changeset 17313:a9f418d6d676

regex-tests, regex: fix bug: memset undeclared * tests/test-regex.c: Don't include regex.h twice. Include string.h, to declare memset. Christensen's report also mentioned this issue. * m4/regex.m4 (gl_REGEX): Keep test program more in sync with test-regex.c, to avoid future problems like this. Remove AC_INCLUDES_DEFAULT. Include <string.h>. Don't include <regex.h> twice.
author Paul Eggert <eggert@cs.ucla.edu>
date Sun, 03 Feb 2013 09:19:06 -0800
parents 219f5e131f8d
children ab5135d5ff83
files ChangeLog m4/regex.m4 tests/test-regex.c
diffstat 3 files changed, 20 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2013-02-03  Paul Eggert  <eggert@cs.ucla.edu>
 
+	regex-tests, regex: fix bug: memset undeclared
+	* tests/test-regex.c: Don't include regex.h twice.  Include
+	string.h, to declare memset.  Christensen's report also mentioned
+	this issue.
+	* m4/regex.m4 (gl_REGEX): Keep test program more in sync with
+	test-regex.c, to avoid future problems like this.  Remove
+	AC_INCLUDES_DEFAULT.  Include <string.h>.  Don't include <regex.h>
+	twice.
+
 	regex-tests: fix link errors on older Solaris
 	These need to link with @LIBINTL@ to get libintl_gettext.
 	Problem reported by Tom G. Christensen in
--- a/m4/regex.m4
+++ b/m4/regex.m4
@@ -32,15 +32,16 @@
                    [gl_cv_func_re_compile_pattern_working],
       [AC_RUN_IFELSE(
         [AC_LANG_PROGRAM(
-          [AC_INCLUDES_DEFAULT[
-           #include <locale.h>
-           #include <limits.h>
-           #include <regex.h>
-           #if HAVE_ALARM
-           # include <unistd.h>
-           # include <signal.h>
-           #endif
-           ]],
+          [[#include <regex.h>
+
+            #include <locale.h>
+            #include <limits.h>
+            #include <string.h>
+            #if HAVE_ALARM
+            # include <unistd.h>
+            # include <signal.h>
+            #endif
+          ]],
           [[int result = 0;
             static struct re_pattern_buffer regex;
             unsigned char folded_chars[UCHAR_MAX + 1];
--- a/tests/test-regex.c
+++ b/tests/test-regex.c
@@ -20,7 +20,7 @@
 
 #include <locale.h>
 #include <limits.h>
-#include <regex.h>
+#include <string.h>
 #if HAVE_ALARM
 # include <unistd.h>
 # include <signal.h>