User account creation filtered due to spam.

Bug 7651 - Define -Wextra strictly in terms of other warning flags
Summary: Define -Wextra strictly in terms of other warning flags
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: unknown
: P3 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: easyhack
: 7653 28876 (view as bug list)
Depends on: 68897 81453
Blocks: 44209
  Show dependency treegraph
 
Reported: 2002-08-20 07:36 UTC by ac131313
Modified: 2017-07-26 15:33 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2005-12-24 19:53:21


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ac131313 2002-08-20 07:36:01 UTC
Assuming I'm reading the current manual correctly, the
-W option is a combination of the following existing
options:

  o  -Wreturn-type

  o  -Wsign-compare

  o  -Wmissing-braces

And also:

  o  An automatic variable can be clobered by a setjmp/longjmp.

  o  An expression statement has no side effects.

  o  ``static'' doesn't come first.

  o  (x<=y ? 1 : 0) <= z} vs {x<=y<=z}

  o  A function returning ``const''.

  o  Missing initalizers for an aggregate.

  o  The -Wunused side effect.

Suggest defining -W strictly in terms of other -W options.
More -W options would need to be added.

Release:
unknown
Comment 1 Andrew Pinski 2003-05-24 01:43:40 UTC
Confirmed with mainline (20030523), this is something nice to have.
Comment 2 Andrew Pinski 2003-05-29 17:15:24 UTC
I forgot to mention that on the mainline -W is now an alias for -Wextra, so it looks like it is 
partly fixed.
Comment 3 Nathanael C. Nerode 2003-07-12 03:50:07 UTC
(resummarizing due to renaming of -W)

Not clear that this is technically fixed; shouldn't -Wextra also be defined
strictly in terms of other warning flags?  And I don't know if it is yet,
but I'd guess not.
Comment 4 ac131313 2003-07-18 17:20:24 UTC
Subject: Re:  Define -Wextra strictly in terms of other warning
 flags

> Not clear that this is technically fixed; shouldn't -Wextra also be defined
> strictly in terms of other warning flags?  And I don't know if it is yet,
> but I'd guess not.

You're correct, it isn't fixed.


Comment 5 Andrew Pinski 2006-08-28 20:33:15 UTC
*** Bug 28876 has been marked as a duplicate of this bug. ***
Comment 6 patchapp@dberlin.org 2006-12-15 12:35:22 UTC
Subject: Bug number PR7651

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2006-12/msg01103.html
Comment 7 Manuel López-Ibáñez 2006-12-16 16:48:15 UTC
Subject: Bug 7651

Author: manu
Date: Sat Dec 16 16:48:01 2006
New Revision: 119963

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=119963
Log:
2006-12-16  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>

	PR middle-end/7651
	* c.opt (Wempty-body): New.
	* doc/invoke.texi (Wempty-body): Document it.
	(Wextra): Enabled by -Wextra.
	* c-opts.c (c_common_post_options): Enabled by -Wextra.
	* c-common.c (empty_body_warning): Replace Wextra with Wempty-body.
	* c-parser.c (c_parser_c99_block_statement): Likewise.
testsuite/
	* gcc.dg/20001116-1.c: Replace -Wextra with -Wempty-body.
	* gcc.dg/if-empty-1.c: Likewise.
	* gcc.dg/pr23165.c: Likewise.
	* g++.dg/warn/empty-body.C: Likewise.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-common.c
    trunk/gcc/c-opts.c
    trunk/gcc/c-parser.c
    trunk/gcc/c.opt
    trunk/gcc/doc/invoke.texi
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/g++.dg/warn/empty-body.C
    trunk/gcc/testsuite/gcc.dg/20001116-1.c
    trunk/gcc/testsuite/gcc.dg/if-empty-1.c
    trunk/gcc/testsuite/gcc.dg/pr23165.c

Comment 8 patchapp@dberlin.org 2006-12-18 00:20:42 UTC
Subject: Bug number PR7651

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2006-12/msg01244.html
Comment 9 patchapp@dberlin.org 2006-12-20 00:57:26 UTC
Subject: Bug number PR7651

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2006-12/msg01415.html
Comment 10 Manuel López-Ibáñez 2006-12-22 15:54:20 UTC
Subject: Bug 7651

Author: manu
Date: Fri Dec 22 15:54:05 2006
New Revision: 120151

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=120151
Log:
2006-12-22  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>

	PR middle-end/7651
	* c.opt (Wclobbered): New.
	* doc/invoke.texi (Wclobbered): Document it.
	(Wextra): Enabled by -Wextra.
	* c-opts.c (c_common_post_options): Enabled by -Wextra.
	* flow.c (rest_of_handle_life): Replace Wextra with Wclobbered.
	* function.c (setjmp_vars_warning): Only warn for Wclobbered.
	(setjmp_args_warning): Likewise.

testsuite/

	* gcc.dg/attr-returns_twice-1.c: Replace Wextra with Wclobbered.
	* gcc.dg/setjmp-1.c: Add explicit Wclobbered.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-opts.c
    trunk/gcc/c.opt
    trunk/gcc/doc/invoke.texi
    trunk/gcc/flow.c
    trunk/gcc/function.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.dg/attr-returns_twice-1.c
    trunk/gcc/testsuite/gcc.dg/setjmp-1.c

Comment 11 Manuel López-Ibáñez 2006-12-23 17:45:48 UTC
Subject: Bug 7651

Author: manu
Date: Sat Dec 23 17:45:33 2006
New Revision: 120173

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=120173
Log:
2006-12-23  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>

	PR middle-end/7651
	* c.opt (Wmissing-parameter-type): New.
	* doc/invoke.texi (Wmissing-parameter-type): Document it.
	(Wextra): Enabled by -Wextra.
	* c-opts.c (c_common_post_options): Enabled by -Wextra.
	* c-decl.c (store_parm_decls_oldstyle): Replace Wextra with
	Wmissing-parameter-type.
	
testsuite/

	* gcc.dg/Wmissing-parameter-type.c: New.
	* gcc.dg/Wmissing-parameter-type-Wextra.c: New.
	* gcc.dg/Wmissing-parameter-type-no.c: New.

Added:
    trunk/gcc/testsuite/gcc.dg/Wmissing-parameter-type-Wextra.c
    trunk/gcc/testsuite/gcc.dg/Wmissing-parameter-type-no.c
    trunk/gcc/testsuite/gcc.dg/Wmissing-parameter-type.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-decl.c
    trunk/gcc/c-opts.c
    trunk/gcc/c.opt
    trunk/gcc/doc/invoke.texi
    trunk/gcc/testsuite/ChangeLog

Comment 12 patchapp@dberlin.org 2006-12-24 14:15:24 UTC
Subject: Bug number PR7651

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2006-12/msg01661.html
Comment 13 patchapp@dberlin.org 2006-12-24 14:30:23 UTC
Subject: Bug number PR7651

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2006-12/msg01663.html
Comment 14 patchapp@dberlin.org 2006-12-29 18:35:31 UTC
Subject: Bug number PR7651

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2006-12/msg01837.html
Comment 15 patchapp@dberlin.org 2006-12-29 19:30:20 UTC
Subject: Bug number PR7651

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2006-12/msg01842.html
Comment 16 Manuel López-Ibáñez 2007-01-02 17:33:36 UTC
Subject: Bug 7651

Author: manu
Date: Tue Jan  2 17:33:25 2007
New Revision: 120347

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=120347
Log:
2007-01-02  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>

	PR middle-end/7651
	* c.opt (Wold-style-declaration): New.
	* doc/invoke.texi (C-only Warning Options): New.
	(Wold-style-declaration): Document it.
	(Wextra): Enabled by -Wextra.
	* c-opts.c (c_common_post_options): Enabled by -Wextra.
	* c-decl.c (declspecs_add_scspec): Replace -Wextra with
	-Wold-style-declaration.

testsuite/
	* gcc.dg/declspec-3.c: Replace -W with -Wold-style-declaration.
	* gcc.dg/declspec-3-Wextra.c: New.
	* gcc.dg/declspec-3-no.c: New

Added:
    trunk/gcc/testsuite/gcc.dg/declspec-3-Wextra.c
    trunk/gcc/testsuite/gcc.dg/declspec-3-no.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-decl.c
    trunk/gcc/c-opts.c
    trunk/gcc/c.opt
    trunk/gcc/doc/invoke.texi
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.dg/declspec-3.c

Comment 17 patchapp@dberlin.org 2007-01-05 23:40:26 UTC
Subject: Bug number PR7651

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2007-01/msg00440.html
Comment 18 patchapp@dberlin.org 2007-01-07 12:55:45 UTC
Subject: Bug number PR7651

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2007-01/msg00503.html
Comment 19 patchapp@dberlin.org 2007-01-07 21:05:17 UTC
Subject: Bug number PR7651

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2007-01/msg00520.html
Comment 20 patchapp@dberlin.org 2007-01-08 21:25:25 UTC
Subject: Bug number PR7651

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2007-01/msg00608.html
Comment 21 patchapp@dberlin.org 2007-01-16 00:56:49 UTC
Subject: Bug number PR7651

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2007-01/msg01120.html
Comment 22 patchapp@dberlin.org 2007-01-23 19:45:39 UTC
Subject: Bug number PR7651

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2007-01/msg01933.html
Comment 23 Manuel López-Ibáñez 2007-02-12 09:32:19 UTC
Subject: Bug 7651

Author: manu
Date: Mon Feb 12 09:32:08 2007
New Revision: 121843

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=121843
Log:
2007-02-12  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>

	PR middle-end/7651
	* doc/invoke.texi (Wunused-value): Update description.
	(Wextra): Delete item.
	* opts.c (set_Wextra): Don't use the value of Wextra to set the
	value of Wunused-value.
	* c-typeck.c (c_process_expr_stmt): Don't check extra_warnings.
	(c_finish_stmt_expr): Don't check extra_warnings.
	(emit_side_effect_warnings): The caller is responsible to check
	warn_unused_value.
cp/
	* cp-gimplify.c (gimplify_expr_stmt): Don't check extra_warnings.
	Check warn_unused_value just once.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-typeck.c
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/cp-gimplify.c
    trunk/gcc/doc/invoke.texi
    trunk/gcc/opts.c

Comment 24 patchapp@dberlin.org 2007-02-12 22:10:33 UTC
Subject: Bug number PR7651

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2007-02/msg01102.html
Comment 25 Manuel López-Ibáñez 2007-05-20 01:46:14 UTC
Subject: Bug 7651

Author: manu
Date: Sun May 20 00:45:58 2007
New Revision: 124866

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=124866
Log:
2006-05-20  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>

	PR middle-end/7651
	* doc/invoke.texi (Wreturn-type): Complete description.
	(Wextra): Delete item about return-type warning.
	* c-decl.c: Delete redundant Wextra warning.

testsuite/
	* gcc.dg/20030906-1.c: Replace Wextra with Wreturn-type.
	* gcc.dg/20030906-2.c: Likewise.
	* objc.dg/method-17.m: Add -Wreturn-type.
	* obj-c++.dg/method-21.mm: Likewise.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-decl.c
    trunk/gcc/doc/invoke.texi
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.dg/20030906-1.c
    trunk/gcc/testsuite/gcc.dg/20030906-2.c
    trunk/gcc/testsuite/obj-c++.dg/method-21.mm
    trunk/gcc/testsuite/objc.dg/method-17.m

Comment 26 Manuel López-Ibáñez 2007-05-20 21:31:57 UTC
Subject: Bug 7651

