annotate gcc/testsuite/gcc.dg/c99-static-1.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
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 whose
kono
parents:
diff changeset
3 result is an integer constant. The use of the function simply
kono
parents:
diff changeset
4 being unevaluated is not enough. */
kono
parents:
diff changeset
5 /* Origin: Joseph Myers <jsm@polyomino.org.uk> */
kono
parents:
diff changeset
6 /* { dg-do compile } */
kono
parents:
diff changeset
7 /* { dg-options "-O2 -std=iso9899:1999 -pedantic-errors" } */
kono
parents:
diff changeset
8
kono
parents:
diff changeset
9 /* Constraint violation (trivial case, where function is used). */
kono
parents:
diff changeset
10 static void f0(void); /* { dg-error "used but never defined" } */
kono
parents:
diff changeset
11 void g0(void) { f0(); }
kono
parents:
diff changeset
12
kono
parents:
diff changeset
13 /* Constraint violation. */
kono
parents:
diff changeset
14 static void f1(void); /* { dg-error "used but never defined" } */
kono
parents:
diff changeset
15 void g1(void) { if (0) { f1(); } }
kono
parents:
diff changeset
16
kono
parents:
diff changeset
17 /* Constraint violation. */
kono
parents:
diff changeset
18 static int f2(void); /* { dg-error "used but never defined" } */
kono
parents:
diff changeset
19 void g2(void) { 0 ? f2() : 0; }
kono
parents:
diff changeset
20
kono
parents:
diff changeset
21 /* OK. */
kono
parents:
diff changeset
22 static int f3(void);
kono
parents:
diff changeset
23 void g3(void) { sizeof(f3()); }
kono
parents:
diff changeset
24
kono
parents:
diff changeset
25 /* OK (VM type, not VLA). */
kono
parents:
diff changeset
26 static int f4(void);
kono
parents:
diff changeset
27 void g4(void) { sizeof(int (*)[f4()]); }
kono
parents:
diff changeset
28
kono
parents:
diff changeset
29 /* Constraint violation (VLA). */
kono
parents:
diff changeset
30 static int f5(void); /* { dg-error "used but never defined" "VLA" } */
kono
parents:
diff changeset
31 void g5(void) { sizeof(int [0 ? f5() : 1]); }
kono
parents:
diff changeset
32
kono
parents:
diff changeset
33 /* OK (non-constant sizeof inside constant sizeof). */
kono
parents:
diff changeset
34 static int f6(void);
kono
parents:
diff changeset
35 void g6(void) { sizeof(sizeof(int [f6()])); }