Hi Joseph,

On Fri, Oct 11, 2024 at 01:44:36PM GMT, Alejandro Colomar wrote:
> Hi,
> 
> This is just an untested draft.  If there's rough agreement that this is
> wanted, I'll test it, write changelog, etc.
> 
> The intention of this change is to help improve the common C/C++
> language subset, promoting the use of NULL in both languages as the null
> pointer constant, expanding to nullptr in C++, and to ((void *)0) in C.
> 
> While C23 added nullptr, it was a terrible mistake, and it doesn't do
> any good to the C language.  (See the link below for more details.)
> Instead, it's C++ which should reconcile with C.  Let's work in that
> direction.
> 
> Link: <https://software.codidact.com/posts/292718>
> 
> Have a lovely day!
> Alex
> 
> Alejandro Colomar (5):
>   gcc/ginclude/stddef.h: Indent nested cpp conditionals
>   gcc/ginclude/stddef.h: Invert conditional
>   gcc/ginclude/stddef.h: Define NULL as nullptr if possible
>   Don't define NULL as 0 in C
>   libgm2/libm2pim/wrapc.cc: Define NULL as nullptr
> 
>  gcc/ginclude/stddef.h                         | 24 +++++++++++--------
>  .../gcc.c-torture/execute/pr68143_1.c         |  2 +-
>  gcc/testsuite/gcc.c-torture/execute/pr70566.c |  2 +-
>  gcc/testsuite/gcc.dg/tm/20100615.c            |  2 +-
>  gcc/testsuite/gcc.target/aarch64/pr91927.c    |  2 +-
>  libgm2/libm2pim/wrapc.cc                      |  4 +---
>  libiberty/alloca.c                            |  2 +-
>  libiberty/argv.c                              |  2 +-
>  libiberty/getopt1.c                           |  2 +-
>  9 files changed, 22 insertions(+), 20 deletions(-)

There are some regressions.  Below is the diff of .sum files.  In the
.log files, I see some errors saying `CRC mismatch`.  Did I do anything
wrong?

Have a lovely night!
Alex


--- ../.tmp.null.b4/./gcc/testsuite/g++/g++.sum 2024-10-13 17:49:00.772692813 
+0200
+++ ../.tmp.null/./gcc/testsuite/g++/g++.sum    2024-10-13 20:45:15.537873070 
+0200
@@ -1,4 +1,4 @@
-Test run by alx on Sun Oct 13 12:28:13 2024
+Test run by alx on Sun Oct 13 19:41:09 2024
 Native configuration is x86_64-pc-linux-gnu
 
                === g++ tests ===
@@ -192400,8 +192400,7 @@
 PASS: g++.dg/modules/p1689-1.C -std=c++2b (test for excess errors)
 FAIL: g++.dg/modules/p1689-2.C -std=c++17 (test for excess errors)
 FAIL: g++.dg/modules/p1689-2.C -std=c++2a (test for excess errors)
-PASS: g++.dg/modules/p1689-2.C -std=c++2b (test for excess errors)
-FAIL: ERROR: length mismatch at rules/0/requires: actual: "1" expect: "0"
+FAIL: g++.dg/modules/p1689-2.C -std=c++2b (test for excess errors)
 PASS: g++.dg/modules/p1689-3.C -std=c++17 (test for excess errors)
 PASS: g++.dg/modules/p1689-3.C -std=c++2a (test for excess errors)
 PASS: g++.dg/modules/p1689-3.C -std=c++2b (test for excess errors)
@@ -193382,12 +193381,12 @@
 PASS: g++.dg/modules/binding-1_b.H module-cmi  
(gcm.cache/$srcdir/g++.dg/modules/binding-1_b.H.gcm)
 FAIL: g++.dg/modules/binding-1_c.C -std=c++2a (test for excess errors)
 FAIL: g++.dg/modules/binding-1_c.C module-cmi hello (gcm.cache/hello.gcm)
