OSDN Git Service

update
[pf3gnuchains/gcc-fork.git] / gcc / frame.c
index 4c38721..4b62759 100644 (file)
@@ -32,6 +32,17 @@ Boston, MA 02111-1307, USA.  */
    do not apply.  */
 
 #include "tconfig.h"
+
+/* We disable this when inhibit_libc, so that gcc can still be built without
+   needing header files first.  */
+/* ??? This is not a good solution, since prototypes may be required in
+   some cases for correct code.  See also libgcc2.c.  */
+#ifndef inhibit_libc
+/* fixproto guarantees these system headers exist. */
+#include <stdlib.h>
+#include <unistd.h>
+#endif
+
 #include "defaults.h"
 
 #ifdef DWARF2_UNWIND_INFO
@@ -264,9 +275,10 @@ fde_split (fde_vector *linear, fde_vector *erratic)
   linear->count = j;
 }
 
-/* This is O(n log(n)). */
+/* This is O(n log(n)).  BSD/OS defines heapsort in stdlib.h, so we must
+   use a name that does not conflict.  */
 static inline void
-heapsort (fde_vector *erratic)
+frame_heapsort (fde_vector *erratic)
 {
   /* For a description of this algorithm, see:
      Samuel P. Harbison, Guy L. Steele Jr.: C, a reference manual, 2nd ed.,
@@ -361,7 +373,7 @@ end_fde_sort (fde_accumulator *accu, size_t count)
   fde_split (&accu->linear, &accu->erratic);
   if (accu->linear.count + accu->erratic.count != count)
     abort ();
-  heapsort (&accu->erratic);
+  frame_heapsort (&accu->erratic);
   fde_merge (&accu->linear, &accu->erratic);
   free (accu->erratic.array);
   return accu->linear.array;
@@ -535,7 +547,7 @@ extract_cie_info (fde *f, struct cie_info *c)
   return p;
 }
 
-/* Decode one instruction's worth of of DWARF 2 call frame information.
+/* Decode one instruction's worth of DWARF 2 call frame information.
    Used by __frame_state_for.  Takes pointers P to the instruction to
    decode, STATE to the current register unwind information, INFO to the
    current CIE information, and PC to the current PC value.  Returns a