Remove ATTRIBUTE_UNUSED check from ARI
[deliverable/binutils-gdb.git] / gdb / contrib / ari / gdb_ari.sh
index e90dec853f4ca43b01c849078b0a7bc3b17397eb..b5a54334dac8c9253e575222968d7a814c186527 100755 (executable)
@@ -2,7 +2,7 @@
 
 # GDB script to list of problems using awk.
 #
-# Copyright (C) 2002-2016 Free Software Foundation, Inc.
+# Copyright (C) 2002-2019 Free Software Foundation, Inc.
 #
 # This file is part of GDB.
 #
@@ -27,7 +27,7 @@ LC_ALL=C ; export LC_ALL
 
 # Permanent checks take the form:
 
-#     Do not use XXXX, ISO C 90 implies YYYY
+#     Do not use XXXX, C++11 implies YYYY
 #     Do not use XXXX, instead use YYYY''.
 
 # and should never be removed.
@@ -60,7 +60,7 @@ Options:
   -Werror        Treat all problems as errors.
   -Wall          Report all problems.
   -Wari          Report problems that should be fixed in new code.
-  -W<category>   Report problems in the specifed category.  Vaid categories
+  -W<category>   Report problems in the specifed category.  Valid categories
                  are: ${all}
 EOF
     exit 1
@@ -255,17 +255,6 @@ BEGIN {
 }
 
 
