]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/testsuite] Fix gdb.base/fileio.exp for local-remote-host-native
authorTom de Vries <tdevries@suse.de>
Fri, 5 Sep 2025 07:54:41 +0000 (09:54 +0200)
committerTom de Vries <tdevries@suse.de>
Fri, 5 Sep 2025 07:54:41 +0000 (09:54 +0200)
When running test-case gdb.base/fileio.exp with host/target board
local-remote-host-native I run into:
...
gdb compile failed, fileio.c: In function 'test_open':
<command-line>:0:8: error: expected expression before '.' token
fileio.c:89:15: note: in expansion of macro 'OUTDIR'
   ret = open (OUTDIR FILENAME, O_CREAT | O_TRUNC | O_RDWR, S_IWUSR | S_IRUSR);
               ^~~~~~
...

Fix this by using:
- quote_for_host to pass -DOUTDIR to the compilation, and
- STRINGIFY to stringify OUTDIR in fileio.c.

Tested on x86_64-linux, with target board unix and host/target board
local-remote-host-native.

gdb/testsuite/gdb.base/fileio.c
gdb/testsuite/gdb.base/fileio.exp

index 0f201518b714128c2685592772cd664154576450..4ba5ab0d9aec07b5ff21e52399a928b1a723cb88 100644 (file)
@@ -73,6 +73,10 @@ static const char *strerrno (int err);
 
 #define STRING      "Hello World"
 
+#define STRINGIFY(s) STRINGIFY_(s)
+#define STRINGIFY_(s) #s
+#define OUTDIR STRINGIFY (OUTDIR_)
+
 static void stop (void) {}
 
 /* A NULL string.  We pass this to stat below instead of a NULL
index 6996d6d9b01ab6fbc36d430753bc36ee8c526139..7347c1160b1055425441800a07ac94effbd7f46b 100644 (file)
@@ -27,7 +27,7 @@ if {[is_remote host]} {
 
 if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
           executable \
-          [list debug "additional_flags=-DOUTDIR=\"$outdir/\""]] != "" } {
+          [list debug additional_flags=[quote_for_host -DOUTDIR_=$outdir/]]] != "" } {
     untested "failed to compile"
     return -1
 }