]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Suppress ‘make syntax-check’ complaint about use of strcmp.
authorZack Weinberg <zackw@panix.com>
Fri, 28 Aug 2020 17:59:05 +0000 (13:59 -0400)
committerZack Weinberg <zackw@panix.com>
Fri, 28 Aug 2020 17:59:05 +0000 (13:59 -0400)
Recently ‘make syntax-check’ added a lint rule discouraging use of
bare ‘strcmp’ (in favor of gnulib’s streq/strneq wrappers), which
triggers on some code in c.m4’s test for C++98 compliance.

This lint rule makes sense for typical C programs coded to GNU’s
standards, but not for autoconf’s test programs.  There is no way to
disable it from outside the code, so this patch adds parentheses
around the name ‘strcmp’, which is sufficient to disable this
grep-based lint but doesn’t change the meaning of the code as
understood by an actual C++ compiler.

* c.m4 (_AC_CXX_CXX98_TEST_HEADER): Suppress ‘make syntax-check’
  error on use of strcmp.

lib/autoconf/c.m4

index eaef13a9252a4255155930e6100c77e39a1b102e..5d6e7b71ae4449b2e18c9bb7de5f4bda02b544c5 100644 (file)
@@ -2261,7 +2261,9 @@ void test_exception_syntax()
   try {
     throw "test";
   } catch (const char *s) {
-    assert (!strcmp (s, "test"));
+    // Extra parentheses suppress a warning when building autoconf itself,
+    // due to lint rules shared with more typical C programs.
+    assert (!(strcmp) (s, "test"));
   }
 }