summaryrefslogtreecommitdiff
path: root/gcc/cp/decl.c
diff options
context:
space:
mode:
authorespindola <espindola@138bc75d-0d04-0410-961f-82ee72b054a4>2006-10-23 19:47:58 +0000
committerespindola <espindola@138bc75d-0d04-0410-961f-82ee72b054a4>2006-10-23 19:47:58 +0000
commit54be5d7e4e5aaee714a12a972bcf5ba628e5a239 (patch)
treedb6d791ee7b718303aa5b8c1eacfff0daaa114c9 /gcc/cp/decl.c
parentb356dfef7e02914fdff0b675eacf431c121c6e85 (diff)
downloadgcc-54be5d7e4e5aaee714a12a972bcf5ba628e5a239.tar.gz
* gcc/java/decl.c: Include langhooks.h.
(builtin_function): Remove. (java_init_decl_processing): Replace calls to builtin_function with add_builtin_function. * gcc/java/Make-lang.in (jc1$(exeext)): Depend on and link with attribs.o. (java/decl.o): Depend on langhooks.h. * gcc/java/java-tree.h (builtin_function): Remove. * gcc/tree.c (local_define_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/objc/objc-act.c (synth_module_prologue): Replace calls to builtin_function with add_builtin_function. (build_next_objc_exception_stuff): Replace calls to builtin_function with add_builtin_function. (build_objc_exception_stuff): Replace calls to builtin_function with add_builtin_function. * gcc/objcp/objcp-decl.h (objcp_builtin_function): Remove. * gcc/cp/decl.c (builtin_function_1): Move common code to add_builtin_function. (builtin_function): Rename to cxx_builtin_function. Change the signature. * gcc/cp/call.c: Include langhooks.h. (build_java_interface_fn_ref): Replace calls to builtin_function with add_builtin_function. * gcc/cp/Make-lang.in (cp/call.o): Depend on langhooks.h. * gcc/cp/cp-objcp-common.h (LANG_HOOKS_BUILTIN_FUNCTION): Define as cxx_builtin_function. * gcc/cp/cp-tree.h (builtin_function): Rename to cxx_builtin_function. Change the signature. * gcc/c-objc-common.h (LANG_HOOKS_BUILTIN_FUNCTION): Define as c_builtin_function. * gcc/c-tree.h (builtin_function): Rename to c_builtin_function. Change the signature. * gcc/ada/utils.c (builtin_function): Rename to gnat_builtin_function. Move common code to add_builtin_function. * gcc/ada/misc.c (LANG_HOOKS_BUILTIN_FUNCTION): Define as gnat_builtin_function. * gcc/ada/gigi.h (builtin_function): Rename to gnat_builtin_function. Change the signature. * gcc/c-decl.c (builtin_function): Rename to c_builtin_function. Move common code to add_builtin_function. * gcc/fortran/Make-lang.in (f951$(exeext)): Depend on and link with attribs.o. * gcc/fortran/trans.h (builtin_function): Rename to gfc_builtin_function. Change the signature. * gcc/fortran/f95-lang.c (LANG_HOOKS_BUILTIN_FUNCTION): Define as gfc_builtin_function. (builtin_function): Rename to gfc_builtin_function. Move common code to builtin_function. (gfc_define_builtin): Replace calls to builtin_function with gfc_define_builtin. * gcc/langhooks.c (add_builtin_function): New function. (lhd_builtin_function): New function. * gcc/langhooks.h (struct lang_hooks): Change the signature of builtin_function. (add_builtin_function): New function. * gcc/treelang/treetree.c (builtin_function): Remove. * gcc/tree-ssa-loop-prefetch.c (tree_ssa_prefetch_arrays): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/c-common.c (decl_builtin_1): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/alpha/alpha.c (alpha_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/frv/frv.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/s390/s390.c (s390_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/sparc/sparc.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/i386/i386.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/sh/sh.c (sh_media_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/c4x/c4x.c (c4x_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/stormy16/stormy16.c (xstormy16_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/iq2000/iq2000.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/ia64/ia64.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/rs6000/rs6000.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (altivec_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/arm/arm.c (def_mbuiltin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (arm_init_tls_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/mips/mips.c (mips_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/bfin/bfin.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/langhooks-def.h (lhd_builtin_function): New function. (LANG_HOOKS_BUILTIN_FUNCTION): Define as lhd_builtin_function. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@117981 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r--gcc/cp/decl.c86
1 files changed, 24 insertions, 62 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index a2a650d4ef3..17b209a1f14 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -64,10 +64,7 @@ static tree grok_reference_init (tree, tree, tree, tree *);
static tree grokvardecl (tree, tree, const cp_decl_specifier_seq *,
int, int, tree);
static void record_unknown_type (tree, const char *);
-static tree builtin_function_1 (const char *, tree, tree,
- enum built_in_function code,
- enum built_in_class cl, const char *,
- tree);
+static tree builtin_function_1 (tree, tree);
static tree build_library_fn_1 (tree, enum tree_code, tree);
static int member_function_or_else (tree, tree, enum overload_flags);
static void bad_specifiers (tree, const char *, int, int, int, int,
@@ -3359,90 +3356,55 @@ cp_make_fname_decl (tree id, int type_dep)
return decl;
}
-/* Make a definition for a builtin function named NAME in the current
- namespace, whose data type is TYPE and whose context is CONTEXT.
- TYPE should be a function type with argument types.
+static tree
+builtin_function_1 (tree decl, tree context)
+{
+ tree id = DECL_NAME (decl);
+ const char *name = IDENTIFIER_POINTER (id);
- CLASS and CODE tell later passes how to compile calls to this function.
- See tree.h for possible values.
+ retrofit_lang_decl (decl);
- If LIBNAME is nonzero, use that for DECL_ASSEMBLER_NAME,
- the name to be called if we can't opencode the function.
- If ATTRS is nonzero, use that for the function's attribute
- list. */
+ /* All nesting of C++ functions is lexical; there is never a "static
+ chain" in the sense of GNU C nested functions. */
+ DECL_NO_STATIC_CHAIN (decl) = 1;
+
+ DECL_ARTIFICIAL (decl) = 1;
+ SET_OVERLOADED_OPERATOR_CODE (decl, ERROR_MARK);
+ SET_DECL_LANGUAGE (decl, lang_c);
+ /* Runtime library routines are, by definition, available in an
+ external shared object. */
+ DECL_VISIBILITY (decl) = VISIBILITY_DEFAULT;
+ DECL_VISIBILITY_SPECIFIED (decl) = 1;
-static tree
-builtin_function_1 (const char* name,
- tree type,
- tree context,
- enum built_in_function code,
- enum built_in_class class,
- const char* libname,
- tree attrs)
-{
- tree decl = build_library_fn_1 (get_identifier (name), ERROR_MARK, type);
- DECL_BUILT_IN_CLASS (decl) = class;
- DECL_FUNCTION_CODE (decl) = code;
DECL_CONTEXT (decl) = context;
pushdecl (decl);
- /* Since `pushdecl' relies on DECL_ASSEMBLER_NAME instead of DECL_NAME,
- we cannot change DECL_ASSEMBLER_NAME until we have installed this
- function in the namespace. */
- if (libname)
- SET_DECL_ASSEMBLER_NAME (decl, get_identifier (libname));
-
/* A function in the user's namespace should have an explicit
declaration before it is used. Mark the built-in function as
anticipated but not actually declared. */
if (name[0] != '_' || name[1] != '_')
DECL_ANTICIPATED (decl) = 1;
- /* Possibly apply some default attributes to this built-in function. */
- if (attrs)
- decl_attributes (&decl, attrs, ATTR_FLAG_BUILT_IN);
- else
- decl_attributes (&decl, NULL_TREE, 0);
-
return decl;
}
-/* Entry point for the benefit of c_common_nodes_and_builtins.
-
- Make a definition for a builtin function named NAME and whose data type
- is TYPE. TYPE should be a function type with argument types. This
- function places the anticipated declaration in the global namespace
- and additionally in the std namespace if appropriate.
-
- CLASS and CODE tell later passes how to compile calls to this function.
- See tree.h for possible values.
-
- If LIBNAME is nonzero, use that for DECL_ASSEMBLER_NAME,
- the name to be called if we can't opencode the function.
-
- If ATTRS is nonzero, use that for the function's attribute
- list. */
-
tree
-builtin_function (const char* name,
- tree type,
- int code,
- enum built_in_class cl,
- const char* libname,
- tree attrs)
+cxx_builtin_function (tree decl)
{
+ tree id = DECL_NAME (decl);
+ const char *name = IDENTIFIER_POINTER (id);
+ tree decl2 = copy_node(decl);
/* All builtins that don't begin with an '_' should additionally
go in the 'std' namespace. */
if (name[0] != '_')
{
push_namespace (std_identifier);
- builtin_function_1 (name, type, std_node, code, cl, libname, attrs);
+ builtin_function_1 (decl, std_node);
pop_namespace ();
}
- return builtin_function_1 (name, type, NULL_TREE, code,
- cl, libname, attrs);
+ return builtin_function_1 (decl2, NULL_TREE);
}
/* Generate a FUNCTION_DECL with the typical flags for a runtime library