diff options
author | Zack Weinberg <zackw@panix.com> | 2020-08-28 16:42:28 -0400 |
---|---|---|
committer | Zack Weinberg <zackw@panix.com> | 2020-08-28 16:42:28 -0400 |
commit | 87a81f44c6a9e9dbb4b3b94680084edfea603a89 (patch) | |
tree | 3d020ffa58421cbf73b42643130f3d92ee034716 /tests | |
parent | a2a6641c52994641bd10fb5efe2ecc51c07d798e (diff) | |
download | autoconf-87a81f44c6a9e9dbb4b3b94680084edfea603a89.tar.gz |
Fix testsuite failures from ‘make maintainer-check-c++’.
‘make maintainer-check-c++’ has two test failures that don’t show in
an ordinary ‘make check’. One of these is a pair of problems with the
semantics.at test of AC_CHECK_DECL(S):
* AC_CHECK_DECL cannot handle a function argument whose declared type
is ‘char []’; it generates a cast to the array type, which is
invalid in both C and C++. This was masked by an M4 quotation bug,
causing it to emit a cast to ‘char’ instead, prodicing code that
was valid C but invalid C++. I don’t think it’s practical to teach
AC_CHECK_DECL to do argument type decay, so I changed the type
signature in the AC_CHECK_DECL call (not in the actual declaration)
to ‘char *’. Conveniently this also avoids the quotation issue.
* In C++, apparently ‘extern struct { int x; } foo;’ is invalid.
(clang++ explains at length: “variable ‘foo’ is used but not
defined in this translation unit, and cannot be defined in any
other translation unit because its type does not have linkage.”)
Fixed by giving the struct a tag.
The other failure is an actual bug in AC_PROG_LEX: the test program
used by _AC_PROG_LEX_YYTEXT_DECL uses the flex utility function
‘input’, which is renamed to ‘yyinput’ when the scanner is compiled as
C++. Fixed with ifdefs in the offending action--it might seem cleaner
to use a macro defined in a %{ %} block, but that would be inserted into
the skeleton *above* the declaration of (yy)input, so I didn’t feel
it was safe.
* tests/semantics.at (AC_CHECK_DECLS): Adjust test programs for C++
compatibility and to work around lack of support for argument type
decay.
* programs.m4 (_AC_PROG_LEX_YYTEXT_DECL): Call yyinput(), not input(),
in scanner action when scanner is compiled as C++.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/semantics.at | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/semantics.at b/tests/semantics.at index 98933aa1..32811f6d 100644 --- a/tests/semantics.at +++ b/tests/semantics.at @@ -111,7 +111,7 @@ AT_CHECK_MACRO([AC_CHECK_DECLS], [[AC_CHECK_DECLS([yes, no, myenum, mystruct, myfunc, mymacro1, mymacro2],,, [[extern int yes; enum { myenum }; - extern struct { int x[20]; } mystruct; + extern struct mystruct_s { int x[20]; } mystruct; extern int myfunc(); #define mymacro1(arg) arg #define mymacro2]]) @@ -119,7 +119,7 @@ AT_CHECK_MACRO([AC_CHECK_DECLS], AC_CHECK_DECLS([strerror],,, [[]]) # The difference in space-before-open-paren is intentional. AC_CHECK_DECLS([basenam (char *), dirnam(char *), - [moreargs (char, short, int, long, void *, char [], float, double)]],,, + moreargs (char, short, int, long, void *, char *, float, double)],,, [[#ifdef __cplusplus extern "C++" char *basenam (char *); extern "C++" const char *basenam (const char *); |