Bug 10798 - variable declare inside code block in binutils/dlltool.c
Summary: variable declare inside code block in binutils/dlltool.c
Status: RESOLVED DUPLICATE of bug 10792
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: 2.21
: P2 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-10-17 08:40 UTC by Jerker Bäck
Modified: 2009-10-18 23:04 UTC (History)
1 user (show)

See Also:
Host: x86_64-unknown-interix6.1
Target: x86_64-unknown-interix6.1
Build: x86_64-unknown-interix6.1
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jerker Bäck 2009-10-17 08:40:02 UTC
variable declared inside code block.
Not all compilers are happy about it

===================================================================
RCS file: /cvs/src/src/binutils/dlltool.c,v
retrieving revision 1.93
diff -w -b -B -u -p -r1.93 dlltool.c
--- dlltool.c	4 Sep 2009 01:22:18 -0000	1.93
+++ dlltool.c	16 Oct 2009 20:36:00 -0000
@@ -3162,13 +3162,14 @@ gen_lib_file (int delay)
 static void
 dll_name_list_append (dll_name_list_type * list, bfd_byte * data)
 {
+  dll_name_list_node_type * entry;
+
   /* Error checking.  */
   if (! list || ! list->tail)
     return;
 
   /* Allocate new node.  */
-  dll_name_list_node_type * entry =
-    (dll_name_list_node_type *) xmalloc (sizeof (dll_name_list_node_type));
+  entry = (dll_name_list_node_type *) xmalloc (sizeof 
(dll_name_list_node_type));
 
   /* Initialize its values.  */
   entry->dllname = xstrdup ((char *) data);
@@ -3184,12 +3185,14 @@ dll_name_list_append (dll_name_list_type
 static int 
 dll_name_list_count (dll_name_list_type * list)
 {
+  dll_name_list_node_type * p;
+  int count = 0;
+
   /* Error checking.  */
   if (! list || ! list->head)
     return 0;
 
-  int count = 0;
-  dll_name_list_node_type * p = list->head;
+  p = list->head;
 
   while (p && p->next)
     {
@@ -3204,11 +3207,13 @@ dll_name_list_count (dll_name_list_type 
 static void 
 dll_name_list_print (dll_name_list_type * list)
 {
+  dll_name_list_node_type * p;
+
   /* Error checking.  */
   if (! list || ! list->head)
     return;
 
-  dll_name_list_node_type * p = list->head;
+  p = list->head;
 
   while (p && p->next && p->next->dllname && *(p->next->dllname))
     {
Comment 1 Alan Modra 2009-10-18 23:04:06 UTC

*** This bug has been marked as a duplicate of 10792 ***