summaryrefslogtreecommitdiff
path: root/include/stdc-predef.h
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2024-02-26 09:37:44 -0500
committerRich Felker <dalias@aerifal.cx>2024-02-26 14:14:08 -0500
commita7239cbc1bc4144eb34e0b85f71769f0acda58dd (patch)
treebcf8d3e57e464d8de6cc25fc77f5a0b54e5ebece /include/stdc-predef.h
parent2c887f24da36fa30eccd72e50d91222828fa526e (diff)
downloadmusl-a7239cbc1bc4144eb34e0b85f71769f0acda58dd.tar.gz
switch __STDC_UTF_{16,32}__ macro definitions from #undef to #ifndef
originally, compilers did not provide these macros and we had to provide them ourselves. this meant we were redefining them, which was technically invalid unless the token sequence of the original definition matched exactly. the original patch proposed by Jules Maselbas to fix this made the definitions conditional on them not already being defined; however I suggested using #undef to avoid any possibly-wrong definitions already in place and ensure that the definitions are 1. the version adopted as commit 8b7048680731707d135ea231f81eb3eaf52378ee made this change. unfortunately, gcc is loud about not liking #undef of any __STDC_* macro name, and while warnings are suppressed in the system include path, there is apparently no way to suppress this warning if the system include dir has also been provided via -I. while normally we don't go out of our way to satisfy warnings over style in the public headers, in this case, it seems to be a matter of disagreement over contract of which part of "the implementation" is entitled to define or undefine macros belonging to the implementation, and it's quite reasonable to conclude that the compiler may reject attempts to undefine them. this commit reverts to the originally-submitted version of the patch making the definitions conditional.
Diffstat (limited to 'include/stdc-predef.h')
-rw-r--r--include/stdc-predef.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/include/stdc-predef.h b/include/stdc-predef.h
index 5ccd884d..642bad2d 100644
--- a/include/stdc-predef.h
+++ b/include/stdc-predef.h
@@ -7,10 +7,12 @@
#define __STDC_IEC_559__ 1
#endif
-#undef __STDC_UTF_16__
+#if !defined(__STDC_UTF_16__)
#define __STDC_UTF_16__ 1
+#endif
-#undef __STDC_UTF_32__
+#if !defined(__STDC_UTF_32__)
#define __STDC_UTF_32__ 1
+#endif
#endif