This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PCH] fixes for mips-elf
- From: Geoffrey Keating <geoffk at romulus dot sfbay dot redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sun, 5 May 2002 00:38:42 -0700
- Subject: [PCH] fixes for mips-elf
This corrects some problems that were visible when building on
mips-elf.
Tested on mips-elf (where else?) with GC checking.
--
Geoff Keating <geoffk@redhat.com>
===File ~/patches/pchbranch-maybeundeffix.patch=============
2002-05-05 Geoffrey Keating <geoffk@redhat.com>
* gengtype.c (set_gc_used_type): Correct some errors in last change.
(write_gc_structure_fields): If a field which should be NULL is
not, abort.
* c-pragma.c: Move struct align_stack and variable alignment_stack
out from the ifdef.
Index: c-pragma.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-pragma.c,v
retrieving revision 1.46.4.3
diff -p -u -p -r1.46.4.3 c-pragma.c
--- c-pragma.c 6 Apr 2002 00:08:44 -0000 1.46.4.3
+++ c-pragma.c 5 May 2002 07:39:27 -0000
@@ -36,9 +36,6 @@ Software Foundation, 59 Temple Place - S
#define GCC_BAD(msgid) do { warning (msgid); return; } while (0)
#define GCC_BAD2(msgid, arg) do { warning (msgid, arg); return; } while (0)
-#ifdef HANDLE_PRAGMA_PACK
-static void handle_pragma_pack PARAMS ((cpp_reader *));
-
typedef struct align_stack GTY(())
{
int alignment;
@@ -48,6 +45,9 @@ typedef struct align_stack GTY(())
} align_stack;
static GTY(()) struct align_stack * alignment_stack;
+
+#ifdef HANDLE_PRAGMA_PACK
+static void handle_pragma_pack PARAMS ((cpp_reader *));
#ifdef HANDLE_PRAGMA_PACK_PUSH_POP
/* If we have a "global" #pragma pack(<n>) in effect when the first
Index: gengtype.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/gengtype.c,v
retrieving revision 1.1.2.12
diff -p -u -p -r1.1.2.12 gengtype.c
--- gengtype.c 4 May 2002 17:26:47 -0000 1.1.2.12
+++ gengtype.c 5 May 2002 07:39:28 -0000
@@ -359,13 +359,13 @@ set_gc_used_type (t, level)
for (f = t->u.s.fields; f; f = f->next)
{
options_p o;
- int maybe_null = 0;
+ int maybe_undef = 0;
for (o = f->opt; o; o = o->next)
- if (strcmp (o->name, "maybe_null") == 0)
- maybe_null = 1;
+ if (strcmp (o->name, "maybe_undef") == 0)
+ maybe_undef = 1;
- if (maybe_null && f->type->kind == TYPE_POINTER)
+ if (maybe_undef && f->type->kind == TYPE_POINTER)
set_gc_used_type (f->type->u.p, GC_MAYBE_POINTED_TO);
else
set_gc_used_type (f->type, GC_USED);
@@ -824,17 +824,12 @@ write_gc_structure_fields (of, s, val, p
if (skip_p)
continue;
- if (maybe_undef_p)
- {
- if (f->type->kind != TYPE_POINTER
- || f->type->u.p->kind != TYPE_STRUCT)
- error_at_line (&f->line,
- "field `%s' has invalid option `maybe_undef_p'\n",
- f->name);
- if (f->type->u.p->u.s.line.file == NULL)
- continue;
- }
-
+ if (maybe_undef_p
+ && (f->type->kind != TYPE_POINTER
+ || f->type->u.p->kind != TYPE_STRUCT))
+ error_at_line (&f->line,
+ "field `%s' has invalid option `maybe_undef_p'\n",
+ f->name);
if (s->kind == TYPE_UNION && ! always_p )
{
if (! tagid)
@@ -869,7 +864,11 @@ write_gc_structure_fields (of, s, val, p
case TYPE_POINTER:
if (! length)
{
- if (f->type->u.p->kind == TYPE_STRUCT
+ if (maybe_undef_p
+ && f->type->u.p->u.s.line.file == NULL)
+ fprintf (of, "%*sif (%s.%s) abort();\n", indent, "",
+ val, f->name);
+ else if (f->type->u.p->kind == TYPE_STRUCT
|| f->type->u.p->kind == TYPE_UNION
|| f->type->u.p->kind == TYPE_LANG_STRUCT)
fprintf (of, "%*sgt_ggc_m_%s (%s.%s);\n", indent, "",
============================================================