| delorie.com/archives/browse.cgi | search |
| DMARC-Filter: | OpenDMARC Filter v1.4.2 delorie.com 525KqD3x095677 |
| 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 525KqD3x095677 |
| 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=OjZ6Vc6F | |
| X-Recipient: | archive-cygwin AT delorie DOT com |
| DKIM-Filter: | OpenDKIM Filter v2.11.0 sourceware.org 93C593858D26 |
| DKIM-Signature: | v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; |
| s=default; t=1741207931; | |
| bh=l2vshJwG4YTQ/7gWI+2ZIb+oZOb14pvFXPxAreFFLDg=; | |
| h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe: | |
| List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: | |
| From; | |
| b=OjZ6Vc6FTEiQtURHBZMGIRPA4LEeg8dDoedQ1B9n1pZJVZX2prP8HiCZOUAXZIKui | |
| qHwLkHSJNNUvHXaTnZ+cHdHLRh0e544y58Qzd/sa/7shtF+ByEi8uUraSpq0VTgIXU | |
| L4zQwdZ6mnJgwTDY0P2SnTMTq9kIHOQ7+U4w3cNA= | |
| X-Original-To: | cygwin AT cygwin DOT com |
| Delivered-To: | cygwin AT cygwin DOT com |
| DMARC-Filter: | OpenDMARC Filter v1.4.2 sourceware.org 29AED3858D26 |
| ARC-Filter: | OpenARC Filter v1.0.0 sourceware.org 29AED3858D26 |
| ARC-Seal: | i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1741207868; cv=none; |
| b=RYRG3U4Oc5GYpzS7CjB7V1NQy1y5OFnZKQaFGElNKkdwp1guAwucKatr61XYNbpvhcDx7r3YsKKJTqHLMvvVkIBliEkmezccymbSQvrW/DJ8EGlIwdL9nl2t0PdTysEkiBCLz1QYc2/xv9Vi2ZCX4JxfHbaLydHkijieA+yKLbI= | |
| ARC-Message-Signature: | i=1; a=rsa-sha256; d=sourceware.org; s=key; |
| t=1741207868; c=relaxed/simple; | |
| bh=X+GtKQd+bOBNUhRb5PsAbWYuEoQsjx3bmkZC0Wu0ZwE=; | |
| h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; | |
| b=I3AbgTTpg0LsKDbJDMx+K/y+aOgXtskJXYN00QOkzXLVFfM12kW6Uayd+Fms+UAn5S+hVxm3FZoIW9bMe0WHTNMh9kqrvN5L3UOYRbRAmOmk2CHmrXkv4j4xchigyvbOXVxRMM0twEwBO3RQeRf1RxmzImN7+opXkmWt/awY9vw= | |
| ARC-Authentication-Results: | i=1; server2.sourceware.org |
| DKIM-Filter: | OpenDKIM Filter v2.11.0 sourceware.org 29AED3858D26 |
| Date: | Wed, 5 Mar 2025 15:51:02 -0500 |
| To: | "cygwin AT cygwin DOT com" <cygwin AT cygwin DOT com> |
| Subject: | Re: Cygwin 3.6: clang cannot use /usr/include/unistd.h, issue with |
| |setproctitle_init()| ... | |
| Message-ID: | <Z8i5NuGsW5a4htXO@xps13> |
| 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> | |
| MIME-Version: | 1.0 |
| In-Reply-To: | <PH0PR09MB1094132B9F45CE4E365E1C802A5CB2@PH0PR09MB10941.namprd09.prod.outlook.com> |
| 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: | Glenn Strauss via Cygwin <cygwin AT cygwin DOT com> |
| Reply-To: | Glenn Strauss <gs-cygwin DOT com AT gluelogic 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> |
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
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |