3 # Copyright © 2012 Nick Bowler
5 # Check that cdecl99 rejects a variety of invalid declarations.
7 # License WTFPL2: Do What The Fuck You Want To Public License, version 2.
8 # This is free software: you are free to do what the fuck you want to.
9 # There is NO WARRANTY, to the extent permitted by law.
11 cdecl99=./cdecl99$EXEEXT
15 if $cdecl99 -e "explain $*" >/dev/null 2>&1; then
16 printf '%s: %s not rejected\n' "$scriptname" "$*" 1>&2
25 test_decl 'long long long x'
26 test_decl 'inline int x'
27 test_decl 'restrict int x'
28 test_decl 'static auto int x'
31 test_decl 'int _Complex x'
32 test_decl 'typedef int'
33 test_decl 'int x, (void)'
34 test_decl 'int [5], (void)'
35 test_decl 'void f(...)'
36 # XXX: While these silly void-parameter declarations are "obviously" invalid, I
37 # can't actually find a statement in the specification which forbids them.
38 test_decl 'void f(void, void)'
39 test_decl 'void f(void, ...)'
40 test_decl 'void f(register void)'
41 test_decl 'void f(const void)'
42 test_decl 'void f(void const)'
43 test_decl 'void f(const)'
44 test_decl 'void f(typedef int x)'
45 test_decl 'void f(static int x)'
46 test_decl 'int f(void)[1]'
47 test_decl 'inline int (void)'
48 test_decl 'int f((x))'
49 test_decl 'int f, g((x))'
50 test_decl 'int f(void), g(...)'
51 test_decl 'int f(inline int g())'
52 test_decl 'int f(void)(void)'
53 test_decl 'int ((int))'
56 test_decl 'int a[1](void)'
57 test_decl 'int a[1nan]'
58 test_decl 'int a[99999999999999999999999999999999999999999999999999999]'