Skip to contentSkip to conversation

Make all the anonymous structures truly anonymous

PATCH In review Ryan Anderson 2 participants 2 messages Jun 8, 2003

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Make all the anonymous structures truly anonymous

This patch removes the type-names on the anonymous structures. This fixes compilation when using gcc-3.3 (Debian). Credit for identifying the fix goes to Arnaldo Carvalho de Melo <[email protected]>.

# This is a BitKeeper generated patch for the following project:
# Project Name: TSCT - The Silly C Tokenizer
# This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas:

#	           ChangeSet	1.354   -> 1.355  
#	             parse.h	1.35    -> 1.36   
#	            symbol.h	1.66    -> 1.67   
#	        expression.h	1.26    -> 1.27   

#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/06/07 ryan@mythryan2.(none) 1.355
# Fix anonymous structures to be truly anonymous.
# (Fixes compile errors with gcc-3.2)
# --------------------------------------------
#

expression.h +10 -10
diff -Nru a/expression.h b/expression.h
@@ -53,7 +53,7 @@
 		struct expression *unop;
 
 		// EXPR_SYMBOL
-		struct symbol_arg {
+		struct /* symbol_arg */ {
 			struct symbol *symbol;
 			struct ident *symbol_name;
 		};
@@ -62,35 +62,35 @@
 		struct statement *statement;
 
 		// EXPR_BINOP, EXPR_COMMA, EXPR_COMPARE, EXPR_LOGICAL and EXPR_ASSIGNMENT
-		struct binop_arg {
+		struct /* binop_arg */ {
 			struct expression *left, *right;
 		};
 		// EXPR_DEREF
-		struct deref_arg {
+		struct /* deref_arg */ {
 			struct expression *deref;
 			struct ident *member;
 		};
 		// EXPR_CAST and EXPR_SIZEOF
-		struct cast_arg {
+		struct /* cast_arg */ {
 			struct symbol *cast_type;
 			struct expression *cast_expression;
 		};
 		// EXPR_CONDITIONAL
-		struct conditional_expr {
+		struct /* conditional_expr */ {
 			struct expression *conditional, *cond_true, *cond_false;
 		};
 		// EXPR_CALL
-		struct call_expr {
+		struct /* call_expr */ {
 			struct expression *fn;
 			struct expression_list *args;
 		};
 		// EXPR_BITFIELD
-		struct bitfield_expr {
+		struct /* bitfield_expr */ {
 			unsigned char bitpos, nrbits;
 			struct expression *address;
 		};
 		// EXPR_LABEL
-		struct label_expr {
+		struct /* label_expr */ {
 			struct symbol *label_symbol;
 		};
 		// EXPR_INITIALIZER
@@ -98,11 +98,11 @@
 		// EXPR_IDENTIFIER
 		struct ident *expr_ident;
 		// EXPR_INDEX
-		struct index_expr {
+		struct /* index_expr */ {
 			unsigned int idx_from, idx_to;
 		};
 		// EXPR_POS
-		struct initpos_expr {
+		struct /* initpos_expr */ {
 			unsigned int init_offset;
 			struct symbol *init_sym;
 			struct expression *init_expr;
parse.h +9 -9
diff -Nru a/parse.h b/parse.h
@@ -28,41 +28,41 @@
 	enum statement_type type;
 	struct position pos;
 	union {
-		struct label_arg {
+		struct /* label_arg */ {
 			struct symbol *label;
 			struct statement *label_statement;
 		};
 		struct expression *expression;
-		struct return_statement {
+		struct /* return_statement */ {
 			struct expression *ret_value;
 			struct symbol *ret_target;
 		};
-		struct if_statement {
+		struct /* if_statement */ {
 			struct expression *if_conditional;
 			struct statement *if_true;
 			struct statement *if_false;
 		};
-		struct compound_struct {
+		struct /* compound_struct */ {
 			struct symbol_list *syms;
 			struct statement_list *stmts;
 			struct symbol *ret;
 		};
-		struct labeled_struct {
+		struct /* labeled_struct */ {
 			struct symbol *label_identifier;
 			struct statement *label_statement;
 		};
-		struct case_struct {
+		struct /* case_struct */ {
 			struct expression *case_expression;
 			struct expression *case_to;
 			struct statement *case_statement;
 			struct symbol *case_label;
 		};
-		struct switch_struct {
+		struct /* switch_struct */ {
 			struct expression *switch_expression;
 			struct statement *switch_statement;
 			struct symbol *switch_break, *switch_case;
 		};
-		struct iterator_struct {
+		struct /* iterator_struct */ {
 			struct symbol *iterator_break;
 			struct symbol *iterator_continue;
 			struct symbol_list *iterator_syms;
@@ -74,7 +74,7 @@
 			struct statement  *iterator_post_statement;
 			struct expression *iterator_post_condition;
 		};
-		struct goto_struct {
+		struct /* goto_struct */ {
 			struct symbol *goto_label;
 			struct expression *goto_expression;
 		};
symbol.h +2 -2
diff -Nru a/symbol.h b/symbol.h
@@ -67,12 +67,12 @@
 	struct symbol	*same_symbol;
 	int (*evaluate)(struct expression *);
 
-	struct preprocessor_sym {
+	struct /* preprocessor_sym */ {
 		struct token *expansion;
 		struct token *arglist;
 	};
 	
-	struct ctype_sym {
+	struct /* ctype_sym */ {
 		unsigned long	offset;
 		unsigned int	bit_size;
 		unsigned int	bit_offset:8,
Signature · 2 lines
Ryan Anderson
  sometimes Pug Majere
#1 lore raw

Em Sat, Jun 07, 2003 at 08:43:35PM -0400, Ryan Anderson escreveu:

Quoted 3 lines

This patch removes the type-names on the anonymous structures. This fixes compilation when using gcc-3.3 (Debian). Credit for identifying the fix goes to Arnaldo Carvalho de Melo <[email protected]>.

Oh, in fact this credits should go to Eduardo Habkost (aka foca), a coworker that found this behaviour.

- Arnaldo