]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: Fix building with clang
authorJens Remus <jremus@linux.ibm.com>
Mon, 5 Feb 2024 16:50:05 +0000 (17:50 +0100)
committerAndreas Arnez <arnez@linux.ibm.com>
Thu, 8 Feb 2024 13:21:01 +0000 (14:21 +0100)
This resolves the following clang++ error message:

../../gdb/symtab.c:4892:33: error: logical not is only applied to the left hand side of this comparison [-Werror,-Wlogical-not-parentheses]
              if (preg.has_value () && !preg->exec (sym->natural_name (), 0,
                                       ^
../../gdb/symtab.c:4892:33: note: add parentheses after the '!' to evaluate the comparison first
              if (preg.has_value () && !preg->exec (sym->natural_name (), 0,
                                       ^
                                        (
../../gdb/symtab.c:4892:33: note: add parentheses around left hand side expression to silence this warning
              if (preg.has_value () && !preg->exec (sym->natural_name (), 0,
                                       ^
                                       (

Bug: https://sourceware.org/PR31328

Signed-off-by: Jens Remus <jremus@linux.ibm.com>
gdb/symtab.c

index 32b19e6c902315eec575ef9b11208b4b6bab3151..02f5d4f1b3d19df163072f3d6f32293795bb6405 100644 (file)
@@ -4889,8 +4889,8 @@ global_symbol_searcher::add_matching_symbols
              if (!sym->matches (kind))
                continue;
 
-             if (preg.has_value () && !preg->exec (sym->natural_name (), 0,
-                                                   nullptr, 0) == 0)
+             if (preg.has_value () && preg->exec (sym->natural_name (), 0,
+                                                  nullptr, 0) != 0)
                continue;
 
              if (((sym->domain () == VAR_DOMAIN