-PASS: g++.dg/modules/binding-1_a.H -std=c++2b (test for excess errors)
-PASS: g++.dg/modules/binding-1_a.H module-cmi  
(gcm.cache/$srcdir/g++.dg/modules/binding-1_a.H.gcm)
+FAIL: g++.dg/modules/binding-1_a.H -std=c++2b (test for excess errors)
+FAIL: g++.dg/modules/binding-1_a.H module-cmi  
(gcm.cache/$srcdir/g++.dg/modules/binding-1_a.H.gcm)
 PASS: g++.dg/modules/binding-1_b.H -std=c++2b (test for excess errors)
 PASS: g++.dg/modules/binding-1_b.H module-cmi  
(gcm.cache/$srcdir/g++.dg/modules/binding-1_b.H.gcm)
-PASS: g++.dg/modules/binding-1_c.C -std=c++2b (test for excess errors)
-PASS: g++.dg/modules/binding-1_c.C module-cmi hello (gcm.cache/hello.gcm)
+FAIL: g++.dg/modules/binding-1_c.C -std=c++2b (test for excess errors)
+FAIL: g++.dg/modules/binding-1_c.C module-cmi hello (gcm.cache/hello.gcm)
 PASS: g++.dg/modules/block-decl-1_a.C -std=c++17  (test for bogus messages, 
line 7)
 PASS: g++.dg/modules/block-decl-1_a.C -std=c++17 (test for excess errors)
 PASS: g++.dg/modules/block-decl-1_a.C module-cmi bla (gcm.cache/bla.gcm)
@@ -194824,13 +194823,13 @@
 FAIL: g++.dg/modules/global-3_b.C -std=c++2a (test for excess errors)
 UNRESOLVED: g++.dg/modules/global-3 -std=c++2a link
 UNRESOLVED: g++.dg/modules/global-3 -std=c++2a execute
-PASS: g++.dg/modules/global-3_a.C -std=c++2b (test for excess errors)
-PASS: g++.dg/modules/global-3_a.C -std=c++2b  scan-lang-dump module 
"Dependencies of decl function_decl:'::Log'"
+FAIL: g++.dg/modules/global-3_a.C -std=c++2b (test for excess errors)
+FAIL: g++.dg/modules/global-3_a.C -std=c++2b  scan-lang-dump module 
"Dependencies of decl function_decl:'::Log'"
 PASS: g++.dg/modules/global-3_a.C -std=c++2b  scan-lang-dump-not module 
"Reachable GMF '::printf[^'\\n]*' added"
-PASS: g++.dg/modules/global-3_a.C module-cmi logger (gcm.cache/logger.gcm)
-PASS: g++.dg/modules/global-3_b.C -std=c++2b (test for excess errors)
-PASS: g++.dg/modules/global-3 -std=c++2b link
-PASS: g++.dg/modules/global-3 -std=c++2b execute
+FAIL: g++.dg/modules/global-3_a.C module-cmi logger (gcm.cache/logger.gcm)
+FAIL: g++.dg/modules/global-3_b.C -std=c++2b (test for excess errors)
+UNRESOLVED: g++.dg/modules/global-3 -std=c++2b link
+UNRESOLVED: g++.dg/modules/global-3 -std=c++2b execute
 PASS: g++.dg/modules/gmf-1_a.C -std=c++17 (test for excess errors)
 PASS: g++.dg/modules/gmf-1_a.C module-cmi hello (gcm.cache/hello.gcm)
 PASS: g++.dg/modules/gmf-1_b.C -std=c++17 (test for excess errors)
@@ -194946,11 +194945,11 @@
 FAIL: g++.dg/modules/hello-1_b.C -std=c++2a (test for excess errors)
 UNRESOLVED: g++.dg/modules/hello-1 -std=c++2a link
 UNRESOLVED: g++.dg/modules/hello-1 -std=c++2a execute
