shithub: scc

Download patch

ref: d7ab9b5afef9e41134bab4f6fc5448204702c2ee
parent: 91cc5b95f08b79cefba27608f1ad94874ba34064
author: Roberto E. Vargas Caballero <[email protected]>
date: Fri Jan 22 13:38:25 EST 2016

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.

--- a/cc1/code.c
+++ b/cc1/code.c
@@ -228,7 +228,6 @@
 	putchar(tp->letter);
 	switch (tp->op) {
 	case ARY:
-	case FTN:
 	case STRUCT:
 	case UNION:
 		printf("%u", tp->id);
@@ -272,15 +271,6 @@
 			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();
--- a/cc1/decl.c
+++ b/cc1/decl.c
@@ -847,7 +847,6 @@
 	 * against GLOBALCTX+1
 	 */
 	if (curctx != GLOBALCTX+1 || yytoken == ';') {
-		emit(ODECL, sym);
 		/*
 		 * avoid non used warnings in prototypes
 		 */
--- a/cc1/tests/test001.c
+++ b/cc1/tests/test001.c
@@ -3,10 +3,7 @@
 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
--- a/cc1/tests/test002.c
+++ b/cc1/tests/test002.c
@@ -4,8 +4,7 @@
 error:
 output:
 G4	P	"x
-F7	I
-G8	F7	"main
+G8	F	"main
 {
 \
 S2	S
--- a/cc1/tests/test003.c
+++ b/cc1/tests/test003.c
@@ -3,18 +3,17 @@
 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
--- a/cc1/tests/test004.c
+++ b/cc1/tests/test004.c
@@ -3,8 +3,7 @@
 description: Test integer operations
 error:
 output:
-F1	I	E
-G2	F1	"main
+G2	F	"main
 {
 \
 A3	I	"x
--- a/cc1/tests/test005.c
+++ b/cc1/tests/test005.c
@@ -3,8 +3,7 @@
 description: Test unary integer operations
 error:
 output:
-F1	I	E
-G2	F1	"main
+G2	F	"main
 {
 \
 A3	I	"x
--- a/cc1/tests/test006.c
+++ b/cc1/tests/test006.c
@@ -7,8 +7,7 @@
 test006.c:11: warning: conditional expression is constant
 output:
 G1	K	"c
-F2	I	E
-G3	F2	"main
+G3	F	"main
 {
 \
 	j	L4	#I0
--- a/cc1/tests/test007.c
+++ b/cc1/tests/test007.c
@@ -3,8 +3,7 @@
 description: basic while test
 error:
 output:
-F1	I	E
-G2	F1	"main
+G2	F	"main
 {
 \
 A3	I	"x
--- a/cc1/tests/test008.c
+++ b/cc1/tests/test008.c
@@ -3,8 +3,7 @@
 description: Basic do while loop
 error:
 output:
-F1	I	E
-G2	F1	"main
+G2	F	"main
 {
 \
 A3	I	"x
--- a/cc1/tests/test009.c
+++ b/cc1/tests/test009.c
@@ -3,8 +3,7 @@
 description: Basic test for loops
 error:
 output:
-F1	I	E
-G2	F1	"main
+G2	F	"main
 {
 \
 A3	I	"x
--- a/cc1/tests/test010.c
+++ b/cc1/tests/test010.c
@@ -6,8 +6,7 @@
 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
--- a/cc1/tests/test011.c
+++ b/cc1/tests/test011.c
@@ -5,8 +5,7 @@
 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
--- a/cc1/tests/test012.c
+++ b/cc1/tests/test012.c
@@ -4,8 +4,7 @@
 error:
 test012.c:39: warning: 'foo' defined but not used
 output:
-F1	I	E
-G2	F1	"main
+G2	F	"main
 {
 \
 A3	I	"x
--- a/cc1/tests/test013.c
+++ b/cc1/tests/test013.c
@@ -17,8 +17,7 @@
 G9	O	"i
 G10	I	"j
 G11	N	"k
-F12	I
-G13	F12	"main
+G13	F	"main
 {
 \
 	G1	G2	gI	:I
--- a/cc1/tests/test014.c
+++ b/cc1/tests/test014.c
@@ -22,8 +22,7 @@
 G1	I	"a
 Y2	K	"b
 X3	I	"c
-F5	I
-G6	F5	"func1
+G6	F	"func1
 {
 \
 A7	I	"h
@@ -33,14 +32,13 @@
 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
 \
--- 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 @@
 S2	s
 M11	S5	"s
 G12	S2	"s2
-F13	I
-G14	F13	"main
+G14	F	"main
 {
 \
 	j	L15
--- a/cc1/tests/test016.c
+++ b/cc1/tests/test016.c
@@ -6,8 +6,7 @@
 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 @@
 L8
 	r	#I0
 }
-G9	F2	"func2
+G9	F	"func2
 {
 \
 A10	I	"x
--- a/cc1/tests/test017.c
+++ b/cc1/tests/test017.c
@@ -3,8 +3,7 @@
 description: Basic test about pointers and structs
 error:
 output:
-F9	I	E
-G10	F9	"main
+G10	F	"main
 {
 \
 S2	s1
--- a/cc1/tests/test018.c
+++ b/cc1/tests/test018.c
@@ -3,8 +3,7 @@
 description: Basic test for arrays
 error:
 output:
-F1	I	E
-G2	F1	"main
+G2	F	"main
 {
 \
 V3	K	#4
--- a/cc1/tests/test019.c
+++ b/cc1/tests/test019.c
@@ -6,8 +6,7 @@
 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
--- 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
--- a/cc1/tests/test021.c
+++ b/cc1/tests/test021.c
@@ -5,8 +5,7 @@
 comments: This test is done for z80 implementation
 error:
 output:
-F1	I
-G2	F1	"main
+G2	F	"main
 {
 \
 A3	K	"uc
--- a/cc1/tests/test022.c
+++ b/cc1/tests/test022.c
@@ -5,8 +5,7 @@
 comments: This test is done for z80 data types
 error:
 output:
-F1	I
-G2	F1	"main
+G2	F	"main
 {
 \
 A3	I	"i
--- a/cc1/tests/test023.c
+++ b/cc1/tests/test023.c
@@ -5,8 +5,7 @@
 comments: This test is done for z80 data types
 error:
 output:
-F1	I
-G2	F1	"main
+G2	F	"main
 {
 \
 A3	W	"i
--- a/cc1/tests/test024.c
+++ b/cc1/tests/test024.c
@@ -5,8 +5,7 @@
 comments: This test is done for z80 data types
 error:
 output:
-F1	I
-G2	F1	"main
+G2	F	"main
 {
 \
 A3	Q	"i
--- a/cc1/tests/test026.c
+++ b/cc1/tests/test026.c
@@ -4,8 +4,7 @@
 descritpion: Test of predefined cpp macros
 error:
 output:
-F2	I
-G3	F2	"main
+G3	F	"main
 {
 \
 A4	I	"y
@@ -17,7 +16,7 @@
 	#K00
 )
 	A6	Y7	'P	:P
-	A4	#I25	:I
+	A4	#I24	:I
 	A4	#I1	:I
 	A4	#I1	:I
 	A4	#I1	:I
--- a/cc1/tests/test027.c
+++ b/cc1/tests/test027.c
@@ -4,8 +4,7 @@
 description: Test of cpp stringizer
 error:
 output:
-F2	I
-G3	F2	"main
+G3	F	"main
 {
 \
 A5	P	"p
--- a/cc1/tests/test028.c
+++ b/cc1/tests/test028.c
@@ -4,8 +4,7 @@
 description: Test of reinterpretation in define
 error:
 output:
-F5	P
-G6	F5	"foo
+G6	F	"foo
 {
 \
 V8	K	#3
--- a/cc1/tests/test029.c
+++ b/cc1/tests/test029.c
@@ -6,11 +6,10 @@
           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
--- a/cc1/tests/test030.c
+++ b/cc1/tests/test030.c
@@ -4,8 +4,7 @@
 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 @@
 L15
 	r	A11	@S2	M4	.I	A12	+I
 }
-F16	I
-G17	F16	"main
+G17	F	"main
 {
 \
 A18	S2	"f
--- a/cc1/tests/test032.c
+++ b/cc1/tests/test032.c
@@ -4,8 +4,7 @@
 description: test special characters @ and $ in macro definitions
 error:
 output:
-F4	I
-G5	F4	"main
+G5	F	"main
 {
 \
 V9	K	#44
--- 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
--- a/cc1/tests/test035.c
+++ b/cc1/tests/test035.c
@@ -4,8 +4,7 @@
 description: Basic test for enumerations
 error:
 output:
-F6	I	E
-G7	F6	"main
+G7	F	"main
 {
 \
 A8	I	"e
--- 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
--- a/cc1/tests/test037.c
+++ b/cc1/tests/test037.c
@@ -4,12 +4,11 @@
 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
--- 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
--- a/cc1/tests/test039.c
+++ b/cc1/tests/test039.c
@@ -5,8 +5,7 @@
 comments: This test is done for z80 sizes
 error:
 output:
-F1	I
-G2	F1	"main
+G2	F	"main
 {
 \
 A3	I	"i
--- a/cc1/tests/test040.c
+++ b/cc1/tests/test040.c
@@ -3,8 +3,7 @@
 description: Test for bug parsing typenames in struct definition
 error:
 output:
-F8	I
-G9	F8	"main
+G9	F	"main
 {
 \
 S2	List
--- 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
--- 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
--- a/cc1/tests/test043.c
+++ b/cc1/tests/test043.c
@@ -3,16 +3,14 @@
 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
 }
 */
--- a/cc1/tests/test045.c
+++ b/cc1/tests/test045.c
@@ -7,8 +7,7 @@
 (
 	#I5
 )
-F2	I	E
-G3	F2	"main
+G3	F	"main
 {
 \
 	j	L4	G1	#I5	=I
--- a/cc1/tests/test046.c
+++ b/cc1/tests/test046.c
@@ -10,8 +10,7 @@
 	#I2
 	#I3
 )
-F3	I	E
-G4	F3	"main
+G4	F	"main
 {
 \
 	j	L5	G2	#I1	=I
--- a/cc1/tests/test047.c
+++ b/cc1/tests/test047.c
@@ -13,8 +13,7 @@
 	#I2
 	#I3
 )
-F7	I	E
-G8	F7	"main
+G8	F	"main
 {
 \
 	j	L9	G6	M3	.I	#I1	=I
--- a/cc1/tests/test048.c
+++ b/cc1/tests/test048.c
@@ -12,8 +12,7 @@
 	#I1
 	#I2
 )
-F7	I	E
-G8	F7	"main
+G8	F	"main
 {
 \
 	j	L9	G6	M3	.I	#I1	=I
--- a/cc1/tests/test049.c
+++ b/cc1/tests/test049.c
@@ -11,8 +11,7 @@
 (
 	G1	'P
 )
-F4	I	E
-G5	F4	"main
+G5	F	"main
 {
 \
 	j	L6	G3	@I	#I5	=I
--- a/cc1/tests/test051.c
+++ b/cc1/tests/test051.c
@@ -10,8 +10,7 @@
 	#I1
 	#I2
 )
-F3	I	E
-G4	F3	"main
+G4	F	"main
 {
 \
 	j	L5	G2	#I0	=I
--- a/cc1/tests/test052.c
+++ b/cc1/tests/test052.c
@@ -14,8 +14,7 @@
 	#I3
 	#I4
 )
-F7	I	E
-G8	F7	"main
+G8	F	"main
 {
 \
 	j	L9	G6	M3	.I	#I1	=I
--- a/cc1/tests/test053.c
+++ b/cc1/tests/test053.c
@@ -11,8 +11,7 @@
 	#I1
 	#I2
 )
-F6	I	E
-G7	F6	"main
+G7	F	"main
 {
 \
 	j	L8	G5	M3	.I	#I1	=I
--- a/cc1/tests/test056.c
+++ b/cc1/tests/test056.c
@@ -24,8 +24,7 @@
 G11	V10	"m
 (
 )
-F12	I
-G13	F12	"main
+G13	F	"main
 {
 \
 	r	G9	M7	.V6	'P	#P2	+P	@K	gI	gN	#N0	!I
--- a/cc1/tests/test057.c
+++ b/cc1/tests/test057.c
@@ -24,8 +24,7 @@
 	#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
--- a/cc1/tests/test058.c
+++ b/cc1/tests/test058.c
@@ -39,8 +39,7 @@
 	#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