ref: 51d0b0427379342a3b2d3701c495bd87b3bea8b1
parent: 45c82467f51b356445aae338b33968c9d4f08788
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Fri Sep 18 06:15:06 EDT 2015
Remove parentheses in struct definitions They are totally unneeded because we can add the member to the last struct/union defined.
--- a/cc1/code.c
+++ b/cc1/code.c
@@ -263,11 +263,10 @@
emitletter(tp);
if ((tag = tp->tag->name) != NULL)
printf("\t%s", tag);
- puts("\n(");
+ putchar('\n');
n = tp->n.elem;
for (sp = tp->p.fields; n-- > 0; ++sp)
emit(ODECL, *sp);
- puts(")");
break;
case FTN:
emitletter(tp);
--- a/cc1/ir.md
+++ b/cc1/ir.md
@@ -65,10 +65,8 @@
### Type declarations ###
Some declarations need a previous declaration of the types involved
-in the variable declaration. In the case of structs and unions
-a '(' means that begins a list of members of the last type declaration
-(the front end must ensure that '(; only can follow struct/union
-declarations).
+in the variable declaration. In the case of members, they form part
+of the last struct or union declared.
For example the next code:
@@ -80,10 +78,8 @@
will generate the next output:
> S2 foo
-> (
> M3 I i
> M4 W c
-> )
> G5 S2 var1
@@ -351,8 +347,6 @@
* T -- local (function scopped static variable)
* M -- member (struct/union member)
* L -- label
-* ( -- begin of struct/enum definition
-* ) -- end of struct/enum definition
* { -- end of function body
* } -- end of fucntion body
* - -- end of function parameters
--- a/cc1/tests/test002.c
+++ b/cc1/tests/test002.c
@@ -8,10 +8,8 @@
{
-
S2 S
-(
M5 I i
M6 P next
-)
A2 S2 y
A3 P p
A4 N n
--- a/cc1/tests/test015.c
+++ b/cc1/tests/test015.c
@@ -2,20 +2,14 @@
name: TEST015
description: Stress namespace mechanism
output:
-test015.c:58: error: label 's' already defined
+test015.c:52: error: label 's' already defined
S8 s2
-(
M9 I s
-)
S5 s1
-(
M6 I s
M10 S8 s1
-)
S2 s
-(
M11 S5 s
-)
G12 S2 s2
F1
G13 F1 main
--- a/cc1/tests/test017.c
+++ b/cc1/tests/test017.c
@@ -7,15 +7,11 @@
{
-
S2 s1
-(
M3 I y
M4 I z
-)
A2 S2 nested
S6 s2
-(
M8 P p
-)
A3 S6 v
A3 M8 .P A2 'P :P
A3 M8 .P @S2 M3 .I #I1 :I