-PASS: g++.dg/modules/hello-1_a.C -std=c++2b (test for excess errors)
-PASS: g++.dg/modules/hello-1_a.C module-cmi hello (gcm.cache/hello.gcm)
-PASS: g++.dg/modules/hello-1_b.C -std=c++2b (test for excess errors)
-PASS: g++.dg/modules/hello-1 -std=c++2b link
-PASS: g++.dg/modules/hello-1 -std=c++2b execute
+FAIL: g++.dg/modules/hello-1_a.C -std=c++2b (test for excess errors)
+FAIL: g++.dg/modules/hello-1_a.C module-cmi hello (gcm.cache/hello.gcm)
+FAIL: g++.dg/modules/hello-1_b.C -std=c++2b (test for excess errors)
+UNRESOLVED: g++.dg/modules/hello-1 -std=c++2b link
+UNRESOLVED: g++.dg/modules/hello-1 -std=c++2b execute
 PASS: g++.dg/modules/hello-2_a.C -std=c++17 (test for excess errors)
 PASS: g++.dg/modules/hello-2_a.C module-cmi Hello2 (gcm.cache/Hello2.gcm)
 FAIL: g++.dg/modules/hello-2_b.C -std=c++17 (test for excess errors)
@@ -194963,9 +194962,9 @@
 UNRESOLVED: g++.dg/modules/hello-2 -std=c++2a execute
 PASS: g++.dg/modules/hello-2_a.C -std=c++2b (test for excess errors)
 PASS: g++.dg/modules/hello-2_a.C module-cmi Hello2 (gcm.cache/Hello2.gcm)
-PASS: g++.dg/modules/hello-2_b.C -std=c++2b (test for excess errors)
-PASS: g++.dg/modules/hello-2 -std=c++2b link
-PASS: g++.dg/modules/hello-2 -std=c++2b execute
+FAIL: g++.dg/modules/hello-2_b.C -std=c++2b (test for excess errors)
+UNRESOLVED: g++.dg/modules/hello-2 -std=c++2b link
+UNRESOLVED: g++.dg/modules/hello-2 -std=c++2b execute
 PASS: g++.dg/modules/horcrux-1_a.C -std=c++17 (test for excess errors)
 PASS: g++.dg/modules/horcrux-1_a.C module-cmi foo (gcm.cache/foo.gcm)
 PASS: g++.dg/modules/horcrux-1_b.C -std=c++17 (test for excess errors)
@@ -195873,11 +195872,11 @@
 FAIL: g++.dg/modules/iostream-1_b.C -std=c++2a (test for excess errors)
 UNRESOLVED: g++.dg/modules/iostream-1 -std=c++2a link
 UNRESOLVED: g++.dg/modules/iostream-1 -std=c++2a execute
-PASS: g++.dg/modules/iostream-1_a.H -std=c++2b (test for excess errors)
-PASS: g++.dg/modules/iostream-1_a.H module-cmi  
(gcm.cache/$srcdir/g++.dg/modules/iostream-1_a.H.gcm)
-PASS: g++.dg/modules/iostream-1_b.C -std=c++2b (test for excess errors)
-PASS: g++.dg/modules/iostream-1 -std=c++2b link
-PASS: g++.dg/modules/iostream-1 -std=c++2b execute
+FAIL: g++.dg/modules/iostream-1_a.H -std=c++2b (test for excess errors)
+FAIL: g++.dg/modules/iostream-1_a.H module-cmi  
(gcm.cache/$srcdir/g++.dg/modules/iostream-1_a.H.gcm)
+FAIL: g++.dg/modules/iostream-1_b.C -std=c++2b (test for excess errors)
+UNRESOLVED: g++.dg/modules/iostream-1 -std=c++2b link
+UNRESOLVED: g++.dg/modules/iostream-1 -std=c++2b execute
 PASS: g++.dg/modules/keyword-1_a.C -std=c++17 (test for excess errors)
 PASS: g++.dg/modules/keyword-1_a.C module-cmi bob (gcm.cache/bob.gcm)
 PASS: g++.dg/modules/keyword-1_b.C -std=c++17 (test for excess errors)
@@ -197839,7 +197838,7 @@
 PASS: g++.dg/modules/part-5_a.C module-cmi module1:submodule1 
