Postfix3.3.1
全て データ構造 ファイル 関数 変数 型定義 マクロ定義
gccw.c
[詳解]
1  /*
2  * This is is a regression test for all the things that gcc is meant to warn
3  * about.
4  *
5  * gcc version 3 breaks several tests:
6  *
7  * -W does not report missing return value
8  *
9  * -Wunused does not report unused parameter
10  */
11 
12 #include <stdio.h>
13 #include <setjmp.h>
14 
15 jmp_buf jbuf;
16 
17  /* -Wmissing-prototypes: no previous prototype for 'test1' */
18  /* -Wimplicit: return type defaults to `int' */
19 test1(void)
20 {
21  /* -Wunused: unused variable `foo' */
22  int foo;
23 
24  /* -Wparentheses: suggest parentheses around && within || */
25  printf("%d\n", 1 && 2 || 3 && 4);
26  /* -W: statement with no effect */
27  0;
28  /* BROKEN in gcc 3 */
29  /* -W: control reaches end of non-void function */
30 }
31 
32 
33  /* -W??????: unused parameter `foo' */
34 void test2(int foo)
35 {
36  enum {
37  a = 10, b = 15} moe;
38  int bar;
39 
40  /* -Wuninitialized: 'bar' might be used uninitialized in this function */
41  /* -Wformat: format argument is not a pointer (arg 2) */
42  printf("%s\n", bar);
43  /* -Wformat: too few arguments for format */
44  printf("%s%s\n", "bar");
45  /* -Wformat: too many arguments for format */
46  printf("%s\n", "bar", "bar");
47 
48  /* -Wswitch: enumeration value `b' not handled in switch */
49  switch (moe) {
50  case a:
51  return;
52  }
53 }
54 
55  /* -Wstrict-prototypes: function declaration isn't a prototype */
56 void test3()
57 {
58 }
void test2(int foo)
Definition: gccw.c:34
test1(void)
Definition: gccw.c:19
jmp_buf jbuf
Definition: gccw.c:15
void test3()
Definition: gccw.c:56