diff options
author | kan <kan@FreeBSD.org> | 2003-07-11 03:40:53 +0000 |
---|---|---|
committer | kan <kan@FreeBSD.org> | 2003-07-11 03:40:53 +0000 |
commit | b2a8872fbe1ec1c49094559ac7b78e6ea4ab7180 (patch) | |
tree | f6b0610f4a17fd26aa234354f050080f789861a4 /contrib/gcc/c-pragma.c | |
parent | 52e69d78eee5612ac195e0701a5cebe40d1ab0e1 (diff) | |
download | FreeBSD-src-b2a8872fbe1ec1c49094559ac7b78e6ea4ab7180.zip FreeBSD-src-b2a8872fbe1ec1c49094559ac7b78e6ea4ab7180.tar.gz |
Gcc 3.3.1-pre as of 2003-07-11.
Diffstat (limited to 'contrib/gcc/c-pragma.c')
-rw-r--r-- | contrib/gcc/c-pragma.c | 68 |
1 files changed, 25 insertions, 43 deletions
diff --git a/contrib/gcc/c-pragma.c b/contrib/gcc/c-pragma.c index a0a99fd..73c7d5f 100644 --- a/contrib/gcc/c-pragma.c +++ b/contrib/gcc/c-pragma.c @@ -29,7 +29,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "flags.h" #include "toplev.h" #include "ggc.h" -#include "c-lex.h" #include "c-common.h" #include "output.h" #include "tm_p.h" @@ -37,11 +36,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #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 *)); - -#ifdef HANDLE_PRAGMA_PACK_PUSH_POP -typedef struct align_stack +typedef struct align_stack GTY(()) { int alignment; unsigned int num_pushes; @@ -49,8 +44,12 @@ typedef struct align_stack struct align_stack * prev; } align_stack; -static struct align_stack * alignment_stack = NULL; +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 #pragma pack(push,<n>) is encountered, this stores the value of maximum_field_alignment in effect. When the final pop_alignment() @@ -62,7 +61,6 @@ static int default_alignment; static void push_alignment PARAMS ((int, tree)); static void pop_alignment PARAMS ((tree)); -static void mark_align_stack PARAMS ((void *)); /* Push an alignment value onto the stack. */ static void @@ -76,7 +74,7 @@ push_alignment (alignment, id) { align_stack * entry; - entry = (align_stack *) xmalloc (sizeof (* entry)); + entry = (align_stack *) ggc_alloc (sizeof (* entry)); entry->alignment = alignment; entry->num_pushes = 1; @@ -138,24 +136,9 @@ pop_alignment (id) else maximum_field_alignment = entry->alignment; - free (alignment_stack); - alignment_stack = entry; } } - -static void -mark_align_stack (p) - void *p; -{ - align_stack *a = *(align_stack **) p; - - while (a) - { - ggc_mark_tree (a->id); - a = a->prev; - } -} #else /* not HANDLE_PRAGMA_PACK_PUSH_POP */ #define SET_GLOBAL_ALIGNMENT(ALIGN) (maximum_field_alignment = (ALIGN)) #define push_alignment(ID, N) \ @@ -273,12 +256,12 @@ handle_pragma_pack (dummy) } #endif /* HANDLE_PRAGMA_PACK */ +static GTY(()) tree pending_weaks; + #ifdef HANDLE_PRAGMA_WEAK static void apply_pragma_weak PARAMS ((tree, tree)); static void handle_pragma_weak PARAMS ((cpp_reader *)); -static tree pending_weaks; - static void apply_pragma_weak (decl, value) tree decl, value; @@ -364,11 +347,11 @@ maybe_apply_pragma_weak (decl) } #endif /* HANDLE_PRAGMA_WEAK */ +static GTY(()) tree pending_redefine_extname; + #ifdef HANDLE_PRAGMA_REDEFINE_EXTNAME static void handle_pragma_redefine_extname PARAMS ((cpp_reader *)); -static tree pending_redefine_extname; - /* #pragma redefined_extname oldname newname */ static void handle_pragma_redefine_extname (dummy) @@ -400,16 +383,23 @@ handle_pragma_redefine_extname (dummy) SET_DECL_ASSEMBLER_NAME (decl, newname); } else - pending_redefine_extname - = tree_cons (oldname, newname, pending_redefine_extname); + add_to_renaming_pragma_list(oldname, newname); } #endif +void +add_to_renaming_pragma_list (oldname, newname) + tree oldname, newname; +{ + pending_redefine_extname + = tree_cons (oldname, newname, pending_redefine_extname); +} + +static GTY(()) tree pragma_extern_prefix; + #ifdef HANDLE_PRAGMA_EXTERN_PREFIX static void handle_pragma_extern_prefix PARAMS ((cpp_reader *)); -static tree pragma_extern_prefix; - /* #pragma extern_prefix "prefix" */ static void handle_pragma_extern_prefix (dummy) @@ -457,11 +447,10 @@ maybe_apply_renaming_pragma (decl, asmname) { const char *oldasmname = IDENTIFIER_POINTER (oldname) + 1; if (asmname && strcmp (TREE_STRING_POINTER (asmname), oldasmname) != 0) - warning ("asm declaration conficts with previous rename"); + warning ("asm declaration conflicts with previous rename"); asmname = build_string (strlen (oldasmname), oldasmname); } -#ifdef HANDLE_PRAGMA_REDEFINE_EXTNAME { tree *p, t; @@ -477,7 +466,6 @@ maybe_apply_renaming_pragma (decl, asmname) return build_string (strlen (newname), newname); } } -#endif #ifdef HANDLE_PRAGMA_EXTERN_PREFIX if (pragma_extern_prefix && !asmname) @@ -501,25 +489,19 @@ init_pragma () #endif #ifdef HANDLE_PRAGMA_WEAK cpp_register_pragma (parse_in, 0, "weak", handle_pragma_weak); - ggc_add_tree_root (&pending_weaks, 1); #endif #ifdef HANDLE_PRAGMA_REDEFINE_EXTNAME cpp_register_pragma (parse_in, 0, "redefine_extname", handle_pragma_redefine_extname); - ggc_add_tree_root (&pending_redefine_extname, 1); #endif #ifdef HANDLE_PRAGMA_EXTERN_PREFIX cpp_register_pragma (parse_in, 0, "extern_prefix", handle_pragma_extern_prefix); - ggc_add_tree_root (&pragma_extern_prefix, 1); #endif #ifdef REGISTER_TARGET_PRAGMAS REGISTER_TARGET_PRAGMAS (parse_in); #endif - -#ifdef HANDLE_PRAGMA_PACK_PUSH_POP - ggc_add_root (&alignment_stack, 1, sizeof(alignment_stack), - mark_align_stack); -#endif } + +#include "gt-c-pragma.h" |