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.
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"));
}
}