develooper Front page | perl.cvs.parrot | Postings from December 2008

[svn:parrot] r34311 - trunk/compilers/imcc

From:
chromatic
Date:
December 23, 2008 17:49
Subject:
[svn:parrot] r34311 - trunk/compilers/imcc
Message ID:
20081224014932.0462CCBA12@x12.develooper.com
Author: chromatic
Date: Tue Dec 23 17:49:30 2008
New Revision: 34311

Modified:
   trunk/compilers/imcc/optimizer.c
   trunk/compilers/imcc/pbc.c

Log:
[IMCC] Cleaned up some compilation warnings, making sure never to use an
uninitialized variable.

Modified: trunk/compilers/imcc/optimizer.c
==============================================================================
--- trunk/compilers/imcc/optimizer.c	(original)
+++ trunk/compilers/imcc/optimizer.c	Tue Dec 23 17:49:30 2008
@@ -83,6 +83,8 @@
 /* HEADERIZER BEGIN: static */
 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
 
+#if DO_LOOP_OPTIMIZATION
+
 PARROT_WARN_UNUSED_RESULT
 static int _is_ins_save(
     ARGIN(const IMC_Unit *unit),
@@ -93,6 +95,8 @@
         __attribute__nonnull__(2)
         __attribute__nonnull__(3);
 
+#endif
+
 static int branch_branch(PARROT_INTERP, ARGMOD(IMC_Unit *unit))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2)
@@ -149,6 +153,8 @@
         __attribute__nonnull__(2)
         FUNC_MODIFIES(*unit);
 
+#if DO_LOOP_OPTIMIZATION
+
 PARROT_WARN_UNUSED_RESULT
 static int is_ins_save(PARROT_INTERP,
     ARGIN(const IMC_Unit *unit),
@@ -159,6 +165,7 @@
         __attribute__nonnull__(2)
         __attribute__nonnull__(3)
         __attribute__nonnull__(4);
+#endif
 
 static int strength_reduce(PARROT_INTERP, ARGMOD(IMC_Unit *unit))
         __attribute__nonnull__(1)
@@ -1512,9 +1519,13 @@
 
     /* Unreachable instructions */
 
-    for (last = unit->instructions, last && (ins = last->next);
+
+    for (last = unit->instructions, ins = last->next;
          last && ins;
          ins = ins->next) {
+         if (!last && !ins)
+            break;
+
         if ((last->type & IF_goto) && !(ins->type & ITLABEL) &&
             STREQ(last->opname, "branch")) {
             IMCC_debug(interp, DEBUG_OPT1,
@@ -1523,6 +1534,7 @@
             unit->ostat.deleted_ins++;
             changed++;
         }
+
         /*
          *   branch L1     => --
          * L1: ...            L1:

Modified: trunk/compilers/imcc/pbc.c
==============================================================================
--- trunk/compilers/imcc/pbc.c	(original)
+++ trunk/compilers/imcc/pbc.c	Tue Dec 23 17:49:30 2008
@@ -687,6 +687,7 @@
     ARGIN(const subs_t *sym), ARGOUT(int *pc))
 {
     subs_t *s;
+    UNUSED(sym);
 
     *pc = 0;
 



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About