From: Ben Elliston Date: Wed, 13 Dec 2006 05:25:57 +0000 (+1100) Subject: spu.h (C_COMMON_OVERRIDE_OPTIONS): Define. X-Git-Tag: releases/gcc-4.3.0~7990 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=83a01f24c360b7cb62f568d4d886ee21f5ed0d79;p=thirdparty%2Fgcc.git spu.h (C_COMMON_OVERRIDE_OPTIONS): Define. * config/spu/spu.h (C_COMMON_OVERRIDE_OPTIONS): Define. (REGISTER_TARGET_PRAGMAS): Don't zero warn_main flag. * config/spu/spu-protos.h (spu_c_common_override_options): Declare. * config/spu/spu-c.c (spu_c_common_override_options): New. * config/spu/spu.c (spu_override_options): Whitespace fix. testsuite/ * gcc.target/spu/Wmain.c: New test. From-SVN: r119817 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9914f2de487e..0c159c812823 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2006-12-13 Sa Liu + Ben Elliston + + * config/spu/spu.h (C_COMMON_OVERRIDE_OPTIONS): Define. + (REGISTER_TARGET_PRAGMAS): Don't zero warn_main flag. + * config/spu/spu-protos.h (spu_c_common_override_options): + Declare. + * config/spu/spu-c.c (spu_c_common_override_options): New. + * config/spu/spu.c (spu_override_options): Whitespace fix. + 2006-12-12 Trevor Smigiel * config/spu/spu.c (cpat_info): Fix an incorrectly identified case. diff --git a/gcc/config/spu/spu-c.c b/gcc/config/spu/spu-c.c index d52d5242c7ff..43d5d16b8257 100644 --- a/gcc/config/spu/spu-c.c +++ b/gcc/config/spu/spu-c.c @@ -141,3 +141,12 @@ spu_cpu_cpp_builtins (struct cpp_reader *pfile) builtin_define_std ("__vector=__attribute__((__spu_vector__))"); } +void +spu_c_common_override_options (void) +{ + if (!TARGET_STD_MAIN) + { + /* Don't give warnings about the main() function. */ + warn_main = 0; + } +} diff --git a/gcc/config/spu/spu-protos.h b/gcc/config/spu/spu-protos.h index 710c833746ae..01f5c60c887c 100644 --- a/gcc/config/spu/spu-protos.h +++ b/gcc/config/spu/spu-protos.h @@ -24,6 +24,7 @@ extern enum machine_mode spu_eh_return_filter_mode (void); extern void spu_cpu_cpp_builtins (struct cpp_reader * pfile); extern void builtin_define_std (const char *); extern void spu_override_options (void); +extern void spu_c_common_override_options (void); extern int valid_subreg (rtx op); extern void spu_expand_extv (rtx * ops, int unsignedp); extern void spu_expand_insv (rtx * ops); diff --git a/gcc/config/spu/spu.c b/gcc/config/spu/spu.c index 52b21e2e72a8..7317da70afbd 100644 --- a/gcc/config/spu/spu.c +++ b/gcc/config/spu/spu.c @@ -257,7 +257,6 @@ struct gcc_target targetm = TARGET_INITIALIZER; void spu_override_options (void) { - /* Override some of the default param values. With so many registers larger values are better for these params. */ if (MAX_UNROLLED_INSNS == 100) diff --git a/gcc/config/spu/spu.h b/gcc/config/spu/spu.h index 813bc6c039b5..5dc88fb8ee3d 100644 --- a/gcc/config/spu/spu.h +++ b/gcc/config/spu/spu.h @@ -22,6 +22,7 @@ #define TARGET_VERSION fprintf (stderr, " (spu %s)", __DATE__); #define OVERRIDE_OPTIONS spu_override_options() +#define C_COMMON_OVERRIDE_OPTIONS spu_c_common_override_options() extern int target_flags; extern const char *spu_fixed_range_string; @@ -242,8 +243,6 @@ enum reg_class { #define REGISTER_TARGET_PRAGMAS() do { \ targetm.resolve_overloaded_builtin = spu_resolve_overloaded_builtin; \ - /* Don't give warnings about the main() function. */ \ -warn_main = 0; \ }while (0); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b42ce26993f1..6f8978106dec 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2006-12-13 Ben Elliston + + * gcc.target/spu/Wmain.c: New test. + 2006-12-12 Josh Conner * g++.dg/abi/thunk3.C: Use .weak_definition on darwin. diff --git a/gcc/testsuite/gcc.target/spu/Wmain.c b/gcc/testsuite/gcc.target/spu/Wmain.c new file mode 100644 index 000000000000..530c03f2afc2 --- /dev/null +++ b/gcc/testsuite/gcc.target/spu/Wmain.c @@ -0,0 +1,7 @@ +/* { dg-do compile } */ +/* { dg-options "-Wmain -mstdmain" } */ + +int main (void *wrong) +{ /* { dg-warning "first argument of 'main' should be 'int'" "" } */ + /* { dg-warning "'main' takes only zero or two arguments" "" { target *-*-* } 5 } */ +}