Fix gdb.base/infcall-nested-structs-c++.exp with Clang
authorGary Benson <gbenson@redhat.com>
Fri, 25 Sep 2020 13:44:07 +0000 (14:44 +0100)
committerGary Benson <gbenson@redhat.com>
Fri, 25 Sep 2020 13:44:07 +0000 (14:44 +0100)
gdb.base/infcall-nested-structs-c++.exp failed to build using Clang
with many variations on the following error:

  gdb compile failed, /gdbtest/src/gdb/testsuite/gdb.base/infcall-nested-structs.c:207:46:
    warning: self-comparison always evaluates to true [-Wtautological-compare]

This commit builds this testcase with -Wno-tautological-compare when
using Clang, to avoid this failure.

gdb/testsuite/ChangeLog:

* gdb.base/infcall-nested-structs.exp.tcl: Add
additional_flags=-Wno-tautological-compare for C++
tests when compiling using Clang.

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/infcall-nested-structs.exp.tcl

index a19af885d39da7e7a9edce1d58ef06fe8ec86d2a..2e35f6cdf1a573e04b813e5e022b47d60fef1030 100644 (file)
@@ -1,3 +1,9 @@
+2020-09-25  Gary Benson <gbenson@redhat.com>
+
+       * gdb.base/infcall-nested-structs.exp.tcl: Add
+       additional_flags=-Wno-tautological-compare for C++
+       tests when compiling using Clang.
+
 2020-09-25  Gary Benson <gbenson@redhat.com>
 
        * lib/gdb.exp (gdb_compile): Pass "-x c++" earlier, and only
index f7409612f80ed95d8e53542e800cae90e893f12f..907abe7ee8527f9eec1583bde5dd1688588434a3 100644 (file)
@@ -33,6 +33,13 @@ if [support_complex_tests] {
     lappend compile_flags "additional_flags=-Wno-psabi"
 }
 
+if { $lang == "c++" && [test_compiler_info clang*] } {
+    # Clang rightly deduces that the static member tests are
+    # tautological comparisons, so we need to inhibit that
+    # particular warning in order to build.
+    lappend compile_flags "additional_flags=-Wno-tautological-compare"
+}
+
 # Given N (0..25), return the corresponding alphabetic letter in upper
 # case.