summaryrefslogtreecommitdiff
path: root/gcc/c-common.c
diff options
context:
space:
mode:
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2000-10-18 18:59:04 +0000
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2000-10-18 18:59:04 +0000
commit0270ae907f04cec701159b8c8251f90edefee85b (patch)
tree549802a7ccf67eda822a46929952ac0b0725f86e /gcc/c-common.c
parentbb7fded7a79601528508b15986ab267806626af1 (diff)
downloadgcc-0270ae907f04cec701159b8c8251f90edefee85b.tar.gz
* c-common.h (flag_no_builtin): Declare.
(flag_no_nonansi_builtin): Likewise. (c_common_nodes_and_builtins): Change prototype. * c-common.c (flag_no_builtin): New variable. (flag_no_nonansi_builtin): Likewise. (c_common_nodes_and_builtins): Remove parameters. Adjust accordingly. * c-decl.c (flag_no_builtin): Remove. (flag_no_nonansi_builtin): Likewise. (init_decl_processing): Adjust call to c_common_nodes_and_builtins. * cp-tree.h (cp_tree_index): Add CPTI_FAKE_STD. (fake_std_node): New macro. * decl.c (in_std): Rename to ... (in_fake_std): ... this. (flag_no_builtin): Remove. (flag_no_nonansi_builtin): Likewise. (walk_namespaces_r): Use fake_std_node. (push_namespace): Use std_identifier. (pop_namespace): Use in_fake_std. (lookup_name_real): Use fake_std_node. (init_decl_processing): When -fhonor-std, create the `std' namespace. Don't create a dummy fake_std_node in that case. Adjust call to c_common_nodes_and_builtins. Use std_identifier. (builtin_function): Put builtins whose names don't begin with `_' in the std namespace. * decl2.c (flag_no_builtin): Remove. (flag_no_nonansi_builtin): Likewise. (set_decl_namespace): Use fake_std_node. (validate_nonmember_using_decl): Likewise. (do_using_directive): Likewise. (handle_class_head): Likewise. * dump.c (dequeue_and_dump): Likewise. * except.c (init_exception_processing): Use std_identifier. * init.c (build_member_call): Use fake_std_node. * rtti.c (init_rtti_processing): Use std_identifier. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@36940 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r--gcc/c-common.c52
1 files changed, 25 insertions, 27 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c
index 09cb949f439..086177f5860 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -140,6 +140,15 @@ cpp_reader parse_in;
tree c_global_trees[CTI_MAX];
+/* Nonzero means don't recognize the non-ANSI builtin functions. */
+
+int flag_no_builtin;
+
+/* Nonzero means don't recognize the non-ANSI builtin functions.
+ -ansi sets this. */
+
+int flag_no_nonansi_builtin;
+
/* Nonzero means warn about possible violations of sequence point rules. */
int warn_sequence_point;
@@ -4767,16 +4776,10 @@ lang_get_alias_set (t)
}
/* Build tree nodes and builtin functions common to both C and C++ language
- frontends.
- CPLUS_MODE is nonzero if we are called from the C++ frontend, we generate
- some stricter prototypes in that case.
- NO_BUILTINS and NO_NONANSI_BUILTINS contain the respective values of
- the language frontend flags flag_no_builtin and
- flag_no_nonansi_builtin. */
+ frontends. */
void
-c_common_nodes_and_builtins (cplus_mode, no_builtins, no_nonansi_builtins)
- int cplus_mode, no_builtins, no_nonansi_builtins;
+c_common_nodes_and_builtins ()
{
tree temp;
tree memcpy_ftype, memset_ftype, strlen_ftype;
@@ -4889,7 +4892,8 @@ c_common_nodes_and_builtins (cplus_mode, no_builtins, no_nonansi_builtins)
const_string_type_node,
endlink)));
- traditional_len_type_node = (flag_traditional && ! cplus_mode
+ traditional_len_type_node = ((flag_traditional &&
+ c_language != clk_cplusplus)
? integer_type_node : sizetype);
traditional_len_endlink = tree_cons (NULL_TREE, traditional_len_type_node,
endlink);
@@ -4908,9 +4912,11 @@ c_common_nodes_and_builtins (cplus_mode, no_builtins, no_nonansi_builtins)
tree_cons (NULL_TREE, const_string_type_node,
endlink));
- traditional_ptr_type_node = (flag_traditional && ! cplus_mode
+ traditional_ptr_type_node = ((flag_traditional &&
+ c_language != clk_cplusplus)
? string_type_node : ptr_type_node);
- traditional_cptr_type_node = (flag_traditional && ! cplus_mode
+ traditional_cptr_type_node = ((flag_traditional &&
+ c_language != clk_cplusplus)
? const_string_type_node : const_ptr_type_node);
/* Prototype for memcpy. */
@@ -4970,7 +4976,7 @@ c_common_nodes_and_builtins (cplus_mode, no_builtins, no_nonansi_builtins)
BUILT_IN_NORMAL, NULL_PTR);
/* Define alloca, ffs as builtins.
Declare _exit just to mark it as volatile. */
- if (! no_builtins && ! no_nonansi_builtins)
+ if (! flag_no_builtin && ! flag_no_nonansi_builtin)
{
#ifndef SMALL_STACK
temp = builtin_function ("alloca", ptr_ftype_sizetype,
@@ -5166,7 +5172,7 @@ c_common_nodes_and_builtins (cplus_mode, no_builtins, no_nonansi_builtins)
builtin_function ("__builtin_fputs", int_ftype_any,
BUILT_IN_FPUTS, BUILT_IN_NORMAL, "fputs");
- if (! no_builtins)
+ if (! flag_no_builtin)
{
builtin_function ("abs", int_ftype_int, BUILT_IN_ABS,
BUILT_IN_NORMAL, NULL_PTR);
@@ -5178,7 +5184,7 @@ c_common_nodes_and_builtins (cplus_mode, no_builtins, no_nonansi_builtins)
BUILT_IN_NORMAL, NULL_PTR);
builtin_function ("labs", long_ftype_long, BUILT_IN_LABS,
BUILT_IN_NORMAL, NULL_PTR);
- if (flag_isoc99 || ! no_nonansi_builtins)
+ if (flag_isoc99 || ! flag_no_nonansi_builtin)
builtin_function ("llabs", longlong_ftype_longlong, BUILT_IN_LLABS,
BUILT_IN_NORMAL, NULL_PTR);
builtin_function ("memcpy", memcpy_ftype, BUILT_IN_MEMCPY,
@@ -5225,27 +5231,19 @@ c_common_nodes_and_builtins (cplus_mode, no_builtins, no_nonansi_builtins)
/* Declare these functions volatile
to avoid spurious "control drops through" warnings. */
- temp = builtin_function ("abort", cplus_mode ? void_ftype : void_ftype_any,
+ temp = builtin_function ("abort",
+ ((c_language == clk_cplusplus)
+ ? void_ftype : void_ftype_any),
0, NOT_BUILT_IN, NULL_PTR);
TREE_THIS_VOLATILE (temp) = 1;
TREE_SIDE_EFFECTS (temp) = 1;
-#if 0 /* ??? The C++ frontend used to do this. */
- /* Well, these are actually ANSI, but we can't set DECL_BUILT_IN on
- them... */
- DECL_BUILT_IN_NONANSI (temp) = 1;
-#endif
temp = builtin_function ("exit",
- cplus_mode ? void_ftype_int : void_ftype_any,
+ ((c_language == clk_cplusplus)
+ ? void_ftype_int : void_ftype_any),
0, NOT_BUILT_IN, NULL_PTR);
TREE_THIS_VOLATILE (temp) = 1;
TREE_SIDE_EFFECTS (temp) = 1;
-
-#if 0 /* ??? The C++ frontend used to do this. */
- /* Well, these are actually ANSI, but we can't set DECL_BUILT_IN on
- them... */
- DECL_BUILT_IN_NONANSI (temp) = 1;
-#endif
}
#if 0