-# Things in comments
-
-BEGIN { doc["ARGSUSED"] = "\
-Do not use ARGSUSED, unnecessary"
-    category["ARGSUSED"] = ari_regression
-}
-/(^|[^_[:alnum:]])ARGSUSED([^_[:alnum:]]|$)/ {
-    fail("ARGSUSED")
-}
-
-
 # SNIP - Strip out comments - SNIP
 
 FNR == 1 {
@@ -334,7 +323,7 @@ Do not include gnu-regex.h, instead include gdb_regex.h"
 
 BEGIN { doc["wait.h"] = "\
 Do not include wait.h or sys/wait.h, instead include gdb_wait.h"
-    fix("wait.h", "common/gdb_wait.h", 2);
+    fix("wait.h", "gdbsupport/gdb_wait.h", 2);
     category["wait.h"] = ari_regression
 }
 /^#[[:space:]]*include[[:space:]]*.wait\.h./ \
@@ -364,7 +353,8 @@ Do not use printf(\"%p\"), instead use printf(\"%s\",paddr()) to dump a \
 target address, or host_address_to_string() for a host address"
     category["%p"] = ari_code
 }
-/%p/ && !/%prec/ {
+# Allow gdb %p extensions, but not other uses of %p.
+/%p[^[\]sF]/ && !/%prec/ {
     fail("%p")
 }
 
@@ -433,27 +423,8 @@ FNR == 1 {
 cont_p { $0 = full_line $0; cont_p = 0; full_line = ""; }
 
 
-# GDB uses ISO C 90.  Check for any non pure ISO C 90 code
-
-BEGIN { doc["PARAMS"] = "\
-Do not use PARAMS(), ISO C 90 implies prototypes"
-    category["PARAMS"] = ari_regression
-}
-/(^|[^_[:alnum:]])PARAMS([^_[:alnum:]]|$)/ {
-    fail("PARAMS")
-}
-
-BEGIN { doc["__func__"] = "\
-Do not use __func__, ISO C 90 does not support this macro"
-    category["__func__"] = ari_regression
-    fix("__func__", "common/gdb_assert.h", 1)
-}
-/(^|[^_[:alnum:]])__func__([^_[:alnum:]]|$)/ {
-    fail("__func__")
-}
-
 BEGIN { doc["__FUNCTION__"] = "\
-Do not use __FUNCTION__, ISO C 90 does not support this macro"
+Do not use __FUNCTION__, C++11 does not support this macro"
     category["__FUNCTION__"] = ari_regression
 }
 /(^|[^_[:alnum:]])__FUNCTION__([^_[:alnum:]]|$)/ {
@@ -470,7 +441,7 @@ autoconf tests"
 }
 
 BEGIN { doc["PTR"] = "\
-Do not use PTR, ISO C 90 implies `void *'\''"
+Do not use PTR, C++11 implies `void *'\''"
     category["PTR"] = ari_regression
     #fix("PTR", "gdb/utils.c", 6)
 }
@@ -593,8 +564,8 @@ BEGIN { doc["strerror"] = "\
 Do not use strerror(), instead use safe_strerror()"
     category["strerror"] = ari_regression
     fix("strerror", "gdb/gdb_string.h", 1)
-    fix("strerror", "gdb/common/mingw-strerror.c", 1)
-    fix("strerror", "gdb/common/posix-strerror.c", 1)
+    fix("strerror", "gdb/gdbsupport/mingw-strerror.c", 1)
+    fix("strerror", "gdb/gdbsupport/posix-strerror.c", 1)
 }
 /(^|[^_[:alnum:]])strerror[[:space:]]*\(/ {
     fail("strerror")
@@ -610,17 +581,6 @@ Do not use `long long'\'', instead use LONGEST"
     fail("long long")
 }
 
-BEGIN { doc["ATTRIBUTE_UNUSED"] = "\
-Do not use ATTRIBUTE_UNUSED, do not bother (GDB is compiled with -Werror and, \
-consequently, is not able to tolerate false warnings.  Since -Wunused-param \
-produces such warnings, neither that warning flag nor ATTRIBUTE_UNUSED \
-are used by GDB"
-    category["ATTRIBUTE_UNUSED"] = ari_regression
-}
-/(^|[^_[:alnum:]])ATTRIBUTE_UNUSED([^_[:alnum:]]|$)/ {
-    fail("ATTRIBUTE_UNUSED")
-}
-
 BEGIN { doc["ATTR_FORMAT"] = "\
 Do not use ATTR_FORMAT, use ATTRIBUTE_PRINTF instead"
     category["ATTR_FORMAT"] = ari_regression
@@ -816,7 +776,7 @@ unconditionally"
 }
 
 BEGIN { doc["bcmp"] = "\
-Do not use bcmp(), ISO C 90 implies memcmp()"
+Do not use bcmp(), C++11 implies memcmp()"
     category["bcmp"] = ari_regression
 }
 /(^|[^_[:alnum:]])bcmp[[:space:]]*\(/ {
@@ -824,7 +784,7 @@ Do not use bcmp(), ISO C 90 implies memcmp()"
 }
 
 BEGIN { doc["setlinebuf"] = "\
-Do not use setlinebuf(), ISO C 90 implies setvbuf()"
+Do not use setlinebuf(), C++11 implies setvbuf()"
     category["setlinebuf"] = ari_regression
 }
 /(^|[^_[:alnum:]])setlinebuf[[:space:]]*\(/ {
@@ -832,7 +792,7 @@ Do not use setlinebuf(), ISO C 90 implies setvbuf()"
 }
 
 BEGIN { doc["bcopy"] = "\
-Do not use bcopy(), ISO C 90 implies memcpy() and memmove()"
+Do not use bcopy(), C++11 implies memcpy() and memmove()"
     category["bcopy"] = ari_regression
 }
 /(^|[^_[:alnum:]])bcopy[[:space:]]*\(/ {
@@ -1080,7 +1040,7 @@ Do not use asprintf(), instead use xstrprintf()"
 
 BEGIN { doc["vasprintf"] = "\
 Do not use vasprintf(), instead use xstrvprintf"
-    fix("vasprintf", "common/common-utils.c", 1)
+    fix("vasprintf", "gdbsupport/common-utils.c", 1)
     category["vasprintf"] = ari_regression
 }
 /(^|[^_[:alnum:]])vasprintf[[:space:]]*\(/ {
@@ -1139,18 +1099,6 @@ Do not use strnicmp(), instead use strncasecmp()"
     fail("strnicmp")
 }
 
-# Boolean expressions and conditionals
-
-BEGIN { doc["boolean"] = "\
-Do not use `boolean'\'',  use `bool'\'' instead"
-    category["boolean"] = ari_regression
-}
-/(^|[^_[:alnum:]])boolean([^_[:alnum:]]|$)/ {
-    if (is_yacc_or_lex == 0) {
-       fail("boolean")
-    }
-}
-
 # Typedefs that are either redundant or can be reduced to `struct
 # type *''.
 # Must be placed before if assignment otherwise ARI exceptions
@@ -1172,20 +1120,6 @@ Do not use strlen dirent.d_name, instead use NAMELEN"
     fail("strlen d_name")
 }
 
-BEGIN { doc["var_boolean"] = "\
-Replace var_boolean with add_setshow_boolean_cmd"
-    category["var_boolean"] = ari_regression
-    fix("var_boolean", "gdb/command.h", 1)
-    # fix only uses the last directory level
-    fix("var_boolean", "cli/cli-decode.c", 2)
-}
-/(^|[^_[:alnum:]])var_boolean([^_[:alnum:]]|$)/ {
-    if (($0 !~ /(^|[^_[:alnum:]])case *var_boolean:/) \
-        && ($0 !~ /(^|[^_[:alnum:]])[=!]= *var_boolean/)) {
-       fail("var_boolean")
-    }
-}
-
 BEGIN { doc["generic_use_struct_convention"] = "\
 Replace generic_use_struct_convention with nothing, \
 EXTRACT_STRUCT_VALUE_ADDRESS is a predicate"
This page took 0.028144 seconds and 4 git commands to generate.