On 2012-10-11 13:55 , Laurynas Biveinis wrote:

  static void
-consume_until_semi (bool immediate)
+consume_until_eos (void)
  {
-  if (immediate && token () != ';')
-    require (';');
    for (;;)
      switch (token ())
        {
        case ';':
         advance ();
         return;
-      default:
-       advance ();
-       break;
+
+      case '{':
+       consume_balanced ('{', '}');
+       return;

        case '(':
         consume_balanced ('(', ')');
         break;
+
        case '[':
         consume_balanced ('[', ']');
         break;
-      case '{':
-       consume_balanced ('{', '}');
-       break;

case '{' moved around without any changes? Likewise for
consume_until_comma_or_eos.

Right.  I wanted to cluster the cases that cause the function to return.


diff --git a/gcc/gengtype.c b/gcc/gengtype.c
index 2135676..b9fbd96 100644
--- a/gcc/gengtype.c
+++ b/gcc/gengtype.c
@@ -497,10 +497,10 @@ struct type scalar_char = {

  /* Lists of various things.  */

-pair_p typedefs;
-type_p structures;
-type_p param_structs;
-pair_p variables;
+pair_p typedefs = NULL;
+type_p structures = NULL;
+type_p param_structs = NULL;
+pair_p variables = NULL;

  static type_p find_param_structure (type_p t, type_p param[NUM_PARAM]);
  static type_p adjust_field_tree_exp (type_p t, options_p opt);

This change...

@@ -676,8 +677,7 @@ new_structure (const char *name, enum typekind kind, struct 
fileloc *pos,
        structures = s;
      }

-  if (s->u.s.line.file != NULL
-      || (s->u.s.lang_struct && (s->u.s.lang_struct->u.s.bitmap & bitmap)))
+  if (s->u.s.lang_struct && (s->u.s.lang_struct->u.s.bitmap & bitmap))
      {
        error_at_line (pos, "duplicate definition of '%s %s'",
                      isunion ? "union" : "struct", s->u.s.tag);

..and this are missing from the ChangeLog. Also, what is the
motivation behind the latter?

I explained it in the original submission:

"There is one check I needed to remove that gave me some trouble.
When a ctor is detected, we have already parsed the name of the
ctor as a type, which is then registered in the list of structures.

We go on to recognize it as a ctor *after* the type has been
registered.  We reject the field in declarator() and it is never
added to the list of fields for the class.

However, when we reach the end of the class, we find that the
type we created while parsing the ctor has line number
information in it (the line where the ctor was) and gengtype
thinks that it is a duplicate structure definition.

I took out this check for two reasons: (a) It is actually
unnecessary because if there were really duplicate definitions of
this structure, the code would not compile, and (b) all the other
alternatives required making the parser much more convoluted and
I'm trying hard not to make gengtype parser too smart."

I should've clarified that I was talking about that hunk, sorry. I will add a ChangeLog entry for it.

Have you compared the before and after gtype state files for the
current GCC sources that there are no unexpected differences?

Yes.  They are identical.

Thanks for the review.


Diego.

Reply via email to