From 3fa8871b0c1386f60e32929c0aa307a99b5a5b65 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Wed, 17 May 2017 16:30:53 +0000 Subject: [PATCH] c-common.c: Use NULL_TREE instead of 0 where appropriate. * c-common.c: Use NULL_TREE instead of 0 where appropriate. * c-warn.c: Likewise. * c-decl.c: Use NULL_TREE instead of 0 where appropriate. * c-typeck.c: Likewise. From-SVN: r248161 --- gcc/c-family/ChangeLog | 5 ++ gcc/c-family/c-common.c | 10 +-- gcc/c-family/c-warn.c | 2 +- gcc/c/ChangeLog | 5 ++ gcc/c/c-decl.c | 144 ++++++++++++++++--------------- gcc/c/c-typeck.c | 187 ++++++++++++++++++++-------------------- 6 files changed, 184 insertions(+), 169 deletions(-) diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 428d733da1a..28c97be9a09 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,8 @@ +2017-05-17 Marek Polacek + + * c-common.c: Use NULL_TREE instead of 0 where appropriate. + * c-warn.c: Likewise. + 2017-05-17 Ville Voutilainen Implement new C++ intrinsics __is_assignable and __is_constructible. diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index a3c63d74d00..bd9b5124083 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -2989,7 +2989,7 @@ shorten_compare (location_t loc, tree *op0_ptr, tree *op1_ptr, if (!real1 && !real2 && integer_zerop (primop1) && TYPE_UNSIGNED (*restype_ptr)) { - tree value = 0; + tree value = NULL_TREE; /* All unsigned values are >= 0, so we warn. However, if OP0 is a constant that is >= 0, the signedness of the comparison isn't an issue, so suppress the @@ -3022,7 +3022,7 @@ shorten_compare (location_t loc, tree *op0_ptr, tree *op1_ptr, break; } - if (value != 0) + if (value != NULL_TREE) { /* Don't forget to evaluate PRIMOP0 if it has side effects. */ if (TREE_SIDE_EFFECTS (primop0)) @@ -4651,10 +4651,10 @@ self_promoting_args_p (const_tree parms) if (type == error_mark_node) continue; - if (TREE_CHAIN (t) == 0 && type != void_type_node) + if (TREE_CHAIN (t) == NULL_TREE && type != void_type_node) return 0; - if (type == 0) + if (type == NULL_TREE) return 0; if (TYPE_MAIN_VARIANT (type) == float_type_node) @@ -5579,7 +5579,7 @@ check_function_arguments_recurse (void (*callback) format_num = tree_to_uhwi (format_num_expr); for (inner_arg = first_call_expr_arg (param, &iter), i = 1; - inner_arg != 0; + inner_arg != NULL_TREE; inner_arg = next_call_expr_arg (&iter), i++) if (i == format_num) { diff --git a/gcc/c-family/c-warn.c b/gcc/c-family/c-warn.c index aa0cfa97b04..1b2a8d89ff2 100644 --- a/gcc/c-family/c-warn.c +++ b/gcc/c-family/c-warn.c @@ -1078,7 +1078,7 @@ match_case_to_enum_1 (tree key, tree type, tree label) else print_hex (key, buf); - if (TYPE_NAME (type) == 0) + if (TYPE_NAME (type) == NULL_TREE) warning_at (DECL_SOURCE_LOCATION (CASE_LABEL (label)), warn_switch ? OPT_Wswitch : OPT_Wswitch_enum, "case value %qs not in enumerated type", diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 6862b536dc6..8d5503107e9 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,8 @@ +2017-05-17 Marek Polacek + + * c-decl.c: Use NULL_TREE instead of 0 where appropriate. + * c-typeck.c: Likewise. + 2017-05-17 Marek Polacek PR sanitizer/80659 diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index bd6c4c1c9e0..55fc53e228b 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -809,7 +809,7 @@ c_finish_incomplete_decl (tree decl) if (type != error_mark_node && TREE_CODE (type) == ARRAY_TYPE && !DECL_EXTERNAL (decl) - && TYPE_DOMAIN (type) == 0) + && TYPE_DOMAIN (type) == NULL_TREE) { warning_at (DECL_SOURCE_LOCATION (decl), 0, "array %q+D assumed to have one element", decl); @@ -1146,7 +1146,7 @@ pop_scope (void) /* If appropriate, create a BLOCK to record the decls for the life of this function. */ - block = 0; + block = NULL_TREE; if (keep) { block = make_node (BLOCK); @@ -1157,7 +1157,7 @@ pop_scope (void) for (p = scope->blocks; p; p = BLOCK_CHAIN (p)) BLOCK_SUPERCONTEXT (p) = block; - BLOCK_VARS (block) = 0; + BLOCK_VARS (block) = NULL_TREE; } /* The TYPE_CONTEXTs for all of the tagged types belonging to this @@ -1230,9 +1230,9 @@ pop_scope (void) /* Propagate TREE_ADDRESSABLE from nested functions to their containing functions. */ if (!TREE_ASM_WRITTEN (p) - && DECL_INITIAL (p) != 0 + && DECL_INITIAL (p) != NULL_TREE && TREE_ADDRESSABLE (p) - && DECL_ABSTRACT_ORIGIN (p) != 0 + && DECL_ABSTRACT_ORIGIN (p) != NULL_TREE && DECL_ABSTRACT_ORIGIN (p) != p) TREE_ADDRESSABLE (DECL_ABSTRACT_ORIGIN (p)) = 1; if (!DECL_EXTERNAL (p) @@ -1677,18 +1677,18 @@ diagnose_arglist_conflict (tree newdecl, tree olddecl, if (TREE_CODE (olddecl) != FUNCTION_DECL || !comptypes (TREE_TYPE (oldtype), TREE_TYPE (newtype)) - || !((!prototype_p (oldtype) && DECL_INITIAL (olddecl) == 0) - || (!prototype_p (newtype) && DECL_INITIAL (newdecl) == 0))) + || !((!prototype_p (oldtype) && DECL_INITIAL (olddecl) == NULL_TREE) + || (!prototype_p (newtype) && DECL_INITIAL (newdecl) == NULL_TREE))) return; t = TYPE_ARG_TYPES (oldtype); - if (t == 0) + if (t == NULL_TREE) t = TYPE_ARG_TYPES (newtype); for (; t; t = TREE_CHAIN (t)) { tree type = TREE_VALUE (t); - if (TREE_CHAIN (t) == 0 + if (TREE_CHAIN (t) == NULL_TREE && TYPE_MAIN_VARIANT (type) != void_type_node) { inform (input_location, "a parameter list with an ellipsis can%'t match " @@ -2297,7 +2297,7 @@ static void merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype) { bool new_is_definition = (TREE_CODE (newdecl) == FUNCTION_DECL - && DECL_INITIAL (newdecl) != 0); + && DECL_INITIAL (newdecl) != NULL_TREE); bool new_is_prototype = (TREE_CODE (newdecl) == FUNCTION_DECL && prototype_p (TREE_TYPE (newdecl))); bool old_is_prototype = (TREE_CODE (olddecl) == FUNCTION_DECL @@ -2412,13 +2412,14 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype) && DECL_IN_SYSTEM_HEADER (newdecl) && !DECL_IN_SYSTEM_HEADER (olddecl)) DECL_SOURCE_LOCATION (olddecl) = DECL_SOURCE_LOCATION (newdecl); - else if ((DECL_INITIAL (newdecl) == 0 && DECL_INITIAL (olddecl) != 0) + else if ((DECL_INITIAL (newdecl) == NULL_TREE + && DECL_INITIAL (olddecl) != NULL_TREE) || (old_is_prototype && !new_is_prototype && !C_DECL_BUILTIN_PROTOTYPE (olddecl))) DECL_SOURCE_LOCATION (newdecl) = DECL_SOURCE_LOCATION (olddecl); /* Merge the initialization information. */ - if (DECL_INITIAL (newdecl) == 0) + if (DECL_INITIAL (newdecl) == NULL_TREE) DECL_INITIAL (newdecl) = DECL_INITIAL (olddecl); /* Merge the threadprivate attribute. */ @@ -2938,8 +2939,8 @@ pushdecl (tree x) if (DECL_EXTERNAL (x) || scope == file_scope) { tree type = TREE_TYPE (x); - tree vistype = 0; - tree visdecl = 0; + tree vistype = NULL_TREE; + tree visdecl = NULL_TREE; bool type_saved = false; if (b && !B_IN_EXTERNAL_SCOPE (b) && VAR_OR_FUNCTION_DECL_P (b->decl) @@ -3355,7 +3356,7 @@ tree implicitly_declare (location_t loc, tree functionid) { struct c_binding *b; - tree decl = 0; + tree decl = NULL_TREE; tree asmspec_tree; for (b = I_SYMBOL_BINDING (functionid); b; b = b->shadowed) @@ -3473,7 +3474,7 @@ undeclared_variable (location_t loc, tree id) static bool already = false; struct c_scope *scope; - if (current_function_decl == 0) + if (current_function_decl == NULL_TREE) { const char *guessed_id = lookup_name_fuzzy (id, FUZZY_LOOKUP_NAME); if (guessed_id) @@ -3767,7 +3768,7 @@ define_label (location_t location, tree name) if (label && ((DECL_CONTEXT (label) == current_function_decl - && DECL_INITIAL (label) != 0) + && DECL_INITIAL (label) != NULL_TREE) || (DECL_CONTEXT (label) != current_function_decl && C_DECLARED_LABEL_FLAG (label)))) { @@ -3960,10 +3961,10 @@ tag_exists_p (enum tree_code code, tree name) void pending_xref_error (void) { - if (pending_invalid_xref != 0) + if (pending_invalid_xref != NULL_TREE) error_at (pending_invalid_xref_location, "%qE defined as wrong kind of tag", pending_invalid_xref); - pending_invalid_xref = 0; + pending_invalid_xref = NULL_TREE; } @@ -4123,7 +4124,7 @@ c_init_decl_processing (void) /* Initialize reserved words for parser. */ c_parse_init (); - current_function_decl = 0; + current_function_decl = NULL_TREE; gcc_obstack_init (&parser_obstack); @@ -4297,7 +4298,7 @@ shadow_tag_warned (const struct c_declspecs *declspecs, int warned) warned = 1; } - if (name == 0) + if (name == NULL_TREE) { if (warned != 1 && code != ENUMERAL_TYPE) /* Empty unnamed enum OK */ @@ -4346,7 +4347,7 @@ shadow_tag_warned (const struct c_declspecs *declspecs, int warned) } else { - pending_invalid_xref = 0; + pending_invalid_xref = NULL_TREE; t = lookup_tag (code, name, true, NULL); if (t == NULL_TREE) @@ -4373,7 +4374,7 @@ shadow_tag_warned (const struct c_declspecs *declspecs, int warned) warned = 1; } - pending_invalid_xref = 0; + pending_invalid_xref = NULL_TREE; if (declspecs->inline_p) { @@ -4859,7 +4860,7 @@ finish_decl (tree decl, location_t init_loc, tree init, tree origtype, tree asmspec_tree) { tree type; - bool was_incomplete = (DECL_SIZE (decl) == 0); + bool was_incomplete = (DECL_SIZE (decl) == NULL_TREE); const char *asmspec = 0; /* If a name was specified, get the string. */ @@ -4877,12 +4878,12 @@ finish_decl (tree decl, location_t init_loc, tree init, record_types_used_by_current_var_decl (decl); /* If `start_decl' didn't like having an initialization, ignore it now. */ - if (init != 0 && DECL_INITIAL (decl) == 0) - init = 0; + if (init != NULL_TREE && DECL_INITIAL (decl) == NULL_TREE) + init = NULL_TREE; /* Don't crash if parm is initialized. */ if (TREE_CODE (decl) == PARM_DECL) - init = 0; + init = NULL_TREE; if (init) store_init_value (init_loc, decl, init, origtype); @@ -4895,7 +4896,7 @@ finish_decl (tree decl, location_t init_loc, tree init, /* Deduce size of array from initialization, if not already known. */ if (TREE_CODE (type) == ARRAY_TYPE - && TYPE_DOMAIN (type) == 0 + && TYPE_DOMAIN (type) == NULL_TREE && TREE_CODE (decl) != TYPE_DECL) { bool do_default @@ -4967,11 +4968,11 @@ finish_decl (tree decl, location_t init_loc, tree init, if (init && TREE_CODE (init) == CONSTRUCTOR) add_flexible_array_elts_to_size (decl, init); - if (DECL_SIZE (decl) == 0 && TREE_TYPE (decl) != error_mark_node + if (DECL_SIZE (decl) == NULL_TREE && TREE_TYPE (decl) != error_mark_node && COMPLETE_TYPE_P (TREE_TYPE (decl))) layout_decl (decl, 0); - if (DECL_SIZE (decl) == 0 + if (DECL_SIZE (decl) == NULL_TREE /* Don't give an error if we already gave one earlier. */ && TREE_TYPE (decl) != error_mark_node && (TREE_STATIC (decl) @@ -4980,7 +4981,7 @@ finish_decl (tree decl, location_t init_loc, tree init, Also if it is not file scope. Otherwise, let it through, but if it is not `extern' then it may cause an error message later. */ - ? (DECL_INITIAL (decl) != 0 + ? (DECL_INITIAL (decl) != NULL_TREE || !DECL_FILE_SCOPE_P (decl)) /* An automatic variable with an incomplete type is an error. */ @@ -4996,7 +4997,7 @@ finish_decl (tree decl, location_t init_loc, tree init, && TREE_STATIC (decl)) incomplete_record_decls.safe_push (decl); - if (is_global_var (decl) && DECL_SIZE (decl) != 0) + if (is_global_var (decl) && DECL_SIZE (decl) != NULL_TREE) { if (TREE_CODE (DECL_SIZE (decl)) == INTEGER_CST) constant_expression_warning (DECL_SIZE (decl)); @@ -5117,8 +5118,8 @@ finish_decl (tree decl, location_t init_loc, tree init, /* If we used it already as memory, it must stay in memory. */ TREE_ADDRESSABLE (decl) = TREE_USED (decl); /* If it's still incomplete now, no init will save it. */ - if (DECL_SIZE (decl) == 0) - DECL_INITIAL (decl) = 0; + if (DECL_SIZE (decl) == NULL_TREE) + DECL_INITIAL (decl) = NULL_TREE; } } } @@ -5647,7 +5648,7 @@ grokdeclarator (const struct c_declarator *declarator, default: gcc_unreachable (); } - if (name == 0) + if (name == NULL_TREE) { gcc_assert (decl_context == PARM || decl_context == TYPENAME @@ -7066,7 +7067,7 @@ grokparms (struct c_arg_info *arg_info, bool funcdef_flag) error ("%<[*]%> not allowed in other than function prototype scope"); } - if (arg_types == 0 && !funcdef_flag + if (arg_types == NULL_TREE && !funcdef_flag && !in_system_header_at (input_location)) warning (OPT_Wstrict_prototypes, "function declaration isn%'t a prototype"); @@ -7084,7 +7085,7 @@ grokparms (struct c_arg_info *arg_info, bool funcdef_flag) else arg_info->parms = arg_info->types; - arg_info->types = 0; + arg_info->types = NULL_TREE; return 0; } else @@ -7179,10 +7180,10 @@ get_parm_info (bool ellipsis, tree expr) struct c_binding *b = current_scope->bindings; struct c_arg_info *arg_info = build_arg_info (); - tree parms = 0; + tree parms = NULL_TREE; vec *tags = NULL; - tree types = 0; - tree others = 0; + tree types = NULL_TREE; + tree others = NULL_TREE; bool gave_void_only_once_err = false; @@ -7283,7 +7284,7 @@ get_parm_info (bool ellipsis, tree expr) (it's impossible to call such a function with type- correct arguments). An anonymous union parm type is meaningful as a GNU extension, so don't warn for that. */ - if (TREE_CODE (decl) != UNION_TYPE || b->id != 0) + if (TREE_CODE (decl) != UNION_TYPE || b->id != NULL_TREE) { if (b->id) /* The %s will be one of 'struct', 'union', or 'enum'. */ @@ -7686,7 +7687,7 @@ detect_field_duplicates_hash (tree fieldlist, tree_node **slot; for (x = fieldlist; x ; x = DECL_CHAIN (x)) - if ((y = DECL_NAME (x)) != 0) + if ((y = DECL_NAME (x)) != NULL_TREE) { slot = htab->find_slot (y, INSERT); if (*slot) @@ -7866,7 +7867,7 @@ finish_struct (location_t loc, tree t, tree fieldlist, tree attributes, /* If this type was previously laid out as a forward reference, make sure we lay it out again. */ - TYPE_SIZE (t) = 0; + TYPE_SIZE (t) = NULL_TREE; decl_attributes (&t, attributes, (int) ATTR_FLAG_TYPE_IN_PLACE); @@ -7874,13 +7875,13 @@ finish_struct (location_t loc, tree t, tree fieldlist, tree attributes, { for (x = fieldlist; x; x = DECL_CHAIN (x)) { - if (DECL_NAME (x) != 0) + if (DECL_NAME (x) != NULL_TREE) break; if (flag_isoc11 && RECORD_OR_UNION_TYPE_P (TREE_TYPE (x))) break; } - if (x == 0) + if (x == NULL_TREE) { if (TREE_CODE (t) == UNION_TYPE) { @@ -8018,7 +8019,7 @@ finish_struct (location_t loc, tree t, tree fieldlist, tree attributes, = c_build_bitfield_integer_type (width, TYPE_UNSIGNED (type)); SET_DECL_MODE (field, TYPE_MODE (TREE_TYPE (field))); } - DECL_INITIAL (field) = 0; + DECL_INITIAL (field) = NULL_TREE; } else if (TYPE_REVERSE_STORAGE_ORDER (t) && TREE_CODE (field) == FIELD_DECL @@ -8218,7 +8219,7 @@ start_enum (location_t loc, struct c_enum_contents *the_enum, tree name) C_TYPE_BEING_DEFINED (enumtype) = 1; - if (TYPE_VALUES (enumtype) != 0) + if (TYPE_VALUES (enumtype) != NULL_TREE) { /* This enum is a named one that has been declared already. */ error_at (loc, "redeclaration of %", name); @@ -8227,7 +8228,7 @@ start_enum (location_t loc, struct c_enum_contents *the_enum, tree name) /* Completely replace its old definition. The old enumerators remain defined, however. */ - TYPE_VALUES (enumtype) = 0; + TYPE_VALUES (enumtype) = NULL_TREE; } the_enum->enum_next_value = integer_zero_node; @@ -8260,7 +8261,7 @@ tree finish_enum (tree enumtype, tree values, tree attributes) { tree pair, tem; - tree minnode = 0, maxnode = 0; + tree minnode = NULL_TREE, maxnode = NULL_TREE; int precision; signop sign; bool toplevel = (file_scope == current_scope); @@ -8326,7 +8327,7 @@ finish_enum (tree enumtype, tree values, tree attributes) TYPE_MAX_VALUE (enumtype) = TYPE_MAX_VALUE (tem); TYPE_UNSIGNED (enumtype) = TYPE_UNSIGNED (tem); SET_TYPE_ALIGN (enumtype, TYPE_ALIGN (tem)); - TYPE_SIZE (enumtype) = 0; + TYPE_SIZE (enumtype) = NULL_TREE; TYPE_PRECISION (enumtype) = TYPE_PRECISION (tem); layout_type (enumtype); @@ -8421,17 +8422,17 @@ build_enumerator (location_t decl_loc, location_t loc, /* Validate and default VALUE. */ - if (value != 0) + if (value != NULL_TREE) { /* Don't issue more errors for error_mark_node (i.e. an undeclared identifier) - just ignore the value expression. */ if (value == error_mark_node) - value = 0; + value = NULL_TREE; else if (!INTEGRAL_TYPE_P (TREE_TYPE (value))) { error_at (loc, "enumerator value for %qE is not an integer constant", name); - value = 0; + value = NULL_TREE; } else { @@ -8447,7 +8448,7 @@ build_enumerator (location_t decl_loc, location_t loc, { error ("enumerator value for %qE is not an integer constant", name); - value = 0; + value = NULL_TREE; } else { @@ -8460,7 +8461,7 @@ build_enumerator (location_t decl_loc, location_t loc, /* Default based on previous value. */ /* It should no longer be possible to have NON_LVALUE_EXPR in the default. */ - if (value == 0) + if (value == NULL_TREE) { value = the_enum->enum_next_value; if (the_enum->enum_overflow) @@ -8546,7 +8547,7 @@ start_function (struct c_declspecs *declspecs, struct c_declarator *declarator, /* If the declarator is not suitable for a function definition, cause a syntax error. */ - if (decl1 == 0 + if (decl1 == NULL_TREE || TREE_CODE (decl1) != FUNCTION_DECL) return 0; @@ -8594,20 +8595,21 @@ start_function (struct c_declspecs *declspecs, struct c_declarator *declarator, DECL_INITIAL (decl1) = error_mark_node; /* A nested function is not global. */ - if (current_function_decl != 0) + if (current_function_decl != NULL_TREE) TREE_PUBLIC (decl1) = 0; /* If this definition isn't a prototype and we had a prototype declaration before, copy the arg type info from that prototype. */ old_decl = lookup_name_in_scope (DECL_NAME (decl1), current_scope); if (old_decl && TREE_CODE (old_decl) != FUNCTION_DECL) - old_decl = 0; + old_decl = NULL_TREE; current_function_prototype_locus = UNKNOWN_LOCATION; current_function_prototype_built_in = false; current_function_prototype_arg_types = NULL_TREE; if (!prototype_p (TREE_TYPE (decl1))) { - if (old_decl != 0 && TREE_CODE (TREE_TYPE (old_decl)) == FUNCTION_TYPE + if (old_decl != NULL_TREE + && TREE_CODE (TREE_TYPE (old_decl)) == FUNCTION_TYPE && comptypes (TREE_TYPE (TREE_TYPE (decl1)), TREE_TYPE (TREE_TYPE (old_decl)))) { @@ -8676,7 +8678,7 @@ start_function (struct c_declspecs *declspecs, struct c_declarator *declarator, /* Optionally warn of any def with no previous prototype if the function has already been used. */ else if (warn_missing_prototypes - && old_decl != 0 + && old_decl != NULL_TREE && old_decl != error_mark_node && TREE_USED (old_decl) && !prototype_p (TREE_TYPE (old_decl))) @@ -8685,7 +8687,7 @@ start_function (struct c_declspecs *declspecs, struct c_declarator *declarator, /* Optionally warn of any global def with no previous declaration. */ else if (warn_missing_declarations && TREE_PUBLIC (decl1) - && old_decl == 0 + && old_decl == NULL_TREE && !MAIN_NAME_P (DECL_NAME (decl1)) && !DECL_DECLARED_INLINE_P (decl1)) warning_at (loc, OPT_Wmissing_declarations, @@ -8694,7 +8696,7 @@ start_function (struct c_declspecs *declspecs, struct c_declarator *declarator, /* Optionally warn of any def with no previous declaration if the function has already been used. */ else if (warn_missing_declarations - && old_decl != 0 + && old_decl != NULL_TREE && old_decl != error_mark_node && TREE_USED (old_decl) && C_DECL_IMPLICIT (old_decl)) @@ -8838,11 +8840,11 @@ store_parm_decls_oldstyle (tree fndecl, const struct c_arg_info *arg_info) decl in the appropriate TREE_PURPOSE slot of the parmids chain. */ for (parm = parmids; parm; parm = TREE_CHAIN (parm)) { - if (TREE_VALUE (parm) == 0) + if (TREE_VALUE (parm) == NULL_TREE) { error_at (DECL_SOURCE_LOCATION (fndecl), "parameter name missing from parameter list"); - TREE_PURPOSE (parm) = 0; + TREE_PURPOSE (parm) = NULL_TREE; continue; } @@ -8866,7 +8868,7 @@ store_parm_decls_oldstyle (tree fndecl, const struct c_arg_info *arg_info) { error_at (DECL_SOURCE_LOCATION (decl), "multiple parameters named %qD", decl); - TREE_PURPOSE (parm) = 0; + TREE_PURPOSE (parm) = NULL_TREE; continue; } /* If the declaration says "void", complain and turn it into @@ -8948,7 +8950,7 @@ store_parm_decls_oldstyle (tree fndecl, const struct c_arg_info *arg_info) /* Chain the declarations together in the order of the list of names. Store that chain in the function decl, replacing the list of names. Update the current scope to match. */ - DECL_ARGUMENTS (fndecl) = 0; + DECL_ARGUMENTS (fndecl) = NULL_TREE; for (parm = parmids; parm; parm = TREE_CHAIN (parm)) if (TREE_PURPOSE (parm)) @@ -8964,7 +8966,7 @@ store_parm_decls_oldstyle (tree fndecl, const struct c_arg_info *arg_info) DECL_CHAIN (last) = TREE_PURPOSE (parm); last = TREE_PURPOSE (parm); } - DECL_CHAIN (last) = 0; + DECL_CHAIN (last) = NULL_TREE; } /* If there was a previous prototype, @@ -9068,14 +9070,14 @@ store_parm_decls_oldstyle (tree fndecl, const struct c_arg_info *arg_info) } } } - TYPE_ACTUAL_ARG_TYPES (TREE_TYPE (fndecl)) = 0; + TYPE_ACTUAL_ARG_TYPES (TREE_TYPE (fndecl)) = NULL_TREE; } /* Otherwise, create a prototype that would match. */ else { - tree actual = 0, last = 0, type; + tree actual = NULL_TREE, last = NULL_TREE, type; for (parm = DECL_ARGUMENTS (fndecl); parm; parm = DECL_CHAIN (parm)) { @@ -9558,7 +9560,7 @@ c_pop_function_context (void) /* But DECL_INITIAL must remain nonzero so we know this was an actual function definition. */ DECL_INITIAL (current_function_decl) = error_mark_node; - DECL_ARGUMENTS (current_function_decl) = 0; + DECL_ARGUMENTS (current_function_decl) = NULL_TREE; } c_stmt_tree = p->base.x_stmt_tree; @@ -11122,7 +11124,7 @@ c_write_global_declarations_1 (tree globals) standard's definition of "used", and set TREE_NO_WARNING so that check_global_declaration doesn't repeat the check. */ if (TREE_CODE (decl) == FUNCTION_DECL - && DECL_INITIAL (decl) == 0 + && DECL_INITIAL (decl) == NULL_TREE && DECL_EXTERNAL (decl) && !TREE_PUBLIC (decl)) { diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c index 1edf521f410..4c75c3237bd 100644 --- a/gcc/c/c-typeck.c +++ b/gcc/c/c-typeck.c @@ -216,7 +216,7 @@ c_incomplete_type_error (location_t loc, const_tree value, const_tree type) if (TREE_CODE (type) == ERROR_MARK) return; - if (value != 0 && (VAR_P (value) || TREE_CODE (value) == PARM_DECL)) + if (value != NULL_TREE && (VAR_P (value) || TREE_CODE (value) == PARM_DECL)) error_at (loc, "%qD has an incomplete type %qT", value, type); else { @@ -422,8 +422,8 @@ composite_type (tree t1, tree t2) t1_complete = COMPLETE_TYPE_P (t1); t2_complete = COMPLETE_TYPE_P (t2); - d1_zero = d1 == 0 || !TYPE_MAX_VALUE (d1); - d2_zero = d2 == 0 || !TYPE_MAX_VALUE (d2); + d1_zero = d1 == NULL_TREE || !TYPE_MAX_VALUE (d1); + d2_zero = d2 == NULL_TREE || !TYPE_MAX_VALUE (d2); d1_variable = (!d1_zero && (TREE_CODE (TYPE_MIN_VALUE (d1)) != INTEGER_CST @@ -505,13 +505,13 @@ composite_type (tree t1, tree t2) return build_type_attribute_variant (t2, attributes); /* Simple way if one arg fails to specify argument types. */ - if (TYPE_ARG_TYPES (t1) == 0) + if (TYPE_ARG_TYPES (t1) == NULL_TREE) { t1 = build_function_type (valtype, TYPE_ARG_TYPES (t2)); t1 = build_type_attribute_variant (t1, attributes); return qualify_type (t1, t2); } - if (TYPE_ARG_TYPES (t2) == 0) + if (TYPE_ARG_TYPES (t2) == NULL_TREE) { t1 = build_function_type (valtype, TYPE_ARG_TYPES (t1)); t1 = build_type_attribute_variant (t1, attributes); @@ -536,12 +536,12 @@ composite_type (tree t1, tree t2) { /* A null type means arg type is not specified. Take whatever the other function type has. */ - if (TREE_VALUE (p1) == 0) + if (TREE_VALUE (p1) == NULL_TREE) { TREE_VALUE (n) = TREE_VALUE (p2); goto parm_done; } - if (TREE_VALUE (p2) == 0) + if (TREE_VALUE (p2) == NULL_TREE) { TREE_VALUE (n) = TREE_VALUE (p1); goto parm_done; @@ -1178,10 +1178,10 @@ comptypes_internal (const_tree type1, const_tree type2, bool *enum_and_int_p, return 0; if (different_types_p != NULL - && (d1 == 0) != (d2 == 0)) + && (d1 == NULL_TREE) != (d2 == NULL_TREE)) *different_types_p = true; /* Sizes must match unless one is missing or variable. */ - if (d1 == 0 || d2 == 0 || d1 == d2) + if (d1 == NULL_TREE || d2 == NULL_TREE || d1 == d2) break; d1_zero = !TYPE_MAX_VALUE (d1); @@ -1642,13 +1642,13 @@ function_types_compatible_p (const_tree f1, const_tree f2, args2 = TYPE_ARG_TYPES (f2); if (different_types_p != NULL - && (args1 == 0) != (args2 == 0)) + && (args1 == NULL_TREE) != (args2 == NULL_TREE)) *different_types_p = true; /* An unspecified parmlist matches any specified parmlist whose argument types don't need default promotions. */ - if (args1 == 0) + if (args1 == NULL_TREE) { if (!self_promoting_args_p (args2)) return 0; @@ -1661,7 +1661,7 @@ function_types_compatible_p (const_tree f1, const_tree f2, val = 2; return val; } - if (args2 == 0) + if (args2 == NULL_TREE) { if (!self_promoting_args_p (args1)) return 0; @@ -1694,11 +1694,11 @@ type_lists_compatible_p (const_tree args1, const_tree args2, while (1) { tree a1, mv1, a2, mv2; - if (args1 == 0 && args2 == 0) + if (args1 == NULL_TREE && args2 == NULL_TREE) return val; /* If one list is shorter than the other, they fail to match. */ - if (args1 == 0 || args2 == 0) + if (args1 == NULL_TREE || args2 == NULL_TREE) return 0; mv1 = a1 = TREE_VALUE (args1); mv2 = a2 = TREE_VALUE (args2); @@ -1717,14 +1717,14 @@ type_lists_compatible_p (const_tree args1, const_tree args2, but nothing is specified about what type it has. So match anything that self-promotes. */ if (different_types_p != NULL - && (a1 == 0) != (a2 == 0)) + && (a1 == NULL_TREE) != (a2 == NULL_TREE)) *different_types_p = true; - if (a1 == 0) + if (a1 == NULL_TREE) { if (c_type_promotes_to (a2) != a2) return 0; } - else if (a2 == 0) + else if (a2 == NULL_TREE) { if (c_type_promotes_to (a1) != a1) return 0; @@ -1741,7 +1741,7 @@ type_lists_compatible_p (const_tree args1, const_tree args2, /* Allow wait (union {union wait *u; int *i} *) and wait (union wait *) to be compatible. */ if (TREE_CODE (a1) == UNION_TYPE - && (TYPE_NAME (a1) == 0 + && (TYPE_NAME (a1) == NULL_TREE || TYPE_TRANSPARENT_AGGR (a1)) && TREE_CODE (TYPE_SIZE (a1)) == INTEGER_CST && tree_int_cst_equal (TYPE_SIZE (a1), @@ -1762,11 +1762,11 @@ type_lists_compatible_p (const_tree args1, const_tree args2, different_types_p)) break; } - if (memb == 0) + if (memb == NULL_TREE) return 0; } else if (TREE_CODE (a2) == UNION_TYPE - && (TYPE_NAME (a2) == 0 + && (TYPE_NAME (a2) == NULL_TREE || TYPE_TRANSPARENT_AGGR (a2)) && TREE_CODE (TYPE_SIZE (a2)) == INTEGER_CST && tree_int_cst_equal (TYPE_SIZE (a2), @@ -1787,7 +1787,7 @@ type_lists_compatible_p (const_tree args1, const_tree args2, different_types_p)) break; } - if (memb == 0) + if (memb == NULL_TREE) return 0; } else @@ -1831,11 +1831,11 @@ decl_constant_value (tree decl) if (/* Don't change a variable array bound or initial value to a constant in a place where a variable is invalid. Note that DECL_INITIAL isn't valid for a PARM_DECL. */ - current_function_decl != 0 + current_function_decl != NULL_TREE && TREE_CODE (decl) != PARM_DECL && !TREE_THIS_VOLATILE (decl) && TREE_READONLY (decl) - && DECL_INITIAL (decl) != 0 + && DECL_INITIAL (decl) != NULL_TREE && TREE_CODE (DECL_INITIAL (decl)) != ERROR_MARK /* This is invalid if initial value is not constant. If it has either a function call, a memory reference, @@ -2777,7 +2777,7 @@ build_external_ref (location_t loc, tree id, int fun, tree *type) { if (!in_sizeof && !in_typeof) C_DECL_USED (ref) = 1; - else if (DECL_INITIAL (ref) == 0 + else if (DECL_INITIAL (ref) == NULL_TREE && DECL_EXTERNAL (ref) && !TREE_PUBLIC (ref)) record_maybe_used_decl (ref); @@ -2800,20 +2800,20 @@ build_external_ref (location_t loc, tree id, int fun, tree *type) ref = DECL_INITIAL (ref); TREE_CONSTANT (ref) = 1; } - else if (current_function_decl != 0 + else if (current_function_decl != NULL_TREE && !DECL_FILE_SCOPE_P (current_function_decl) && (VAR_OR_FUNCTION_DECL_P (ref) || TREE_CODE (ref) == PARM_DECL)) { tree context = decl_function_context (ref); - if (context != 0 && context != current_function_decl) + if (context != NULL_TREE && context != current_function_decl) DECL_NONLOCAL (ref) = 1; } /* C99 6.7.4p3: An inline definition of a function with external linkage ... shall not contain a reference to an identifier with internal linkage. */ - else if (current_function_decl != 0 + else if (current_function_decl != NULL_TREE && DECL_DECLARED_INLINE_P (current_function_decl) && DECL_EXTERNAL (current_function_decl) && VAR_OR_FUNCTION_DECL_P (ref) @@ -3003,7 +3003,7 @@ build_function_call_vec (location_t loc, vec arg_loc, tree function, vec *params, vec *origtypes) { - tree fntype, fundecl = 0; + tree fntype, fundecl = NULL_TREE; tree name = NULL_TREE, result; tree tem; int nargs; @@ -3337,7 +3337,7 @@ convert_arguments (location_t loc, vec arg_loc, tree typelist, } } - if (type != 0) + if (type != NULL_TREE) { /* Formal parm type is specified by a function prototype. */ @@ -3552,7 +3552,7 @@ convert_arguments (location_t loc, vec arg_loc, tree typelist, gcc_assert (parmnum == vec_safe_length (values)); - if (typetail != 0 && TREE_VALUE (typetail) != void_type_node) + if (typetail != NULL_TREE && TREE_VALUE (typetail) != void_type_node) { error_at (loc, "too few arguments to function %qE", function); inform_declaration (fundecl); @@ -4162,7 +4162,7 @@ build_unary_op (location_t location, enum tree_code code, tree xarg, { /* No default_conversion here. It causes trouble for ADDR_EXPR. */ tree arg = xarg; - tree argtype = 0; + tree argtype = NULL_TREE; enum tree_code typecode; tree val; tree ret = error_mark_node; @@ -4651,7 +4651,7 @@ build_unary_op (location_t location, enum tree_code code, tree xarg, gcc_unreachable (); } - if (argtype == 0) + if (argtype == NULL_TREE) argtype = TREE_TYPE (arg); if (TREE_CODE (arg) == INTEGER_CST) ret = (require_constant_value @@ -6906,7 +6906,7 @@ store_init_value (location_t init_loc, tree decl, tree init, tree origtype) /* Check if we need to set array size from compound literal size. */ if (TREE_CODE (type) == ARRAY_TYPE - && TYPE_DOMAIN (type) == 0 + && TYPE_DOMAIN (type) == NULL_TREE && value != error_mark_node) { tree inside_init = init; @@ -7162,8 +7162,8 @@ digest_init (location_t init_loc, tree type, tree init, tree origtype, } TREE_TYPE (inside_init) = type; - if (TYPE_DOMAIN (type) != 0 - && TYPE_SIZE (type) != 0 + if (TYPE_DOMAIN (type) != NULL_TREE + && TYPE_SIZE (type) != NULL_TREE && TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST) { unsigned HOST_WIDE_INT len = TREE_STRING_LENGTH (inside_init); @@ -7235,7 +7235,7 @@ digest_init (location_t init_loc, tree type, tree init, tree origtype, /* Any type can be initialized from an expression of the same type, optionally with braces. */ - if (inside_init && TREE_TYPE (inside_init) != 0 + if (inside_init && TREE_TYPE (inside_init) != NULL_TREE && (comptypes (TYPE_MAIN_VARIANT (TREE_TYPE (inside_init)), TYPE_MAIN_VARIANT (type)) || (code == ARRAY_TYPE @@ -7576,7 +7576,7 @@ start_init (tree decl, tree asmspec_tree ATTRIBUTE_UNUSED, int top_level, constructor_designated = 0; constructor_top_level = top_level; - if (decl != 0 && decl != error_mark_node) + if (decl != NULL_TREE && decl != error_mark_node) { require_constant_value = TREE_STATIC (decl); require_constant_elements @@ -7650,7 +7650,7 @@ really_start_incremental_init (tree type) { struct constructor_stack *p = XNEW (struct constructor_stack); - if (type == 0) + if (type == NULL_TREE) type = TREE_TYPE (constructor_decl); if (VECTOR_TYPE_P (type) @@ -7700,8 +7700,9 @@ really_start_incremental_init (tree type) { constructor_fields = TYPE_FIELDS (constructor_type); /* Skip any nameless bit fields at the beginning. */ - while (constructor_fields != 0 && DECL_C_BIT_FIELD (constructor_fields) - && DECL_NAME (constructor_fields) == 0) + while (constructor_fields != NULL_TREE + && DECL_C_BIT_FIELD (constructor_fields) + && DECL_NAME (constructor_fields) == NULL_TREE) constructor_fields = DECL_CHAIN (constructor_fields); constructor_unfilled_fields = constructor_fields; @@ -7764,7 +7765,7 @@ finish_implicit_inits (location_t loc, struct obstack *braced_init_obstack) while (constructor_stack->implicit) { if (RECORD_OR_UNION_TYPE_P (constructor_type) - && constructor_fields == 0) + && constructor_fields == NULL_TREE) process_init_element (input_location, pop_init_level (loc, 1, braced_init_obstack, last_init_list_comma), @@ -7819,7 +7820,7 @@ push_init_level (location_t loc, int implicit, p->erroneous = constructor_erroneous; p->pending_elts = constructor_pending_elts; p->depth = constructor_depth; - p->replacement_value.value = 0; + p->replacement_value.value = NULL_TREE; p->replacement_value.original_code = ERROR_MARK; p->replacement_value.original_type = NULL; p->implicit = implicit; @@ -7849,13 +7850,13 @@ push_init_level (location_t loc, int implicit, /* Don't die if an entire brace-pair level is superfluous in the containing level. */ - if (constructor_type == 0) + if (constructor_type == NULL_TREE) ; else if (RECORD_OR_UNION_TYPE_P (constructor_type)) { /* Don't die if there are extra init elts at the end. */ - if (constructor_fields == 0) - constructor_type = 0; + if (constructor_fields == NULL_TREE) + constructor_type = NULL_TREE; else { constructor_type = TREE_TYPE (constructor_fields); @@ -7873,11 +7874,11 @@ push_init_level (location_t loc, int implicit, constructor_depth++; } - if (constructor_type == 0) + if (constructor_type == NULL_TREE) { error_init (loc, "extra brace group at end of initializer"); - constructor_fields = 0; - constructor_unfilled_fields = 0; + constructor_fields = NULL_TREE; + constructor_unfilled_fields = NULL_TREE; return; } @@ -7905,8 +7906,9 @@ push_init_level (location_t loc, int implicit, { constructor_fields = TYPE_FIELDS (constructor_type); /* Skip any nameless bit fields at the beginning. */ - while (constructor_fields != 0 && DECL_C_BIT_FIELD (constructor_fields) - && DECL_NAME (constructor_fields) == 0) + while (constructor_fields != NULL_TREE + && DECL_C_BIT_FIELD (constructor_fields) + && DECL_NAME (constructor_fields) == NULL_TREE) constructor_fields = DECL_CHAIN (constructor_fields); constructor_unfilled_fields = constructor_fields; @@ -7982,7 +7984,7 @@ pop_init_level (location_t loc, int implicit, { struct constructor_stack *p; struct c_expr ret; - ret.value = 0; + ret.value = NULL_TREE; ret.original_code = ERROR_MARK; ret.original_type = NULL; @@ -8097,7 +8099,7 @@ pop_init_level (location_t loc, int implicit, /* If this closes a superfluous brace pair, just pass out the element between them. */ ret = p->replacement_value; - else if (constructor_type == 0) + else if (constructor_type == NULL_TREE) ; else if (!RECORD_OR_UNION_TYPE_P (constructor_type) && TREE_CODE (constructor_type) != ARRAY_TYPE @@ -8168,7 +8170,7 @@ pop_init_level (location_t loc, int implicit, constructor_stack = p->next; free (p); - if (ret.value == 0 && constructor_stack == 0) + if (ret.value == NULL_TREE && constructor_stack == 0) ret.value = error_mark_node; return ret; } @@ -8185,7 +8187,7 @@ set_designator (location_t loc, int array, /* Don't die if an entire brace-pair level is superfluous in the containing level. */ - if (constructor_type == 0) + if (constructor_type == NULL_TREE) return 1; /* If there were errors in this designator list already, bail out @@ -8305,7 +8307,7 @@ set_init_index (location_t loc, tree first, tree last, if (TREE_CODE (first) != INTEGER_CST) error_init (loc, "nonconstant array index in initializer"); - else if (last != 0 && TREE_CODE (last) != INTEGER_CST) + else if (last != NULL_TREE && TREE_CODE (last) != INTEGER_CST) error_init (loc, "nonconstant array index in initializer"); else if (TREE_CODE (constructor_type) != ARRAY_TYPE) error_init (loc, "array index in non-array initializer"); @@ -8329,21 +8331,21 @@ set_init_index (location_t loc, tree first, tree last, if (last) { if (tree_int_cst_equal (first, last)) - last = 0; + last = NULL_TREE; else if (tree_int_cst_lt (last, first)) { error_init (loc, "empty index range in initializer"); - last = 0; + last = NULL_TREE; } else { last = convert (bitsizetype, last); - if (constructor_max_index != 0 + if (constructor_max_index != NULL_TREE && tree_int_cst_lt (constructor_max_index, last)) { error_init (loc, "array index range in initializer exceeds " "array bounds"); - last = 0; + last = NULL_TREE; } } } @@ -8376,7 +8378,7 @@ set_init_label (location_t loc, tree fieldname, location_t fieldname_loc, field = lookup_field (constructor_type, fieldname); - if (field == 0) + if (field == NULL_TREE) { tree guessed_id = lookup_field_fuzzy (constructor_type, fieldname); if (guessed_id) @@ -8674,9 +8676,9 @@ set_nonincremental_init (struct obstack * braced_init_obstack) { constructor_unfilled_fields = TYPE_FIELDS (constructor_type); /* Skip any nameless bit fields at the beginning. */ - while (constructor_unfilled_fields != 0 + while (constructor_unfilled_fields != NULL_TREE && DECL_C_BIT_FIELD (constructor_unfilled_fields) - && DECL_NAME (constructor_unfilled_fields) == 0) + && DECL_NAME (constructor_unfilled_fields) == NULL_TREE) constructor_unfilled_fields = TREE_CHAIN (constructor_unfilled_fields); } @@ -9044,14 +9046,14 @@ output_init_element (location_t loc, tree value, tree origtype, = DECL_CHAIN (constructor_unfilled_fields); /* Skip any nameless bit fields. */ - while (constructor_unfilled_fields != 0 + while (constructor_unfilled_fields != NULL_TREE && DECL_C_BIT_FIELD (constructor_unfilled_fields) - && DECL_NAME (constructor_unfilled_fields) == 0) + && DECL_NAME (constructor_unfilled_fields) == NULL_TREE) constructor_unfilled_fields = DECL_CHAIN (constructor_unfilled_fields); } else if (TREE_CODE (constructor_type) == UNION_TYPE) - constructor_unfilled_fields = 0; + constructor_unfilled_fields = NULL_TREE; /* Now output any pending elements which have become next. */ if (pending) @@ -9081,7 +9083,7 @@ output_pending_init_elements (int all, struct obstack * braced_init_obstack) output it. Otherwise, set NEXT to the element that comes first among those still pending. */ - next = 0; + next = NULL_TREE; while (elt) { if (TREE_CODE (constructor_type) == ARRAY_TYPE) @@ -9132,7 +9134,7 @@ output_pending_init_elements (int all, struct obstack * braced_init_obstack) tree ctor_unfilled_bitpos, elt_bitpos; /* If the current record is complete we are done. */ - if (constructor_unfilled_fields == 0) + if (constructor_unfilled_fields == NULL_TREE) break; ctor_unfilled_bitpos = bit_position (constructor_unfilled_fields); @@ -9186,7 +9188,7 @@ output_pending_init_elements (int all, struct obstack * braced_init_obstack) /* Ordinarily return, but not if we want to output all and there are elements left. */ - if (!(all && next != 0)) + if (!(all && next != NULL_TREE)) return; /* If it's not incremental, just skip over the gap, so that after @@ -9219,7 +9221,8 @@ process_init_element (location_t loc, struct c_expr value, bool implicit, struct obstack * braced_init_obstack) { tree orig_value = value.value; - int string_flag = orig_value != 0 && TREE_CODE (orig_value) == STRING_CST; + int string_flag + = (orig_value != NULL_TREE && TREE_CODE (orig_value) == STRING_CST); bool strict_string = value.original_code == STRING_CST; bool was_designated = designator_depth != 0; @@ -9244,7 +9247,7 @@ process_init_element (location_t loc, struct c_expr value, bool implicit, return; } - if (constructor_stack->replacement_value.value != 0) + if (constructor_stack->replacement_value.value != NULL_TREE) { error_init (loc, "excess elements in struct initializer"); return; @@ -9252,7 +9255,7 @@ process_init_element (location_t loc, struct c_expr value, bool implicit, /* Ignore elements of a brace group if it is entirely superfluous and has already been diagnosed. */ - if (constructor_type == 0) + if (constructor_type == NULL_TREE) return; if (!implicit && warn_designated_init && !was_designated @@ -9269,7 +9272,7 @@ process_init_element (location_t loc, struct c_expr value, bool implicit, while (constructor_stack->implicit) { if (RECORD_OR_UNION_TYPE_P (constructor_type) - && constructor_fields == 0) + && constructor_fields == NULL_TREE) process_init_element (loc, pop_init_level (loc, 1, braced_init_obstack, last_init_list_comma), @@ -9315,7 +9318,7 @@ process_init_element (location_t loc, struct c_expr value, bool implicit, tree fieldtype; enum tree_code fieldcode; - if (constructor_fields == 0) + if (constructor_fields == NULL_TREE) { pedwarn_init (loc, 0, "excess elements in struct initializer"); break; @@ -9365,14 +9368,14 @@ process_init_element (location_t loc, struct c_expr value, bool implicit, } /* Accept a string constant to initialize a subarray. */ - if (value.value != 0 + if (value.value != NULL_TREE && fieldcode == ARRAY_TYPE && INTEGRAL_TYPE_P (TREE_TYPE (fieldtype)) && string_flag) value.value = orig_value; /* Otherwise, if we have come to a subaggregate, and we don't have an element of its type, push into it. */ - else if (value.value != 0 + else if (value.value != NULL_TREE && value.value != error_mark_node && TYPE_MAIN_VARIANT (TREE_TYPE (value.value)) != fieldtype && (fieldcode == RECORD_TYPE || fieldcode == ARRAY_TYPE @@ -9418,9 +9421,9 @@ process_init_element (location_t loc, struct c_expr value, bool implicit, constructor_fields = DECL_CHAIN (constructor_fields); /* Skip any nameless bit fields at the beginning. */ - while (constructor_fields != 0 + while (constructor_fields != NULL_TREE && DECL_C_BIT_FIELD (constructor_fields) - && DECL_NAME (constructor_fields) == 0) + && DECL_NAME (constructor_fields) == NULL_TREE) constructor_fields = DECL_CHAIN (constructor_fields); } else if (TREE_CODE (constructor_type) == UNION_TYPE) @@ -9428,7 +9431,7 @@ process_init_element (location_t loc, struct c_expr value, bool implicit, tree fieldtype; enum tree_code fieldcode; - if (constructor_fields == 0) + if (constructor_fields == NULL_TREE) { pedwarn_init (loc, 0, "excess elements in union initializer"); @@ -9457,14 +9460,14 @@ process_init_element (location_t loc, struct c_expr value, bool implicit, "of unions"); /* Accept a string constant to initialize a subarray. */ - if (value.value != 0 + if (value.value != NULL_TREE && fieldcode == ARRAY_TYPE && INTEGRAL_TYPE_P (TREE_TYPE (fieldtype)) && string_flag) value.value = orig_value; /* Otherwise, if we have come to a subaggregate, and we don't have an element of its type, push into it. */ - else if (value.value != 0 + else if (value.value != NULL_TREE && value.value != error_mark_node && TYPE_MAIN_VARIANT (TREE_TYPE (value.value)) != fieldtype && (fieldcode == RECORD_TYPE || fieldcode == ARRAY_TYPE @@ -9491,7 +9494,7 @@ process_init_element (location_t loc, struct c_expr value, bool implicit, constructor_unfilled_fields = DECL_CHAIN (constructor_fields); } - constructor_fields = 0; + constructor_fields = NULL_TREE; } else if (TREE_CODE (constructor_type) == ARRAY_TYPE) { @@ -9499,14 +9502,14 @@ process_init_element (location_t loc, struct c_expr value, bool implicit, enum tree_code eltcode = TREE_CODE (elttype); /* Accept a string constant to initialize a subarray. */ - if (value.value != 0 + if (value.value != NULL_TREE && eltcode == ARRAY_TYPE && INTEGRAL_TYPE_P (TREE_TYPE (elttype)) && string_flag) value.value = orig_value; /* Otherwise, if we have come to a subaggregate, and we don't have an element of its type, push into it. */ - else if (value.value != 0 + else if (value.value != NULL_TREE && value.value != error_mark_node && TYPE_MAIN_VARIANT (TREE_TYPE (value.value)) != elttype && (eltcode == RECORD_TYPE || eltcode == ARRAY_TYPE @@ -9516,7 +9519,7 @@ process_init_element (location_t loc, struct c_expr value, bool implicit, continue; } - if (constructor_max_index != 0 + if (constructor_max_index != NULL_TREE && (tree_int_cst_lt (constructor_max_index, constructor_index) || integer_all_onesp (constructor_max_index))) { @@ -9584,7 +9587,7 @@ process_init_element (location_t loc, struct c_expr value, bool implicit, /* Handle the sole element allowed in a braced initializer for a scalar variable. */ else if (constructor_type != error_mark_node - && constructor_fields == 0) + && constructor_fields == NULL_TREE) { pedwarn_init (loc, 0, "excess elements in scalar initializer"); @@ -9597,7 +9600,7 @@ process_init_element (location_t loc, struct c_expr value, bool implicit, strict_string, constructor_type, NULL_TREE, 1, implicit, braced_init_obstack); - constructor_fields = 0; + constructor_fields = NULL_TREE; } /* Handle range initializers either at this level or anywhere higher @@ -9896,7 +9899,7 @@ c_finish_return (location_t loc, tree retval, tree origtype) { current_function_returns_null = 1; if ((warn_return_type || flag_isoc99) - && valtype != 0 && TREE_CODE (valtype) != VOID_TYPE) + && valtype != NULL_TREE && TREE_CODE (valtype) != VOID_TYPE) { bool warned_here; if (flag_isoc99) @@ -9913,7 +9916,7 @@ c_finish_return (location_t loc, tree retval, tree origtype) "declared here"); } } - else if (valtype == 0 || TREE_CODE (valtype) == VOID_TYPE) + else if (valtype == NULL_TREE || TREE_CODE (valtype) == VOID_TYPE) { current_function_returns_null = 1; bool warned_here; @@ -10757,11 +10760,11 @@ build_binary_op (location_t location, enum tree_code code, /* Nonzero means create the expression with this type, rather than RESULT_TYPE. */ - tree build_type = 0; + tree build_type = NULL_TREE; /* Nonzero means after finally constructing the expression convert it to this type. */ - tree final_type = 0; + tree final_type = NULL_TREE; /* Nonzero if this is an operation like MIN or MAX which can safely be computed in short if both args are promoted shorts. @@ -11733,7 +11736,7 @@ build_binary_op (location_t location, enum tree_code code, = shorten_compare (location, &xop0, &xop1, &xresult_type, &xresultcode); - if (val != 0) + if (val != NULL_TREE) { ret = val; goto return_build_binary_op; @@ -11854,7 +11857,7 @@ build_binary_op (location_t location, enum tree_code code, : fold_build2_loc (location, resultcode, build_type, op0, op1)); else ret = build2 (resultcode, build_type, op0, op1); - if (final_type != 0) + if (final_type != NULL_TREE) ret = convert (final_type, ret); return_build_binary_op: -- 2.30.2