(gcm.cache/module1-submodule1.gcm)
 PASS: g++.dg/modules/part-5_b.C -std=c++2b (test for excess errors)
 PASS: g++.dg/modules/part-5_b.C module-cmi module1 (gcm.cache/module1.gcm)
-PASS: g++.dg/modules/part-5_c.C -std=c++2b (test for excess errors)
+FAIL: g++.dg/modules/part-5_c.C -std=c++2b (test for excess errors)
 PASS: g++.dg/modules/part-6_a.C -std=c++17 (test for excess errors)
 PASS: g++.dg/modules/part-6_a.C module-cmi foo:exp (gcm.cache/foo-exp.gcm)
 PASS: g++.dg/modules/part-6_b.C -std=c++17 (test for excess errors)
@@ -238085,10 +238084,10 @@
 
                === g++ Summary ===
 
-# of expected passes           233644
-# of unexpected failures       124
+# of expected passes           233619
+# of unexpected failures       140
 # of expected failures         2215
-# of unresolved testcases      16
+# of unresolved testcases      24
 # of unsupported tests         2017
 /home/alx/src/gnu/gcc/.tmp.null/gcc/xg++  version 15.0.0 20241010 
(experimental) (GCC) 


And here's some entry of the log:


$ cat gcc/testsuite/g++/g++.log | grep -B17 -A7 'FAIL: g++.dg/modules/p1689-2.C 
-std=c++2b (test for excess errors)'
Executing on host: /home/alx/src/gnu/gcc/.tmp.null/gcc/testsuite/g++/../../xg++ 
-B/home/alx/src/gnu/gcc/.tmp.null/gcc/testsuite/g++/../../  
/home/alx/src/gnu/gcc/null/gcc/testsuite/g++.dg/modules/p1689-2.C    
-fdiagnostics-plain-output  -nostdinc++ 
-I/home/alx/src/gnu/gcc/.tmp.null/x86_64-pc-linux-gnu/libstdc++-v3/include/x86_64-pc-linux-gnu
 -I/home/alx/src/gnu/gcc/.tmp.null/x86_64-pc-linux-gnu/libstdc++-v3/include 
-I/home/alx/src/gnu/gcc/null/libstdc++-v3/libsupc++ 
-I/home/alx/src/gnu/gcc/null/libstdc++-v3/include/backward 
-I/home/alx/src/gnu/gcc/null/libstdc++-v3/testsuite/util -fmessage-length=0 
-std=c++2b -pedantic-errors -Wno-long-long -E -MT p1689-2.ddi -MD -fmodules-ts 
-fdeps-format=p1689r5 -fdeps-target=p1689-2.o -fdeps-file=p1689-2.ddi  -S -o 
p1689-2.s    (timeout = 300)
spawn -ignore SIGHUP 
/home/alx/src/gnu/gcc/.tmp.null/gcc/testsuite/g++/../../xg++ 
-B/home/alx/src/gnu/gcc/.tmp.null/gcc/testsuite/g++/../../ 
/home/alx/src/gnu/gcc/null/gcc/testsuite/g++.dg/modules/p1689-2.C 
-fdiagnostics-plain-output -nostdinc++ 
-I/home/alx/src/gnu/gcc/.tmp.null/x86_64-pc-linux-gnu/libstdc++-v3/include/x86_64-pc-linux-gnu
 -I/home/alx/src/gnu/gcc/.tmp.null/x86_64-pc-linux-gnu/libstdc++-v3/include 
-I/home/alx/src/gnu/gcc/null/libstdc++-v3/libsupc++ 
-I/home/alx/src/gnu/gcc/null/libstdc++-v3/include/backward 
-I/home/alx/src/gnu/gcc/null/libstdc++-v3/testsuite/util -fmessage-length=0 
-std=c++2b -pedantic-errors -Wno-long-long -E -MT p1689-2.ddi -MD -fmodules-ts 
-fdeps-format=p1689r5 -fdeps-target=p1689-2.o -fdeps-file=p1689-2.ddi -S -o 
p1689-2.s
In module imported at 
/home/alx/src/gnu/gcc/.tmp.null/x86_64-pc-linux-gnu/libstdc++-v3/include/system_error:45:1,
        included from 
