From: Tom de Vries Date: Fri, 5 Sep 2025 07:54:41 +0000 (+0200) Subject: [gdb/testsuite] Fix gdb.base/fileio.exp for local-remote-host-native X-Git-Tag: gdb-17-branchpoint~14 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cc91060a47aa0f8d0e4f2c73f720068162408860;p=thirdparty%2Fbinutils-gdb.git [gdb/testsuite] Fix gdb.base/fileio.exp for local-remote-host-native 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': :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. --- diff --git a/gdb/testsuite/gdb.base/fileio.c b/gdb/testsuite/gdb.base/fileio.c index 0f201518b71..4ba5ab0d9ae 100644 --- a/gdb/testsuite/gdb.base/fileio.c +++ b/gdb/testsuite/gdb.base/fileio.c @@ -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 diff --git a/gdb/testsuite/gdb.base/fileio.exp b/gdb/testsuite/gdb.base/fileio.exp index 6996d6d9b01..7347c1160b1 100644 --- a/gdb/testsuite/gdb.base/fileio.exp +++ b/gdb/testsuite/gdb.base/fileio.exp @@ -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 }