5 extension_loaded("psi") or die("skip - need ext/psi");
11 function validate($check, $psi) {
12 if ($check !== psi_validate_string($psi)) {
13 printf("Assertion failed!\nExpected: %s\n\n%s\n\n",
14 $check ? "true" : "false", $psi);
18 validate(false, "typedef void foo;");
19 validate(true, "typedef void *bar;");
20 validate(false, "typedef long int;");
21 validate(true, "typedef long foo;");
22 validate(true, "typedef struct foo bar;");
23 validate(true, "typedef struct {int a;} foo;");
24 validate(false, "struct a; \ntypedef struct a a_t;");
25 validate(true, "struct a::(8,8); \ntypedef struct a a_t;");
26 validate(true, "typedef struct a a_t; \nstruct a::(8,8);");
70 validate(true, "typedef int foo(int bar);");
71 validate(true, "typedef int (foo)(int bar);");
72 validate(true, "typedef int (*foo)(int bar);");
73 validate(true, "typedef int *(*foo)(int bar);");
74 validate(false, "typedef int *(*foo)(int *(*bar)(int baz));");
75 validate(true, "typedef int *(*bar)(int baz); \ntypedef int *(*foo)(bar bar);");
76 validate(true, "typedef int bar(int baz); \ntypedef int *(*foo)(bar bar);");
83 Warning: PSI syntax error: Unexpected token ';' at pos 17 in %s on line 1
85 Warning: PSI syntax error: Unexpected token 'int' at pos 14 in %s on line 1
87 Warning: Cannot compute size of empty struct 'a' in %s on line 1
89 Warning: Unknown variable 'X' in numeric expression in %s on line 4
91 Warning: PSI syntax error: Unexpected token '(' at pos 26 in %s on line 1
93 Warning: PSI syntax error: Unexpected token '(' at pos 32 in %s on line 1