aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormpolacek <mpolacek@138bc75d-0d04-0410-961f-82ee72b054a4>2017-05-18 11:26:25 +0000
committermpolacek <mpolacek@138bc75d-0d04-0410-961f-82ee72b054a4>2017-05-18 11:26:25 +0000
commit781732032760592d6ee80a7597542148ba9eff2e (patch)
tree600b21f9ed1f2db68f3d2b824355badd73f5fe57
parent7eb46067b709fc831b3b448f0d65d07f55f6fbfb (diff)
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@248195 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/c-family/ChangeLog9
-rw-r--r--gcc/c-family/c-common.c16
-rw-r--r--gcc/c-family/c-pragma.c4
-rw-r--r--gcc/c/ChangeLog13
-rw-r--r--gcc/c/c-decl.c26
-rw-r--r--gcc/c/c-typeck.c6
6 files changed, 49 insertions, 25 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 23a6afedb18..98b4b4e9ff9 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,5 +1,14 @@
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.
Use false/true instead of 0/1.
* c-common.h (self_promoting_args_p): Update.
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index a9e2408caba..5f4488a9080 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -2112,7 +2112,7 @@ c_common_type_for_size (unsigned int bits, int unsignedp)
if (bits <= TYPE_PRECISION (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
@@ -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 "
"fixed-point types that have too many integral and "
"fractional bits together");
- return 0;
+ return NULL_TREE;
}
return c_common_type_for_mode (mode, satp);
@@ -2359,7 +2359,7 @@ c_common_type_for_mode (machine_mode mode, int unsignedp)
&& !!unsignedp == !!TYPE_UNSIGNED (TREE_VALUE (t)))
return TREE_VALUE (t);
- return 0;
+ return NULL_TREE;
}
tree
@@ -2690,7 +2690,7 @@ expr_original_type (tree expr)
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
that value. */
@@ -2944,7 +2944,7 @@ shorten_compare (location_t loc, tree *op0_ptr, tree *op1_ptr,
else if (real1 && real2
&& (DECIMAL_FLOAT_MODE_P (TYPE_MODE (TREE_TYPE (primop0)))
|| DECIMAL_FLOAT_MODE_P (TYPE_MODE (TREE_TYPE (primop1)))))
- return 0;
+ return NULL_TREE;
else if (real1 && real2
&& (TYPE_PRECISION (TREE_TYPE (primop0))
@@ -3038,7 +3038,7 @@ shorten_compare (location_t loc, tree *op0_ptr, tree *op1_ptr,
*restype_ptr = truthvalue_type_node;
- return 0;
+ return NULL_TREE;
}
/* Return a tree for the sum or difference (RESULTCODE says which)
@@ -4630,10 +4630,10 @@ c_promoting_integer_type_p (const_tree t)
return TYPE_PRECISION (t) < TYPE_PRECISION (integer_type_node);
case BOOLEAN_TYPE:
- return 1;
+ return true;
default:
- return 0;
+ return false;
}
}
diff --git a/gcc/c-family/c-pragma.c b/gcc/c-family/c-pragma.c
index 55c2b68865c..bc366265cd4 100644
--- a/gcc/c-family/c-pragma.c
+++ b/gcc/c-family/c-pragma.c
@@ -594,7 +594,7 @@ maybe_apply_renaming_pragma (tree decl, tree asmname)
pending_redefine_extname->unordered_remove (ix);
break;
}
- return 0;
+ return NULL_TREE;
}
/* Find out if we have a pending #pragma redefine_extname. */
@@ -643,7 +643,7 @@ maybe_apply_renaming_pragma (tree decl, tree asmname)
}
/* Nada. */
- return 0;
+ return NULL_TREE;
}
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index 4dbeedfe7fb..1f572a76df0 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -1,5 +1,18 @@
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.
(grokdeclarator): Likewise.
(finish_struct): Likewise.
diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c
index 52d89f80350..da1e2c409e6 100644
--- a/gcc/c/c-decl.c
+++ b/gcc/c/c-decl.c
@@ -1630,7 +1630,7 @@ match_builtin_function_types (tree newtype, tree oldtype)
newrettype = TREE_TYPE (newtype);
if (TYPE_MODE (oldrettype) != TYPE_MODE (newrettype))
- return 0;
+ return NULL_TREE;
oldargs = TYPE_ARG_TYPES (oldtype);
newargs = TYPE_ARG_TYPES (newtype);
@@ -1644,7 +1644,7 @@ match_builtin_function_types (tree newtype, tree oldtype)
|| !TREE_VALUE (newargs)
|| TYPE_MODE (TREE_VALUE (oldargs))
!= TYPE_MODE (TREE_VALUE (newargs)))
- return 0;
+ return NULL_TREE;
oldargs = TREE_CHAIN (oldargs);
newargs = TREE_CHAIN (newargs);
@@ -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.
Return the LABEL_DECL node for the label, if the definition is valid.
- Otherwise return 0. */
+ Otherwise return NULL_TREE. */
tree
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);
locate_old_decl (label);
- return 0;
+ return NULL_TREE;
}
else if (label && DECL_CONTEXT (label) == current_function_decl)
{
@@ -3971,7 +3971,7 @@ pending_xref_error (void)
/* Look up NAME in the current scope and its superiors
in the namespace of variables, functions and typedefs.
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
lookup_name (tree name)
@@ -5516,7 +5516,7 @@ smallest_type_quals_location (const location_t *locations,
determine the name and type of the object declared
and construct a ..._DECL node for it.
(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.
@@ -5662,7 +5662,7 @@ grokdeclarator (const struct c_declarator *declarator,
a function declarator. */
if (funcdef_flag && !funcdef_syntax)
- return 0;
+ return NULL_TREE;
/* If this looks like a function definition, make it one,
even if it occurs where parms are expected.
@@ -6833,7 +6833,7 @@ grokdeclarator (const struct c_declarator *declarator,
if (funcdef_flag)
storage_class = declspecs->storage_class = csc_none;
else
- return 0;
+ return NULL_TREE;
}
}
@@ -7073,20 +7073,22 @@ grokparms (struct c_arg_info *arg_info, bool funcdef_flag)
"function declaration isn%'t a prototype");
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)
{
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;
}
else
arg_info->parms = arg_info->types;
arg_info->types = NULL_TREE;
- return 0;
+ return NULL_TREE;
}
else
{
@@ -9599,7 +9601,7 @@ identifier_global_value (tree t)
if (B_IN_FILE_SCOPE (b) || B_IN_EXTERNAL_SCOPE (b))
return b->decl;
- return 0;
+ return NULL_TREE;
}
/* In C, the only C-linkage public declaration is at file scope. */
diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c
index 96f7a5c17ed..25b7dd60253 100644
--- a/gcc/c/c-typeck.c
+++ b/gcc/c/c-typeck.c
@@ -8774,7 +8774,7 @@ set_nonincremental_init_from_string (tree str,
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. */
static tree
@@ -8826,7 +8826,7 @@ find_init_member (tree field, struct obstack * braced_init_obstack)
&& (constructor_elements->last ().index == field))
return constructor_elements->last ().value;
}
- return 0;
+ return NULL_TREE;
}
/* "Output" the next constructor element.
@@ -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 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
c_tree_equal (tree t1, tree t2)