https://gcc.gnu.org/g:5196331c436aef4d9b6c99423040227ee81167fa

commit r16-8525-g5196331c436aef4d9b6c99423040227ee81167fa
Author: Torbjörn SVENSSON <[email protected]>
Date:   Tue Apr 7 09:57:47 2026 +0200

    testsuite: /dev/null is not accessible on Windows
    
    Using same approach as in r13-3079-g5fe2e4f87e5124.
    
    gcc/testsuite/ChangeLog:
    
            * g++.dg/modules/modules.exp: Use "@nul" for Windows,
            "@/dev/null" for other environments.
    
    Signed-off-by: Torbjörn SVENSSON <[email protected]>

Diff:
---
 gcc/testsuite/g++.dg/modules/modules.exp | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/gcc/testsuite/g++.dg/modules/modules.exp 
b/gcc/testsuite/g++.dg/modules/modules.exp
index c97408bf19b5..2c7365db1cc5 100644
--- a/gcc/testsuite/g++.dg/modules/modules.exp
+++ b/gcc/testsuite/g++.dg/modules/modules.exp
@@ -54,18 +54,25 @@ global module_cmis
 
 set DEFAULT_REPO "gcm.cache"
 
+set devnull "/dev/null"
+if { [info exists ::env(OS)] && [string match "Windows*" $::env(OS)] } {
+    # Windows uses special file named "nul" as a substitute for /dev/null
+    set devnull "nul"
+}
+
 # Return the pathname for <HNAME>.
 # On failure this will return garbage that results in the understandable
 # FAIL: g++.dg/modules/compile-std1.C module-cmi <bits/stdcx++.h> 
(gcm.cache/,/ader_path1095619.C:1:10: fatal error: bits/stdcx++.h: No such file 
or directory.gcm)
 # ??? it would be nice to have a simple --print-include-name flag.
 proc host_header_path {hname} {
     global tool
+    global devnull
     set src header_path[pid].C
     set f [open $src "w"]
     puts $f "#include <$hname>"
     close $f
     set opts [list "additional_flags=-H" "additional_flags=-fdirectives-only"]
-    set lines [${tool}_target_compile $src /dev/null preprocess $opts]
+    set lines [${tool}_target_compile $src $devnull preprocess $opts]
     file delete $f
     # The first line of the -H output is ". /path/to/hname"
     set newline_idx [expr {[string first "\n" $lines] - 1}]

Reply via email to