annotate gcc/testsuite/gcc.dg/c90-static-1.c @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* It is a constraint violation for a static function to be declared
kono
parents:
diff changeset
2 but not defined if it is used except in a sizeof expression. The
kono
parents:
diff changeset
3 use of the function simply being unevaluated is not enough. */
kono
parents:
diff changeset
4 /* Origin: Joseph Myers <jsm@polyomino.org.uk> */
kono
parents:
diff changeset
5 /* { dg-do compile } */
kono
parents:
diff changeset
6 /* { dg-options "-O2 -std=iso9899:1990 -pedantic-errors" } */
kono
parents:
diff changeset
7
kono
parents:
diff changeset
8 /* Constraint violation (trivial case, where function is used). */
kono
parents:
diff changeset
9 static void f0(void); /* { dg-error "used but never defined" } */
kono
parents:
diff changeset
10 void g0(void) { f0(); }
kono
parents:
diff changeset
11
kono
parents:
diff changeset
12 /* Constraint violation. */
kono
parents:
diff changeset
13 static void f1(void); /* { dg-error "used but never defined" } */
kono
parents:
diff changeset
14 void g1(void) { if (0) { f1(); } }
kono
parents:
diff changeset
15
kono
parents:
diff changeset
16 /* Constraint violation. */
kono
parents:
diff changeset
17 static int f2(void); /* { dg-error "used but never defined" } */
kono
parents:
diff changeset
18 void g2(void) { 0 ? f2() : 0; }
kono
parents:
diff changeset
19
kono
parents:
diff changeset
20 /* OK. */
kono
parents:
diff changeset
21 static int f3(void);
kono
parents:
diff changeset
22 void g3(void) { sizeof(f3()); }