[hackers] [scc] Remove parentheses in struct definitions || Roberto E. Vargas Caballero
commit 51d0b0427379342a3b2d3701c495bd87b3bea8b1
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Fri Sep 18 10:15:06 2015 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Fri Sep 18 10:15:06 2015 +0200
Remove parentheses in struct definitions
They are totally unneeded because we can add the member to the last struct/union
defined.
diff --git a/cc1/code.c b/cc1/code.c
index 95d1c7b..d0728fb 100644
--- a/cc1/code.c
+++ b/cc1/code.c
_AT_@ -263,11 +263,10 @@ emittype(Type *tp)
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);
diff --git a/cc1/ir.md b/cc1/ir.md
index 26edf5a..5101005 100644
--- a/cc1/ir.md
+++ b/cc1/ir.md
_AT_@ -65,10 +65,8 @@ name, a type and the name of the variable:
### 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:
_AT_@ -80,10 +78,8 @@ For example the next code:
will generate the next output:
> S2 foo
-> (
> M3 I i
> M4 W c
-> )
> G5 S2 var1
_AT_@ -351,8 +347,6 @@ switch.
* 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
diff --git a/cc1/tests/test002.c b/cc1/tests/test002.c
index 7c2e7f2..a3ce5fd 100644
--- a/cc1/tests/test002.c
+++ b/cc1/tests/test002.c
_AT_@ -8,10 +8,8 @@ G7 F1 main
{
-
S2 S
-(
M5 I i
M6 P next
-)
A2 S2 y
A3 P p
A4 N n
diff --git a/cc1/tests/test015.c b/cc1/tests/test015.c
index e3deb54..cd2c8e0 100644
--- a/cc1/tests/test015.c
+++ b/cc1/tests/test015.c
_AT_@ -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
diff --git a/cc1/tests/test017.c b/cc1/tests/test017.c
index a195be9..16e9e84 100644
--- a/cc1/tests/test017.c
+++ b/cc1/tests/test017.c
_AT_@ -7,15 +7,11 @@ G9 F1 main
{
-
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 _AT_S2 M3 .I #I1 :I
Received on Fri Sep 18 2015 - 15:04:57 CEST
This archive was generated by hypermail 2.3.0
: Fri Sep 18 2015 - 15:12:12 CEST