[Bug c++/94753] -undef, c++20 and feature-test macros

2024-04-25 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94753

--- Comment #5 from Andrew Pinski  ---
I will change the testcase's comment to be:
```
For C++11+ __cpp_constexpr and __cpp_static_assert GCC define these even with
-undef.
```

The feature macros as mentioned by Jonathan, we want them defined almost
everywhere including in older versions of C++, my patch still implements that.
The comment in the testcase might be confusing since feature macros were not in
C++11 but we should still define them for C++11.

[Bug c++/94753] -undef, c++20 and feature-test macros

2024-04-25 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94753

--- Comment #4 from Jonathan Wakely  ---
Maybe I've misunderstood you, but the feature test macros for C++11 features
should definitely be defined for C++11.

They're not "system-specific" or "GCC-specific".

Just because they weren't in the standard prior to C++20 doesn't mean they
shouldn't be defined when the corresponding feature is supported.

[Bug c++/94753] -undef, c++20 and feature-test macros

2024-04-25 Thread r_new at rambler dot ru via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94753

--- Comment #3 from r_new at rambler dot ru ---
Don't know gcc code, but

/* For C++11+ __cpp_constexpr and __cpp_static_assert should be defined. */
#if __cplusplus >= 201103L

is not true.
All standard predefined macros listed in chapter "16.8 Predefined macro names"
C++11 standard.

But for C++20 it's true.

[Bug c++/94753] -undef, c++20 and feature-test macros

2024-04-24 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94753

--- Comment #2 from Andrew Pinski  ---
Created attachment 58030
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58030&action=edit
Patch which I am testing

I am testing this patch and will be submitting it for GCC 15.

[Bug c++/94753] -undef, c++20 and feature-test macros

2024-04-13 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94753

Andrew Pinski  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |pinskia at gcc dot 
gnu.org

--- Comment #1 from Andrew Pinski  ---
I am going to fix this for GCC 15.

The check for -undef is done way to early it seems in c_cpp_builtins .
Basically the code to define the feature macros need to be moved to before that
check.

The reason why __cplusplus works is because that is done via libcpp rather than
from the front-end.