From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6170 invoked by alias); 19 Jun 2018 13:55:04 -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: List-Unsubscribe: X-Seq: 43065 Received: (qmail 8908 invoked by uid 1010); 19 Jun 2018 13:55:04 -0000 X-Qmail-Scanner-Diagnostics: from joooj.vinc17.net by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(155.133.131.76):SA:0(-1.9/5.0):. Processed in 2.730498 secs); 19 Jun 2018 13:55:04 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: vincent@vinc17.net X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Date: Tue, 19 Jun 2018 15:46:29 +0200 From: Vincent Lefevre To: zsh-workers@zsh.org Subject: Re: [PATCH 2/2] Fix two C nits Message-ID: <20180619134629.GA15318@zira.vinc17.org> Mail-Followup-To: zsh-workers@zsh.org References: <20180616010427.2916-2-lists@eitanadler.com> <20180618092243eucas1p133cc109ed17712cd4253a72da472fa54~5NsPXgtMr0676306763eucas1p1g@eucas1p1.samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180618092243eucas1p133cc109ed17712cd4253a72da472fa54~5NsPXgtMr0676306763eucas1p1g@eucas1p1.samsung.com> X-Mailer-Info: https://www.vinc17.net/mutt/ User-Agent: Mutt/1.10+31 (9cdd8847) vl-108074 (2018-06-19) On 2018-06-18 10:22:41 +0100, Peter Stephenson wrote: > On Sat, 16 Jun 2018 01:04:27 +0000 > Eitan Adler wrote: > > - avoid returning from a function that will never return > > > > diff --git a/Src/exec.c b/Src/exec.c > > index d44527841..b36bcef64 100644 > > --- a/Src/exec.c > > +++ b/Src/exec.c > > @@ -4954,7 +4954,6 @@ getpipe(char *cmd, int nullexec) > > execode(prog, 0, 1, out ? "outsubst" : "insubst"); > > cmdpop(); > > _exit(lastval); > > - return 0; > > } > > I'm not 100% sure about this since you're relying on the compiler > knowing that _exit won't return. Probably the majority of compilers > we're involved with for zsh will work that out, but I'm not sure > it's actually required by the C standard that they know the function > doesn't return, is it? You may know some corner I haven't investigated. AFAIK, it's only useful for optimization and optional diagnostics. The _exit function is non-standard. So, it depends on whether it is declared as _Noreturn or not. FYI, the standard C11 function is: _Noreturn void _Exit(int status); Perhaps use it, and _exit as a fallback. -- Vincent Lefèvre - Web: 100% accessible validated (X)HTML - Blog: Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)