From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2000 invoked by alias); 19 Jun 2018 05:32:18 -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: 43063 Received: (qmail 7950 invoked by uid 1010); 19 Jun 2018 05:32:18 -0000 X-Qmail-Scanner-Diagnostics: from mail-yw0-f194.google.com 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(209.85.161.194):SA:0(-1.9/5.0):. Processed in 0.943557 secs); 19 Jun 2018 05:32:18 -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,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_PASS,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: lists@eitanadler.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eitanadler.com; s=0xdeadbeef; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=2cXZGpFgK83f5YYm7lTpO35Uhopha/+nETSESkV2IIc=; b=tagaSog1pNCHhLHWDYxPoztSbrvoksoRl8bt2P3M8I7KzZs3yxNWAZse9alEUQ6SxN yzes6nxqJo5ZJ0PhY2y3Z674Nygprw5wosooylIlWIyz7c7L2xPOXnPA/djakl8/N36N xInwdA0Sgkyv9HdUNxFDOe8GRQWB+UuyMKi2A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=2cXZGpFgK83f5YYm7lTpO35Uhopha/+nETSESkV2IIc=; b=N55v2neDKB0/XRKcc5OsTk+/kPRKB9MBc1g4WIeENnuHLUkFY2tb781BCOWaUv+hAj t07P56YqTX1J3vKAKJcu/E4obP5OQ9c7kQCtl+MXAjafnQEH6CgaOaUwyG4g9kih4I+q idUkht2Maj47YXAPr53nIBC2bYCbmks9A6zEaxCNmwiICdqDpvnqhBbOT3b3kQQlEJJv dhWvqNWh3w45CWDTEMOs8ZsdPQUmNFtukFbvz3fFmqw0Z4oIaR4C95iraXixHxEmrCQq SqmLFAaY6W1UA3iPOWjDIWwlzFVIDR50/ufwGxQvZaH+X3WxWDPLWlO0K5ElwfQu+Hzg UoAQ== X-Gm-Message-State: APt69E0+O2mK47rCeKwmlIWx0c3eVA5bUcDiNh1alL0fZJZyh8Wev8z6 lDs0cBS1dhbFoQwva+UVI4N8Xmfa8RbWho4g6S4NLw== X-Google-Smtp-Source: ADUXVKIlfmtVvWJfEzvNxo/2c+Ls0Wj4J0sC2o2/gLJ8luBi45RLOBJvwYIJniPNsBr/vmqdSr8qrCRvrv8BUalofzQ= X-Received: by 2002:a81:3e16:: with SMTP id l22-v6mr7274881ywa.37.1529386334417; Mon, 18 Jun 2018 22:32:14 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <20180618092243eucas1p133cc109ed17712cd4253a72da472fa54~5NsPXgtMr0676306763eucas1p1g@eucas1p1.samsung.com> References: <20180616010427.2916-2-lists@eitanadler.com> <20180618092243eucas1p133cc109ed17712cd4253a72da472fa54~5NsPXgtMr0676306763eucas1p1g@eucas1p1.samsung.com> From: Eitan Adler Date: Mon, 18 Jun 2018 22:31:43 -0700 Message-ID: Subject: Re: [PATCH 2/2] Fix two C nits To: Peter Stephenson Cc: Zsh hackers list Content-Type: text/plain; charset="UTF-8" On 18 June 2018 at 02:22, 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. It is only required that any function either return, exit, or loop forever [0]. While I don't much about non-modern compilers, it shouldn't affect anything to remove the return. At best, it'll do nothing. At worst older compilers might incorrectly issue a diagnostic. IMHO we should defer to modern compilers when it comes to diagnostics provided the more esoteric options still work. > I'd have been tempted to add /*NOTREACHED*/ on the next line. [0] there is some interesting ancient nuance here, but it's not important for this discussion. -- Eitan Adler