diff options
author | Jacques-Henri Jourdan <jacques-henri.jourdan@inria.fr> | 2015-11-01 22:32:23 +0100 |
---|---|---|
committer | Jacques-Henri Jourdan <jacques-henri.jourdan@inria.fr> | 2015-11-01 22:32:23 +0100 |
commit | b960c83725d7e185ac5c6e3c0d6043c7dcd2f556 (patch) | |
tree | e4567cd598d32114a440102397c41731f5a65412 /test/regression | |
parent | e18d267e6912e18462472687abc014a3d04b9a37 (diff) | |
download | compcert-b960c83725d7e185ac5c6e3c0d6043c7dcd2f556.tar.gz compcert-b960c83725d7e185ac5c6e3c0d6043c7dcd2f556.zip |
Better handling of old-style K&R function declarations:
- Added a Cabs.PROTO_OLD constructor to Cabs.decl_type
- Refactored the Parser.vy and pre_parser.mly grammars
- Rewritten the conversion of old function definitions to new-style
Diffstat (limited to 'test/regression')
-rw-r--r-- | test/regression/Results/parsing | 10 | ||||
-rw-r--r-- | test/regression/parsing.c | 62 |
2 files changed, 69 insertions, 3 deletions
diff --git a/test/regression/Results/parsing b/test/regression/Results/parsing index e69de29b..94923756 100644 --- a/test/regression/Results/parsing +++ b/test/regression/Results/parsing @@ -0,0 +1,10 @@ +2 +3 +4 +5 4.500000 9.000000 +23 +3 +12 13 14 +4 +12 13 14 +4 diff --git a/test/regression/parsing.c b/test/regression/parsing.c index 8687d6aa..ba093225 100644 --- a/test/regression/parsing.c +++ b/test/regression/parsing.c @@ -42,9 +42,9 @@ struct S { unsigned T:3; const T:3; }; - +struct S stru; void i() { - struct S s; + struct S s = stru; s.T = -1; if(s.T < 0) printf("ERROR i\n"); } @@ -106,16 +106,72 @@ int j() { T T; } -int k() { +T k() { { T T; } T t; for(T T; ; ); T u; } +void krf(a) + int a; +{ + printf("%d\n", a); +} + +void krg(); +void krg(int a) +{ + printf("%d\n", a); +} + +void krh(int); +void krh(b) + T b; +{ + printf("%d\n", b); +} + +void kri(); +void kri(b, c) + int b; + double c; +{ + printf("%d %f %f\n", b, c, 2*c); +} + +void krj(); +void krj(a, aa) + int a[]; + void aa(int); +{ + printf("%d\n", *a); + aa(3); +} + +void aa(int x) { + printf("%d\n", x); +} + +void (*krk(a, b, c))(int) + int b, a, c; +{ + printf("%d %d %d\n", a, b, c); + return aa; +} + int main () { f(g); i(); m(); + + krf(2); + krg(3); + krh(4); + kri(5.5, 4.5); + int x = 23; + krj(&x, aa); + krk(12, 13, 14)(4); + (*krk(12, 13, 14))(4); return 0; } |