This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch instaled for K&R bootstrap problem


Bootstrapping with the stage1 compiler in traditional C mode exposed a
K&R problem.  The `const' keyword is defined away for !__STDC__ case
through config.h but `const' was used above config.h in unroll.c.

This patch moves the includes above the code in question.  Tested by
compiling stage1 with "cc -Xs" (traditional C mode) on solaris2.7.

I installed it as obvious.

		--Kaveh

PS: Full disclosure requires me to admit I added the offending use of
const in the first place. :-/


2001-12-30  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* unroll.c: Move include files above first use of `const'.

--- /teal/caip5/ghazi/gcc-testing/egcc-CVS20011230/gcc/unroll.c	Wed Dec 26 22:31:45 2001
+++ egcc-CVS20011229/gcc/unroll.c	Sun Dec 30 10:48:20 2001
@@ -124,57 +124,57 @@ Software Foundation, 59 Temple Place - S
    body of the loop will use the same address, whereas each actually needs a
    different address.  A case where this happens is when a loop containing
    a switch statement is unrolled.
 
    It would be better to let labels be considered invariant.  When we
    unroll loops here, check to see if any insns using a label local to the
    loop were moved before the loop.  If so, then correct the problem, by
    moving the insn back into the loop, or perhaps replicate the insn before
    the loop, one copy for each time the loop is unrolled.  */
 
+#include "config.h"
+#include "system.h"
+#include "rtl.h"
+#include "tm_p.h"
+#include "insn-config.h"
+#include "integrate.h"
+#include "regs.h"
+#include "recog.h"
+#include "flags.h"
+#include "function.h"
+#include "expr.h"
+#include "loop.h"
+#include "toplev.h"
+#include "hard-reg-set.h"
+#include "basic-block.h"
+#include "predict.h"
+
 /* The prime factors looked for when trying to unroll a loop by some
    number which is modulo the total number of iterations.  Just checking
    for these 4 prime factors will find at least one factor for 75% of
    all numbers theoretically.  Practically speaking, this will succeed
    almost all of the time since loops are generally a multiple of 2
    and/or 5.  */
 
 #define NUM_FACTORS 4
 
 static struct _factor { const int factor; int count; }
 factors[NUM_FACTORS] = { {2, 0}, {3, 0}, {5, 0}, {7, 0}};
 
 /* Describes the different types of loop unrolling performed.  */
 
 enum unroll_types
 {
   UNROLL_COMPLETELY,
   UNROLL_MODULO,
   UNROLL_NAIVE
 };
-
-#include "config.h"
-#include "system.h"
-#include "rtl.h"
-#include "tm_p.h"
-#include "insn-config.h"
-#include "integrate.h"
-#include "regs.h"
-#include "recog.h"
-#include "flags.h"
-#include "function.h"
-#include "expr.h"
-#include "loop.h"
-#include "toplev.h"
-#include "hard-reg-set.h"
-#include "basic-block.h"
-#include "predict.h"
 
 /* This controls which loops are unrolled, and by how much we unroll
    them.  */
 
 #ifndef MAX_UNROLLED_INSNS
 #define MAX_UNROLLED_INSNS 100
 #endif
 
 /* Indexed by register number, if non-zero, then it contains a pointer
    to a struct induction for a DEST_REG giv which has been combined with


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]