typeck.c (composite_pointer_type, [...]): Avoid ANSI string concatenation usage.
2000-01-25 Gabriel Dos Reis <gdr@codesourcery.com> * typeck.c (composite_pointer_type, c_sizeof, expr_sizeof, build_binary_op_nodefault, build_unary_op, build_reinterpret_cast, build_const_cast, get_delta_difference, check_return_expr): Avoid ANSI string concatenation usage. From-SVN: r31608
This commit is contained in:
parent
ef8288f7de
commit
ddcc7cf6c8
|
@ -1,3 +1,10 @@
|
||||||
|
2000-01-25 Gabriel Dos Reis <gdr@codesourcery.com>
|
||||||
|
|
||||||
|
* typeck.c (composite_pointer_type, c_sizeof, expr_sizeof,
|
||||||
|
build_binary_op_nodefault, build_unary_op, build_reinterpret_cast,
|
||||||
|
build_const_cast, get_delta_difference, check_return_expr): Avoid
|
||||||
|
ANSI string concatenation usage.
|
||||||
|
|
||||||
2000-01-24 Mark Mitchell <mark@codesourcery.com>
|
2000-01-24 Mark Mitchell <mark@codesourcery.com>
|
||||||
|
|
||||||
* class.c (layout_class_type): Put the fields required to make a
|
* class.c (layout_class_type): Put the fields required to make a
|
||||||
|
|
|
@ -452,15 +452,13 @@ composite_pointer_type (t1, t2, arg1, arg2, location)
|
||||||
else if (TYPE_MAIN_VARIANT (TREE_TYPE (t1)) == void_type_node)
|
else if (TYPE_MAIN_VARIANT (TREE_TYPE (t1)) == void_type_node)
|
||||||
{
|
{
|
||||||
if (pedantic && TREE_CODE (t2) == FUNCTION_TYPE)
|
if (pedantic && TREE_CODE (t2) == FUNCTION_TYPE)
|
||||||
pedwarn ("ISO C++ forbids %s between pointer of type `void *'"
|
pedwarn ("ISO C++ forbids %s between pointer of type `void *' and pointer-to-function", location);
|
||||||
" and pointer-to-function", location);
|
|
||||||
result_type = qualify_type (t1, t2);
|
result_type = qualify_type (t1, t2);
|
||||||
}
|
}
|
||||||
else if (TYPE_MAIN_VARIANT (TREE_TYPE (t2)) == void_type_node)
|
else if (TYPE_MAIN_VARIANT (TREE_TYPE (t2)) == void_type_node)
|
||||||
{
|
{
|
||||||
if (pedantic && TREE_CODE (t1) == FUNCTION_TYPE)
|
if (pedantic && TREE_CODE (t1) == FUNCTION_TYPE)
|
||||||
pedwarn ("ISO C++ forbids %s between pointer of type `void *'"
|
pedwarn ("ISO C++ forbids %s between pointer of type `void *' and pointer-to-function", location);
|
||||||
" and pointer-to-function", location);
|
|
||||||
result_type = qualify_type (t2, t1);
|
result_type = qualify_type (t2, t1);
|
||||||
}
|
}
|
||||||
/* C++ */
|
/* C++ */
|
||||||
|
@ -1560,8 +1558,7 @@ c_sizeof (type)
|
||||||
if (code == VOID_TYPE)
|
if (code == VOID_TYPE)
|
||||||
{
|
{
|
||||||
if (pedantic || warn_pointer_arith)
|
if (pedantic || warn_pointer_arith)
|
||||||
pedwarn ("ISO C++ forbids applying `sizeof' to type `void' which is"
|
pedwarn ("ISO C++ forbids applying `sizeof' to type `void' which is an incomplete type");
|
||||||
" an incomplete type");
|
|
||||||
return size_int (1);
|
return size_int (1);
|
||||||
}
|
}
|
||||||
if (code == ERROR_MARK)
|
if (code == ERROR_MARK)
|
||||||
|
@ -1606,8 +1603,7 @@ expr_sizeof (e)
|
||||||
error ("sizeof applied to a bit-field");
|
error ("sizeof applied to a bit-field");
|
||||||
if (is_overloaded_fn (e))
|
if (is_overloaded_fn (e))
|
||||||
{
|
{
|
||||||
pedwarn ("ISO C++ forbids applying `sizeof' to an expression"
|
pedwarn ("ISO C++ forbids applying `sizeof' to an expression of function type");
|
||||||
" of function type");
|
|
||||||
return size_int (1);
|
return size_int (1);
|
||||||
}
|
}
|
||||||
else if (type_unknown_p (e))
|
else if (type_unknown_p (e))
|
||||||
|
@ -3997,8 +3993,7 @@ build_binary_op_nodefault (code, orig_op0, orig_op1, error_code)
|
||||||
signed_type (result_type)))))
|
signed_type (result_type)))))
|
||||||
/* OK */;
|
/* OK */;
|
||||||
else
|
else
|
||||||
warning ("comparison between a signed and an unsigned"
|
warning ("comparison between a signed and an unsigned integer expressions");
|
||||||
" integer expressions");
|
|
||||||
|
|
||||||
/* Warn if two unsigned values are being compared in a size
|
/* Warn if two unsigned values are being compared in a size
|
||||||
larger than their original size, and one (and only one) is the
|
larger than their original size, and one (and only one) is the
|
||||||
|
@ -4715,13 +4710,9 @@ build_unary_op (code, xarg, noconvert)
|
||||||
if (current_class_type
|
if (current_class_type
|
||||||
&& TREE_OPERAND (arg, 0) == current_class_ref)
|
&& TREE_OPERAND (arg, 0) == current_class_ref)
|
||||||
/* An expression like &memfn. */
|
/* An expression like &memfn. */
|
||||||
cp_pedwarn ("ISO C++ forbids taking the address of a"
|
cp_pedwarn ("ISO C++ forbids taking the address of a non-static member function to form a pointer to member function. Say `&%T::%D'", base, name);
|
||||||
" non-static member function to form a pointer"
|
|
||||||
" to member function. Say `&%T::%D'", base, name);
|
|
||||||
else
|
else
|
||||||
cp_pedwarn ("ISO C++ forbids taking the address of a bound"
|
cp_pedwarn ("ISO C++ forbids taking the address of a bound member function to form a pointer to member function", base, name);
|
||||||
" member function to form a pointer to member"
|
|
||||||
" function", base, name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
arg = build_offset_ref (base, name);
|
arg = build_offset_ref (base, name);
|
||||||
|
@ -4746,8 +4737,7 @@ build_unary_op (code, xarg, noconvert)
|
||||||
case FIX_ROUND_EXPR:
|
case FIX_ROUND_EXPR:
|
||||||
case FIX_CEIL_EXPR:
|
case FIX_CEIL_EXPR:
|
||||||
if (! lvalue_p (arg) && pedantic)
|
if (! lvalue_p (arg) && pedantic)
|
||||||
pedwarn ("ISO C++ forbids taking the address of a cast to a "
|
pedwarn ("ISO C++ forbids taking the address of a cast to a non-lvalue expression");
|
||||||
"non-lvalue expression");
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -5279,8 +5269,7 @@ build_reinterpret_cast (type, expr)
|
||||||
{
|
{
|
||||||
if (! real_lvalue_p (expr))
|
if (! real_lvalue_p (expr))
|
||||||
{
|
{
|
||||||
cp_error ("invalid reinterpret_cast of an rvalue expression of type"
|
cp_error ("invalid reinterpret_cast of an rvalue expression of type `%T' to type `%T'", intype, type);
|
||||||
" `%T' to type `%T'", intype, type);
|
|
||||||
return error_mark_node;
|
return error_mark_node;
|
||||||
}
|
}
|
||||||
expr = build_unary_op (ADDR_EXPR, expr, 0);
|
expr = build_unary_op (ADDR_EXPR, expr, 0);
|
||||||
|
@ -5359,12 +5348,10 @@ build_const_cast (type, expr)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!POINTER_TYPE_P (type))
|
if (!POINTER_TYPE_P (type))
|
||||||
cp_error ("invalid use of const_cast with type `%T', which is not a"
|
cp_error ("invalid use of const_cast with type `%T', which is not a pointer, reference, nor a pointer-to-data-member type", type);
|
||||||
" pointer, reference, nor a pointer-to-data-member type", type);
|
|
||||||
else if (TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE)
|
else if (TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE)
|
||||||
{
|
{
|
||||||
cp_error ("invalid use of const_cast with type `%T', which is a pointer"
|
cp_error ("invalid use of const_cast with type `%T', which is a pointer or reference to a function type", type);
|
||||||
" or reference to a function type", type);
|
|
||||||
return error_mark_node;
|
return error_mark_node;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6061,8 +6048,7 @@ get_delta_difference (from, to, force)
|
||||||
if (binfo_from_vbase (binfo))
|
if (binfo_from_vbase (binfo))
|
||||||
{
|
{
|
||||||
binfo = BINFO_FOR_VBASE (BINFO_TYPE (binfo), from);
|
binfo = BINFO_FOR_VBASE (BINFO_TYPE (binfo), from);
|
||||||
cp_warning ("pointer to member cast to virtual base `%T' will only"
|
cp_warning ("pointer to member cast to virtual base `%T' will only work if you are very careful", BINFO_TYPE (binfo));
|
||||||
" work if you are very careful", BINFO_TYPE (binfo));
|
|
||||||
}
|
}
|
||||||
delta = BINFO_OFFSET (binfo);
|
delta = BINFO_OFFSET (binfo);
|
||||||
delta = cp_convert (ptrdiff_type_node, delta);
|
delta = cp_convert (ptrdiff_type_node, delta);
|
||||||
|
@ -6076,8 +6062,7 @@ get_delta_difference (from, to, force)
|
||||||
{
|
{
|
||||||
if (force)
|
if (force)
|
||||||
{
|
{
|
||||||
cp_warning ("pointer to member cast from virtual base `%T' will "
|
cp_warning ("pointer to member cast from virtual base `%T' will only wokr if you are very careful", BINFO_TYPE (binfo));
|
||||||
"only wokr if you are very careful", BINFO_TYPE (binfo));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
cp_error ("pointer to member conversion from virtual base `%T'",
|
cp_error ("pointer to member conversion from virtual base `%T'",
|
||||||
|
@ -6772,8 +6757,7 @@ check_return_expr (retval)
|
||||||
that's supposed to return a value. */
|
that's supposed to return a value. */
|
||||||
if (!retval && fn_returns_value_p)
|
if (!retval && fn_returns_value_p)
|
||||||
{
|
{
|
||||||
pedwarn ("return-statement with no value, in function declared with"
|
pedwarn ("return-statement with no value, in function declared with a non-void return type");
|
||||||
" a non-void return type");
|
|
||||||
/* Clear this, so finish_function won't say that we reach the
|
/* Clear this, so finish_function won't say that we reach the
|
||||||
end of a non-void function (which we don't, we gave a
|
end of a non-void function (which we don't, we gave a
|
||||||
return!). */
|
return!). */
|
||||||
|
@ -6789,8 +6773,7 @@ check_return_expr (retval)
|
||||||
its side-effects. */
|
its side-effects. */
|
||||||
finish_expr_stmt (retval);
|
finish_expr_stmt (retval);
|
||||||
else
|
else
|
||||||
pedwarn ("return-statement with a value, in function declared with"
|
pedwarn ("return-statement with a value, in function declared with a void return type");
|
||||||
" a void return type");
|
|
||||||
|
|
||||||
current_function_returns_null = 1;
|
current_function_returns_null = 1;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue