char *namep;
int vrb = 2;
- if (! pretty_p)
+ if (!pretty_p)
{
name = "";
vrb = 0;
const int nchars_max = flag_isoc99 ? 4095 : 509;
int length = TREE_STRING_LENGTH (value);
int nchars;
- tree e_type, i_type;
-
+ tree e_type, i_type, a_type;
+
/* Compute the number of elements, for the array type. */
nchars = wide_flag ? length / wchar_bytes : length;
nchars - 1, nchars_max, flag_isoc99 ? 99 : 89);
e_type = wide_flag ? wchar_type_node : char_type_node;
- /* Create the array type for the string constant.
- -Wwrite-strings says make the string constant an array of const char
- so that copying it to a non-const pointer will get a warning.
- For C++, this is the standard behavior. */
- if (flag_const_strings)
- e_type = build_type_variant (e_type, 1, 0);
+ /* Create the array type for the string constant. flag_const_strings
+ says make the string constant an array of const char so that
+ copying it to a non-const pointer will get a warning. For C++,
+ this is the standard behavior.
+
+ The C++ front end relies on TYPE_MAIN_VARIANT of a cv-qualified
+ array type being the unqualified version of that type.
+ Therefore, if we are constructing an array of const char, we must
+ construct the matching unqualified array type first. The C front
+ end does not require this, but it does no harm, so we do it
+ unconditionally. */
i_type = build_index_type (build_int_cst (NULL_TREE, nchars - 1));
- TREE_TYPE (value) = build_array_type (e_type, i_type);
+ a_type = build_array_type (e_type, i_type);
+ if (flag_const_strings)
+ {
+ /* bleah, c_build_qualified_type should set TYPE_MAIN_VARIANT. */
+ tree qa_type = c_build_qualified_type (a_type, TYPE_QUAL_CONST);
+ TYPE_MAIN_VARIANT (qa_type) = a_type;
+ a_type = qa_type;
+ }
+ TREE_TYPE (value) = a_type;
TREE_CONSTANT (value) = 1;
TREE_INVARIANT (value) = 1;
TREE_READONLY (value) = 1;
don't warn unless pedantic. */
if ((pedantic
|| TYPE_UNSIGNED (type)
- || ! constant_fits_type_p (expr,
- c_common_unsigned_type (type)))
+ || !constant_fits_type_p (expr,
+ c_common_unsigned_type (type)))
&& skip_evaluation == 0)
warning ("overflow in implicit constant conversion");
}
while (add)
{
struct tlist *next = add->next;
- if (! copy)
+ if (!copy)
add->next = *to;
- if (! exclude_writer || add->writer != exclude_writer)
+ if (!exclude_writer || add->writer != exclude_writer)
*to = copy ? new_tlist (*to, add->expr, add->writer) : add;
add = next;
}
if (tmp2->expr == add->expr)
{
found = 1;
- if (! tmp2->writer)
+ if (!tmp2->writer)
tmp2->writer = add->writer;
}
- if (! found)
+ if (!found)
{
*end = copy ? add : new_tlist (NULL, add->expr, add->writer);
end = &(*end)->next;
{
if (list->expr == written
&& list->writer != writer
- && (! only_writes || list->writer)
+ && (!only_writes || list->writer)
&& DECL_NAME (list->expr))
{
warned_ids = new_tlist (warned_ids, written, NULL_TREE);
{
struct tlist *tmp_before, *tmp_nosp, *tmp_list2, *tmp_list3;
enum tree_code code;
- char cl;
+ enum tree_code_class cl;
/* X may be NULL if it is the operand of an empty statement expression
({ }). */
if (t->expr == x)
break;
- if (! t)
+ if (!t)
{
t = XOBNEW (&tlist_obstack, struct tlist_cache);
t->next = save_expr_cache;
add_tlist (pno_sp, t->cache_after_sp, NULL_TREE, 1);
return;
}
- default:
- break;
- }
- if (cl == '1')
- {
- if (first_rtl_op (code) == 0)
- return;
- x = TREE_OPERAND (x, 0);
- writer = 0;
- goto restart;
- }
-
- switch (cl)
- {
- case 'r':
- case '<':
- case '2':
- case 'e':
- case 's':
- case 'x':
- {
- int lp;
- int max = first_rtl_op (TREE_CODE (x));
- for (lp = 0; lp < max; lp++)
- {
- tmp_before = tmp_nosp = 0;
- verify_tree (TREE_OPERAND (x, lp), &tmp_before, &tmp_nosp, NULL_TREE);
- merge_tlist (&tmp_nosp, tmp_before, 0);
- add_tlist (pno_sp, tmp_nosp, NULL_TREE, 0);
- }
- break;
- }
+ default:
+ /* For other expressions, simply recurse on their operands.
+ Manual tail recursion for unary expressions.
+ Other non-expressions need not be processed. */
+ if (cl == tcc_unary)
+ {
+ if (first_rtl_op (code) == 0)
+ return;
+ x = TREE_OPERAND (x, 0);
+ writer = 0;
+ goto restart;
+ }
+ else if (IS_EXPR_CODE_CLASS (cl))
+ {
+ int lp;
+ int max = first_rtl_op (TREE_CODE (x));
+ for (lp = 0; lp < max; lp++)
+ {
+ tmp_before = tmp_nosp = 0;
+ verify_tree (TREE_OPERAND (x, lp), &tmp_before, &tmp_nosp, 0);
+ merge_tlist (&tmp_nosp, tmp_before, 0);
+ add_tlist (pno_sp, tmp_nosp, NULL_TREE, 0);
+ }
+ }
+ return;
}
}
tree
c_common_signed_or_unsigned_type (int unsignedp, tree type)
{
- if (! INTEGRAL_TYPE_P (type)
+ if (!INTEGRAL_TYPE_P (type)
|| TYPE_UNSIGNED (type) == unsignedp)
return type;
else
log = tree_floor_log2 (value);
- return log + 1 + ! unsignedp;
+ return log + 1 + !unsignedp;
}
\f
/* Print an error message for invalid operands to arith operation
the second arg is 0. */
if (TREE_CONSTANT (primop0)
- && ! integer_zerop (primop1) && ! real_zerop (primop1))
+ && !integer_zerop (primop1) && !real_zerop (primop1))
{
tree tem = primop0;
int temi = unsignedp0;
enumerated type itself. In C++, TYPE_MAX_VALUE and
TYPE_MIN_VALUE have already been set correctly on the
enumeration type. */
- if (!c_dialect_cxx() && TREE_CODE (type) == ENUMERAL_TYPE)
+ if (!c_dialect_cxx () && TREE_CODE (type) == ENUMERAL_TYPE)
type = c_common_type_for_size (TYPE_PRECISION (type), unsignedp0);
maxval = TYPE_MAX_VALUE (type);
>= 0, the signedness of the comparison isn't an issue,
so suppress the warning. */
if (extra_warnings && !in_system_header
- && ! (TREE_CODE (primop0) == INTEGER_CST
- && ! TREE_OVERFLOW (convert (c_common_signed_type (type),
- primop0))))
+ && !(TREE_CODE (primop0) == INTEGER_CST
+ && !TREE_OVERFLOW (convert (c_common_signed_type (type),
+ primop0))))
warning ("comparison of unsigned expression >= 0 is always true");
value = truthvalue_true_node;
break;
case LT_EXPR:
if (extra_warnings && !in_system_header
- && ! (TREE_CODE (primop0) == INTEGER_CST
- && ! TREE_OVERFLOW (convert (c_common_signed_type (type),
- primop0))))
+ && !(TREE_CODE (primop0) == INTEGER_CST
+ && !TREE_OVERFLOW (convert (c_common_signed_type (type),
+ primop0))))
warning ("comparison of unsigned expression < 0 is always false");
value = truthvalue_false_node;
break;
This helps produce common subexpressions. */
if ((TREE_CODE (intop) == PLUS_EXPR || TREE_CODE (intop) == MINUS_EXPR)
- && ! TREE_CONSTANT (intop)
+ && !TREE_CONSTANT (intop)
&& TREE_CONSTANT (TREE_OPERAND (intop, 1))
&& TREE_CONSTANT (size_exp)
/* If the constant comes from pointer subtraction,
/* If the constant is unsigned, and smaller than the pointer size,
then we must skip this optimization. This is because it could cause
an overflow error if the constant is negative but INTOP is not. */
- && (! TYPE_UNSIGNED (TREE_TYPE (intop))
+ && (!TYPE_UNSIGNED (TREE_TYPE (intop))
|| (TYPE_PRECISION (TREE_TYPE (intop))
== TYPE_PRECISION (TREE_TYPE (ptrop)))))
{
case ADDR_EXPR:
{
if (TREE_CODE (TREE_OPERAND (expr, 0)) == FUNCTION_DECL
- && ! DECL_WEAK (TREE_OPERAND (expr, 0)))
+ && !DECL_WEAK (TREE_OPERAND (expr, 0)))
{
/* Common Ada/Pascal programmer's mistake. We always warn
about this since it is so bad. */
{
int i = 0;
int shift, size;
- tree t = (tree)p;
+ tree t = (tree) p;
tree t2;
switch (TREE_CODE (t))
{
return ((size << 24) | (i << shift));
}
+static GTY((param_is (union tree_node))) htab_t type_hash_table;
+
/* Return the typed-based alias set for T, which may be an expression
or a type. Return -1 if we don't do anything special. */
{
tree u;
PTR *slot;
- static htab_t type_hash_table;
/* Permit type-punning when accessing a union, provided the access
is directly through the union. For example, this code does not
return 0;
/* That's all the expressions we handle specially. */
- if (! TYPE_P (t))
+ if (!TYPE_P (t))
return -1;
/* The C standard guarantees that any object may be accessed via an
/* Look up t in hash table. Only one of the compatible types within each
alias set is recorded in the table. */
if (!type_hash_table)
- type_hash_table = htab_create (1021, c_type_hash,
+ type_hash_table = htab_create_ggc (1021, c_type_hash,
(htab_eq) lang_hooks.types_compatible_p,
NULL);
slot = htab_find_slot (type_hash_table, t, INSERT);
expression. If both low_value and high_value are out of range,
don't insert the case label and return NULL_TREE. */
if (low_value
- && ! check_case_bounds (type, orig_type,
- &low_value, high_value ? &high_value : NULL))
+ && !check_case_bounds (type, orig_type,
+ &low_value, high_value ? &high_value : NULL))
return NULL_TREE;
/* Look up the LOW_VALUE in the table of case labels we already
/* Change this type to have a type with the specified mode.
First check for the special modes. */
- if (! strcmp (p, "byte"))
+ if (!strcmp (p, "byte"))
mode = byte_mode;
else if (!strcmp (p, "word"))
mode = word_mode;
- else if (! strcmp (p, "pointer"))
+ else if (!strcmp (p, "pointer"))
mode = ptr_mode;
else
for (j = 0; j < NUM_MACHINE_MODES; j++)
if (!strcmp (p, GET_MODE_NAME (j)))
- mode = (enum machine_mode) j;
+ {
+ mode = (enum machine_mode) j;
+ break;
+ }
if (mode == VOIDmode)
{
if (typefm == NULL_TREE)
{
- error ("no data type for mode %<%s%>", p);
+ error ("no data type for mode %qs", p);
return NULL_TREE;
}
else if (TREE_CODE (type) == ENUMERAL_TYPE)
this mode for this type. */
if (TREE_CODE (typefm) != INTEGER_TYPE)
{
- error ("cannot use mode %qs for enumeral types",
- GET_MODE_NAME (mode));
+ error ("cannot use mode %qs for enumeral types", p);
return NULL_TREE;
}
TYPE_PRECISION (type) = TYPE_PRECISION (typefm);
typefm = type;
}
+ else if (TREE_CODE (type) != TREE_CODE (typefm))
+ {
+ error ("mode %qs applied to inappropriate type", p);
+ return NULL_TREE;
+ }
+
*node = typefm;
/* No need to layout the type here. The caller should do this. */
{
if (TREE_CODE (decl) == VAR_DECL
&& current_function_decl != NULL_TREE
- && ! TREE_STATIC (decl))
+ && !TREE_STATIC (decl))
{
error ("%Jsection attribute cannot be specified for "
"local variables", decl);
tree decl = *node;
if ((TREE_CODE (decl) == FUNCTION_DECL && DECL_INITIAL (decl))
- || (TREE_CODE (decl) != FUNCTION_DECL && ! DECL_EXTERNAL (decl)))
+ || (TREE_CODE (decl) != FUNCTION_DECL && !DECL_EXTERNAL (decl)))
{
error ("%J%qD defined both normally and as an alias", decl, decl);
*no_add_attrs = true;
return NULL_TREE;
}
}
- else if (decl_function_context (decl) != 0 || ! TREE_PUBLIC (decl))
+ else if (decl_function_context (decl) != 0 || !TREE_PUBLIC (decl))
{
warning ("%qs attribute ignored", IDENTIFIER_POINTER (name));
return NULL_TREE;
if (TYPE_P (decl))
{
decl = TYPE_NAME (decl);
- if (! decl)
+ if (!decl)
return NULL_TREE;
}
{
tree decl = *node;
- if (! DECL_THREAD_LOCAL (decl))
+ if (!DECL_THREAD_LOCAL (decl))
{
warning ("%qs attribute ignored", IDENTIFIER_POINTER (name));
*no_add_attrs = true;
if (TREE_CODE (size) == NON_LVALUE_EXPR)
size = TREE_OPERAND (size, 0);
- if (! host_integerp (size, 1))
+ if (!host_integerp (size, 1))
{
warning ("%qs attribute ignored", IDENTIFIER_POINTER (name));
return NULL_TREE;
if (TREE_CODE (type) == RECORD_TYPE
|| (GET_MODE_CLASS (orig_mode) != MODE_FLOAT
&& GET_MODE_CLASS (orig_mode) != MODE_INT)
- || ! host_integerp (TYPE_SIZE_UNIT (type), 1))
+ || !host_integerp (TYPE_SIZE_UNIT (type), 1))
{
error ("invalid vector type for attribute %qs",
IDENTIFIER_POINTER (name));
/* If no arguments are specified, all pointer arguments should be
non-null. Verify a full prototype is given so that the arguments
will have the correct types when we actually check them later. */
- if (! args)
+ if (!args)
{
- if (! TYPE_ARG_TYPES (type))
+ if (!TYPE_ARG_TYPES (type))
{
error ("nonnull attribute without arguments on a non-prototype");
*no_add_attrs = true;
tree argument;
unsigned HOST_WIDE_INT arg_num = 0, ck_num;
- if (! get_nonnull_operand (TREE_VALUE (args), &arg_num))
+ if (!get_nonnull_operand (TREE_VALUE (args), &arg_num))
{
error ("nonnull argument has invalid operand number (arg %lu)",
(unsigned long) attr_arg_num);
{
for (ck_num = 1; ; ck_num++)
{
- if (! argument || ck_num == arg_num)
+ if (!argument || ck_num == arg_num)
break;
argument = TREE_CHAIN (argument);
}
- if (! argument
+ if (!argument
|| TREE_CODE (TREE_VALUE (argument)) == VOID_TYPE)
{
error ("nonnull argument with out-of-range operand number (arg %lu, operand %lu)",
for (param = params, param_num = 1; ;
param_num++, param = TREE_CHAIN (param))
{
- if (! param)
+ if (!param)
break;
- if (! args || nonnull_check_p (args, param_num))
+ if (!args || nonnull_check_p (args, param_num))
check_function_arguments_recurse (check_nonnull_arg, NULL,
TREE_VALUE (param),
param_num);