This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [Patch] Fix glibc testing with GCC 4.9 compiler
- From: Steve Ellcey <sellcey at imgtec dot com>
- To: Joseph Myers <joseph at codesourcery dot com>, Florian Weimer <fw at deneb dot enyo dot de>
- Cc: <libc-alpha at sourceware dot org>
- Date: Fri, 26 Feb 2016 11:11:27 -0800
- Subject: Re: [Patch] Fix glibc testing with GCC 4.9 compiler
- Authentication-results: sourceware.org; auth=none
- References: <68cad408-de62-4515-98ee-987574823403 at BAMAIL02 dot ba dot imgtec dot org> <alpine dot DEB dot 2 dot 10 dot 1602251811070 dot 23613 at digraph dot polyomino dot org dot uk>
- Reply-to: <sellcey at imgtec dot com>
Here is an updated and tested patch that checks to see if the compiler
understands the -Wmemset-transposed-args option or not. Tested using
the 4.9.2 debian compiler as well as a 4.8 compiler and a ToT compiler.
OK to checkin?
Steve Ellcey
sellcey@imgtec.com
2016-02-26 Steve Ellcey <sellcey@imgtec.com>
* config.h.in (HAVE_MEMSET_WARNING): Add undef.
* configure.ac: Check if compiler understands -Wmemset-transposed-args.
* configure: Regenerate.
* string/tester.c (test_memset): Check HAVE_MEMSET_WARNING instead
of GCC version.
diff --git a/config.h.in b/config.h.in
index 0147ba3..ec672e6 100644
--- a/config.h.in
+++ b/config.h.in
@@ -45,6 +45,9 @@
/* Define if the compiler supports __builtin_memset. */
#undef HAVE_BUILTIN_MEMSET
+/* Define if the compiler accepts -Wmemset-transposed-args. */
+#undef HAVE_MEMSET_WARNING
+
/* Define if compiler accepts -ftree-loop-distribute-patterns. */
#undef HAVE_CC_INHIBIT_LOOP_TO_LIBCALL
diff --git a/configure.ac b/configure.ac
index 3c766b7..21fa353 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1449,6 +1449,13 @@ if test "$libc_cv_gcc_builtin_memset" = yes ; then
AC_DEFINE(HAVE_BUILTIN_MEMSET)
fi
+AC_CACHE_CHECK(for -Wmemset-transposed-args, libc_cv_memset_warning, [dnl
+LIBC_TRY_CC_OPTION([-Wmemset-transposed-args], [libc_cv_memset_warning=yes], [libc_cv_memset_warning=no])
+])
+if test "$libc_cv_memset_warning" = yes ; then
+ AC_DEFINE(HAVE_MEMSET_WARNING)
+fi
+
AC_CACHE_CHECK(for redirection of built-in functions, libc_cv_gcc_builtin_redirection, [dnl
cat > conftest.c <<\EOF
extern char *strstr (const char *, const char *) __asm ("my_strstr");
diff --git a/string/tester.c b/string/tester.c
index 7c36591..1659693 100644
--- a/string/tester.c
+++ b/string/tester.c
@@ -1305,7 +1305,7 @@ test_memset (void)
equal(one, "axxxefgh", 2); /* Basic test. */
DIAG_PUSH_NEEDS_COMMENT;
-#if __GNUC_PREREQ (5, 0)
+#ifdef HAVE_MEMSET_WARNING
/* GCC 5.0 warns about a zero-length memset because the arguments to memset
may be in the wrong order. But we really want to test this. */
DIAG_IGNORE_NEEDS_COMMENT (5.0, "-Wmemset-transposed-args")