Merge branch 'maint-0.4.8'
[tor.git] / scripts / maint / checkspace_tests / dubious.c
blob59c5f8e4fe42c6c5a6b635929dd3e1f301d920ff
2 // The { coming up should be on its own line.
3 int
4 foo(void) {
5 // There should be a space before (1)
6 if(1) x += 1;
8 // The following empty line is unnecessary.
13 // There should be a newline between void and bar.
14 void bar(void)
16 // too wide:
17 testing("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
20 long
21 bad_spacing()
23 // here comes a tab
24 return 2;
25 // here comes a label without space:
26 foo:
30 // Here comes a CR:
32 // Trailing space:
34 int
35 non_k_and_r(void)
37 // non-k&r
38 if (foo)
40 // double-semi
41 return 1;;
43 else
45 return 2;
49 // #else #if causes a warning.
50 #if 1
51 #else
52 #if 2
53 #else
54 #endif
55 #endif
57 // always space before a brace.
58 foo{
61 void
62 unexpected_space(void)
64 // This space gives a warning.
65 foobar (77);
68 void
69 bad_function_calls(long)
71 // These are forbidden:
72 assert(1);
73 memcmp("a","b",1);
74 strcat(foo,x);
75 strcpy(foo,y);
76 sprintf(foo,"x");
77 malloc(7);
78 free(p);
79 realloc(p);
80 strdup(s);
81 strndup(s,10);
82 calloc(a,b);