mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Gabriel Ravier <gabravier@gmail.com>
To: musl@lists.openwall.com, Rich Felker <dalias@libc.org>,
	Jules Maselbas <jmaselbas@zdiv.net>
Subject: Re: [musl] [PATCH v2] prevent from redefining __STDC_UTF_{16,32}__ macros
Date: Mon, 26 Feb 2024 03:47:22 +0000	[thread overview]
Message-ID: <0a3fb421-dc8f-4cbb-97e3-b11cc7608d24@gmail.com> (raw)
In-Reply-To: <20240226021749.GG4163@brightrain.aerifal.cx>

On 2/26/24 02:17, Rich Felker wrote:
> On Thu, Jan 25, 2024 at 03:14:40PM +0100, Jules Maselbas wrote:
>> Undefine any previous __STDC_UTF_{16,32}__ macros before defining
>> them to prenvent any warnings of redefining macros.
>>
>> ---
>> v2:
>>   - changed `#if !define(...)` guard to `#undef`, as suggested by Rich Felker
>>
>> I encountered this "issue" trying to compile a program with the -isystem
>> option to override toolchain/installed musl headers with one from source.
>>
>>   include/stdc-predef.h | 3 +++
>>   1 file changed, 3 insertions(+)
>>
>> diff --git a/include/stdc-predef.h b/include/stdc-predef.h
>> index af1a2799..5ccd884d 100644
>> --- a/include/stdc-predef.h
>> +++ b/include/stdc-predef.h
>> @@ -7,7 +7,10 @@
>>   #define __STDC_IEC_559__ 1
>>   #endif
>>   
>> +#undef __STDC_UTF_16__
>>   #define __STDC_UTF_16__ 1
>> +
>> +#undef __STDC_UTF_32__
>>   #define __STDC_UTF_32__ 1
>>   
>>   #endif
>> -- 
>> 2.43.0
> I merged this, but now gcc warns about undefining them if system
> header warnings aren't suppressed. I'm not sure what the justification
> is for that... *sigh*
>
> Rich

It appears as though since 2001 GCC makes it so that any redefinition or 
undefinition of any macro with a name starting with "__STDC_" (with 
hard-coded exceptions for __STDC_FORMAT_MACROS, __STDC_LIMIT_MACROS and 
__STDC_CONSTANT_MACROS) always results in a warning (from reading the 
code this doesn't seem to be tied to any -W switch, so it's simply 
entirely impossible to work around)


  reply	other threads:[~2024-02-26  3:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-25 14:14 Jules Maselbas
2024-02-26  2:17 ` Rich Felker
2024-02-26  3:47   ` Gabriel Ravier [this message]
2024-02-26  7:14     ` Jens Gustedt
2024-02-26 14:36       ` Rich Felker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0a3fb421-dc8f-4cbb-97e3-b11cc7608d24@gmail.com \
    --to=gabravier@gmail.com \
    --cc=dalias@libc.org \
    --cc=jmaselbas@zdiv.net \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).