Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20240125140724.GH4163@brightrain.aerifal.cx>
Date: Thu, 25 Jan 2024 09:07:25 -0500
From: Rich Felker <dalias@...c.org>
To: Jules Maselbas <jmaselbas@...v.net>
Cc: musl@...ts.openwall.com
Subject: Re: [PATCH] prevent from redefining __STDC_UTF_{16,32}__
 macros

On Thu, Jan 25, 2024 at 01:09:54PM +0100, Jules Maselbas wrote:
> ---
> 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 | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/include/stdc-predef.h b/include/stdc-predef.h
> index af1a2799..642bad2d 100644
> --- a/include/stdc-predef.h
> +++ b/include/stdc-predef.h
> @@ -7,7 +7,12 @@
>  #define __STDC_IEC_559__ 1
>  #endif
>  
> +#if !defined(__STDC_UTF_16__)
>  #define __STDC_UTF_16__ 1
> +#endif
> +
> +#if !defined(__STDC_UTF_32__)
>  #define __STDC_UTF_32__ 1
> +#endif
>  
>  #endif
> -- 
> 2.43.0

This should probably be #undef rather than #if !defined, so we ensure
that they have the correct values even if something was done to mess
them up.

I'm kinda confused how this happened though. With -isystem rather than
-I, they should still be treated as system headers immune to warnings.
But it may be a good change anyway since redefinition is disallowed by
the language.

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.