diff options
author | Jakub Jelinek <jakub@redhat.com> | 2025-09-01 21:55:49 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2025-09-01 21:55:49 +0200 |
commit | a4d066f3643d3df5929425767130d68e8a775241 (patch) | |
tree | 71006e3f899563bcef0cc192a6cb99a670ea8842 /libgo/go | |
parent | 086d0d8c9cbd9625b6e1af1146c014662ff96ae2 (diff) | |
download | gcc-a4d066f3643d3df5929425767130d68e8a775241.zip gcc-a4d066f3643d3df5929425767130d68e8a775241.tar.gz gcc-a4d066f3643d3df5929425767130d68e8a775241.tar.bz2 |
c: Implement C2Y N3457 - The __COUNTER__ predefined macro
The following patch implements the
https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3457.htm
paper without the first 3 lines in Recommended practice.
Seems GCC behavior already matches the expected behavior except for
diagnostics of more than 2147483648 __COUNTER__ expansions, so the
patch adds a diagnostic for that (but not testcase because
#define A __COUNTER__ __COUNTER__ __COUNTER__ __COUNTER__ __COUNTER__ __COUNTER__ __COUNTER__ __COUNTER__
#define B A A A A A A A A
#define C B B B B B B B B
#define D C C C C C C C C
#define E D D D D D D D D
#define F E E E E E E E E
#define G F F F F F F F F
#define H G G G G G G G G
#define I H H H H H H H H
#define J I I I I I I I I
J J J J
__COUNTER__
just takes too long to preprocess).
Plus I've included all the snippets from the paper into one testcase.
2025-09-01 Jakub Jelinek <jakub@redhat.com>
* macro.cc: Implement C2Y N3457 - The __COUNTER__ predefined macro.
(_cpp_builtin_macro_text): Diagnose if __COUNTER__ reaches
2147483648 value.
* gcc.dg/cpp/c2y-counter-1.c: New test.
Diffstat (limited to 'libgo/go')
0 files changed, 0 insertions, 0 deletions