diff gcc/testsuite/gcc.dg/redecl-4.c @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children 1830386684a0
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gcc/testsuite/gcc.dg/redecl-4.c	Fri Oct 27 22:46:09 2017 +0900
@@ -0,0 +1,29 @@
+/* Test for multiple declarations and composite types, with built-in
+   functions.  */
+/* Origin: Joseph Myers <jsm@polyomino.org.uk> */
+/* { dg-do compile } */
+/* { dg-options "-std=c89 -Wformat -g" } */
+
+void
+f (void)
+{
+  int printf;
+  int strcmp;
+  {
+    int printf (const char *, ...);
+    int strcmp ();
+    /* Should get format warnings even though the built-in declaration
+       isn't "visible".  */
+    printf (
+	    "%s", 1); /* { dg-warning "8:format" } */
+    /* The type of strcmp here should have no prototype.  */
+    if (0)
+      strcmp (1);
+    /* Likewise, implicitly declared memcmp.  */
+    if (0)
+      memcmp (1);
+  }
+}
+
+/* Should still diagnose incompatible prototype for strcmp.  */
+int strcmp (void); /* { dg-error "conflict" } */