[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':
<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.
This commit is contained in:
Tom de Vries
2025-09-05 09:54:41 +02:00
parent c6df5d79aa
commit cc91060a47
2 changed files with 5 additions and 1 deletions

View 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

View 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
}