On 30.09.19 19:20, Jakub Jelinek wrote:
On Mon, Sep 30, 2019 at 07:15:59PM +0200, Andreas Tobler wrote:
Hi all,

the below patch tries to silence a warning from the FreeBSD libc. This
warning currently makes all the test cases fail where we make use of the
tmpnam() function.

---
/usr/local/bin/ld: /tmp//ccBQaYlC.o: in function `main':
printf-2.c:(.text+0x8d): warning: warning: tmpnam() possibly used unsafely;
consider using mkstemp()
---

With this patch, all the *printf* test cases in the gcc part are now
passing.

What dou you think?

Wouldn't it be better to just dg-prune-output it in the 3 affected tests,
perhaps only for affected targets?

Thanks for the feedback!

This way?

TIA,
Andreas


2019-09-30  Andreas Tobler  <andre...@gcc.gnu.org>

        * gcc.c-torture/execute/fprintf-2.c: Silence a FreeBSD libc warning.
        * gcc.c-torture/execute/printf-2.c: Likewise.
        * gcc.c-torture/execute/user-printf.c: Likewise.


Index: fprintf-2.c
===================================================================
--- fprintf-2.c (revision 276292)
+++ fprintf-2.c (working copy)
@@ -1,7 +1,8 @@
 /* Verify that calls to fprintf don't get eliminated even if their
    result on success can be computed at compile time (they can fail).
    The calls can still be transformed into those of other functions.
-   { dg-skip-if "requires io" { freestanding } } */
+   { dg-skip-if "requires io" { freestanding } }
+   { dg-prune-output "(^|\n)(\[^\n\])*warning: warning: \[^\n\]* possibly used 
unsafely; consider using \[^\n\]*\n" } */ 
 
 #include <stdio.h>
 #include <stdlib.h>
Index: printf-2.c
===================================================================
--- printf-2.c  (revision 276292)
+++ printf-2.c  (working copy)
@@ -2,7 +2,8 @@
    result on success can be computed at compile time (they can fail).
    The calls can still be transformed into those of other functions.
    { dg-require-effective-target unwrapped }
-   { dg-skip-if "requires io" { freestanding } } */
+   { dg-skip-if "requires io" { freestanding } }
+   { dg-prune-output "(^|\n)(\[^\n\])*warning: warning: \[^\n\]* possibly used 
unsafely; consider using \[^\n\]*\n" } */
 
 #include <stdio.h>
 #include <stdlib.h>
Index: user-printf.c
===================================================================
--- user-printf.c       (revision 276292)
+++ user-printf.c       (working copy)
@@ -2,7 +2,8 @@
    don't get eliminated even if their result on success can be computed at
    compile time (they can fail).
    { dg-require-effective-target unwrapped }
-   { dg-skip-if "requires io" { freestanding } } */
+   { dg-skip-if "requires io" { freestanding } }
+   { dg-prune-output "(^|\n)(\[^\n\])*warning: warning: \[^\n\]* possibly used 
unsafely; consider using \[^\n\]*\n" } */
 
 #include <stdarg.h>
 #include <stdio.h>

Reply via email to