Hi Joseph,
I've removed the -compat and -no-compat tests, and have squashed all the
commits into one. See range-diff below. See also the interdiff, which
can be easier to read.
I've successfully tested for regressions:
alx@devuan:~/src/gnu/gcc/maxof$ git tag maxof5
alx@devuan:~/src/gnu/gcc/maxof$ git log --oneline gnu/master^..maxof5
ef68a32a2bd5 (HEAD -> maxof, tag: maxof5) c: Add _Maxof and _Minof
operators
d8e3ddc3191f (gnu/trunk, gnu/master, gnu/HEAD) cobol: Correct libgcobol
install directory and add components.
alx@devuan:~/src/gnu/gcc/maxof$ git reset gnu/master --h
HEAD is now at d8e3ddc3191f cobol: Correct libgcobol install directory
and add components.
alx@devuan:~/src/gnu/gcc/maxof$ mkdir ../maxof5
alx@devuan:~/src/gnu/gcc/maxof$ cd ../maxof5/
alx@devuan:~/src/gnu/gcc/maxof5$ set -o pipefail
alx@devuan:~/src/gnu/gcc/maxof5$ ../maxof/configure --disable-multilib
--prefix=/opt/local/gnu/gcc/maxof3 |& ts -s | tail -n1; echo $?; make -j24
bootstrap |& ts -s | tail -n1; echo $?; make -j24 check |& ts -s | tail -n1;
echo $?;
00:00:02 config.status: creating Makefile
0
00:22:18 make[1]: Leaving directory '/srv/alx/src/gnu/gcc/maxof5'
0
00:34:27 make[1]: Leaving directory '/srv/alx/src/gnu/gcc/maxof5'
0
alx@devuan:~/src/gnu/gcc/maxof5$ cd ../maxof
alx@devuan:~/src/gnu/gcc/maxof$ git merge --ff-only maxof5
Updating d8e3ddc3191f..ef68a32a2bd5
Fast-forward
gcc/c-family/c-common.cc | 32 ++++
gcc/c-family/c-common.def | 6 +
gcc/c-family/c-common.h | 4 +-
gcc/c/c-parser.cc | 65 +++++++-
gcc/c/c-tree.h | 2 +
gcc/c/c-typeck.cc | 54 ++++++
gcc/doc/extend.texi | 19 +++
gcc/testsuite/gcc.dg/maxof-compile.c | 163 +++++++++++++++++++
gcc/testsuite/gcc.dg/maxof-pedantic-errors.c | 5 +
gcc/testsuite/gcc.dg/maxof-pedantic.c | 5 +
10 files changed, 353 insertions(+), 2 deletions(-)
create mode 100644 gcc/testsuite/gcc.dg/maxof-compile.c
create mode 100644 gcc/testsuite/gcc.dg/maxof-pedantic-errors.c
create mode 100644 gcc/testsuite/gcc.dg/maxof-pedantic.c
alx@devuan:~/src/gnu/gcc/maxof$ cd ../
alx@devuan:~/src/gnu/gcc$ mv maxof5/ maxof5_b4
alx@devuan:~/src/gnu/gcc$ mkdir maxof5
alx@devuan:~/src/gnu/gcc$ cd maxof5
alx@devuan:~/src/gnu/gcc/maxof5$ ../maxof/configure --disable-multilib
--prefix=/opt/local/gnu/gcc/maxof3 |& ts -s | tail -n1; echo $?; make -j24
bootstrap |& ts -s | tail -n1; echo $?; make -j24 check |& ts -s | tail -n1;
echo $?;
00:00:01 config.status: creating Makefile
0
00:24:28 make[1]: Leaving directory '/srv/alx/src/gnu/gcc/maxof5'
0
00:36:28 make[1]: Leaving directory '/srv/alx/src/gnu/gcc/maxof5'
0
alx@devuan:~/src/gnu/gcc/maxof5$ find -type f | grep '\.sum$' | while
read f; do diff -u "../maxof5_b4/$f" "$f"; done;
--- ../maxof5_b4/./x86_64-pc-linux-gnu/libitm/testsuite/libitm.sum
2025-11-18 23:53:48.203348748 +0100
+++ ./x86_64-pc-linux-gnu/libitm/testsuite/libitm.sum 2025-11-19
00:53:56.306431408 +0100
@@ -1,4 +1,4 @@
-Test run by alx on Tue Nov 18 23:53:45 2025
+Test run by alx on Wed Nov 19 00:53:53 2025
Native configuration is x86_64-pc-linux-gnu
=== libitm tests ===
---
../maxof5_b4/./x86_64-pc-linux-gnu/libatomic/testsuite/libatomic.sum2025-11-18
23:53:47.246926682 +0100
+++ ./x86_64-pc-linux-gnu/libatomic/testsuite/libatomic.sum
2025-11-19 00:53:55.049685365 +0100
@@ -1,4 +1,4 @@
-Test run by alx on Tue Nov 18 23:53:45 2025
+Test run by alx on Wed Nov 19 00:53:53 2025
Native configuration is x86_64-pc-linux-gnu
=== libatomic tests ===
--- ../maxof5_b4/./x86_64-pc-linux-gnu/libgomp/testsuite/libgomp.sum
2025-11-18 23:56:15.369551694 +0100
+++ ./x86_64-pc-linux-gnu/libgomp/testsuite/libgomp.sum 2025-11-19
00:57:23.463737042 +0100
@@ -1,4 +1,4 @@
-Test run by alx on Tue Nov 18 23:53:45 2025
+Test run by alx on Wed Nov 19 00:53:53 2025
Native configuration is x86_64-pc-linux-gnu
=== libgomp tests ===
---
../maxof5_b4/./x86_64-pc-linux-gnu/libstdc++-v3/testsuite/libstdc++.sum
2025-11-19 00:28:12.441837015 +0100
+++ ./x86_64-pc-linux-gnu/libstdc++-v3/testsuite/libstdc++.sum
2025-11-19 01:30:21.036621807 +0100
@@ -1,4 +1,4 @@
-Test run by alx on Tue Nov 18 23:53:46 2025
+Test run by alx on Wed Nov 19 00:53:54 2025
Native configuration is x86_64-pc-linux-gnu
=== libstdc++ tests ===
--- ../maxof5_b4/./gcc/testsuite/objc/objc.sum 2025-11-18
23:54:39.644649618 +0100
+++ ./gcc/testsuite/objc/objc.sum 2025-11-19 00:55:07.475302212
+0100
@@ -1,4 +1,4 @@
-Test run by alx on Tue Nov 18 23:53:46 2025
+Test run by alx on Wed Nov 19 00:53:54 2025
Native configuration is x86_64-pc-linux-gnu
=== objc tests ===
--- ../maxof5_b4/./gcc/testsuite/g++/g++.sum 2025-11-19
00:11:55.020866106 +0100
+++ ./gcc/testsuite/g++/g++.sum 2025-11-19 01:08:40.343874452 +0100
@@ -1,4 +1,4 @@
-Test run by alx on Tue Nov 18 23:53:46 2025
+Test run by alx on Wed Nov 19 00:53:54 2025
Native configuration is x86_64-pc-linux-gnu
=== g++ tests ===
--- ../maxof5_b4/./gcc/testsuite/gcc/gcc.sum 2025-11-19
00:16:55.115544911 +0100
+++ ./gcc/testsuite/gcc/gcc.sum 2025-11-19 01:19:31.894414427 +0100
@@ -1,4 +1,4 @@
-Test run by alx on Tue Nov 18 23:53:46 2025
+Test run by alx on Wed Nov 19 00:53:54 2025
Native configuration is x86_64-pc-linux-gnu
=== gcc tests ===
@@ -94161,6 +94161,39 @@
PASS: gcc.dg/max-1.c execution test
PASS: gcc.dg/max.c (test for excess errors)
PASS: gcc.dg/max.c scan-tree-dump-not optimized "MAX_EXPR"
+PASS: gcc.dg/maxof-compile.c (test for errors, line 100)
+PASS: gcc.dg/maxof-compile.c (test for errors, line 101)
+PASS: gcc.dg/maxof-compile.c (test for errors, line 102)
+PASS: gcc.dg/maxof-compile.c (test for errors, line 103)
+PASS: gcc.dg/maxof-compile.c (test for errors, line 104)
+PASS: gcc.dg/maxof-compile.c (test for errors, line 105)
+PASS: gcc.dg/maxof-compile.c (test for errors, line 111)
+PASS: gcc.dg/maxof-compile.c (test for errors, line 113)
+PASS: gcc.dg/maxof-compile.c (test for errors, line 115)
+PASS: gcc.dg/maxof-compile.c (test for errors, line 116)
+PASS: gcc.dg/maxof-compile.c (test for errors, line 122)
+PASS: gcc.dg/maxof-compile.c (test for errors, line 123)
+PASS: gcc.dg/maxof-compile.c (test for errors, line 80)
+PASS: gcc.dg/maxof-compile.c (test for errors, line 82)
+PASS: gcc.dg/maxof-compile.c (test for errors, line 84)
+PASS: gcc.dg/maxof-compile.c (test for errors, line 86)
+PASS: gcc.dg/maxof-compile.c (test for errors, line 88)
+PASS: gcc.dg/maxof-compile.c (test for errors, line 89)
+PASS: gcc.dg/maxof-compile.c (test for errors, line 90)
+PASS: gcc.dg/maxof-compile.c (test for errors, line 91)
+PASS: gcc.dg/maxof-compile.c (test for excess errors)
+PASS: gcc.dg/maxof-compile.c syntax error at line 112 (test for
errors, line 111)
+PASS: gcc.dg/maxof-compile.c syntax error at line 114 (test for
errors, line 113)
+PASS: gcc.dg/maxof-compile.c syntax error at line 81 (test for errors,
line 80)
+PASS: gcc.dg/maxof-compile.c syntax error at line 83 (test for errors,
line 82)
+PASS: gcc.dg/maxof-compile.c syntax error at line 85 (test for errors,
line 84)
+PASS: gcc.dg/maxof-compile.c syntax error at line 87 (test for errors,
line 86)
+PASS: gcc.dg/maxof-pedantic-errors.c (test for errors, line 4)
+PASS: gcc.dg/maxof-pedantic-errors.c (test for errors, line 5)
+PASS: gcc.dg/maxof-pedantic-errors.c (test for excess errors)
+PASS: gcc.dg/maxof-pedantic.c (test for warnings, line 4)
+PASS: gcc.dg/maxof-pedantic.c (test for warnings, line 5)
+PASS: gcc.dg/maxof-pedantic.c (test for excess errors)
PASS: gcc.dg/memchr-2.c (test for excess errors)
PASS: gcc.dg/memchr-2.c scan-tree-dump-not optimized "abort"
PASS: gcc.dg/memchr-2.c scan-tree-dump-not optimized "memcmp \\("
@@ -221120,7 +221153,7 @@
=== gcc Summary ===
-# of expected passes 215051
+# of expected passes 215084
# of unexpected failures 529
# of unexpected successes 6
# of expected failures 1486
--- ../maxof5_b4/./gcc/testsuite/gfortran/gfortran.sum 2025-11-19
00:05:12.301662138 +0100
+++ ./gcc/testsuite/gfortran/gfortran.sum 2025-11-19
01:07:22.219675882 +0100
@@ -1,4 +1,4 @@
-Test run by alx on Tue Nov 18 23:53:46 2025
+Test run by alx on Wed Nov 19 00:53:54 2025
Native configuration is x86_64-pc-linux-gnu
=== gfortran tests ===
Have a lovely day!
Alex
Alejandro Colomar (1):
c: Add _Maxof and _Minof operators
gcc/c-family/c-common.cc | 32 ++++
gcc/c-family/c-common.def | 6 +
gcc/c-family/c-common.h | 4 +-
gcc/c/c-parser.cc | 65 +++++++-
gcc/c/c-tree.h | 2 +
gcc/c/c-typeck.cc | 54 ++++++
gcc/doc/extend.texi | 19 +++
gcc/testsuite/gcc.dg/maxof-compile.c | 163 +++++++++++++++++++
gcc/testsuite/gcc.dg/maxof-pedantic-errors.c | 5 +
gcc/testsuite/gcc.dg/maxof-pedantic.c | 5 +
10 files changed, 353 insertions(+), 2 deletions(-)
create mode 100644 gcc/testsuite/gcc.dg/maxof-compile.c
create mode 100644 gcc/testsuite/gcc.dg/maxof-pedantic-errors.c
create mode 100644 gcc/testsuite/gcc.dg/maxof-pedantic.c
Interdiff against v4:
diff --git a/gcc/testsuite/gcc.dg/maxof-compat.c
b/gcc/testsuite/gcc.dg/maxof-compat.c
deleted file mode 100644
index 956d86e46bab..000000000000
--- a/gcc/testsuite/gcc.dg/maxof-compat.c
+++ /dev/null
@@ -1,5 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-std=c2y -pedantic-errors -Wc23-c2y-compat" } */
-
-int a[_Maxof(char)]; /* { dg-error "ISO C does not support" } */
-int b[1 + _Minof(unsigned char)]; /* { dg-error "ISO C does not support" } */
diff --git a/gcc/testsuite/gcc.dg/maxof-no-compat.c
b/gcc/testsuite/gcc.dg/maxof-no-compat.c
deleted file mode 100644
index 894ffabfc04a..000000000000
--- a/gcc/testsuite/gcc.dg/maxof-no-compat.c
+++ /dev/null
@@ -1,5 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-std=c23 -pedantic-errors -Wno-c23-c2y-compat" } */
-
-int a[_Maxof(char)]; /* { dg-error "ISO C does not support" } */
-int b[1 + _Minof(unsigned char)]; /* { dg-error "ISO C does not support" } */
Range-diff against v4:
1: da4cf539a385 ! 1: ef68a32a2bd5 c: Add _Maxof and _Minof operators
@@ Commit message
Link: <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3628.txt>
+ These operators have not yet been accepted by the C Committee, so this
+ is implemented as a GNU extension.
+
gcc/ChangeLog:
* doc/extend.texi (Syntax Extensions): Document _Maxof &
_Minof.
@@ Commit message
gcc/testsuite/ChangeLog:
- * gcc.dg/maxof-compat.c: New test.
* gcc.dg/maxof-compile.c: New test.
- * gcc.dg/maxof-no-compat.c: New test.
* gcc.dg/maxof-pedantic-errors.c: New test.
* gcc.dg/maxof-pedantic.c: New test.
@@ gcc/c/c-parser.cc: c_parser_alignof_expression (c_parser *parser)
+
+ start = c_parser_peek_token (parser)->location;
+
-+ pedwarn_c23 (start, OPT_Wpedantic,
-+ "ISO C does not support %qs before C2Y", op_name);
++ pedwarn (start, OPT_Wpedantic, "ISO C does not support %qs", op_name);
+
+ c_parser_consume_token (parser);
+ c_inhibit_evaluation_warnings++;
@@ gcc/c/c-parser.cc: c_parser_alignof_expression (c_parser *parser)
+ if (!c_token_starts_typename (c_parser_peek_token (parser)))
+ {
+ error_at (expr_loc, "invalid application of %qs to something not a
type", op_name);
++ parens.skip_until_found_close (parser);
+ goto fail;
+ }
+ type_name = c_parser_type_name (parser, true);
@@ gcc/doc/extend.texi: _Countof (int [7][n++]); // integer constant
expression
@subsection Support for @code{offsetof}
@findex __builtin_offsetof
- ## gcc/testsuite/gcc.dg/maxof-compat.c (new) ##
-@@
-+/* { dg-do compile } */
-+/* { dg-options "-std=c2y -pedantic-errors -Wc23-c2y-compat" } */
-+
-+int a[_Maxof(char)]; /* { dg-warning "ISO C does not support" } */
-+int b[1 + _Minof(unsigned char)]; /* { dg-warning "ISO C does not
support" } */
-
## gcc/testsuite/gcc.dg/maxof-compile.c (new) ##
@@
+/* { dg-do compile } */
-+/* { dg-options "-std=c2y -pedantic-errors" } */
++/* { dg-options "-std=gnu2y" } */
+
+#define SCHAR_MAX __SCHAR_MAX__
+#define SCHAR_MIN (-SCHAR_MAX - 1)
@@ gcc/testsuite/gcc.dg/maxof-compile.c (new)
+ int x;
+
+ _Maxof (x); /* { dg-error "to something not a type" } */
-+ /* { dg-error "expected ';'" "syntax error" { target *-*-* } .-1 } */
-+ /* { dg-error "expected statement" "syntax error 2" { target *-*-* }
.-2 } */
++ /* { dg-error "expected '\\)'" "syntax error" { target *-*-* } .-1 } */
+ _Minof (x); /* { dg-error "to something not a type" } */
-+ /* { dg-error "expected ';'" "syntax error" { target *-*-* } .-1 } */
-+ /* { dg-error "expected statement" "syntax error 2" { target *-*-* }
.-2 } */
++ /* { dg-error "expected '\\)'" "syntax error" { target *-*-* } .-1 } */
+ _Maxof (1); /* { dg-error "to something not a type" } */
-+ /* { dg-error "expected ';'" "syntax error" { target *-*-* } .-1 } */
-+ /* { dg-error "expected statement" "syntax error 2" { target *-*-* }
.-2 } */
++ /* { dg-error "expected '\\)'" "syntax error" { target *-*-* } .-1 } */
+ _Minof (1); /* { dg-error "to something not a type" } */
-+ /* { dg-error "expected ';'" "syntax error" { target *-*-* } .-1 } */
-+ /* { dg-error "expected statement" "syntax error 2" { target *-*-* }
.-2 } */
++ /* { dg-error "expected '\\)'" "syntax error" { target *-*-* } .-1 } */
+ _Maxof 1; /* { dg-error "expected '\\('" } */
+ _Minof 1; /* { dg-error "expected '\\('" } */
+ _Maxof (int) {1}; /* { dg-error "expected ';'" } */
@@ gcc/testsuite/gcc.dg/maxof-compile.c (new)
+specs (void)
+{
+ _Maxof (static int); /* { dg-error "to something not a type" } */
-+ /* { dg-error "expected ';'" "syntax error" { target *-*-* } .-1 } */
-+ /* { dg-error "expected statement" "syntax error 2" { target *-*-* }
.-2 } */
++ /* { dg-error "expected '\\)'" "syntax error" { target *-*-* } .-1 } */
+ _Minof (static int); /* { dg-error "to something not a type" } */
-+ /* { dg-error "expected ';'" "syntax error" { target *-*-* } .-1 } */
-+ /* { dg-error "expected statement" "syntax error 2" { target *-*-* }
.-2 } */
++ /* { dg-error "expected '\\)'" "syntax error" { target *-*-* } .-1 } */
+ _Maxof (alignas(8) int); /* { dg-error "alignment specified" } */
+ _Minof (alignas(8) int); /* { dg-error "alignment specified" } */
+}
@@ gcc/testsuite/gcc.dg/maxof-compile.c (new)
+ _Generic (_Minof (unsigned _BitInt (5)), unsigned _BitInt (5): 0);
+}
- ## gcc/testsuite/gcc.dg/maxof-no-compat.c (new) ##
-@@
-+/* { dg-do compile } */
-+/* { dg-options "-std=c23 -pedantic-errors -Wno-c23-c2y-compat" } */
-+
-+int a[_Maxof(char)];
-+int b[1 + _Minof(unsigned char)];
-
## gcc/testsuite/gcc.dg/maxof-pedantic-errors.c (new) ##
@@
+/* { dg-do compile } */
2: 96b815be5e5d < -: ------------ c: Reduce excess errors of _Maxof and _Minof
3: 4b4334f3c071 < -: ------------ c: _Maxof and _Minof have not been accepted
yet by the C Committee
--
2.51.0