commit d7ab9b5afef9e41134bab4f6fc5448204702c2ee parent 91cc5b95f08b79cefba27608f1ad94874ba34064 Author: Roberto E. Vargas Caballero <k0ga@shike2.com> Date: Fri, 22 Jan 2016 18:38:25 +0100 Do not emit prototypes This is a waste of time. We can get the same benefits if we indicate elipsis parameters in the call expression. Diffstat:
53 files changed, 79 insertions(+), 151 deletions(-)
diff --git a/cc1/code.c b/cc1/code.c @@ -228,7 +228,6 @@ emitletter(Type *tp) putchar(tp->letter); switch (tp->op) { case ARY: - case FTN: case STRUCT: case UNION: printf("%u", tp->id); @@ -272,15 +271,6 @@ emittype(Type *tp) emit(ODECL, *sp); break; case FTN: - emitletter(tp); - putchar('\t'); - emitletter(tp->type); - n = tp->n.elem; - for (vp = tp->p.pars; n-- > 0; ++vp) { - putchar('\t'); - emitletter(*vp); - } - putchar('\n'); return; default: abort(); diff --git a/cc1/decl.c b/cc1/decl.c @@ -847,7 +847,6 @@ decl(void) * against GLOBALCTX+1 */ if (curctx != GLOBALCTX+1 || yytoken == ';') { - emit(ODECL, sym); /* * avoid non used warnings in prototypes */ diff --git a/cc1/tests/test001.c b/cc1/tests/test001.c @@ -3,10 +3,7 @@ name: TEST001 description: Basic hello world test error: output: -F3 I P E -X4 F3 "printf -F5 I -G6 F5 "main +G6 F "main { \ V8 K #13 diff --git a/cc1/tests/test002.c b/cc1/tests/test002.c @@ -4,8 +4,7 @@ description: Test forward references before definition of types error: output: G4 P "x -F7 I -G8 F7 "main +G8 F "main { \ S2 S diff --git a/cc1/tests/test003.c b/cc1/tests/test003.c @@ -3,18 +3,17 @@ name: TEST003 description: Select function to call inside ternary operator error: output: -F1 I -G2 F1 "foo +G2 F "foo { \ r #I2A } -G3 F1 "bar +G3 F "bar { \ r #I18 } -G4 F1 "main +G4 F "main { \ r G2 cI diff --git a/cc1/tests/test004.c b/cc1/tests/test004.c @@ -3,8 +3,7 @@ name: TEST004 description: Test integer operations error: output: -F1 I E -G2 F1 "main +G2 F "main { \ A3 I "x diff --git a/cc1/tests/test005.c b/cc1/tests/test005.c @@ -3,8 +3,7 @@ name: TEST005 description: Test unary integer operations error: output: -F1 I E -G2 F1 "main +G2 F "main { \ A3 I "x diff --git a/cc1/tests/test006.c b/cc1/tests/test006.c @@ -7,8 +7,7 @@ test006.c:8: warning: conditional expression is constant test006.c:11: warning: conditional expression is constant output: G1 K "c -F2 I E -G3 F2 "main +G3 F "main { \ j L4 #I0 diff --git a/cc1/tests/test007.c b/cc1/tests/test007.c @@ -3,8 +3,7 @@ name: TEST007 description: basic while test error: output: -F1 I E -G2 F1 "main +G2 F "main { \ A3 I "x diff --git a/cc1/tests/test008.c b/cc1/tests/test008.c @@ -3,8 +3,7 @@ name: TEST008 description: Basic do while loop error: output: -F1 I E -G2 F1 "main +G2 F "main { \ A3 I "x diff --git a/cc1/tests/test009.c b/cc1/tests/test009.c @@ -3,8 +3,7 @@ name: TEST009 description: Basic test for loops error: output: -F1 I E -G2 F1 "main +G2 F "main { \ A3 I "x diff --git a/cc1/tests/test010.c b/cc1/tests/test010.c @@ -6,8 +6,7 @@ test010.c:9: warning: conditional expression is constant test010.c:11: warning: conditional expression is constant test010.c:31: warning: conditional expression is constant output: -F1 I E -G2 F1 "main +G2 F "main { \ A3 I "x diff --git a/cc1/tests/test011.c b/cc1/tests/test011.c @@ -5,8 +5,7 @@ error: test011.c:14: warning: 'foo' defined but not used test011.c:14: warning: 'start' defined but not used output: -F1 I E -G2 F1 "main +G2 F "main { \ L3 diff --git a/cc1/tests/test012.c b/cc1/tests/test012.c @@ -4,8 +4,7 @@ description: Basic switch test error: test012.c:39: warning: 'foo' defined but not used output: -F1 I E -G2 F1 "main +G2 F "main { \ A3 I "x diff --git a/cc1/tests/test013.c b/cc1/tests/test013.c @@ -17,8 +17,7 @@ G8 Q "h G9 O "i G10 I "j G11 N "k -F12 I -G13 F12 "main +G13 F "main { \ G1 G2 gI :I diff --git a/cc1/tests/test014.c b/cc1/tests/test014.c @@ -22,8 +22,7 @@ output: G1 I "a Y2 K "b X3 I "c -F5 I -G6 F5 "func1 +G6 F "func1 { \ A7 I "h @@ -33,14 +32,13 @@ X10 I "k T11 Z "a r #I0 } -F13 0 I -G14 F13 "func2 +G14 F "func2 { R12 I "par \ A15 I "par } -T17 F13 "func3 +T17 F "func3 { R16 I "par \ diff --git a/cc1/tests/test015.c b/cc1/tests/test015.c @@ -2,7 +2,7 @@ name: TEST015 description: Stress namespace mechanism error: -test015.c:53: error: label 's' already defined +test015.c:52: error: label 's' already defined output: S8 s2 M9 I "s @@ -12,8 +12,7 @@ M10 S8 "s1 S2 s M11 S5 "s G12 S2 "s2 -F13 I -G14 F13 "main +G14 F "main { \ j L15 diff --git a/cc1/tests/test016.c b/cc1/tests/test016.c @@ -6,8 +6,7 @@ test016.c:43: error: redefinition of 'func2' test016.c:47: error: incompatible types when assigning output: G1 I "g -F2 I -G3 F2 "func1 +G3 F "func1 { \ A4 I "x @@ -26,7 +25,7 @@ L7 L8 r #I0 } -G9 F2 "func2 +G9 F "func2 { \ A10 I "x diff --git a/cc1/tests/test017.c b/cc1/tests/test017.c @@ -3,8 +3,7 @@ name: TEST017 description: Basic test about pointers and structs error: output: -F9 I E -G10 F9 "main +G10 F "main { \ S2 s1 diff --git a/cc1/tests/test018.c b/cc1/tests/test018.c @@ -3,8 +3,7 @@ name: TEST018 description: Basic test for arrays error: output: -F1 I E -G2 F1 "main +G2 F "main { \ V3 K #4 diff --git a/cc1/tests/test019.c b/cc1/tests/test019.c @@ -6,8 +6,7 @@ error: test019.c:13: warning: division by 0 test019.c:14: warning: division by 0 output: -F1 I -G2 F1 "main +G2 F "main { \ A3 I "i diff --git a/cc1/tests/test020.c b/cc1/tests/test020.c @@ -3,11 +3,10 @@ name: TEST020 description: Basic test for integer algebraic identities error: +test020.c:81: warning: division by 0 test020.c:82: warning: division by 0 -test020.c:83: warning: division by 0 output: -F1 I -G2 F1 "main +G2 F "main { \ A3 I "i diff --git a/cc1/tests/test021.c b/cc1/tests/test021.c @@ -5,8 +5,7 @@ description: Basic test for char constants comments: This test is done for z80 implementation error: output: -F1 I -G2 F1 "main +G2 F "main { \ A3 K "uc diff --git a/cc1/tests/test022.c b/cc1/tests/test022.c @@ -5,8 +5,7 @@ description: Basic test for int constants comments: This test is done for z80 data types error: output: -F1 I -G2 F1 "main +G2 F "main { \ A3 I "i diff --git a/cc1/tests/test023.c b/cc1/tests/test023.c @@ -5,8 +5,7 @@ description: Basic test for long constants comments: This test is done for z80 data types error: output: -F1 I -G2 F1 "main +G2 F "main { \ A3 W "i diff --git a/cc1/tests/test024.c b/cc1/tests/test024.c @@ -5,8 +5,7 @@ description: Basic test for long long constants comments: This test is done for z80 data types error: output: -F1 I -G2 F1 "main +G2 F "main { \ A3 Q "i diff --git a/cc1/tests/test026.c b/cc1/tests/test026.c @@ -4,8 +4,7 @@ name: TEST026 descritpion: Test of predefined cpp macros error: output: -F2 I -G3 F2 "main +G3 F "main { \ A4 I "y @@ -17,7 +16,7 @@ Y7 V8 " #K00 ) A6 Y7 'P :P - A4 #I25 :I + A4 #I24 :I A4 #I1 :I A4 #I1 :I A4 #I1 :I diff --git a/cc1/tests/test027.c b/cc1/tests/test027.c @@ -4,8 +4,7 @@ name: TEST027 description: Test of cpp stringizer error: output: -F2 I -G3 F2 "main +G3 F "main { \ A5 P "p diff --git a/cc1/tests/test028.c b/cc1/tests/test028.c @@ -4,8 +4,7 @@ name: TEST028 description: Test of reinterpretation in define error: output: -F5 P -G6 F5 "foo +G6 F "foo { \ V8 K #3 diff --git a/cc1/tests/test029.c b/cc1/tests/test029.c @@ -6,11 +6,10 @@ comments: f(2) will expand to 2*g, which will expand to 2*f, and in this moment f will not be expanded because the macro definition is a function alike macro, and in this case there is no arguments. error: -test029.c:35: error: redefinition of 'f1' -test029.c:36: error: 'f' undeclared +test029.c:34: error: redefinition of 'f1' +test029.c:35: error: 'f' undeclared output: -F2 I -G3 F2 "f1 +G3 F "f1 { \ A4 I "f diff --git a/cc1/tests/test030.c b/cc1/tests/test030.c @@ -4,8 +4,7 @@ name: TEST030 description: Basic test for vararg functions error: output: -F13 I S2 P I E -G14 F13 "f1 +G14 F "f1 { S2 foo M3 I "i @@ -22,8 +21,7 @@ A12 I "n L15 r A11 @S2 M4 .I A12 +I } -F16 I -G17 F16 "main +G17 F "main { \ A18 S2 "f diff --git a/cc1/tests/test032.c b/cc1/tests/test032.c @@ -4,8 +4,7 @@ name: TEST032 description: test special characters @ and $ in macro definitions error: output: -F4 I -G5 F4 "main +G5 F "main { \ V9 K #44 diff --git a/cc1/tests/test034.c b/cc1/tests/test034.c @@ -3,19 +3,17 @@ name: TEST034 description: Basic test for incomplete structures error: -test034.c:46: error: declared variable 'bar' of incomplete type -test034.c:46: error: redeclaration of 'bar' +test034.c:44: error: declared variable 'bar' of incomplete type +test034.c:44: error: redeclaration of 'bar' output: X3 S2 "x -F4 I E -X5 F4 "foo -G6 F4 "main +G6 F "main { \ X7 S2 "x r X7 'P #P0 !I } -G5 F4 "foo +G5 F "foo { \ X3 M9 .I #I0 :I diff --git a/cc1/tests/test035.c b/cc1/tests/test035.c @@ -4,8 +4,7 @@ name: TEST035 description: Basic test for enumerations error: output: -F6 I E -G7 F6 "main +G7 F "main { \ A8 I "e diff --git a/cc1/tests/test036.c b/cc1/tests/test036.c @@ -3,10 +3,9 @@ name: TEST036 description: Duff's device error: -test036.c:61: warning: type defaults to 'int' in declaration +test036.c:60: warning: type defaults to 'int' in declaration output: -F4 I E -G5 F4 "send +G5 F "send { R1 P "to R2 P "from diff --git a/cc1/tests/test037.c b/cc1/tests/test037.c @@ -4,12 +4,11 @@ name: TEST037 description: Basic sizeof test comments: This test is based in z80 sizes error: -test037.c:30: warning: conditional expression is constant -test037.c:32: warning: conditional expression is constant -test037.c:34: warning: conditional expression is constant +test037.c:29: warning: conditional expression is constant +test037.c:31: warning: conditional expression is constant +test037.c:33: warning: conditional expression is constant output: -F1 I E -G2 F1 "main +G2 F "main { \ j L3 #I0 diff --git a/cc1/tests/test038.c b/cc1/tests/test038.c @@ -3,21 +3,18 @@ name: TEST038 description: Basic test for tentative definitions error: -test038.c:46: error: redeclaration of 'x' +test038.c:43: error: redeclaration of 'x' output: G1 I "x ( #I0 ) -F2 I E -X3 F2 "main -F4 P E -G5 F4 "foo +G5 F "foo { \ r X3 'P } -G3 F2 "main +G3 F "main { \ G1 #I0 :I diff --git a/cc1/tests/test039.c b/cc1/tests/test039.c @@ -5,8 +5,7 @@ description: Test of integer constants comments: This test is done for z80 sizes error: output: -F1 I -G2 F1 "main +G2 F "main { \ A3 I "i diff --git a/cc1/tests/test040.c b/cc1/tests/test040.c @@ -3,8 +3,7 @@ name: TEST040 description: Test for bug parsing typenames in struct definition error: output: -F8 I -G9 F8 "main +G9 F "main { \ S2 List diff --git a/cc1/tests/test041.c b/cc1/tests/test041.c @@ -2,15 +2,14 @@ name: TEST041 description: Test for bug parsing ternary operators error: -test041.c:49: error: type mismatch in conditional expression -test041.c:49: error: incompatible types when assigning -test041.c:50: error: used struct/union type value where scalar is required -test041.c:51: warning: 'i' defined but not used -test041.c:51: warning: 'foo' defined but not used -test041.c:51: warning: 's' defined but not used +test041.c:48: error: type mismatch in conditional expression +test041.c:48: error: incompatible types when assigning +test041.c:49: error: used struct/union type value where scalar is required +test041.c:50: warning: 'i' defined but not used +test041.c:50: warning: 'foo' defined but not used +test041.c:50: warning: 's' defined but not used output: -F1 I -G2 F1 "main +G2 F "main { \ A3 I "i diff --git a/cc1/tests/test042.c b/cc1/tests/test042.c @@ -2,14 +2,11 @@ name: TEST042 description: Test for bug parsing ternary operators error: -test042.c:20: error: bad type convertion requested +test042.c:17: error: bad type convertion requested output: -F1 I -G2 F1 "main +G2 F "main { \ -F3 0 -X4 F3 "f */ int diff --git a/cc1/tests/test043.c b/cc1/tests/test043.c @@ -3,16 +3,14 @@ name: TEST043 description: Test for double typedef (taken from plan9 kernel) error: output: -F4 0 S2 Clock0link M6 P "clock M8 P "link G9 S2 "cl0 -F10 I -G11 F10 "main +G11 F "main { \ - G9 M6 .P @F4 c0 + G9 M6 .P @F c0 r #I0 } */ diff --git a/cc1/tests/test045.c b/cc1/tests/test045.c @@ -7,8 +7,7 @@ G1 I "x ( #I5 ) -F2 I E -G3 F2 "main +G3 F "main { \ j L4 G1 #I5 =I diff --git a/cc1/tests/test046.c b/cc1/tests/test046.c @@ -10,8 +10,7 @@ G2 V1 "x #I2 #I3 ) -F3 I E -G4 F3 "main +G4 F "main { \ j L5 G2 #I1 =I diff --git a/cc1/tests/test047.c b/cc1/tests/test047.c @@ -13,8 +13,7 @@ G6 S2 "x #I2 #I3 ) -F7 I E -G8 F7 "main +G8 F "main { \ j L9 G6 M3 .I #I1 =I diff --git a/cc1/tests/test048.c b/cc1/tests/test048.c @@ -12,8 +12,7 @@ G6 V5 "x #I1 #I2 ) -F7 I E -G8 F7 "main +G8 F "main { \ j L9 G6 M3 .I #I1 =I diff --git a/cc1/tests/test049.c b/cc1/tests/test049.c @@ -11,8 +11,7 @@ G3 P "p ( G1 'P ) -F4 I E -G5 F4 "main +G5 F "main { \ j L6 G3 @I #I5 =I diff --git a/cc1/tests/test051.c b/cc1/tests/test051.c @@ -10,8 +10,7 @@ G2 V1 "arr #I1 #I2 ) -F3 I E -G4 F3 "main +G4 F "main { \ j L5 G2 #I0 =I diff --git a/cc1/tests/test052.c b/cc1/tests/test052.c @@ -14,8 +14,7 @@ G6 V5 "arr #I3 #I4 ) -F7 I E -G8 F7 "main +G8 F "main { \ j L9 G6 M3 .I #I1 =I diff --git a/cc1/tests/test053.c b/cc1/tests/test053.c @@ -11,8 +11,7 @@ G5 S2 "s #I1 #I2 ) -F6 I E -G7 F6 "main +G7 F "main { \ j L8 G5 M3 .I #I1 =I diff --git a/cc1/tests/test056.c b/cc1/tests/test056.c @@ -24,8 +24,7 @@ V10 K #0 G11 V10 "m ( ) -F12 I -G13 F12 "main +G13 F "main { \ r G9 M7 .V6 'P #P2 +P @K gI gN #N0 !I diff --git a/cc1/tests/test057.c b/cc1/tests/test057.c @@ -24,8 +24,7 @@ G4 V2 "arr2 #I1 #I2 ) -F5 I -G6 F5 "main +G6 F "main { \ r G3 'P #P6 +P #P4 +P @I G4 'P #P6 +P #P6 +P @I !I diff --git a/cc1/tests/test058.c b/cc1/tests/test058.c @@ -39,8 +39,7 @@ G4 V3 "arr #I0 #I0 ) -F5 I -G6 F5 "main +G6 F "main { \ r G4 'P #PA +P #P8 +P @I G4 'P #P1E +P #PA +P #P8 +P @I !I