delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2025/03/06/03:54:26

DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 5268sQsH339965
Authentication-Results: delorie.com; dmarc=pass (p=none dis=none) header.from=cygwin.com
Authentication-Results: delorie.com; spf=pass smtp.mailfrom=cygwin.com
DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 5268sQsH339965
Authentication-Results: delorie.com;
dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=CjDXU4+C
X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 891DE385841C
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1741251264;
bh=u70vnlORd3T3F5o+7iCC9VLAPhlvhiNAEHkJAOyLLmI=;
h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:
From;
b=CjDXU4+CNE8+Iaxbez3aYBtvHpXVeNq1AtMwdiA3xtzI8qodem4+0Zt//LPDr/Bfe
w3cQnWyOeNJMGwgGtYi9meOQl5bhh49O8nQBmMEDI7Sd67gLaAV1h4e0drrUshQTl5
FUyERNtxA0n1L0UjnV5FVEG19zZ19Qh/ae7lTxfo=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0ECF33858C2C
Date: Thu, 6 Mar 2025 09:52:01 +0100
To: cygwin AT cygwin DOT com
Subject: Re: Cygwin 3.6: clang cannot use /usr/include/unistd.h, issue with
|setproctitle_init()| ...
Message-ID: <Z8liMV3uVOnMzquj@calimero.vinschen.de>
Mail-Followup-To: cygwin AT cygwin DOT com
References: <CAKAoaQkjCNVRr3wj_2S=FW+-0YLs6SpxN1Fecws83NRR9E0Q3A AT mail DOT gmail DOT com>
<112c2ecc-cfc6-86d4-d7b6-bce46d92197e AT t-online DOT de>
<Z8ie5ezqgXKtnmnl AT calimero DOT vinschen DOT de>
<PH0PR09MB1094132B9F45CE4E365E1C802A5CB2 AT PH0PR09MB10941 DOT namprd09 DOT prod DOT outlook DOT com>
<Z8i5NuGsW5a4htXO AT xps13>
MIME-Version: 1.0
In-Reply-To: <Z8i5NuGsW5a4htXO@xps13>
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.30
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Corinna Vinschen via Cygwin <cygwin AT cygwin DOT com>
Reply-To: cygwin AT cygwin DOT com
Cc: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
Errors-To: cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com>

Guys, I already applied a patch.

Thanks,
Corinna

On Mar  5 15:51, Glenn Strauss via Cygwin wrote:
> On Wed, Mar 05, 2025 at 08:27:53PM +0000, Lavrentiev, Anton (NIH/NLM/NCBI) [C] via Cygwin wrote:
> > >  We could change this to a macro instead:
> > >
> > > -static inline void setproctitle_init (int, char *[], char *[]) {}
> > > +#define setproctitle_init(c, a, e)
> > 
> > Changing to the empty marco removes the side effects in the arguments (such as len++, for example),
> > which may silently break existing code -- so I think it's not a good idea.  If the idea to use the empty
> > arguments was not to implicitly document them (because the API was slated for removal, IIRC), then
> > naming them just with "arg1", "arg2" (rather than leaving empty altogether) should help better, IMO.
> > 
> > Anton Lavrentiev
> > Contractor NIH/NLM/NCBI
> 
> If you want the side effects of the arguments and still want a macro:
> 
>   #define setproctitle_init(c, a, e) \
>     do { (void)(c); (void)(a); (void)(e); } while (0)
> 
> or, since it is unlikely (though possible) that someone has defined a
> single-letter macro for 'c', 'a', or 'b':
> 
> static inline void setproctitle_init (int c, char *a[], char *b[])
> {
>     (void)(c);
>     (void)(a);
>     (void)(e);
> }
> 
> or use the intended, more descriptive names in the prototype
> 
> static inline void setproctitle_init (int argc, char *argv[], char *envp[])
> {
>     (void)(argc);
>     (void)(argv);
>     (void)(envp);
> }
> 
> If gcc or clang, you could also add __attribute__((__unused__)),
> though it should probaby be its own macro so that it could be no-op for
> certain compilers:
> 
> There is also [[maybe_unused]]
> https://clang.llvm.org/docs/AttributeReference.html#maybe-unused-unused
> https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-4-c4189?view=msvc-170
> 
> #ifndef __attribute_unused__
> #ifdef _MSC_VER
> #define __attribute_unused__ [[maybe_unused]]
> #else
> #define __attribute_unused__ __attribute__((__unused__)),
> #endif
> #endif
> 
> static inline void setproctitle_init (int argc     __attribute_unused__,
>                                       char *argv[] __attribute_unused__,
>                                       char *envp[] __attribute_unused__)
> {
>     (void)(argc);
>     (void)(argv);
>     (void)(envp);
> }
> 
> Cheers, Glenn
> 
> -- 
> Problem reports:      https://cygwin.com/problems.html
> FAQ:                  https://cygwin.com/faq/
> Documentation:        https://cygwin.com/docs.html
> Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019