re PR c/37724 ("initialization from incompatible pointer type" does not say which field is being initialized)
gcc/ 2010-06-08 Andrew Pinski <pinskia@gmail.com> Shujing Zhao <pearly.zhao@oracle.com> PR c/37724 * c-typeck.c (convert_for_assignment): Call pedwarn_init if the implicit bad conversions is initialization. (error_init): Use gmsgid instead of msgid for argument name and change the call for error. (pedwarn_init): Use gmsgid instead of msgid for argument name and change the call for pedwarn. (warning_init): Use gmsgid instead of msgid for argument name and change the call for warning. gcc/testsuite/ 2010-06-08 Andrew Pinski <pinskia@gmail.com> Shujing Zhao <pearly.zhao@oracle.com> PR c/37724 * gcc.dg/c90-const-expr-10.c: Adjust. * gcc.dg/c99-const-expr-10.c: Adjust. * gcc.dg/init-bad-7.c: New. From-SVN: r160418
This commit is contained in:
parent
c8061de73f
commit
6a8f4e12f5
@ -1,6 +1,19 @@
|
||||
2010-06-08 Andrew Pinski <pinskia@gmail.com>
|
||||
Shujing Zhao <pearly.zhao@oracle.com>
|
||||
|
||||
PR c/37724
|
||||
* c-typeck.c (convert_for_assignment): Call pedwarn_init if the
|
||||
implicit bad conversions is initialization.
|
||||
(error_init): Use gmsgid instead of msgid for argument name and change
|
||||
the call for error.
|
||||
(pedwarn_init): Use gmsgid instead of msgid for argument name and
|
||||
change the call for pedwarn.
|
||||
(warning_init): Use gmsgid instead of msgid for argument name and
|
||||
change the call for warning.
|
||||
|
||||
2010-06-07 Nathan Froyd <froydnj@codesourcery.com>
|
||||
|
||||
* config/mips/mips-protos.h (mips_print_operand): Delete.
|
||||
* config/mips/mips-protos.h (mips_print_operand): Delete.
|
||||
(mips_print_operand_address): Delete.
|
||||
* config/mips/mips.h (mips_print_operand_punct): Delete.
|
||||
(PRINT_OPERAND): Delete.
|
||||
|
@ -5011,7 +5011,7 @@ convert_for_assignment (location_t location, tree type, tree rhs,
|
||||
pedwarn (LOCATION, OPT, AS); \
|
||||
break; \
|
||||
case ic_init: \
|
||||
pedwarn (LOCATION, OPT, IN); \
|
||||
pedwarn_init (LOCATION, OPT, IN); \
|
||||
break; \
|
||||
case ic_return: \
|
||||
pedwarn (LOCATION, OPT, RE); \
|
||||
@ -5785,15 +5785,16 @@ print_spelling (char *buffer)
|
||||
}
|
||||
|
||||
/* Issue an error message for a bad initializer component.
|
||||
MSGID identifies the message.
|
||||
GMSGID identifies the message.
|
||||
The component name is taken from the spelling stack. */
|
||||
|
||||
void
|
||||
error_init (const char *msgid)
|
||||
error_init (const char *gmsgid)
|
||||
{
|
||||
char *ofwhat;
|
||||
|
||||
error ("%s", _(msgid));
|
||||
/* The gmsgid may be a format string with %< and %>. */
|
||||
error (gmsgid);
|
||||
ofwhat = print_spelling ((char *) alloca (spelling_length () + 1));
|
||||
if (*ofwhat)
|
||||
error ("(near initialization for %qs)", ofwhat);
|
||||
@ -5801,15 +5802,16 @@ error_init (const char *msgid)
|
||||
|
||||
/* Issue a pedantic warning for a bad initializer component. OPT is
|
||||
the option OPT_* (from options.h) controlling this warning or 0 if
|
||||
it is unconditionally given. MSGID identifies the message. The
|
||||
it is unconditionally given. GMSGID identifies the message. The
|
||||
component name is taken from the spelling stack. */
|
||||
|
||||
void
|
||||
pedwarn_init (location_t location, int opt, const char *msgid)
|
||||
pedwarn_init (location_t location, int opt, const char *gmsgid)
|
||||
{
|
||||
char *ofwhat;
|
||||
|
||||
pedwarn (location, opt, "%s", _(msgid));
|
||||
|
||||
/* The gmsgid may be a format string with %< and %>. */
|
||||
pedwarn (location, opt, gmsgid);
|
||||
ofwhat = print_spelling ((char *) alloca (spelling_length () + 1));
|
||||
if (*ofwhat)
|
||||
pedwarn (location, opt, "(near initialization for %qs)", ofwhat);
|
||||
@ -5818,15 +5820,16 @@ pedwarn_init (location_t location, int opt, const char *msgid)
|
||||
/* Issue a warning for a bad initializer component.
|
||||
|
||||
OPT is the OPT_W* value corresponding to the warning option that
|
||||
controls this warning. MSGID identifies the message. The
|
||||
controls this warning. GMSGID identifies the message. The
|
||||
component name is taken from the spelling stack. */
|
||||
|
||||
static void
|
||||
warning_init (int opt, const char *msgid)
|
||||
warning_init (int opt, const char *gmsgid)
|
||||
{
|
||||
char *ofwhat;
|
||||
|
||||
warning (opt, "%s", _(msgid));
|
||||
/* The gmsgid may be a format string with %< and %>. */
|
||||
warning (opt, gmsgid);
|
||||
ofwhat = print_spelling ((char *) alloca (spelling_length () + 1));
|
||||
if (*ofwhat)
|
||||
warning (opt, "(near initialization for %qs)", ofwhat);
|
||||
|
@ -1,3 +1,11 @@
|
||||
2010-06-08 Andrew Pinski <pinskia@gmail.com>
|
||||
Shujing Zhao <pearly.zhao@oracle.com>
|
||||
|
||||
PR c/37724
|
||||
* gcc.dg/c90-const-expr-10.c: Adjust.
|
||||
* gcc.dg/c99-const-expr-10.c: Adjust.
|
||||
* gcc.dg/init-bad-7.c: New.
|
||||
|
||||
2010-06-07 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
|
||||
|
||||
* lib/target-supports.exp (check_effective_target_gas): New proc.
|
||||
|
@ -8,7 +8,7 @@
|
||||
__extension__ typedef __SIZE_TYPE__ size_t;
|
||||
|
||||
void *p = (size_t)(void *)0; /* { dg-error "without a cast" } */
|
||||
struct s { void *a; } q = { (size_t)(void *)0 }; /* { dg-error "without a cast" } */
|
||||
struct s { void *a; } q = { (size_t)(void *)0 }; /* { dg-error "without a cast|near initialization" } */
|
||||
void *
|
||||
f (void)
|
||||
{
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */
|
||||
|
||||
void *p = (__SIZE_TYPE__)(void *)0; /* { dg-error "without a cast" } */
|
||||
struct s { void *a; } q = { (__SIZE_TYPE__)(void *)0 }; /* { dg-error "without a cast" } */
|
||||
struct s { void *a; } q = { (__SIZE_TYPE__)(void *)0 }; /* { dg-error "without a cast|near initialization" } */
|
||||
void *
|
||||
f (void)
|
||||
{
|
||||
|
11
gcc/testsuite/gcc.dg/init-bad-7.c
Normal file
11
gcc/testsuite/gcc.dg/init-bad-7.c
Normal file
@ -0,0 +1,11 @@
|
||||
/* PR c/37724 */
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-std=gnu99 -pedantic" } */
|
||||
|
||||
struct f
|
||||
{
|
||||
int *a;
|
||||
};
|
||||
|
||||
char b[10];
|
||||
struct f g = {b}; /* { dg-warning "initialization from incompatible pointer type|near initialization for" } */
|
Loading…
x
Reference in New Issue
Block a user