Commit 6574d78e by Marek Polacek Committed by Marek Polacek

c-common.c (c_common_type_for_size): Use NULL_TREE instead of 0.

	* c-common.c (c_common_type_for_size): Use NULL_TREE instead of 0.
	(c_common_fixed_point_type_for_size): Likewise.
	(c_common_type_for_mode): Likewise.
	(shorten_compare): Likewise.
	(c_promoting_integer_type_p): Use false/true instead of 0/1.
	* c-pragma.c (maybe_apply_renaming_pragma): Use NULL_TREE instead of 0.

	* c-decl.c (match_builtin_function_types): Use NULL_TREE instead of 0.
	(check_earlier_gotos): Likewise.
	(define_label): Likewise.
	(pending_xref_error): Likewise.
	(smallest_type_quals_location): Likewise.
	(grokdeclarator): Likewise.
	(grokparms): Likewise.
	(identifier_global_value): Likewise.
	* c-typeck.c (set_nonincremental_init_from_string): Likewise.
	(find_init_member): Likewise.

From-SVN: r248195
parent 8b656ca7
2017-05-18 Marek Polacek <polacek@redhat.com> 2017-05-18 Marek Polacek <polacek@redhat.com>
* c-common.c (c_common_type_for_size): Use NULL_TREE instead of 0.
(c_common_fixed_point_type_for_size): Likewise.
(c_common_type_for_mode): Likewise.
(shorten_compare): Likewise.
(c_promoting_integer_type_p): Use false/true instead of 0/1.
* c-pragma.c (maybe_apply_renaming_pragma): Use NULL_TREE instead of 0.
2017-05-18 Marek Polacek <polacek@redhat.com>
* c-common.c (self_promoting_args_p): Change the return type to bool. * c-common.c (self_promoting_args_p): Change the return type to bool.
Use false/true instead of 0/1. Use false/true instead of 0/1.
* c-common.h (self_promoting_args_p): Update. * c-common.h (self_promoting_args_p): Update.
......
...@@ -2112,7 +2112,7 @@ c_common_type_for_size (unsigned int bits, int unsignedp) ...@@ -2112,7 +2112,7 @@ c_common_type_for_size (unsigned int bits, int unsignedp)
if (bits <= TYPE_PRECISION (intDI_type_node)) if (bits <= TYPE_PRECISION (intDI_type_node))
return unsignedp ? unsigned_intDI_type_node : intDI_type_node; return unsignedp ? unsigned_intDI_type_node : intDI_type_node;
return 0; return NULL_TREE;
} }
/* Return a fixed-point type that has at least IBIT ibits and FBIT fbits /* Return a fixed-point type that has at least IBIT ibits and FBIT fbits
...@@ -2138,7 +2138,7 @@ c_common_fixed_point_type_for_size (unsigned int ibit, unsigned int fbit, ...@@ -2138,7 +2138,7 @@ c_common_fixed_point_type_for_size (unsigned int ibit, unsigned int fbit,
sorry ("GCC cannot support operators with integer types and " sorry ("GCC cannot support operators with integer types and "
"fixed-point types that have too many integral and " "fixed-point types that have too many integral and "
"fractional bits together"); "fractional bits together");
return 0; return NULL_TREE;
} }
return c_common_type_for_mode (mode, satp); return c_common_type_for_mode (mode, satp);
...@@ -2359,7 +2359,7 @@ c_common_type_for_mode (machine_mode mode, int unsignedp) ...@@ -2359,7 +2359,7 @@ c_common_type_for_mode (machine_mode mode, int unsignedp)
&& !!unsignedp == !!TYPE_UNSIGNED (TREE_VALUE (t))) && !!unsignedp == !!TYPE_UNSIGNED (TREE_VALUE (t)))
return TREE_VALUE (t); return TREE_VALUE (t);
return 0; return NULL_TREE;
} }
tree tree
...@@ -2690,7 +2690,7 @@ expr_original_type (tree expr) ...@@ -2690,7 +2690,7 @@ expr_original_type (tree expr)
LOC is the location of the comparison. LOC is the location of the comparison.
If this function returns nonzero, it means that the comparison has If this function returns non-NULL_TREE, it means that the comparison has
a constant value. What this function returns is an expression for a constant value. What this function returns is an expression for
that value. */ that value. */
...@@ -2944,7 +2944,7 @@ shorten_compare (location_t loc, tree *op0_ptr, tree *op1_ptr, ...@@ -2944,7 +2944,7 @@ shorten_compare (location_t loc, tree *op0_ptr, tree *op1_ptr,
else if (real1 && real2 else if (real1 && real2
&& (DECIMAL_FLOAT_MODE_P (TYPE_MODE (TREE_TYPE (primop0))) && (DECIMAL_FLOAT_MODE_P (TYPE_MODE (TREE_TYPE (primop0)))
|| DECIMAL_FLOAT_MODE_P (TYPE_MODE (TREE_TYPE (primop1))))) || DECIMAL_FLOAT_MODE_P (TYPE_MODE (TREE_TYPE (primop1)))))
return 0; return NULL_TREE;
else if (real1 && real2 else if (real1 && real2
&& (TYPE_PRECISION (TREE_TYPE (primop0)) && (TYPE_PRECISION (TREE_TYPE (primop0))
...@@ -3038,7 +3038,7 @@ shorten_compare (location_t loc, tree *op0_ptr, tree *op1_ptr, ...@@ -3038,7 +3038,7 @@ shorten_compare (location_t loc, tree *op0_ptr, tree *op1_ptr,
*restype_ptr = truthvalue_type_node; *restype_ptr = truthvalue_type_node;
return 0; return NULL_TREE;
} }
/* Return a tree for the sum or difference (RESULTCODE says which) /* Return a tree for the sum or difference (RESULTCODE says which)
...@@ -4630,10 +4630,10 @@ c_promoting_integer_type_p (const_tree t) ...@@ -4630,10 +4630,10 @@ c_promoting_integer_type_p (const_tree t)
return TYPE_PRECISION (t) < TYPE_PRECISION (integer_type_node); return TYPE_PRECISION (t) < TYPE_PRECISION (integer_type_node);
case BOOLEAN_TYPE: case BOOLEAN_TYPE:
return 1; return true;
default: default:
return 0; return false;
} }
} }
......
...@@ -594,7 +594,7 @@ maybe_apply_renaming_pragma (tree decl, tree asmname) ...@@ -594,7 +594,7 @@ maybe_apply_renaming_pragma (tree decl, tree asmname)
pending_redefine_extname->unordered_remove (ix); pending_redefine_extname->unordered_remove (ix);
break; break;
} }
return 0; return NULL_TREE;
} }
/* Find out if we have a pending #pragma redefine_extname. */ /* Find out if we have a pending #pragma redefine_extname. */
...@@ -643,7 +643,7 @@ maybe_apply_renaming_pragma (tree decl, tree asmname) ...@@ -643,7 +643,7 @@ maybe_apply_renaming_pragma (tree decl, tree asmname)
} }
/* Nada. */ /* Nada. */
return 0; return NULL_TREE;
} }
......
2017-05-18 Marek Polacek <polacek@redhat.com> 2017-05-18 Marek Polacek <polacek@redhat.com>
* c-decl.c (match_builtin_function_types): Use NULL_TREE instead of 0.
(check_earlier_gotos): Likewise.
(define_label): Likewise.
(pending_xref_error): Likewise.
(smallest_type_quals_location): Likewise.
(grokdeclarator): Likewise.
(grokparms): Likewise.
(identifier_global_value): Likewise.
* c-typeck.c (set_nonincremental_init_from_string): Likewise.
(find_init_member): Likewise.
2017-05-18 Marek Polacek <polacek@redhat.com>
* c-decl.c (start_decl): Use false/true instead of 0/1. * c-decl.c (start_decl): Use false/true instead of 0/1.
(grokdeclarator): Likewise. (grokdeclarator): Likewise.
(finish_struct): Likewise. (finish_struct): Likewise.
......
...@@ -1630,7 +1630,7 @@ match_builtin_function_types (tree newtype, tree oldtype) ...@@ -1630,7 +1630,7 @@ match_builtin_function_types (tree newtype, tree oldtype)
newrettype = TREE_TYPE (newtype); newrettype = TREE_TYPE (newtype);
if (TYPE_MODE (oldrettype) != TYPE_MODE (newrettype)) if (TYPE_MODE (oldrettype) != TYPE_MODE (newrettype))
return 0; return NULL_TREE;
oldargs = TYPE_ARG_TYPES (oldtype); oldargs = TYPE_ARG_TYPES (oldtype);
newargs = TYPE_ARG_TYPES (newtype); newargs = TYPE_ARG_TYPES (newtype);
...@@ -1644,7 +1644,7 @@ match_builtin_function_types (tree newtype, tree oldtype) ...@@ -1644,7 +1644,7 @@ match_builtin_function_types (tree newtype, tree oldtype)
|| !TREE_VALUE (newargs) || !TREE_VALUE (newargs)
|| TYPE_MODE (TREE_VALUE (oldargs)) || TYPE_MODE (TREE_VALUE (oldargs))
!= TYPE_MODE (TREE_VALUE (newargs))) != TYPE_MODE (TREE_VALUE (newargs)))
return 0; return NULL_TREE;
oldargs = TREE_CHAIN (oldargs); oldargs = TREE_CHAIN (oldargs);
newargs = TREE_CHAIN (newargs); newargs = TREE_CHAIN (newargs);
...@@ -3755,7 +3755,7 @@ check_earlier_gotos (tree label, struct c_label_vars* label_vars) ...@@ -3755,7 +3755,7 @@ check_earlier_gotos (tree label, struct c_label_vars* label_vars)
/* Define a label, specifying the location in the source file. /* Define a label, specifying the location in the source file.
Return the LABEL_DECL node for the label, if the definition is valid. Return the LABEL_DECL node for the label, if the definition is valid.
Otherwise return 0. */ Otherwise return NULL_TREE. */
tree tree
define_label (location_t location, tree name) define_label (location_t location, tree name)
...@@ -3774,7 +3774,7 @@ define_label (location_t location, tree name) ...@@ -3774,7 +3774,7 @@ define_label (location_t location, tree name)
{ {
error_at (location, "duplicate label %qD", label); error_at (location, "duplicate label %qD", label);
locate_old_decl (label); locate_old_decl (label);
return 0; return NULL_TREE;
} }
else if (label && DECL_CONTEXT (label) == current_function_decl) else if (label && DECL_CONTEXT (label) == current_function_decl)
{ {
...@@ -3971,7 +3971,7 @@ pending_xref_error (void) ...@@ -3971,7 +3971,7 @@ pending_xref_error (void)
/* Look up NAME in the current scope and its superiors /* Look up NAME in the current scope and its superiors
in the namespace of variables, functions and typedefs. in the namespace of variables, functions and typedefs.
Return a ..._DECL node of some kind representing its definition, Return a ..._DECL node of some kind representing its definition,
or return 0 if it is undefined. */ or return NULL_TREE if it is undefined. */
tree tree
lookup_name (tree name) lookup_name (tree name)
...@@ -5516,7 +5516,7 @@ smallest_type_quals_location (const location_t *locations, ...@@ -5516,7 +5516,7 @@ smallest_type_quals_location (const location_t *locations,
determine the name and type of the object declared determine the name and type of the object declared
and construct a ..._DECL node for it. and construct a ..._DECL node for it.
(In one case we can return a ..._TYPE node instead. (In one case we can return a ..._TYPE node instead.
For invalid input we sometimes return 0.) For invalid input we sometimes return NULL_TREE.)
DECLSPECS is a c_declspecs structure for the declaration specifiers. DECLSPECS is a c_declspecs structure for the declaration specifiers.
...@@ -5662,7 +5662,7 @@ grokdeclarator (const struct c_declarator *declarator, ...@@ -5662,7 +5662,7 @@ grokdeclarator (const struct c_declarator *declarator,
a function declarator. */ a function declarator. */
if (funcdef_flag && !funcdef_syntax) if (funcdef_flag && !funcdef_syntax)
return 0; return NULL_TREE;
/* If this looks like a function definition, make it one, /* If this looks like a function definition, make it one,
even if it occurs where parms are expected. even if it occurs where parms are expected.
...@@ -6833,7 +6833,7 @@ grokdeclarator (const struct c_declarator *declarator, ...@@ -6833,7 +6833,7 @@ grokdeclarator (const struct c_declarator *declarator,
if (funcdef_flag) if (funcdef_flag)
storage_class = declspecs->storage_class = csc_none; storage_class = declspecs->storage_class = csc_none;
else else
return 0; return NULL_TREE;
} }
} }
...@@ -7073,20 +7073,22 @@ grokparms (struct c_arg_info *arg_info, bool funcdef_flag) ...@@ -7073,20 +7073,22 @@ grokparms (struct c_arg_info *arg_info, bool funcdef_flag)
"function declaration isn%'t a prototype"); "function declaration isn%'t a prototype");
if (arg_types == error_mark_node) if (arg_types == error_mark_node)
return 0; /* don't set TYPE_ARG_TYPES in this case */ /* Don't set TYPE_ARG_TYPES in this case. */
return NULL_TREE;
else if (arg_types && TREE_CODE (TREE_VALUE (arg_types)) == IDENTIFIER_NODE) else if (arg_types && TREE_CODE (TREE_VALUE (arg_types)) == IDENTIFIER_NODE)
{ {
if (!funcdef_flag) if (!funcdef_flag)
{ {
pedwarn (input_location, 0, "parameter names (without types) in function declaration"); pedwarn (input_location, 0, "parameter names (without types) in "
"function declaration");
arg_info->parms = NULL_TREE; arg_info->parms = NULL_TREE;
} }
else else
arg_info->parms = arg_info->types; arg_info->parms = arg_info->types;
arg_info->types = NULL_TREE; arg_info->types = NULL_TREE;
return 0; return NULL_TREE;
} }
else else
{ {
...@@ -9599,7 +9601,7 @@ identifier_global_value (tree t) ...@@ -9599,7 +9601,7 @@ identifier_global_value (tree t)
if (B_IN_FILE_SCOPE (b) || B_IN_EXTERNAL_SCOPE (b)) if (B_IN_FILE_SCOPE (b) || B_IN_EXTERNAL_SCOPE (b))
return b->decl; return b->decl;
return 0; return NULL_TREE;
} }
/* In C, the only C-linkage public declaration is at file scope. */ /* In C, the only C-linkage public declaration is at file scope. */
......
...@@ -8774,7 +8774,7 @@ set_nonincremental_init_from_string (tree str, ...@@ -8774,7 +8774,7 @@ set_nonincremental_init_from_string (tree str,
constructor_incremental = 0; constructor_incremental = 0;
} }
/* Return value of FIELD in pending initializer or zero if the field was /* Return value of FIELD in pending initializer or NULL_TREE if the field was
not initialized yet. */ not initialized yet. */
static tree static tree
...@@ -8826,7 +8826,7 @@ find_init_member (tree field, struct obstack * braced_init_obstack) ...@@ -8826,7 +8826,7 @@ find_init_member (tree field, struct obstack * braced_init_obstack)
&& (constructor_elements->last ().index == field)) && (constructor_elements->last ().index == field))
return constructor_elements->last ().value; return constructor_elements->last ().value;
} }
return 0; return NULL_TREE;
} }
/* "Output" the next constructor element. /* "Output" the next constructor element.
...@@ -14007,7 +14007,7 @@ c_build_va_arg (location_t loc1, tree expr, location_t loc2, tree type) ...@@ -14007,7 +14007,7 @@ c_build_va_arg (location_t loc1, tree expr, location_t loc2, tree type)
} }
/* Return truthvalue of whether T1 is the same tree structure as T2. /* Return truthvalue of whether T1 is the same tree structure as T2.
Return 1 if they are the same. Return 0 if they are different. */ Return 1 if they are the same. Return false if they are different. */
bool bool
c_tree_equal (tree t1, tree t2) c_tree_equal (tree t1, tree t2)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment