[PATCH] libstdc++: Fix unwanted #pragma messages from PSTL headers [PR113376]

Jonathan Wakely jwakely@redhat.com
Wed Jun 12 20:36:17 GMT 2024


This is enough to fix the regression for now.

I think we should revert more of the upstream change that switched #if
to #ifdef everywhere, as much of it was unnecessary and causes issues
for people combining our pstl headers with the one's in Intel oneAPI
(which share the same names for pstl_config.h and the config macros, but
don't agree on whether to test them with #if or #ifdef).

Tested x64_64-debug.

-- >8 --

When we rebased the PSTL on upstream, in r14-2109-g3162ca09dbdc2e, a
change to how _PSTL_USAGE_WARNINGS is set was missed out, but the change
to how it's tested was included. This means that the macro is always
defined, so testing it with #ifdef (instead of using #if to test its
value) doesn't work as intended.

Revert the test to use #if again, since that part of the upstream change
was unnecessary in the first place (the macro is always defined, so
there's no need to use #ifdef to avoid -Wundef warnings).

libstdc++-v3/ChangeLog:

	PR libstdc++/113376
	* include/pstl/pstl_config.h: Use #if instead of #ifdef to test
	the _PSTL_USAGE_WARNINGS macro.
---
 libstdc++-v3/include/pstl/pstl_config.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libstdc++-v3/include/pstl/pstl_config.h b/libstdc++-v3/include/pstl/pstl_config.h
index 7157a8a492e..6fae15460ea 100644
--- a/libstdc++-v3/include/pstl/pstl_config.h
+++ b/libstdc++-v3/include/pstl/pstl_config.h
@@ -177,7 +177,7 @@
 
 #define _PSTL_PRAGMA_MESSAGE_IMPL(x) _PSTL_PRAGMA(message(_PSTL_STRING_CONCAT(_PSTL_PRAGMA_LOCATION, x)))
 
-#if defined(_PSTL_USAGE_WARNINGS)
+#if _PSTL_USAGE_WARNINGS
 #    define _PSTL_PRAGMA_MESSAGE(x) _PSTL_PRAGMA_MESSAGE_IMPL(x)
 #    define _PSTL_PRAGMA_MESSAGE_POLICIES(x) _PSTL_PRAGMA_MESSAGE_IMPL(x)
 #else
-- 
2.45.1



More information about the Libstdc++ mailing list