c-pragma patch to allow external renaming
Steve Ellcey
sje@cup.hp.com
Tue Jun 25 11:21:00 GMT 2002
This is a patch I would like to get approved in order to allow me to
implement some HP specific pragmas. This patch doesn't include the HP
specific code, only the c-pragma.[ch] changes I need to implement the HP
specific stuff. I sent this once before and have made a change based on
some feedback from Richard Henderson so that the new function
(add_to_renaming_pragma_list) is available regardless of whether or not
HANDLE_PRAGMA_REDEFINE_EXTNAME is defined.
If someone approves this patch my plan is to make an HP-UX IA64 specific
patch that implements the #builtin pragma and which will call this
function to give some builtin math functions different external names
based on the gcc -std= option that was specified. Without this patch I
will need to modify the HP headers in order to add redefine_extname
pragmas or the __asm__ keyword to redefine the external names. With
this change I can implement the #builtin pragma and not have to modify
the header files.
Steve Ellcey
sje@cup.hp.com
2002-06-21 Steve Ellcey <sje@cup.hp.com>
* gcc/c-pragma.h (add_to_renaming_pragma_list): New function.
* gcc/c-pragma.c (add_to_renaming_pragma_list): New function.
(handle_pragma_redefine_extname): Change to use new function.
(maybe_apply_renaming_pragma): Check pending_redefine_extname
list even if HANDLE_PRAGMA_REDEFINE_EXTNAME is not set.
*** gcc.orig/gcc/c-pragma.h Fri Jun 21 08:49:48 2002
--- gcc/gcc/c-pragma.h Tue Jun 25 10:56:05 2002
*************** extern void cpp_register_pragma PARAMS (
*** 62,67 ****
--- 62,68 ----
extern void maybe_apply_pragma_weak PARAMS ((tree));
extern tree maybe_apply_renaming_pragma PARAMS ((tree, tree));
+ extern void add_to_renaming_pragma_list PARAMS ((tree, tree));
extern int c_lex PARAMS ((tree *));
*** gcc.orig/gcc/c-pragma.c Fri Jun 21 08:49:45 2002
--- gcc/gcc/c-pragma.c Tue Jun 25 10:56:39 2002
*************** handle_pragma_redefine_extname (dummy)
*** 383,393 ****
SET_DECL_ASSEMBLER_NAME (decl, newname);
}
else
! pending_redefine_extname
! = tree_cons (oldname, newname, pending_redefine_extname);
}
#endif
static GTY(()) tree pragma_extern_prefix;
#ifdef HANDLE_PRAGMA_EXTERN_PREFIX
--- 383,400 ----
SET_DECL_ASSEMBLER_NAME (decl, newname);
}
else
! 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
*************** maybe_apply_renaming_pragma (decl, asmna
*** 444,450 ****
asmname = build_string (strlen (oldasmname), oldasmname);
}
- #ifdef HANDLE_PRAGMA_REDEFINE_EXTNAME
{
tree *p, t;
--- 451,456 ----
*************** maybe_apply_renaming_pragma (decl, asmna
*** 460,466 ****
return build_string (strlen (newname), newname);
}
}
- #endif
#ifdef HANDLE_PRAGMA_EXTERN_PREFIX
if (pragma_extern_prefix && !asmname)
--- 466,471 ----
More information about the Gcc-patches
mailing list