From 106cc98f0ecd239bc71eb44a908e9c7e0f63af67 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Thu, 24 Dec 2015 14:57:38 +0000
Subject: gcc2 fix


diff --git a/src/AnnotationList.c b/src/AnnotationList.c
index 4c21d6b..c7b7979 100644
--- a/src/AnnotationList.c
+++ b/src/AnnotationList.c
@@ -230,12 +230,12 @@ AnnotationList__computePredecessorAnnotations (AnnotationList *self, state *s,
   state **predecessor;
   for (predecessor = predecessors[s->number]; *predecessor; ++predecessor)
     {
+      bool potential_contribution = false;
+      bitset *lookaheads = NULL;
       AnnotationList *annotation_node =
         AnnotationList__alloc_on_obstack (
           self->inadequacyNode->contributionCount, annotations_obstackp);
       annotation_node->inadequacyNode = self->inadequacyNode;
-      bool potential_contribution = false;
-      bitset *lookaheads = NULL;
       {
         ContributionIndex ci;
         for (ci = 0; ci < self->inadequacyNode->contributionCount; ++ci)
diff --git a/src/complain.c b/src/complain.c
index e39626a..4c4d0d0 100644
--- a/src/complain.c
+++ b/src/complain.c
@@ -104,6 +104,7 @@ ARGMATCH_VERIFY (warnings_args, warnings_types);
 void
 warning_argmatch (char const *arg, size_t no, size_t err)
 {
+  size_t b;
   int value = XARGMATCH ("--warning", arg + no + err,
                          warnings_args, warnings_types);
 
@@ -114,7 +115,6 @@ warning_argmatch (char const *arg, size_t no, size_t err)
       no = !no;
     }
 
-  size_t b;
   for (b = 0; b < warnings_size; ++b)
     if (value & 1 << b)
       {
diff --git a/src/getargs.c b/src/getargs.c
index 5696c35..a245e4c 100644
--- a/src/getargs.c
+++ b/src/getargs.c
@@ -253,6 +253,7 @@ usage (int status)
              program_name);
   else
     {
+      const char *lc_messages = setlocale (LC_MESSAGES, NULL);
       /* For ../build-aux/cross-options.pl to work, use the format:
                 ^  -S, --long[=ARGS] (whitespace)
          A --long option is required.
@@ -363,7 +364,6 @@ FEATURE is a list of comma separated words that can include:\n\
       /* Don't output this redundant message for English locales.
          Note we still output for 'C' so that it gets included in the
          man page.  */
-      const char *lc_messages = setlocale (LC_MESSAGES, NULL);
       if (lc_messages && !STREQ (lc_messages, "en_"))
         /* TRANSLATORS: Replace LANG_CODE in this URL with your language
            code <http://translationproject.org/team/LANG_CODE.html> to
diff --git a/src/ielr.c b/src/ielr.c
index 4ff03c1..9d389cd 100644
--- a/src/ielr.c
+++ b/src/ielr.c
@@ -1032,9 +1032,9 @@ ielr_split_states (bitsetv follow_kernel_items, bitsetv always_follows,
      lookahead sets.  */
   if (!annotation_lists)
     {
+      state_list *node;
       timevar_push (TV_IELR_PHASE4);
       initialize_LA ();
-      state_list *node;
       for (node = first_state; node; node = node->next)
         if (!node->state->consistent)
           {
diff --git a/src/muscle-tab.c b/src/muscle-tab.c
index c14273f..a464f38 100644
--- a/src/muscle-tab.c
+++ b/src/muscle-tab.c
@@ -468,12 +468,13 @@ muscle_percent_variable_update (char const *variable, location variable_loc,
              && STREQ (eq + 1, *value))
           : STREQ (c->obsolete, variable))
         {
+          char *res;
           char *old = define_directive (c->obsolete, *value);
           char *upd = define_directive (c->updated, *value);
           deprecated_directive (&variable_loc, old, upd);
           free (old);
           free (upd);
-          char *res = xstrdup (c->updated);
+          res = xstrdup (c->updated);
           {
             char *eq2 = strchr (res, '=');
             if (eq2)
@@ -506,6 +507,7 @@ muscle_percent_define_insert (char const *var, location variable_loc,
   if (how == MUSCLE_PERCENT_DEFINE_GRAMMAR_FILE
       && muscle_find_const (name))
     {
+      location loc;
       muscle_percent_define_how how_old = atoi (muscle_find_const (how_name));
       unsigned i = 0;
       if (how_old == MUSCLE_PERCENT_DEFINE_F)
@@ -514,7 +516,7 @@ muscle_percent_define_insert (char const *var, location variable_loc,
                        _("%%define variable %s redefined"),
                        quote (variable));
       i += SUB_INDENT;
-      location loc = muscle_percent_define_get_loc (variable);
+      loc = muscle_percent_define_get_loc (variable);
       complain_indent (&loc, complaint, &i, _("previous definition"));
     }
 
@@ -657,8 +659,9 @@ muscle_percent_define_flag_if (char const *variable)
         result = false;
       else if (!muscle_find_const (invalid_boolean_name))
         {
+          location loc;
           muscle_insert (invalid_boolean_name, "");
-          location loc = muscle_percent_define_get_loc (variable);
+          loc = muscle_percent_define_get_loc (variable);
           complain (&loc, complaint,
                     _("invalid value for %%define Boolean variable %s"),
                     quote (variable));
diff --git a/src/scan-gram.l b/src/scan-gram.l
index ff5c056..7714285 100644
--- a/src/scan-gram.l
+++ b/src/scan-gram.l
@@ -952,10 +952,11 @@ handle_syncline (char *args, location loc)
 static void
 unexpected_end (boundary start, char const *msgid, char const *token_end)
 {
+  size_t i;
   location loc;
   loc.start = start;
   loc.end = scanner_cursor;
-  size_t i = strlen (token_end);
+  i = strlen (token_end);
 
 /* Adjust scanner cursor so that any later message does not count
      the characters about to be inserted.  */
diff --git a/src/symlist.c b/src/symlist.c
index a6f0d04..d53dc03 100644
--- a/src/symlist.c
+++ b/src/symlist.c
@@ -120,9 +120,9 @@ symbol_list_prepend (symbol_list *list, symbol_list *node)
 symbol_list *
 symbol_list_append (symbol_list *list, symbol_list *node)
 {
+  symbol_list *next = list;
   if (!list)
     return node;
-  symbol_list *next = list;
   while (next->next)
     next = next->next;
   next->next = node;
diff --git a/src/symtab.c b/src/symtab.c
index 75024b1..0cd0fd2 100644
--- a/src/symtab.c
+++ b/src/symtab.c
@@ -1030,8 +1030,9 @@ init_prec_nodes (void)
   prec_nodes = xcalloc (nsyms, sizeof *prec_nodes);
   for (i = 0; i < nsyms; ++i)
     {
+      symgraph *s;
       prec_nodes[i] = xmalloc (sizeof *prec_nodes[i]);
-      symgraph *s = prec_nodes[i];
+      s = prec_nodes[i];
       s->id = i;
       s->succ = 0;
       s->pred = 0;
diff --git a/src/uniqstr.c b/src/uniqstr.c
index bfe1d17..f51e722 100644
--- a/src/uniqstr.c
+++ b/src/uniqstr.c
@@ -64,12 +64,14 @@ uniqstr_vsprintf (char const *format, ...)
   length = vsnprintf (NULL, 0, format, args);
   va_end (args);
 
+{
   char res[length + 1];
   va_start (args, format);
   vsprintf (res, format, args);
   va_end (args);
   return uniqstr_new (res);
 }
+}
 
 /*------------------------------.
 | Abort if S is not a uniqstr.  |
-- 
2.2.2

