[PATCH 3/7] gdb/testsuite: Let gdb_simple_compile take empty default flags

Pedro Alves <[email protected]>
Newsgroups gmane.comp.gdb.patches
Message-ID <[email protected]>
I noticed this while renaming nodebug to symtab.

gdb_simple_compile and its wrapper gdb_can_simple_compile take a
default_compile_flags argument that, when left unspecified, defaults
to a debug build ("debug nowarnings quiet").  The check for
"unspecified argument" is:

    if { $default_compile_flags == "" } {

which makes the default indistinguishable from a caller explicitly
passing "", so there was no way to ask for a build with no default
flags at all -- passing an empty list still gets you the default
flags.

Fix this by using a distinct "DEFAULT" sentinel for the unspecified
case instead.

Note no caller passes an explicit empty default_compile_flags today.

Change-Id: I30235fa1d28eb93dfdf08248af26669a7336d708
---
 gdb/testsuite/lib/gdb.exp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index d34ac30f2f0..b268152bdb7 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -6293,7 +6293,7 @@ gdb_caching_proc universal_compile_options_assembly {} {
 # Return 1 if code can be compiled
 # Leave the file name of the resulting object in the upvar object.
 
-proc gdb_simple_compile {name code {type object} {compile_flags {}} {object obj} {default_compile_flags {}}} {
+proc gdb_simple_compile {name code {type object} {compile_flags {}} {object obj} {default_compile_flags DEFAULT}} {
     upvar $object obj
 
     switch -regexp -- $type {
@@ -6331,7 +6331,7 @@ proc gdb_simple_compile {name code {type object} {compile_flags {}} {object obj}
     }
     set src [standard_temp_file $name.$ext]
     set obj [standard_temp_file $name.$postfix]
-    if { $default_compile_flags == "" } {
+    if { $default_compile_flags eq "DEFAULT" } {
 	set compile_flags [concat $compile_flags {debug nowarnings quiet}]
     } else {
 	set compile_flags [concat $compile_flags $default_compile_flags]
@@ -6357,7 +6357,7 @@ proc gdb_simple_compile {name code {type object} {compile_flags {}} {object obj}
 # Return 1 if code can be compiled
 # Delete all created files and objects.
 
-proc gdb_can_simple_compile {name code {type object} {compile_flags ""} {default_compile_flags ""}} {
+proc gdb_can_simple_compile {name code {type object} {compile_flags ""} {default_compile_flags DEFAULT}} {
     set ret [gdb_simple_compile $name $code $type $compile_flags temp_obj \
 		 $default_compile_flags]
     file delete $temp_obj
-- 
2.54.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.