public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug preprocessor/94753] New: -undef, c++20 and feature-test macros
@ 2020-04-24 23:22 r_new at rambler dot ru
  2020-04-25 13:47 ` [Bug preprocessor/94753] " redi at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: r_new at rambler dot ru @ 2020-04-24 23:22 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 94753
           Summary: -undef, c++20 and feature-test macros
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: preprocessor
          Assignee: unassigned at gcc dot gnu.org
          Reporter: r_new at rambler dot ru
  Target Milestone: ---

In c++20 feature-test macros (_­_­cpp_­attributes, _­_­cpp_­constexpr, ...) are
standard predefined macros, must be predefined even with -undef.

g++ -undef -std=c++2a -E -dM -x c++ - < /dev/null 
#define __STDC_HOSTED__ 1
#define __STDC_IEC_559__ 1
#define __STDC_ISO_10646__ 201706L
#define __STDC_UTF_16__ 1
#define __cplusplus 201709L
#define _STDC_PREDEF_H 1
#define __STDC_IEC_559_COMPLEX__ 1
#define __STDC_UTF_32__ 1
#define __STDC__ 1
#define _GNU_SOURCE 1

gcc version 10.0.1 20200423 (experimental) (Compiler-Explorer-Build) and gcc
version 9.3.0 (Arch Linux 9.3.0-1)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug preprocessor/94753] -undef, c++20 and feature-test macros
  2020-04-24 23:22 [Bug preprocessor/94753] New: -undef, c++20 and feature-test macros r_new at rambler dot ru
@ 2020-04-25 13:47 ` redi at gcc dot gnu.org
  2024-04-13 23:29 ` [Bug c++/94753] " pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2020-04-25 13:47 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2020-04-25
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/94753] -undef, c++20 and feature-test macros
  2020-04-24 23:22 [Bug preprocessor/94753] New: -undef, c++20 and feature-test macros r_new at rambler dot ru
  2020-04-25 13:47 ` [Bug preprocessor/94753] " redi at gcc dot gnu.org
@ 2024-04-13 23:29 ` pinskia at gcc dot gnu.org
  2024-04-24 22:54 ` pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-04-13 23:29 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> 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 <pinskia at gcc dot gnu.org> ---
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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/94753] -undef, c++20 and feature-test macros
  2020-04-24 23:22 [Bug preprocessor/94753] New: -undef, c++20 and feature-test macros r_new at rambler dot ru
  2020-04-25 13:47 ` [Bug preprocessor/94753] " redi at gcc dot gnu.org
  2024-04-13 23:29 ` [Bug c++/94753] " pinskia at gcc dot gnu.org
@ 2024-04-24 22:54 ` pinskia at gcc dot gnu.org
  2024-04-25 11:58 ` r_new at rambler dot ru
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-04-24 22:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/94753] -undef, c++20 and feature-test macros
  2020-04-24 23:22 [Bug preprocessor/94753] New: -undef, c++20 and feature-test macros r_new at rambler dot ru
                   ` (2 preceding siblings ...)
  2024-04-24 22:54 ` pinskia at gcc dot gnu.org
@ 2024-04-25 11:58 ` r_new at rambler dot ru
  2024-04-25 16:19 ` redi at gcc dot gnu.org
  2024-04-25 16:26 ` pinskia at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: r_new at rambler dot ru @ 2024-04-25 11:58 UTC (permalink / raw)
  To: 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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/94753] -undef, c++20 and feature-test macros
  2020-04-24 23:22 [Bug preprocessor/94753] New: -undef, c++20 and feature-test macros r_new at rambler dot ru
                   ` (3 preceding siblings ...)
  2024-04-25 11:58 ` r_new at rambler dot ru
@ 2024-04-25 16:19 ` redi at gcc dot gnu.org
  2024-04-25 16:26 ` pinskia at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2024-04-25 16:19 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/94753] -undef, c++20 and feature-test macros
  2020-04-24 23:22 [Bug preprocessor/94753] New: -undef, c++20 and feature-test macros r_new at rambler dot ru
                   ` (4 preceding siblings ...)
  2024-04-25 16:19 ` redi at gcc dot gnu.org
@ 2024-04-25 16:26 ` pinskia at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-04-25 16:26 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-04-25 16:26 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-24 23:22 [Bug preprocessor/94753] New: -undef, c++20 and feature-test macros r_new at rambler dot ru
2020-04-25 13:47 ` [Bug preprocessor/94753] " redi at gcc dot gnu.org
2024-04-13 23:29 ` [Bug c++/94753] " pinskia at gcc dot gnu.org
2024-04-24 22:54 ` pinskia at gcc dot gnu.org
2024-04-25 11:58 ` r_new at rambler dot ru
2024-04-25 16:19 ` redi at gcc dot gnu.org
2024-04-25 16:26 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).