[Bug binutils/10792] New: variable declare inside code block in binutils/dlltool.c

View: New views
5 Messages — Rating Filter:   Alert me  

[Bug binutils/10792] New: variable declare inside code block in binutils/dlltool.c

by Bugzilla from sourceware-bugzilla@sourceware.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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))
     {

--
           Summary: variable declare inside code block in binutils/dlltool.c
           Product: binutils
           Version: 2.21 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: binutils
        AssignedTo: unassigned at sources dot redhat dot com
        ReportedBy: jerker dot back at gmail dot com
                CC: bug-binutils at gnu dot org
 GCC build triplet: x86_64-unknown-interix6.1
  GCC host triplet: x86_64-unknown-interix6.1
GCC target triplet: x86_64-unknown-interix6.1


http://sourceware.org/bugzilla/show_bug.cgi?id=10792

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


_______________________________________________
bug-binutils mailing list
bug-binutils@...
http://lists.gnu.org/mailman/listinfo/bug-binutils

[Bug binutils/10792] variable declare inside code block in binutils/dlltool.c

by Bugzilla from sourceware-bugzilla@sourceware.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


------- Additional Comments From amodra at bigpond dot net dot au  2009-10-18 23:04 -------
*** Bug 10798 has been marked as a duplicate of this bug. ***

--


http://sourceware.org/bugzilla/show_bug.cgi?id=10792

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


_______________________________________________
bug-binutils mailing list
bug-binutils@...
http://lists.gnu.org/mailman/listinfo/bug-binutils

[Bug binutils/10792] variable declare inside code block in binutils/dlltool.c

by Bugzilla from sourceware-bugzilla@sourceware.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2009-10-18 23:11 -------
Subject: Bug 10792

CVSROOT: /cvs/src
Module name: src
Changes by: amodra@... 2009-10-18 23:11:35

Modified files:
        binutils       : ChangeLog dlltool.c

Log message:
        PR binutils/10792
        * dlltool.c (dll_name_list_append): Declare variable at start
        of block.
        (dll_name_list_count, dll_name-list_print): Likewise.

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/binutils/ChangeLog.diff?cvsroot=src&r1=1.1549&r2=1.1550
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/binutils/dlltool.c.diff?cvsroot=src&r1=1.94&r2=1.95



--


http://sourceware.org/bugzilla/show_bug.cgi?id=10792

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


_______________________________________________
bug-binutils mailing list
bug-binutils@...
http://lists.gnu.org/mailman/listinfo/bug-binutils

[Bug binutils/10792] variable declare inside code block in binutils/dlltool.c

by Bugzilla from sourceware-bugzilla@sourceware.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2009-10-18 23:13 -------
Subject: Bug 10792

CVSROOT: /cvs/src
Module name: src
Branch: binutils-2_20-branch
Changes by: amodra@... 2009-10-18 23:12:50

Modified files:
        binutils       : ChangeLog dlltool.c

Log message:
        PR binutils/10792
        * dlltool.c (dll_name_list_append): Declare variable at start
        of block.
        (dll_name_list_count, dll_name-list_print): Likewise.

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/binutils/ChangeLog.diff?cvsroot=src&only_with_tag=binutils-2_20-branch&r1=1.1521.2.13&r2=1.1521.2.14
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/binutils/dlltool.c.diff?cvsroot=src&only_with_tag=binutils-2_20-branch&r1=1.93&r2=1.93.2.1



--


http://sourceware.org/bugzilla/show_bug.cgi?id=10792

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


_______________________________________________
bug-binutils mailing list
bug-binutils@...
http://lists.gnu.org/mailman/listinfo/bug-binutils

[Bug binutils/10792] variable declare inside code block in binutils/dlltool.c

by Bugzilla from sourceware-bugzilla@sourceware.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


------- Additional Comments From amodra at bigpond dot net dot au  2009-10-18 23:15 -------
.

--
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


http://sourceware.org/bugzilla/show_bug.cgi?id=10792

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


_______________________________________________
bug-binutils mailing list
bug-binutils@...
http://lists.gnu.org/mailman/listinfo/bug-binutils