mailing list of musl libc
 help / color / mirror / code / Atom feed
* [musl] [PATCH] prevent from redefining __STDC_UTF_{16,32}__ macros
@ 2024-01-25 12:09 Jules Maselbas
  2024-01-25 14:07 ` Rich Felker
  0 siblings, 1 reply; 2+ messages in thread
From: Jules Maselbas @ 2024-01-25 12:09 UTC (permalink / raw)
  To: musl; +Cc: Jules Maselbas

---
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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [musl] [PATCH] prevent from redefining __STDC_UTF_{16,32}__ macros
  2024-01-25 12:09 [musl] [PATCH] prevent from redefining __STDC_UTF_{16,32}__ macros Jules Maselbas
@ 2024-01-25 14:07 ` Rich Felker
  0 siblings, 0 replies; 2+ messages in thread
From: Rich Felker @ 2024-01-25 14:07 UTC (permalink / raw)
  To: Jules Maselbas; +Cc: musl

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-01-25 14:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-25 12:09 [musl] [PATCH] prevent from redefining __STDC_UTF_{16,32}__ macros Jules Maselbas
2024-01-25 14:07 ` Rich Felker

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).