c-common.c: Include c-common.h, not c-lex.h or c-tree.h.

* c-common.c: Include c-common.h, not c-lex.h or c-tree.h.
	* c-common.h (flag_const_strings): Declare.
	(warn_format): Likewise.
	(flag_traditional): Likewise.
	(flag_isoc99): Likewise.
	(warn_parentheses): Likewise.
	(warn_conversion): Likewise.
	(C_TYPE_OBJECT_P): Likewise.
	(C_TYPE_INCOMPLETE_P): Likewise.
	(C_TYPE_FUNCTION_P): Likewise.
	(C_TYPE_OBJECT_OR_INCOMPLETE_P): Likewise.
	(C_EXP_ORIGINAL_CODE): Likewise.
	(build_unary_op): Likewise.
	(build_binary_op): Likewise.
	(lvalue_p): Likewise.
	(default_conversion): Likewise.
	(common_type): Likewise.
	* c-tree.h (C_TYPE_OBJECT_P): Remove.
	(C_TYPE_INCOMPLETE_P): Likewise.
	(C_TYPE_FUNCTION_P): Likewise.
	(C_TYPE_OBJECT_OR_INCOMPLETE_P): Likewise.
	(C_EXP_ORIGINAL_CODE): Likewise.
	(common_type): Likewise.
	(default_conversion): Likewise.
	(build_binary_op): Likewise.
	(build_unary_op): Likewise.
	(lvalue_p): Likewise.
	(flag_const_strings): Likewise.
	(warn_format): Likewise.
	(warn_conversion): Likewise.
	(flag_traditional): Likewise.
	(flag_isoc99): Likewise.
	(warn_parentheses): Likewise.

	* cp-tree.h (flag_const_strings): Remove.
	(warn_parentheses): Likewise.
	(warn_format): Likewise.
	(common_type): Likewise.
	(default_conversion): Likewise.
	(build_binary_op): Likewise.
	(cp_build_binary_op): New macro.
	* call.c (build_new_op): Use cp_build_binary_op instead of
	build_binary_op.
	* class.c (build_vtable_entry_ref): Likewise.
	* decl.c (expand_static_init): Likewise.
	(compute_array_index_type): Likewise.
	(build_enumerator): Likewise.
	* decl2.c (delete_sanity): Likewise.
	(start_static_initialization_or_destruction): Likewise.
	* error.c (dump_type_suffix): Likewise.
	* init.c (resolve_offset_ref): Likewise.
	(build_new): Likewise.
	(build_new_1): Likewise.
	(build_vec_delete_1): Likewise.
	(build_vec_init): Likewise.
	(build_delete): Likewise.
	* rtti.c (synthesize_tinfo_fn): Likewise.
	(synthesize_tinfo_var): Likewise.
	* search.c (expand_upcast_fixups): Likewise.
	(fixup_all_virtual_upcast_offsets): Likewise.
	* typeck.c (build_array_ref): Likewise.
	(get_member_function_from_ptrfunc): Likewise.
	(build_binary_op): Add parameter.
	(pointer_int_sum): Use cp_build_binary_op.
	(pointer_diff): Likewise.
	(build_modify_expr): Likewise.
	(get_delta_difference): Likewise.
	(build_ptrmemfunc): Likewise.

From-SVN: r34796
This commit is contained in:
Mark Mitchell 2000-06-30 00:26:03 +00:00 committed by Mark Mitchell
parent 6eaeeb553a
commit ab76ca54bb
15 changed files with 266 additions and 193 deletions

View File

@ -1,3 +1,39 @@
2000-06-29 Mark Mitchell <mark@codesourcery.com>
* c-common.c: Include c-common.h, not c-lex.h or c-tree.h.
* c-common.h (flag_const_strings): Declare.
(warn_format): Likewise.
(flag_traditional): Likewise.
(flag_isoc99): Likewise.
(warn_parentheses): Likewise.
(warn_conversion): Likewise.
(C_TYPE_OBJECT_P): Likewise.
(C_TYPE_INCOMPLETE_P): Likewise.
(C_TYPE_FUNCTION_P): Likewise.
(C_TYPE_OBJECT_OR_INCOMPLETE_P): Likewise.
(C_EXP_ORIGINAL_CODE): Likewise.
(build_unary_op): Likewise.
(build_binary_op): Likewise.
(lvalue_p): Likewise.
(default_conversion): Likewise.
(common_type): Likewise.
* c-tree.h (C_TYPE_OBJECT_P): Remove.
(C_TYPE_INCOMPLETE_P): Likewise.
(C_TYPE_FUNCTION_P): Likewise.
(C_TYPE_OBJECT_OR_INCOMPLETE_P): Likewise.
(C_EXP_ORIGINAL_CODE): Likewise.
(common_type): Likewise.
(default_conversion): Likewise.
(build_binary_op): Likewise.
(build_unary_op): Likewise.
(lvalue_p): Likewise.
(flag_const_strings): Likewise.
(warn_format): Likewise.
(warn_conversion): Likewise.
(flag_traditional): Likewise.
(flag_isoc99): Likewise.
(warn_parentheses): Likewise.
2000-06-29 James E. Wilson <wilson@cygnus.com>
* config/ia64/linux.h (LINK_SPEC): Change so.1 to so.2.

View File

@ -22,8 +22,7 @@ Boston, MA 02111-1307, USA. */
#include "config.h"
#include "system.h"
#include "tree.h"
#include "c-lex.h"
#include "c-tree.h"
#include "c-common.h"
#include "flags.h"
#include "toplev.h"
#include "output.h"

View File

@ -54,21 +54,6 @@ enum c_tree_index
CTI_MAX
};
extern tree c_global_trees[CTI_MAX];
typedef enum c_language_kind
{
clk_c, /* A dialect of C: K&R C, ANSI/ISO C89, C2000,
etc. */
clk_cplusplus, /* ANSI/ISO C++ */
clk_objective_c /* Objective C */
}
c_language_kind;
/* The variant of the C language being processed. Each C language
front-end defines this variable. */
extern c_language_kind c_language;
#define wchar_type_node c_global_trees[CTI_WCHAR_TYPE]
#define signed_wchar_type_node c_global_trees[CTI_SIGNED_WCHAR_TYPE]
#define unsigned_wchar_type_node c_global_trees[CTI_UNSIGNED_WCHAR_TYPE]
@ -98,6 +83,67 @@ extern c_language_kind c_language;
#define g77_longint_type_node c_global_trees[CTI_G77_LONGINT_TYPE]
#define g77_ulongint_type_node c_global_trees[CTI_G77_ULONGINT_TYPE]
extern tree c_global_trees[CTI_MAX];
typedef enum c_language_kind
{
clk_c, /* A dialect of C: K&R C, ANSI/ISO C89, C2000,
etc. */
clk_cplusplus, /* ANSI/ISO C++ */
clk_objective_c /* Objective C */
}
c_language_kind;
/* The variant of the C language being processed. Each C language
front-end defines this variable. */
extern c_language_kind c_language;
/* Nonzero means give string constants the type `const char *', rather
than `char *'. */
extern int flag_const_strings;
/* Warn about *printf or *scanf format/argument anomalies. */
extern int warn_format;
/* Nonzero means do some things the same way PCC does. */
extern int flag_traditional;
/* Nonzero means use the ISO C99 dialect of C. */
extern int flag_isoc99;
/* Nonzero means warn about suggesting putting in ()'s. */
extern int warn_parentheses;
/* Warn if a type conversion is done that might have confusing results. */
extern int warn_conversion;
/* C types are partitioned into three subsets: object, function, and
incomplete types. */
#define C_TYPE_OBJECT_P(type) \
(TREE_CODE (type) != FUNCTION_TYPE && TYPE_SIZE (type))
#define C_TYPE_INCOMPLETE_P(type) \
(TREE_CODE (type) != FUNCTION_TYPE && TYPE_SIZE (type) == 0)
#define C_TYPE_FUNCTION_P(type) \
(TREE_CODE (type) == FUNCTION_TYPE)
/* For convenience we define a single macro to identify the class of
object or incomplete types. */
#define C_TYPE_OBJECT_OR_INCOMPLETE_P(type) \
(!C_TYPE_FUNCTION_P (type))
/* Record in each node resulting from a binary operator
what operator was specified for it. */
#define C_EXP_ORIGINAL_CODE(exp) ((enum tree_code) TREE_COMPLEXITY (exp))
/* Pointer to function to generate the VAR_DECL for __FUNCTION__ etc.
ID is the identifier to use, NAME is the string.
TYPE_DEP indicates whether it depends on type of the function or not
@ -125,6 +171,7 @@ extern void constant_expression_warning PARAMS ((tree));
extern tree convert_and_check PARAMS ((tree, tree));
extern void overflow_warning PARAMS ((tree));
extern void unsigned_conversion_warning PARAMS ((tree, tree));
/* Read the rest of the current #-directive line. */
#if USE_CPPLIB
extern char *get_directive_line PARAMS ((void));
@ -164,7 +211,7 @@ extern tree build_va_arg PARAMS ((tree, tree));
extern int self_promoting_args_p PARAMS ((tree));
extern tree simple_type_promotes_to PARAMS ((tree));
/* These macros provide convenient access to the various _STMT nodes
created when parsing template declarations. */
@ -306,3 +353,20 @@ enum c_tree_code {
#undef DEFTREECODE
extern void add_c_tree_codes PARAMS ((void));
/* These functions must be defined by each front-end which implements
a variant of the C language. They are used in c-common.c. */
extern tree build_unary_op PARAMS ((enum tree_code,
tree, int));
extern tree build_binary_op PARAMS ((enum tree_code,
tree, tree, int));
extern int lvalue_p PARAMS ((tree));
extern tree default_conversion PARAMS ((tree));
/* Given two integer or real types, return the type for their sum.
Given two compatible ANSI C types, returns the merged type. */
extern tree common_type PARAMS ((tree, tree));

View File

@ -83,22 +83,6 @@ extern int pedantic;
nonzero if the definition of the type has already started. */
#define C_TYPE_BEING_DEFINED(type) TYPE_LANG_FLAG_0 (type)
/* C types are partitioned into three subsets: object, function, and
incomplete types. */
#define C_TYPE_OBJECT_P(type) \
(TREE_CODE (type) != FUNCTION_TYPE && TYPE_SIZE (type))
#define C_TYPE_FUNCTION_P(type) \
(TREE_CODE (type) == FUNCTION_TYPE)
#define C_TYPE_INCOMPLETE_P(type) \
(TREE_CODE (type) != FUNCTION_TYPE && TYPE_SIZE (type) == 0)
/* For convenience we define a single macro to identify the class of
object or incomplete types. */
#define C_TYPE_OBJECT_OR_INCOMPLETE_P(type) \
(!C_TYPE_FUNCTION_P (type))
/* In a RECORD_TYPE, a sorted array of the fields of the type. */
struct lang_type
{
@ -115,10 +99,6 @@ struct lang_type
#define C_TYPE_VARIABLE_SIZE(type) TYPE_LANG_FLAG_1 (type)
#define C_DECL_VARIABLE_SIZE(type) DECL_LANG_FLAG_0 (type)
/* Record in each node resulting from a binary operator
what operator was specified for it. */
#define C_EXP_ORIGINAL_CODE(exp) ((enum tree_code) TREE_COMPLEXITY (exp))
#if 0 /* Not used. */
/* Record whether a decl for a function or function pointer has
already been mentioned (in a warning) because it was called
@ -251,16 +231,12 @@ extern tree xref_tag PARAMS ((enum tree_code, tree));
/* in c-typeck.c */
extern tree require_complete_type PARAMS ((tree));
extern void incomplete_type_error PARAMS ((tree, tree));
/* Given two integer or real types, return the type for their sum.
Given two compatible ANSI C types, returns the merged type. */
extern tree common_type PARAMS ((tree, tree));
extern int comptypes PARAMS ((tree, tree));
extern tree c_sizeof PARAMS ((tree));
extern tree c_sizeof_nowarn PARAMS ((tree));
extern tree c_size_in_bytes PARAMS ((tree));
extern tree c_alignof PARAMS ((tree));
extern tree c_alignof_expr PARAMS ((tree));
extern tree default_conversion PARAMS ((tree));
extern tree build_component_ref PARAMS ((tree, tree));
extern tree build_indirect_ref PARAMS ((tree, const char *));
extern tree build_array_ref PARAMS ((tree, tree));
@ -268,11 +244,6 @@ extern tree build_external_ref PARAMS ((tree, int));
extern tree build_function_call PARAMS ((tree, tree));
extern tree parser_build_binary_op PARAMS ((enum tree_code,
tree, tree));
extern tree build_binary_op PARAMS ((enum tree_code,
tree, tree, int));
extern tree build_unary_op PARAMS ((enum tree_code,
tree, int));
extern int lvalue_p PARAMS ((tree));
extern int lvalue_or_else PARAMS ((tree, const char *));
extern void readonly_warning PARAMS ((tree, const char *));
extern int mark_addressable PARAMS ((tree));
@ -345,12 +316,6 @@ extern int flag_hosted;
extern int warn_implicit;
/* Nonzero means give string constants the type `const char *'
to get extra warnings from them. These warnings will be too numerous
to be useful, except in thoroughly ANSIfied programs. */
extern int flag_const_strings;
/* Nonzero means warn about sizeof (function) or addition/subtraction
of function pointers. */
@ -392,38 +357,18 @@ extern int warn_missing_noreturn;
extern int warn_traditional;
/* Warn about *printf or *scanf format/argument anomalies. */
extern int warn_format;
/* Warn about a subscript that has type char. */
extern int warn_char_subscripts;
/* Warn if a type conversion is done that might have confusing results. */
extern int warn_conversion;
/* Warn if main is suspicious. */
extern int warn_main;
/* Nonzero means do some things the same way PCC does. */
extern int flag_traditional;
/* Nonzero means use the ISO C99 dialect of C. */
extern int flag_isoc99;
/* Nonzero means to allow single precision math even if we're generally
being traditional. */
extern int flag_allow_single_precision;
/* Nonzero means warn about suggesting putting in ()'s. */
extern int warn_parentheses;
/* Warn if initializer is not completely bracketed. */
extern int warn_missing_braces;

View File

@ -1,3 +1,40 @@
2000-06-29 Mark Mitchell <mark@codesourcery.com>
* cp-tree.h (flag_const_strings): Remove.
(warn_parentheses): Likewise.
(warn_format): Likewise.
(common_type): Likewise.
(default_conversion): Likewise.
(build_binary_op): Likewise.
(cp_build_binary_op): New macro.
* call.c (build_new_op): Use cp_build_binary_op instead of
build_binary_op.
* class.c (build_vtable_entry_ref): Likewise.
* decl.c (expand_static_init): Likewise.
(compute_array_index_type): Likewise.
(build_enumerator): Likewise.
* decl2.c (delete_sanity): Likewise.
(start_static_initialization_or_destruction): Likewise.
* error.c (dump_type_suffix): Likewise.
* init.c (resolve_offset_ref): Likewise.
(build_new): Likewise.
(build_new_1): Likewise.
(build_vec_delete_1): Likewise.
(build_vec_init): Likewise.
(build_delete): Likewise.
* rtti.c (synthesize_tinfo_fn): Likewise.
(synthesize_tinfo_var): Likewise.
* search.c (expand_upcast_fixups): Likewise.
(fixup_all_virtual_upcast_offsets): Likewise.
* typeck.c (build_array_ref): Likewise.
(get_member_function_from_ptrfunc): Likewise.
(build_binary_op): Add parameter.
(pointer_int_sum): Use cp_build_binary_op.
(pointer_diff): Likewise.
(build_modify_expr): Likewise.
(get_delta_difference): Likewise.
(build_ptrmemfunc): Likewise.
2000-06-29 Nathan Sidwell <nathan@codesourcery.com>
* cp-tree.h (SET_DECL_ARTIFICIAL): Remove.

View File

@ -3444,7 +3444,7 @@ builtin:
case BIT_XOR_EXPR:
case TRUTH_ANDIF_EXPR:
case TRUTH_ORIF_EXPR:
return build_binary_op (code, arg1, arg2);
return cp_build_binary_op (code, arg1, arg2);
case CONVERT_EXPR:
case NEGATE_EXPR:

View File

@ -507,7 +507,7 @@ build_vtable_entry_ref (basetype, vtbl, idx)
i = build_c_cast (ptrdiff_type_node, build_unary_op (ADDR_EXPR, i, 0));
i2 = build_array_ref (vtbl, build_int_2(0,0));
i2 = build_c_cast (ptrdiff_type_node, build_unary_op (ADDR_EXPR, i2, 0));
i = build_binary_op (MINUS_EXPR, i, i2);
i = cp_build_binary_op (MINUS_EXPR, i, i2);
i = build_tree_list (build_string (1, "i"), i);
finish_asm_stmt (ridpointers[RID_VOLATILE],

View File

@ -1086,11 +1086,6 @@ extern int warn_ctor_dtor_privacy;
extern int warn_return_type;
/* Nonzero means give string constants the type `const char *', as mandated
by the standard. */
extern int flag_const_strings;
/* If non-NULL, dump the tree structure for the entire translation
unit to this file. */
@ -1106,10 +1101,6 @@ extern int warn_write_strings;
extern int warn_pointer_arith;
/* Nonzero means warn about suggesting putting in ()'s. */
extern int warn_parentheses;
/* Nonzero means warn about multiple (redundant) decls for the same single
variable or function. */
@ -1136,10 +1127,6 @@ extern int warn_char_subscripts;
extern int warn_cast_qual;
/* Warn about *printf or *scanf format/argument anomalies. */
extern int warn_format;
/* Nonzero means warn about non virtual destructors in classes that have
virtual functions. */
@ -4622,7 +4609,6 @@ extern tree complete_type_or_else PARAMS ((tree, tree));
extern int type_unknown_p PARAMS ((tree));
extern tree commonparms PARAMS ((tree, tree));
extern tree original_type PARAMS ((tree));
extern tree common_type PARAMS ((tree, tree));
extern int comp_except_specs PARAMS ((tree, tree, int));
extern int comptypes PARAMS ((tree, tree, int));
extern int comp_target_types PARAMS ((tree, tree, int));
@ -4639,7 +4625,6 @@ extern tree c_sizeof_nowarn PARAMS ((tree));
extern tree c_alignof PARAMS ((tree));
extern tree inline_conversion PARAMS ((tree));
extern tree decay_conversion PARAMS ((tree));
extern tree default_conversion PARAMS ((tree));
extern tree build_object_ref PARAMS ((tree, tree, tree));
extern tree build_component_ref_1 PARAMS ((tree, tree, int));
extern tree build_component_ref PARAMS ((tree, tree, tree, int));
@ -4654,9 +4639,7 @@ extern tree build_function_call PARAMS ((tree, tree));
extern tree build_function_call_maybe PARAMS ((tree, tree));
extern tree convert_arguments PARAMS ((tree, tree, tree, int));
extern tree build_x_binary_op PARAMS ((enum tree_code, tree, tree));
extern tree build_binary_op PARAMS ((enum tree_code, tree, tree));
extern tree build_x_unary_op PARAMS ((enum tree_code, tree));
extern tree build_unary_op PARAMS ((enum tree_code, tree, int));
extern tree unary_complex_lvalue PARAMS ((enum tree_code, tree));
extern int mark_addressable PARAMS ((tree));
extern tree build_x_conditional_expr PARAMS ((tree, tree, tree));
@ -4690,6 +4673,8 @@ extern tree type_after_usual_arithmetic_conversions PARAMS ((tree, tree));
extern tree composite_pointer_type PARAMS ((tree, tree, tree, tree,
const char*));
extern tree check_return_expr PARAMS ((tree));
#define cp_build_binary_op(code, arg1, arg2) \
build_binary_op(code, arg1, arg2, 1)
/* in typeck2.c */
extern tree error_not_base_type PARAMS ((tree, tree));

View File

@ -8607,8 +8607,8 @@ expand_static_init (decl, init)
/* Begin the conditional initialization. */
if_stmt = begin_if_stmt ();
finish_if_stmt_cond (build_binary_op (EQ_EXPR, temp,
integer_zero_node),
finish_if_stmt_cond (cp_build_binary_op (EQ_EXPR, temp,
integer_zero_node),
if_stmt);
then_clause = begin_compound_stmt (/*has_no_scope=*/0);
@ -9421,10 +9421,10 @@ compute_array_index_type (name, size)
/* Compute the index of the largest element in the array. It is
one less than the number of elements in the array. */
itype
= fold (build_binary_op (MINUS_EXPR,
cp_convert (ssizetype, size),
cp_convert (ssizetype,
integer_one_node)));
= fold (cp_build_binary_op (MINUS_EXPR,
cp_convert (ssizetype, size),
cp_convert (ssizetype,
integer_one_node)));
/* Check for variable-sized arrays. We allow such things as an
extension, even though they are not allowed in ANSI/ISO C++. */
@ -13377,9 +13377,9 @@ build_enumerator (name, value, enumtype)
/* The next value is the previous value ... */
prev_value = DECL_INITIAL (TREE_VALUE (TYPE_VALUES (enumtype)));
/* ... plus one. */
value = build_binary_op (PLUS_EXPR,
prev_value,
integer_one_node);
value = cp_build_binary_op (PLUS_EXPR,
prev_value,
integer_one_node);
if (tree_int_cst_lt (value, prev_value))
cp_error ("overflow in enumeration values at `%D'", name);

View File

@ -1266,7 +1266,7 @@ delete_sanity (exp, size, doing_vec, use_global_delete)
if (doing_vec == 2)
{
maxindex = build_binary_op (MINUS_EXPR, size, integer_one_node);
maxindex = cp_build_binary_op (MINUS_EXPR, size, integer_one_node);
pedwarn ("anachronistic use of array size in vector delete");
}
@ -3248,14 +3248,14 @@ start_static_initialization_or_destruction (decl, initp)
/* Conditionalize this initialization on being in the right priority
and being initializing/finalizing appropriately. */
sentry_if_stmt = begin_if_stmt ();
cond = build_binary_op (EQ_EXPR,
priority_decl,
build_int_2 (priority, 0));
cond = cp_build_binary_op (EQ_EXPR,
priority_decl,
build_int_2 (priority, 0));
init_cond = initp ? integer_one_node : integer_zero_node;
init_cond = build_binary_op (EQ_EXPR,
initialize_p_decl,
init_cond);
cond = build_binary_op (TRUTH_ANDIF_EXPR, cond, init_cond);
init_cond = cp_build_binary_op (EQ_EXPR,
initialize_p_decl,
init_cond);
cond = cp_build_binary_op (TRUTH_ANDIF_EXPR, cond, init_cond);
/* We need a sentry if this is an object with external linkage that
might be initialized in more than one place. (For example, a
@ -3275,19 +3275,21 @@ start_static_initialization_or_destruction (decl, initp)
only if the SENTRY is one, i.e., if we are the last to
destroy the variable. */
if (initp)
sentry_cond = build_binary_op (EQ_EXPR,
build_unary_op (PREINCREMENT_EXPR,
sentry,
/*noconvert=*/1),
integer_one_node);
sentry_cond
= cp_build_binary_op (EQ_EXPR,
build_unary_op (PREINCREMENT_EXPR,
sentry,
/*noconvert=*/1),
integer_one_node);
else
sentry_cond = build_binary_op (EQ_EXPR,
build_unary_op (PREDECREMENT_EXPR,
sentry,
/*noconvert=*/1),
integer_zero_node);
sentry_cond
= cp_build_binary_op (EQ_EXPR,
build_unary_op (PREDECREMENT_EXPR,
sentry,
/*noconvert=*/1),
integer_zero_node);
cond = build_binary_op (TRUTH_ANDIF_EXPR, cond, sentry_cond);
cond = cp_build_binary_op (TRUTH_ANDIF_EXPR, cond, sentry_cond);
}
finish_if_stmt_cond (cond, sentry_if_stmt);

View File

@ -725,7 +725,7 @@ dump_type_suffix (t, flags)
dump_expr (TREE_OPERAND (TYPE_MAX_VALUE (TYPE_DOMAIN (t)), 0),
flags & ~TS_EXPR_PARENS);
else
dump_expr (fold (build_binary_op
dump_expr (fold (cp_build_binary_op
(PLUS_EXPR, TYPE_MAX_VALUE (TYPE_DOMAIN (t)),
integer_one_node)),
flags & ~TS_EXPR_PARENS);

View File

@ -1899,9 +1899,9 @@ resolve_offset_ref (exp)
/* Pointer to data members are offset by one, so that a null
pointer with a real value of 0 is distinguishable from an
offset of the first member of a structure. */
member = build_binary_op (MINUS_EXPR, member,
cp_convert (ptrdiff_type_node,
integer_one_node));
member = cp_build_binary_op (MINUS_EXPR, member,
cp_convert (ptrdiff_type_node,
integer_one_node));
return build1 (INDIRECT_REF, type,
build (PLUS_EXPR, build_pointer_type (type),
@ -2047,7 +2047,7 @@ build_new (placement, decl, init, use_global_new)
nelts = integer_zero_node;
}
else
nelts = build_binary_op (MULT_EXPR, nelts, this_nelts);
nelts = cp_build_binary_op (MULT_EXPR, nelts, this_nelts);
}
}
else
@ -2258,7 +2258,7 @@ build_new_1 (exp)
while (TREE_CODE (true_type) == ARRAY_TYPE)
{
tree this_nelts = array_type_nelts_top (true_type);
nelts = build_binary_op (MULT_EXPR, nelts, this_nelts);
nelts = cp_build_binary_op (MULT_EXPR, nelts, this_nelts);
true_type = TREE_TYPE (true_type);
}
@ -2266,8 +2266,8 @@ build_new_1 (exp)
return error_mark_node;
if (has_array)
size = fold (build_binary_op (MULT_EXPR, size_in_bytes (true_type),
nelts));
size = fold (cp_build_binary_op (MULT_EXPR, size_in_bytes (true_type),
nelts));
else
size = size_in_bytes (type);
@ -2393,7 +2393,7 @@ build_new_1 (exp)
{
tree cookie, exp1;
rval = convert (string_type_node, rval); /* for ptr arithmetic */
rval = save_expr (build_binary_op (PLUS_EXPR, rval, cookie_size));
rval = save_expr (cp_build_binary_op (PLUS_EXPR, rval, cookie_size));
/* Store the number of bytes allocated so that we can know how
many elements to destroy later. */
if (flag_new_abi)
@ -2507,7 +2507,7 @@ build_new_1 (exp)
rval = (build_vec_init
(NULL_TREE,
save_expr (rval),
build_binary_op (MINUS_EXPR, nelts, integer_one_node),
cp_build_binary_op (MINUS_EXPR, nelts, integer_one_node),
init,
/*from_array=*/0));
@ -2581,8 +2581,8 @@ build_new_1 (exp)
if (check_new && alloc_expr)
{
/* Did we modify the storage? */
tree ifexp = build_binary_op (NE_EXPR, alloc_node,
integer_zero_node);
tree ifexp = cp_build_binary_op (NE_EXPR, alloc_node,
integer_zero_node);
rval = build_conditional_expr (ifexp, rval, alloc_node);
}
@ -2690,9 +2690,10 @@ build_vec_delete_1 (base, maxindex, type, auto_delete_vec, use_global_delete)
cookie_size = get_cookie_size (type);
base_tbd
= cp_convert (ptype,
build_binary_op (MINUS_EXPR,
cp_convert (string_type_node, base),
cookie_size));
cp_build_binary_op (MINUS_EXPR,
cp_convert (string_type_node,
base),
cookie_size));
/* True size with header. */
virtual_size = size_binop (PLUS_EXPR, virtual_size, cookie_size);
}
@ -3052,8 +3053,8 @@ build_vec_init (decl, base, maxindex, init, from_array)
finish_compound_stmt (/*has_no_scope=*/1, try_body);
finish_cleanup_try_block (try_block);
e = build_vec_delete_1 (rval,
build_binary_op (MINUS_EXPR, maxindex,
iterator),
cp_build_binary_op (MINUS_EXPR, maxindex,
iterator),
type,
sfk_base_destructor,
/*use_global_delete=*/0);
@ -3248,7 +3249,7 @@ build_delete (type, addr, auto_delete, flags, use_global_delete)
ifexp = integer_one_node;
else
/* Handle deleting a null pointer. */
ifexp = fold (build_binary_op (NE_EXPR, addr, integer_zero_node));
ifexp = fold (cp_build_binary_op (NE_EXPR, addr, integer_zero_node));
if (ifexp != integer_one_node)
expr = build (COND_EXPR, void_type_node,

View File

@ -1217,7 +1217,7 @@ synthesize_tinfo_fn (fndecl)
if_stmt = begin_if_stmt ();
tmp = cp_convert (build_pointer_type (ptr_type_node), addr);
tmp = build_indirect_ref (tmp, 0);
tmp = build_binary_op (EQ_EXPR, tmp, integer_zero_node);
tmp = cp_build_binary_op (EQ_EXPR, tmp, integer_zero_node);
finish_if_stmt_cond (tmp, if_stmt);
then_clause = begin_compound_stmt (/*has_no_scope=*/0);
@ -1651,10 +1651,10 @@ synthesize_tinfo_var (target_type, real_name)
is_simple = 0;
/* combine offset and flags into one field */
offset = build_binary_op (LSHIFT_EXPR, offset,
build_int_2 (8, 0));
offset = build_binary_op (BIT_IOR_EXPR, offset,
build_int_2 (flags, 0));
offset = cp_build_binary_op (LSHIFT_EXPR, offset,
build_int_2 (8, 0));
offset = cp_build_binary_op (BIT_IOR_EXPR, offset,
build_int_2 (flags, 0));
base_init = tree_cons (NULL_TREE, offset, base_init);
base_init = tree_cons (NULL_TREE, tinfo, base_init);
base_init = build (CONSTRUCTOR, NULL_TREE, NULL_TREE, base_init);

View File

@ -2664,8 +2664,8 @@ expand_upcast_fixups (binfo, addr, orig_addr, vbase, vbase_addr, t,
/* This is a upcast, so we have to add the offset for the
virtual base. */
old_delta = build_binary_op (PLUS_EXPR, old_delta,
TREE_VALUE (delta));
old_delta = cp_build_binary_op (PLUS_EXPR, old_delta,
TREE_VALUE (delta));
if (vc)
{
/* If this is set, we need to subtract out the delta
@ -2689,7 +2689,7 @@ expand_upcast_fixups (binfo, addr, orig_addr, vbase, vbase_addr, t,
/* This is a downcast, so we have to subtract the offset
for the virtual base. */
old_delta = build_binary_op (MINUS_EXPR, old_delta, vc_delta);
old_delta = cp_build_binary_op (MINUS_EXPR, old_delta, vc_delta);
}
TREE_READONLY (new_delta) = 0;
@ -2758,8 +2758,8 @@ fixup_all_virtual_upcast_offsets (decl_ptr)
if (!in_charge_node)
/* There's no need for any fixups in this case. */
return;
in_charge_node = build_binary_op (EQ_EXPR,
in_charge_node, integer_zero_node);
in_charge_node = cp_build_binary_op (EQ_EXPR,
in_charge_node, integer_zero_node);
if_stmt = begin_if_stmt ();
finish_if_stmt_cond (in_charge_node, if_stmt);

View File

@ -2502,7 +2502,7 @@ build_array_ref (array, idx)
return error_mark_node;
}
return build_indirect_ref (build_binary_op (PLUS_EXPR, ar, ind),
return build_indirect_ref (cp_build_binary_op (PLUS_EXPR, ar, ind),
"array indexing");
}
}
@ -2853,12 +2853,12 @@ get_member_function_from_ptrfunc (instance_ptrptr, function)
easier to make this change. */
if (flag_new_abi)
{
idx = build_binary_op (TRUNC_DIV_EXPR,
build1 (NOP_EXPR, vtable_index_type, e3),
TYPE_SIZE_UNIT (vtable_entry_type));
e1 = build_binary_op (BIT_AND_EXPR,
build1 (NOP_EXPR, vtable_index_type, e3),
integer_one_node);
idx = cp_build_binary_op (TRUNC_DIV_EXPR,
build1 (NOP_EXPR, vtable_index_type, e3),
TYPE_SIZE_UNIT (vtable_entry_type));
e1 = cp_build_binary_op (BIT_AND_EXPR,
build1 (NOP_EXPR, vtable_index_type, e3),
integer_one_node);
}
else
{
@ -2866,8 +2866,8 @@ get_member_function_from_ptrfunc (instance_ptrptr, function)
(build_component_ref (function,
index_identifier,
NULL_TREE, 0)));
e1 = build_binary_op (GE_EXPR, idx, integer_zero_node);
idx = build_binary_op (MINUS_EXPR, idx, integer_one_node);
e1 = cp_build_binary_op (GE_EXPR, idx, integer_zero_node);
idx = cp_build_binary_op (MINUS_EXPR, idx, integer_one_node);
}
vtbl = convert_pointer_to (ptr_type_node, instance);
@ -2891,7 +2891,7 @@ get_member_function_from_ptrfunc (instance_ptrptr, function)
{
aref = save_expr (aref);
delta = build_binary_op
delta = cp_build_binary_op
(PLUS_EXPR,
build_conditional_expr (e1,
build_component_ref (aref,
@ -3269,9 +3269,10 @@ build_x_binary_op (code, arg1, arg2)
multiple inheritance, and deal with pointer to member functions. */
tree
build_binary_op (code, orig_op0, orig_op1)
build_binary_op (code, orig_op0, orig_op1, convert_p)
enum tree_code code;
tree orig_op0, orig_op1;
int convert_p ATTRIBUTE_UNUSED;
{
tree op0, op1;
register enum tree_code code0, code1;
@ -3633,7 +3634,7 @@ build_binary_op (code, orig_op0, orig_op1)
result_type = TREE_TYPE (op0);
}
else if (TYPE_PTRMEMFUNC_P (type1) && null_ptr_cst_p (op0))
return build_binary_op (code, op1, op0);
return cp_build_binary_op (code, op1, op0);
else if (TYPE_PTRMEMFUNC_P (type0) && TYPE_PTRMEMFUNC_P (type1)
&& same_type_p (type0, type1))
{
@ -3664,14 +3665,14 @@ build_binary_op (code, orig_op0, orig_op1)
NULL_TREE, 0);
delta1 = build_component_ref (op1, delta_identifier,
NULL_TREE, 0);
e1 = build_binary_op (EQ_EXPR, delta0, delta1);
e2 = build_binary_op (NE_EXPR,
pfn0,
cp_convert (TREE_TYPE (pfn0),
integer_zero_node));
e1 = build_binary_op (TRUTH_ORIF_EXPR, e1, e2);
e1 = cp_build_binary_op (EQ_EXPR, delta0, delta1);
e2 = cp_build_binary_op (NE_EXPR,
pfn0,
cp_convert (TREE_TYPE (pfn0),
integer_zero_node));
e1 = cp_build_binary_op (TRUTH_ORIF_EXPR, e1, e2);
e2 = build (EQ_EXPR, boolean_type_node, pfn0, pfn1);
e = build_binary_op (TRUTH_ANDIF_EXPR, e2, e1);
e = cp_build_binary_op (TRUTH_ANDIF_EXPR, e2, e1);
}
else
{
@ -3691,21 +3692,23 @@ build_binary_op (code, orig_op0, orig_op1)
tree delta21 = DELTA2_FROM_PTRMEMFUNC (op1);
tree e3;
tree integer_neg_one_node
= build_binary_op (MINUS_EXPR, integer_zero_node,
integer_one_node);
e1 = build_binary_op (EQ_EXPR, index0, index1);
e2 = build_binary_op (NE_EXPR, index1, integer_neg_one_node);
e2 = build_binary_op (TRUTH_ANDIF_EXPR, e2,
build_binary_op (EQ_EXPR, delta20, delta21));
/* We can't use build_binary_op for this cmp because it would get
confused by the ptr to method types and think we want pmfs. */
= cp_build_binary_op (MINUS_EXPR, integer_zero_node,
integer_one_node);
e1 = cp_build_binary_op (EQ_EXPR, index0, index1);
e2 = cp_build_binary_op (NE_EXPR, index1, integer_neg_one_node);
e2 = cp_build_binary_op (TRUTH_ANDIF_EXPR, e2,
cp_build_binary_op (EQ_EXPR,
delta20, delta21));
/* We can't use build_binary_op for this cmp because it
would get confused by the ptr to method types and
think we want pmfs. */
e3 = build (EQ_EXPR, boolean_type_node, pfn0, pfn1);
e2 = build_binary_op (TRUTH_ORIF_EXPR, e2, e3);
e = build_binary_op (TRUTH_ANDIF_EXPR, e1, e2);
e2 = cp_build_binary_op (TRUTH_ORIF_EXPR, e2, e3);
e = cp_build_binary_op (TRUTH_ANDIF_EXPR, e1, e2);
}
if (code == EQ_EXPR)
return e;
return build_binary_op (EQ_EXPR, e, integer_zero_node);
return cp_build_binary_op (EQ_EXPR, e, integer_zero_node);
}
else if ((TYPE_PTRMEMFUNC_P (type0)
&& same_type_p (TYPE_PTRMEMFUNC_FN_TYPE (type0), type1))
@ -4161,7 +4164,7 @@ pointer_int_sum (resultcode, ptrop, intop)
enum tree_code subcode = resultcode;
if (TREE_CODE (intop) == MINUS_EXPR)
subcode = (subcode == PLUS_EXPR ? MINUS_EXPR : PLUS_EXPR);
ptrop = build_binary_op (subcode, ptrop, TREE_OPERAND (intop, 1));
ptrop = cp_build_binary_op (subcode, ptrop, TREE_OPERAND (intop, 1));
intop = TREE_OPERAND (intop, 0);
}
@ -4176,9 +4179,9 @@ pointer_int_sum (resultcode, ptrop, intop)
pointer type (actually unsigned integral). */
intop = cp_convert (result_type,
build_binary_op (MULT_EXPR, intop,
cp_convert (TREE_TYPE (intop),
size_exp)));
cp_build_binary_op (MULT_EXPR, intop,
cp_convert (TREE_TYPE (intop),
size_exp)));
/* Create the sum or difference. */
@ -4220,8 +4223,9 @@ pointer_diff (op0, op1, ptrtype)
/* First do the subtraction as integers;
then drop through to build the divide operator. */
op0 = build_binary_op (MINUS_EXPR, cp_convert (restype, op0),
cp_convert (restype, op1));
op0 = cp_build_binary_op (MINUS_EXPR,
cp_convert (restype, op0),
cp_convert (restype, op1));
/* This generates an error if op1 is a pointer to an incomplete type. */
if (!COMPLETE_TYPE_P (TREE_TYPE (TREE_TYPE (op1))))
@ -4652,8 +4656,8 @@ build_unary_op (code, xarg, noconvert)
{
if (mark_addressable (TREE_OPERAND (arg, 0)) == 0)
return error_mark_node;
return build_binary_op (PLUS_EXPR, TREE_OPERAND (arg, 0),
TREE_OPERAND (arg, 1));
return cp_build_binary_op (PLUS_EXPR, TREE_OPERAND (arg, 0),
TREE_OPERAND (arg, 1));
}
/* Uninstantiated types are all functions. Taking the
@ -5692,7 +5696,7 @@ build_modify_expr (lhs, modifycode, rhs)
else
{
lhs = stabilize_reference (lhs);
newrhs = build_binary_op (modifycode, lhs, rhs);
newrhs = cp_build_binary_op (modifycode, lhs, rhs);
if (newrhs == error_mark_node)
{
cp_error (" in evaluation of `%Q(%#T, %#T)'", modifycode,
@ -6016,9 +6020,9 @@ get_delta_difference (from, to, force)
delta = BINFO_OFFSET (binfo);
delta = cp_convert (ptrdiff_type_node, delta);
return build_binary_op (MINUS_EXPR,
integer_zero_node,
delta);
return cp_build_binary_op (MINUS_EXPR,
integer_zero_node,
delta);
}
if (binfo_from_vbase (binfo))
@ -6184,7 +6188,7 @@ build_ptrmemfunc (type, pfn, force)
n = get_delta_difference (TYPE_PTRMEMFUNC_OBJECT_TYPE (pfn_type),
TYPE_PTRMEMFUNC_OBJECT_TYPE (to_type),
force);
delta = build_binary_op (PLUS_EXPR, delta, n);
delta = cp_build_binary_op (PLUS_EXPR, delta, n);
return build_ptrmemfunc1 (to_type, delta, NULL_TREE, npfn,
NULL_TREE);
}
@ -6215,8 +6219,8 @@ build_ptrmemfunc (type, pfn, force)
n = get_delta_difference (TYPE_PTRMEMFUNC_OBJECT_TYPE (pfn_type),
TYPE_PTRMEMFUNC_OBJECT_TYPE (to_type),
force);
delta = build_binary_op (PLUS_EXPR, ndelta, n);
delta2 = build_binary_op (PLUS_EXPR, ndelta2, n);
delta = cp_build_binary_op (PLUS_EXPR, ndelta, n);
delta2 = cp_build_binary_op (PLUS_EXPR, ndelta2, n);
e1 = fold (build (GT_EXPR, boolean_type_node, idx, integer_zero_node));
/* If it's a virtual function, this is what we want. */