Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 331728 - Feature Request: Add -Wextra in addition to -Wall in C/C++'s default project settings
Summary: Feature Request: Add -Wextra in addition to -Wall in C/C++'s default project ...
Status: RESOLVED DUPLICATE of bug 365461
Alias: None
Product: CDT
Classification: Tools
Component: cdt-build (show other bugs)
Version: 7.0   Edit
Hardware: PC Linux
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Andrew Gvozdev CLA
QA Contact: Andrew Gvozdev CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-02 17:16 EST by Jeffrey Walton CLA
Modified: 2011-12-23 16:14 EST (History)
3 users (show)

See Also:


Attachments
Patch for -Wextra and -Wno-unused-parameter (1 of 2) (1.06 KB, patch)
2010-12-02 19:01 EST, Jeffrey Walton CLA
no flags Details | Diff
Patch for -Wextra and -Wno-unused-parameter (2 of 2) (1.83 KB, patch)
2010-12-02 19:02 EST, Jeffrey Walton CLA
no flags Details | Diff
Patch for -Wextra and -Wno-unused-parameter (2 of 2) (2.33 KB, patch)
2010-12-02 21:37 EST, Jeffrey Walton CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jeffrey Walton CLA 2010-12-02 17:16:16 EST
Build Identifier: 

-Wextra is a switch that alerts programmers to some of the more mundane issues in their code. In addition, the switch is sometimes used in security audits (a clean compile is a quality gate). Many folks are not aware of the warning switch. Consequently, many programmers are not aware of minor issues in their code.

The -Wextra switch can create a lot of additional noise in C++ projects, especially if many interfaces are present. To quiet the noise, one generally uses -Wno-unused-parameter

It would be great if Eclipse considered the following as default warnings on C/C++ projects which use GCC toolschain:

    -Wall -Wextra -Wno-unused-parameter

Reproducible: Always

Steps to Reproduce:
N/A
Comment 1 Remy Suen CLA 2010-12-02 17:21:24 EST
CDT issues go to CDT.
Comment 2 Andrew Gvozdev CLA 2010-12-02 17:57:02 EST
If anybody is really interested in adding more options, patches are welcome. There is an example of similar change in bug 256763. But for changing the defaults it would take discussing on cdt-dev list.
Comment 3 Jeffrey Walton CLA 2010-12-02 19:01:48 EST
Created attachment 184426 [details]
Patch for -Wextra and -Wno-unused-parameter (1 of 2)
Comment 4 Jeffrey Walton CLA 2010-12-02 19:02:23 EST
Created attachment 184427 [details]
Patch for -Wextra and -Wno-unused-parameter (2 of 2)
Comment 5 Jeffrey Walton CLA 2010-12-02 19:04:08 EST
> If anybody is really interested in adding more options, patches are welcome.
As requested. Options are off by default.

As the options can enhance code quality, I would strongly encourage the development team to debate their inclusion as default values.
Comment 6 Jeffrey Walton CLA 2010-12-02 21:37:13 EST
Created attachment 184430 [details]
Patch for -Wextra and -Wno-unused-parameter (2 of 2)

Updated.... original was borked by putting GDB extensions (-ggdb) under <optionCategory> node rather than <option> node.
Comment 7 Andrew Gvozdev CLA 2010-12-04 09:08:06 EST
Thanks for the patch. Here are some comments:

- You should make changes in necessary files in the project and make patch via Team->Create Patch context menu. No need to rename files. The patch should be from workspace root. That makes it easier for both contributor and committer. See http://wiki.eclipse.org/CDT/contributing for what committers expect in a patch.
- I see new warnings are added for C compiler but not for C++.
- The strings like "%Option.Posix.Warn.ExtraWarn" should be added in plugin.properties with user friendly description similarly to others. Now I just see text "%Option..." in UI.
Comment 8 Otavio Pontes CLA 2011-12-02 12:00:27 EST
I created a patch adding -Wextra and -Wconversion in bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=266305
I'm commenting here because it is related to this one.
Comment 9 Andrew Gvozdev CLA 2011-12-23 16:14:17 EST
-Wextra added to the list in bug 365461. It won't be a default as mentioned.

*** This bug has been marked as a duplicate of bug 365461 ***