[Bug libstdc++/113376] Confusing notes when using C++17 parallel algorithms

2024-06-12 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113376

--- Comment #6 from Jonathan Wakely  ---
(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

[Bug libstdc++/113376] Confusing notes when using C++17 parallel algorithms

2024-06-12 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113376

--- Comment #5 from Jonathan Wakely  ---
I think
https://github.com/llvm/llvm-project/commit/3b9a1bb1af90db9472340ef2122d3855eb9ba3fc#r142768040
is the real cause of the problem. They wanted to avoid -Wundef errors, so
changed all the macro tests to use #ifdef instead of #if

That is what requires a change to how _PSTL_USAGE_WARNINGS is defined. It also
caused other problems elsewhere downstream:
https://github.com/oneapi-src/oneDPL/issues/1602

[Bug libstdc++/113376] Confusing notes when using C++17 parallel algorithms

2024-01-15 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113376

--- Comment #4 from Jonathan Wakely  ---
https://github.com/llvm/llvm-project/commit/c4823cc5db69f16bb5c96cf7d1b0d070da83605e
changed the logic upstream, but it looks like that didn't come downstream with
r14-2109-g3162ca09dbdc2e

[Bug libstdc++/113376] Confusing notes when using C++17 parallel algorithms

2024-01-15 Thread pilarlatiesa at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113376

--- Comment #3 from Pilar Latiesa  ---

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

[Bug libstdc++/113376] Confusing notes when using C++17 parallel algorithms

2024-01-15 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113376

--- Comment #2 from Jonathan Wakely  ---
(In reply to Pilar Latiesa from comment #1)
> (In reply to Pilar Latiesa from comment #0)
> > I don't understand why all these functions are even instantiated as they
> > appear to be related to the vectorization of other algorithms.
> 
> Pragma messages are shown irrespectively of whether the function is
> instantiated.

Yeah, I don't know if Clang works differently (I don't think so?) or if those
pragmas are just misused. They come from the upstream PSTL project.

> 
> > i.e. is checking defined(_PSTL_USAGE_WARNINGS) instead of just
> > _PSTL_USAGE_WARNINGS. This logic doesn't seem right.
> 
> This change was made as part of r14-2109-g3162ca09dbdc2e:
> 
> - #if _PSTL_USAGE_WARNINGS
> + #if defined(_PSTL_USAGE_WARNINGS)
> 
> I don’t think this change is correct.

Good catch.

[Bug libstdc++/113376] Confusing notes when using C++17 parallel algorithms

2024-01-15 Thread pilarlatiesa at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113376

--- Comment #1 from Pilar Latiesa  ---
(In reply to Pilar Latiesa from comment #0)
> I don't understand why all these functions are even instantiated as they
> appear to be related to the vectorization of other algorithms.

Pragma messages are shown irrespectively of whether the function is
instantiated.

> i.e. is checking defined(_PSTL_USAGE_WARNINGS) instead of just
> _PSTL_USAGE_WARNINGS. This logic doesn't seem right.

This change was made as part of r14-2109-g3162ca09dbdc2e:

- #if _PSTL_USAGE_WARNINGS
+ #if defined(_PSTL_USAGE_WARNINGS)

I don’t think this change is correct.

[Bug libstdc++/113376] Confusing notes when using C++17 parallel algorithms

2024-01-13 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113376

Jonathan Wakely  changed:

   What|Removed |Added

   Last reconfirmed||2024-01-13
 Ever confirmed|0   |1
 Status|UNCONFIRMED |NEW
 CC||rodgertq at gcc dot gnu.org