https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113376

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Pilar Latiesa from comment #3)
> It seems that what is missing is a corresponding change in the macro
> definition logic. It should have been changed to:
> 
> // Check the user-defined macro for warnings
> #if defined(PSTL_USAGE_WARNINGS)
> #    define _PSTL_USAGE_WARNINGS
> #endif
> 
> See
> https://github.com/llvm/llvm-project/blob/
> 5ccf19ded09f68bef43275c81c20b0e65f7c0b75/pstl/include/pstl/internal/
> pstl_config.h#L26

The upstream change breaks the previous API though.

It looks like users were able to define PSTL_USAGE_WARNINGS=0 or
PSTL_USAGE_WARNINGS=1 to request warnings to be off or on, respectively. But
the LLVM change means that it only matters whether it's defined or not. This
seems to have been a misguided change to make sure *all* macros are used with
#ifdef not #if. But that breaks the intended use for some of them.

So I think we should either revert the change later in the file which checks
_PSTL_USAGE_WARNINGS, or we should take the user-facing macro's value into
account when deciding whether to define it:

// Check the user-defined macro for warnings
#if defined(PSTL_USAGE_WARNINGS) && PSTL_USAGE_WARNINGS != 0
#    define _PSTL_USAGE_WARNINGS
#endif

Reply via email to