/home/alx/src/gnu/gcc/.tmp.null/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/ios_base.h:48,
                 from 
/home/alx/src/gnu/gcc/.tmp.null/x86_64-pc-linux-gnu/libstdc++-v3/include/ios:46,
                 from 
/home/alx/src/gnu/gcc/.tmp.null/x86_64-pc-linux-gnu/libstdc++-v3/include/ostream:42,
                 from 
/home/alx/src/gnu/gcc/.tmp.null/x86_64-pc-linux-gnu/libstdc++-v3/include/iostream:43,
of module 
/home/alx/src/gnu/gcc/.tmp.null/x86_64-pc-linux-gnu/libstdc++-v3/include/iostream,
 imported at 
/home/alx/src/gnu/gcc/null/gcc/testsuite/g++.dg/modules/p1689-2.C:14:
/home/alx/src/gnu/gcc/.tmp.null/x86_64-pc-linux-gnu/libstdc++-v3/include/stdexcept:
 error: module 
'/home/alx/src/gnu/gcc/.tmp.null/x86_64-pc-linux-gnu/libstdc++-v3/include/stdexcept'
 CRC mismatch
/home/alx/src/gnu/gcc/.tmp.null/x86_64-pc-linux-gnu/libstdc++-v3/include/stdexcept:
 error: failed to read compiled module: Bad file data
/home/alx/src/gnu/gcc/.tmp.null/x86_64-pc-linux-gnu/libstdc++-v3/include/stdexcept:
 note: compiled module file is 
'gcm.cache/./home/alx/src/gnu/gcc/.tmp.null/x86_64-pc-linux-gnu/libstdc++-v3/include/stdexcept.gcm'
In module imported at 
/home/alx/src/gnu/gcc/null/gcc/testsuite/g++.dg/modules/p1689-2.C:14:1:
/home/alx/src/gnu/gcc/.tmp.null/x86_64-pc-linux-gnu/libstdc++-v3/include/iostream:
 error: failed to read compiled module: Bad import dependency
/home/alx/src/gnu/gcc/.tmp.null/x86_64-pc-linux-gnu/libstdc++-v3/include/iostream:
 note: compiled module file is 
'gcm.cache/./home/alx/src/gnu/gcc/.tmp.null/x86_64-pc-linux-gnu/libstdc++-v3/include/iostream.gcm'
/home/alx/src/gnu/gcc/.tmp.null/x86_64-pc-linux-gnu/libstdc++-v3/include/iostream:
 fatal error: returning to the gate for a mechanical issue
compilation terminated.
compiler exited with status 1
FAIL: g++.dg/modules/p1689-2.C -std=c++2b (test for excess errors)
Excess errors:
/home/alx/src/gnu/gcc/.tmp.null/x86_64-pc-linux-gnu/libstdc++-v3/include/stdexcept:
 error: module 
'/home/alx/src/gnu/gcc/.tmp.null/x86_64-pc-linux-gnu/libstdc++-v3/include/stdexcept'
 CRC mismatch
/home/alx/src/gnu/gcc/.tmp.null/x86_64-pc-linux-gnu/libstdc++-v3/include/stdexcept:
 error: failed to read compiled module: Bad file data
/home/alx/src/gnu/gcc/.tmp.null/x86_64-pc-linux-gnu/libstdc++-v3/include/iostream:
 error: failed to read compiled module: Bad import dependency
/home/alx/src/gnu/gcc/.tmp.null/x86_64-pc-linux-gnu/libstdc++-v3/include/iostream:
 fatal error: returning to the gate for a mechanical issue
compilation terminated.


-- 
<https://www.alejandro-colomar.es/>

Attachment: signature.asc
Description: PGP signature

Reply via email to