shithub: scc

Download patch

ref: d9bbd7ad7628e10d605a7958db16a432164c4a1d
parent: 3afef127c2996c8be4c24136f105ddebdbd0a437
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Sat Aug 15 15:55:47 EDT 2015

Move function brackets to a line

This make easier to parse the IR, because there is no difference
between a prototype and a function.

--- a/cc1/code.c
+++ b/cc1/code.c
@@ -330,7 +330,7 @@
 	int n;
 
 	emitdcl(op, arg);
-	puts("\t{");
+	puts("\n{");
 
 	n = sym->type->n.elem;
 	for (sp = sym->u.pars; n-- > 0; ++sp) {
--- a/cc1/tests/test001.c
+++ b/cc1/tests/test001.c
@@ -5,7 +5,8 @@
 F3	P
 X1	F3	printf
 F1
-G2	F1	main	{
+G2	F1	main
+{
 -
 	X1	"68656C6C6F20776F726C640A	aP	pP	cI
 	yI	#I0
--- a/cc1/tests/test002.c
+++ b/cc1/tests/test002.c
@@ -4,7 +4,8 @@
 output:
 G4	P	x
 F1
-G6	F1	main	{
+G6	F1	main
+{
 -
 S2	S	(
 M5	I	i
--- a/cc1/tests/test003.c
+++ b/cc1/tests/test003.c
@@ -3,15 +3,18 @@
 description: Select function to call inside ternary operator
 output:
 F1
-G1	F1	foo	{
+G1	F1	foo
+{
 -
 	yI	#I2A
 }
-G2	F1	bar	{
+G2	F1	bar
+{
 -
 	yI	#I18
 }
-G3	F1	main	{
+G3	F1	main
+{
 -
 	yI	G1	cI
 }
--- a/cc1/tests/test004.c
+++ b/cc1/tests/test004.c
@@ -3,7 +3,8 @@
 description: Test integer operations
 output:
 F1
-G1	F1	main	{
+G1	F1	main
+{
 -
 A2	I	x
 	A2	#I0	:I
--- a/cc1/tests/test005.c
+++ b/cc1/tests/test005.c
@@ -3,7 +3,8 @@
 description: Test unary integer operations
 output:
 F1
-G1	F1	main	{
+G1	F1	main
+{
 -
 A2	I	x
 	A2	#I3	:I
--- a/cc1/tests/test006.c
+++ b/cc1/tests/test006.c
@@ -2,12 +2,13 @@
 name: TEST006
 description: Basic test for if
 output:
-test006.c:41: warning: conditional expression is constant
-test006.c:43: warning: conditional expression is constant
-test006.c:46: warning: conditional expression is constant
+test006.c:42: warning: conditional expression is constant
+test006.c:44: warning: conditional expression is constant
+test006.c:47: warning: conditional expression is constant
 G1	M	c
 F1
-G2	F1	main	{
+G2	F1	main
+{
 -
 	j	L2	#I0
 	yI	#I1