Ignore warning in string/tester.c.
diff mbox

Message ID 1418670947.7165.1.camel@triegel.csb
State New
Headers show

Commit Message

Torvald Riegel Dec. 15, 2014, 7:15 p.m. UTC
This fixes a warning in a build using a fairly recent GCC.  AFAIK the
warning/option is new and hasn't been offered by 4.9, hence the
conditional.  OK?

Comments

Ondřej Bílka Dec. 15, 2014, 10:44 p.m. UTC | #1
On Mon, Dec 15, 2014 at 08:15:47PM +0100, Torvald Riegel wrote:
> This fixes a warning in a build using a fairly recent GCC.  AFAIK the
> warning/option is new and hasn't been offered by 4.9, hence the
> conditional.  OK?

OK with obvious ChangeLog.

Patch
diff mbox

commit c489aa94f6e1721afa7e9e559fdb375587187590
Author: Torvald Riegel <triegel@redhat.com>
Date:   Mon Dec 15 20:13:11 2014 +0100

    Ignore warning in string/tester.c.

diff --git a/string/tester.c b/string/tester.c
index 62905a7..b219693 100644
--- a/string/tester.c
+++ b/string/tester.c
@@ -32,6 +32,7 @@ 
 #include <string.h>
 #include <strings.h>
 #include <fcntl.h>
+#include <libc-internal.h>
 
 
 #define	STREQ(a, b)	(strcmp((a), (b)) == 0)
@@ -1303,8 +1304,15 @@  test_memset (void)
   check(memset(one+1, 'x', 3) == one+1, 1);	/* Return value. */
   equal(one, "axxxefgh", 2);		/* Basic test. */
 
+  DIAG_PUSH_NEEDS_COMMENT;
+#if __GNUC_PREREQ (5, 0)
+  /* 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")
+#endif
   (void) memset(one+2, 'y', 0);
   equal(one, "axxxefgh", 3);		/* Zero-length set. */
+  DIAG_POP_NEEDS_COMMENT;
 
   (void) memset(one+5, 0, 1);
   equal(one, "axxxe", 4);			/* Zero fill. */