]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Fix more bugs in specific tests under AC_LANG(C++).
authorZack Weinberg <zackw@panix.com>
Mon, 9 Nov 2020 18:08:13 +0000 (13:08 -0500)
committerZack Weinberg <zackw@panix.com>
Mon, 9 Nov 2020 18:10:46 +0000 (13:10 -0500)
Found by exhaustive testing for differences between probe results
under AC_LANG(C) and AC_LANG(C++).

 * lib/autoconf/c.m4 (AC_C_FLEXIBLE_ARRAY_MEMBER): Cast result of
   malloc for C++ compatibility.
 * lib/autoconf/programs.m4 (_AC_PROG_LEX_YYTEXT_DECL): Declare yywrap
   as extern "C" when compiling as C++.

lib/autoconf/c.m4
lib/autoconf/programs.m4

index ca63dc58ee873e41cf691ef9d9a323524bba3033..a31d2d33637e9513f17f281da98be1a3771abf0a 100644 (file)
@@ -1993,8 +1993,8 @@ AC_DEFUN([AC_C_FLEXIBLE_ARRAY_MEMBER],
            #include <stddef.h>
            struct s { int n; double d[]; };]],
          [[int m = getchar ();
-           struct s *p = malloc (offsetof (struct s, d)
-                                 + m * sizeof (double));
+           struct s *p = (struct s *) malloc (offsetof (struct s, d)
+                                              + m * sizeof (double));
            p->d[0] = 0.0;
            return p->d != (double *) NULL;]])],
        [ac_cv_c_flexmember=yes],
index b352ce2442a02ee5f6a42db68668753fd50fc311..63e0704395df4dd4827478dc0408902f05e5c414 100644 (file)
@@ -747,6 +747,9 @@ fi])])
 AC_DEFUN([_AC_PROG_LEX_YYTEXT_DECL],
 [cat >conftest.l <<_ACEOF[
 %{
+#ifdef __cplusplus
+extern "C"
+#endif
 int yywrap(void);
 %}
 %%