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
24 test_decl 'inline int x'
25 test_decl 'restrict int x'
26 test_decl 'static auto int x'
28 test_decl 'int _Complex x'
29 test_decl 'typedef int'
30 test_decl 'void f(...)'
31 # XXX: While these silly void-parameter declarations are "obviously" invalid, I
32 # can't actually find a statement in the specification which forbids them.
33 test_decl 'void f(void, void)'
34 test_decl 'void f(register void)'
35 test_decl 'void f(const void)'
36 test_decl 'void f(const)'
37 test_decl 'void f(typedef int x)'
38 test_decl 'void f(static int x)'
39 test_decl 'int f(void)[1]'
42 test_decl 'int a[1](void)'