public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [pushed] Minor fix in skip_ctf_tests
@ 2021-02-27  0:34 Tom Tromey
  0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2021-02-27  0:34 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

I noticed an oddity in skip_ctf_tests -- for me it ends up caching the
string "!0", because it ends with 'return ![...]'.  In Tcl, this is
just string concatenation.

The result works because the users of this function have unbraced if
conditions, like:

    if [skip_ctf_tests] {

... which works because "if" re-parses the returned string as an
expression, and evaluates that.

There's only a latent bug here, but this is also un-idiomatic, so I am
checking in this patch to fix it.  This way, if someone in the future
uses a braced condition (which is what I normally recommend), it will
continue to work.

gdb/testsuite/ChangeLog
2021-02-26  Tom Tromey  <tom@tromey.com>

	* lib/gdb.exp (skip_ctf_tests): Use expr on result.
---
 gdb/testsuite/ChangeLog   | 4 ++++
 gdb/testsuite/lib/gdb.exp | 4 +++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 142051296cb..7480bd5665f 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -7433,11 +7433,13 @@ gdb_caching_proc skip_ctf_tests {
 	return 1
     }
 
-    return ![gdb_can_simple_compile ctfdebug {
+    set can_ctf [gdb_can_simple_compile ctfdebug {
 	int main () {
 	    return 0;
 	}
     } executable "additional_flags=-gt"]
+
+    return [expr {!$can_ctf}]
 }
 
 # Return 1 if compiler supports -gstatement-frontiers.  Otherwise,
-- 
2.26.2


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-02-27  0:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-27  0:34 [pushed] Minor fix in skip_ctf_tests Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).