Blame SOURCES/glibc-rh1505492-zerodiv-1.patch

00db10
commit c81e9deba2f73ddc6f62a9d41684824c854366c6
00db10
Author: Joseph Myers <joseph@codesourcery.com>
00db10
Date:   Wed Dec 10 00:43:36 2014 +0000
00db10
00db10
    Disable -Wdiv-by-zero for some tests in stdio-common/tst-unlockedio.c.
00db10
    
00db10
    This patch uses diagnostic control pragmas to disable some
00db10
    division-by-zero warnings in stdio-common/tst-unlockedio.c.  This is
00db10
    another test where disabling warnings using diagnostic pragmas seems
00db10
    appropriate (the warnings are not wildly inappropriate for what the
00db10
    test deliberately does; the deliberate use of unusual arguments to the
00db10
    macros being tested means that changing the arguments in a way that
00db10
    avoids the warning would also unduly perturb what is being tested).
00db10
    
00db10
    Tested for x86_64.
00db10
    
00db10
            * stdio-common/tst-unlockedio.c: Include <libc-internal.h>.
00db10
            (do_test): Disable -Wdiv-by-zero around some calls to
00db10
            fwrite_unlocked and fread_unlocked.
00db10
00db10
diff --git a/stdio-common/tst-unlockedio.c b/stdio-common/tst-unlockedio.c
00db10
index 2e5848ec5f49b693..5ce02fe6f5c7ea5c 100644
00db10
--- a/stdio-common/tst-unlockedio.c
00db10
+++ b/stdio-common/tst-unlockedio.c
00db10
@@ -20,6 +20,7 @@
00db10
 #include <stdlib.h>
00db10
 #include <stdio.h>
00db10
 #include <string.h>
00db10
+#include <libc-internal.h>
00db10
 
00db10
 int fd;
00db10
 static void do_prepare (void);
00db10
@@ -44,6 +45,13 @@ do_test (void)
00db10
 
00db10
   f = fp;
00db10
   cp = blah;
00db10
+  /* These tests deliberately use fwrite_unlocked with the size
00db10
+     argument specified as 0, which results in "division by zero"
00db10
+     warnings from the expansion of that macro (in code that is not
00db10
+     evaluated for a size of 0).  This applies to the tests of
00db10
+     fread_unlocked below as well.  */
00db10
+  DIAG_PUSH_NEEDS_COMMENT;
00db10
+  DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wdiv-by-zero");
00db10
   if (ftello (fp) != 0
00db10
       || fwrite_unlocked (blah, blah - blah, strlen (blah), f++) != 0
00db10
       || f != fp + 1
00db10
@@ -59,6 +67,7 @@ do_test (void)
00db10
       puts ("One of fwrite_unlocked tests failed");
00db10
       exit (1);
00db10
     }
00db10
+  DIAG_POP_NEEDS_COMMENT;
00db10
 
00db10
   if (fwrite_unlocked (blah, 1, strlen (blah) - 2, fp) != strlen (blah) - 2)
00db10
     {
00db10
@@ -93,6 +102,9 @@ do_test (void)
00db10
   f = fp;
00db10
   wp = buf;
00db10
   memset (buf, ' ', sizeof (buf));
00db10
+  /* See explanation above.  */
00db10
+  DIAG_PUSH_NEEDS_COMMENT;
00db10
+  DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wdiv-by-zero");
00db10
   if (ftello (fp) != 0
00db10
       || fread_unlocked (buf, buf - buf, strlen (blah), f++) != 0
00db10
       || f != fp + 1
00db10
@@ -109,6 +121,7 @@ do_test (void)
00db10
       puts ("One of fread_unlocked tests failed");
00db10
       exit (1);
00db10
     }
00db10
+  DIAG_POP_NEEDS_COMMENT;
00db10
 
00db10
   if (fread_unlocked (buf, 1, strlen (blah) - 2, fp) != strlen (blah) - 2)
00db10
     {