Author: manu
Date: Sun May 20 20:29:55 2007
New Revision: 124875

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=124875
Log:
2007-05-20  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>
	
	PR middle-end/7651
	PR c++/11856
	PR c/12963
	PR c/23587
	PR other/29694
	* c.opt (Wtype-limits): New.
	* doc/invoke.texi (Wtype-limits): Document it.
	(Wextra): Enabled by -Wextra.
	* c-opts.c (c_common_post_options): Enabled by -Wextra.
	* c-common.c (shorten_compare): Warn with Wtype-limits.

testsuite/
	* gcc.dg/compare6.c: Replace Wall with Wtype-limits.
	* gcc.dg/Wtype-limits.c: New.
	* gcc.dg/Wtype-limits-Wextra.c: New.
	* gcc.dg/Wtype-limits-no.c: New.
	* g++.dg/warn/Wtype-limits.C: New.
	* g++.dg/warn/Wtype-limits-Wextra.C: New.
	* g++.dg/warn/Wtype-limits-no.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/warn/Wtype-limits-Wextra.C
    trunk/gcc/testsuite/g++.dg/warn/Wtype-limits-no.C
    trunk/gcc/testsuite/g++.dg/warn/Wtype-limits.C
    trunk/gcc/testsuite/gcc.dg/Wtype-limits-Wextra.c
    trunk/gcc/testsuite/gcc.dg/Wtype-limits-no.c
    trunk/gcc/testsuite/gcc.dg/Wtype-limits.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-common.c
    trunk/gcc/c-opts.c
    trunk/gcc/c.opt
    trunk/gcc/doc/invoke.texi
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.dg/compare6.c

Comment 27 Manuel López-Ibáñez 2008-08-08 23:33:49 UTC
Subject: Bug 7651

Author: manu
Date: Fri Aug  8 23:32:23 2008
New Revision: 138892

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=138892
Log:
2008-08-09  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>

	PR 7651
	* doc/invoke.texi (-Wextra): Move warning from here...
	(-Wuninitialized): ... to here.
cp/
	* class.c (check_bases_and_members): Warn with -Wuninitialized
	instead of -Wextra.
testsuite/
	* g++.dg/warn/Wuninitializable-member.C: New.
	* g++.dg/warn/Wuninitializable-member-no.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/warn/Wuninitializable-member-no.C
    trunk/gcc/testsuite/g++.dg/warn/Wuninitializable-member.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/class.c
    trunk/gcc/doc/invoke.texi
    trunk/gcc/testsuite/ChangeLog

Comment 28 Manuel López-Ibáñez 2014-08-21 01:24:25 UTC
A good way to finish this is to find which option in Clang warns for the corresponding thing in Wextra and add the same option to GCC.

I can take care of writing and testing the patches but someone else would need to do the search for each warning.
Comment 29 Marek Polacek 2014-08-21 07:05:33 UTC
I'll look at it if I find some free time, this should be easy.
Comment 30 Manuel López-Ibáñez 2014-08-21 09:02:39 UTC
(In reply to Marek Polacek from comment #29)
> I'll look at it if I find some free time, this should be easy.

Fine, although this is such a minor issue that it doesn't seem worth your time/skills. I'd rather see you tackle the really challenging stuff that newbies and sporadic contributors could not manage, like the folding in the FEs or PR52959 or the various bugs present in our macro unwinder (see point I at https://gcc.gnu.org/wiki/Better_Diagnostics).

The last ones would require some discussion with Dodji about what result he really wants to see. Perhaps this would be easier for you than for an outsider.
Comment 31 Jakub Jelinek 2015-04-22 11:58:26 UTC
GCC 5.1 has been released.
Comment 32 Richard Biener 2015-07-16 09:13:01 UTC
GCC 5.2 is being released, adjusting target milestone to 5.3.
Comment 33 Manuel López-Ibáñez 2015-07-16 09:45:19 UTC
non-regressions should not have target milestones.
Comment 34 Manuel López-Ibáñez 2016-02-15 22:50:37 UTC
This should be easy (apart from the option name bike-shedding)