From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27068 invoked by alias); 13 Jun 2014 06:58:29 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 32772 Received: (qmail 21665 invoked from network); 13 Jun 2014 06:58:17 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 From: Bart Schaefer Message-id: <140612235757.ZM4782@torch.brasslantern.com> Date: Thu, 12 Jun 2014 23:57:57 -0700 In-reply-to: <20140612203525.4c8e66d4@pws-pc.ntlworld.com> Comments: In reply to Peter Stephenson "Re: break/continue vs. try-always" (Jun 12, 8:35pm) References: <140603191227.ZM28198@torch.brasslantern.com> <140604223723.ZM22960@torch.brasslantern.com> <140605085319.ZM4272@torch.brasslantern.com> <20140606215853.0c6ecae9@pws-pc.ntlworld.com> <20140606224523.09d5f22c@pws-pc.ntlworld.com> <140606232250.ZM23057@torch.brasslantern.com> <20140608185401.35bed78f@pws-pc.ntlworld.com> <140608114123.ZM20229@torch.brasslantern.com> <20140608204358.4ec607b8@pws-pc.ntlworld.com> <140608140146.ZM20431@torch.brasslantern.com> <20140608225035.078a86a8@pws-pc.ntlworld.com> <140608191115.ZM20627@torch.brasslantern.com> <20140612203525.4c8e66d4@pws-pc.ntlworld.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: break/continue vs. try-always MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Jun 12, 8:35pm, Peter Stephenson wrote: } } This makes a break or continue at the end of a function produce a } warning. It didn't seem worth a hard error, but presumably a break or } continue is usually intended to do something so it should be reported if } it doesn't. Hrm. That makes it sort of like WARN_CREATE_GLOBAL. I can think of cases where you want the warning, and cases where you don't ... the situation that got us to this point is one of latter. However ... } +When this option is not set, the effect of tt(break) and tt(continue) } +commands may propagate outside function scope, affecting loops in } +calling functions. When this option is not set, a tt(break) or } +a tt(continue) that is not caught within a function produces a warning. Typo, extra "not" in the last sentence. } + opts[LOCALLOOPS] = saveopts[LOCALLOOPS]; } + } } + } + if (opts[LOCALLOOPS]) { } + if (contflag) } + zwarn("`continue' active at end of function scope"); } + if (breaks) } + zwarn("`break' active at end of function scope"); } + contflag = breaks = 0; Since breaks is saved as obreaks on entry to doshfunc, shouldn't this be breaks = obreaks; Also, probably need to save/restore contflag and loops? In case the function is called from a trap handler, for example?