From: Joseph Myers Date: Mon, 30 Aug 2010 10:30:57 +0000 (+0100) Subject: opts.h (CL_ERR_NEGATIVE): Define. X-Git-Tag: releases/gcc-4.6.0~4787 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=184eb658fe5d4897c705d28ad01c3bd51e8fc62f;p=thirdparty%2Fgcc.git opts.h (CL_ERR_NEGATIVE): Define. * opts.h (CL_ERR_NEGATIVE): Define. * opts.c (unknown_option_callback): Don't postpone warnings for options marked with CL_ERR_NEGATIVE. * opts-common.c (decode_cmdline_option): Set CL_ERR_NEGATIVE error for negative versions of CL_REJECT_NEGATIVE options. testsuite: * gcc.dg/opts-1.c: Expect errors, not warnings. From-SVN: r163637 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5a23b03dd397..37106bff8842 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2010-08-30 Joseph Myers + + * opts.h (CL_ERR_NEGATIVE): Define. + * opts.c (unknown_option_callback): Don't postpone warnings for + options marked with CL_ERR_NEGATIVE. + * opts-common.c (decode_cmdline_option): Set CL_ERR_NEGATIVE error + for negative versions of CL_REJECT_NEGATIVE options. + 2010-08-30 Uros Bizjak * config/i386/i386.md (zero_extendsidi2_1): Rename from diff --git a/gcc/opts-common.c b/gcc/opts-common.c index cd4ec2b55868..871e4662d3b9 100644 --- a/gcc/opts-common.c +++ b/gcc/opts-common.c @@ -197,6 +197,7 @@ decode_cmdline_option (const char **argv, unsigned int lang_mask, if (!value && (option->flags & CL_REJECT_NEGATIVE)) { opt_index = OPT_SPECIAL_unknown; + errors |= CL_ERR_NEGATIVE; arg = argv[0]; goto done; } diff --git a/gcc/opts.c b/gcc/opts.c index d1f956889a92..034157dc3584 100644 --- a/gcc/opts.c +++ b/gcc/opts.c @@ -482,7 +482,8 @@ unknown_option_callback (const struct cl_decoded_option *decoded) { const char *opt = decoded->arg; - if (opt[1] == 'W' && opt[2] == 'n' && opt[3] == 'o' && opt[4] == '-') + if (opt[1] == 'W' && opt[2] == 'n' && opt[3] == 'o' && opt[4] == '-' + && !(decoded->errors & CL_ERR_NEGATIVE)) { /* We don't generate warnings for unknown -Wno-* options unless we issue diagnostics. */ diff --git a/gcc/opts.h b/gcc/opts.h index 74e5733731de..b2ff86c637b2 100644 --- a/gcc/opts.h +++ b/gcc/opts.h @@ -102,6 +102,9 @@ extern const unsigned int cl_lang_count; #define CL_ERR_MISSING_ARG (1 << 1) /* Argument required but missing. */ #define CL_ERR_WRONG_LANG (1 << 2) /* Option for wrong language. */ #define CL_ERR_UINT_ARG (1 << 3) /* Bad unsigned integer argument. */ +#define CL_ERR_NEGATIVE (1 << 4) /* Negative form of option + not permitted (together + with OPT_SPECIAL_unknown). */ /* Structure describing the result of decoding an option. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index fe9f0240bde5..984c2f45ef20 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2010-08-30 Joseph Myers + + * gcc.dg/opts-1.c: Expect errors, not warnings. + 2010-08-29 Janus Weil PR fortran/42769 diff --git a/gcc/testsuite/gcc.dg/opts-1.c b/gcc/testsuite/gcc.dg/opts-1.c index 0d16c3ded6e9..3b90fe97dcc6 100644 --- a/gcc/testsuite/gcc.dg/opts-1.c +++ b/gcc/testsuite/gcc.dg/opts-1.c @@ -5,5 +5,5 @@ /* { dg-error "-fno-abi-version" "-fno-abi-version" { target *-*-* } 0 } */ /* { dg-error "-fno-lto-compression-level" "-fno-lto-compression-level" { target *-*-* } 0 } */ /* { dg-error "-fno-tree-parallelize-loops" "-fno-tree-parallelize-loops" { target *-*-* } 0 } */ -/* { dg-warning "-Wno-strict-overflow" "-Wno-strict-overflow" { target *-*-* } 0 } */ -/* { dg-warning "-Wno-strict-aliasing" "-Wno-strict-aliasing" { target *-*-* } 0 } */ +/* { dg-error "-Wno-strict-overflow" "-Wno-strict-overflow" { target *-*-* } 0 } */ +/* { dg-error "-Wno-strict-aliasing" "-Wno-strict-aliasing" { target *-*-* } 0 } */