| Summary: | Feature Request: Add -Wextra in addition to -Wall in C/C++'s default project settings | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [Tools] CDT | Reporter: | Jeffrey Walton <noloader> | ||||||||
| Component: | cdt-build | Assignee: | Andrew Gvozdev <angvoz.dev> | ||||||||
| Status: | RESOLVED DUPLICATE | QA Contact: | Andrew Gvozdev <angvoz.dev> | ||||||||
| Severity: | enhancement | ||||||||||
| Priority: | P3 | CC: | cdtdoug, obusatto, remy.suen | ||||||||
| Version: | 7.0 | ||||||||||
| Target Milestone: | --- | ||||||||||
| Hardware: | PC | ||||||||||
| OS: | Linux | ||||||||||
| Whiteboard: | |||||||||||
| Attachments: |
|
||||||||||
CDT issues go to CDT. 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. Created attachment 184426 [details]
Patch for -Wextra and -Wno-unused-parameter (1 of 2)
Created attachment 184427 [details]
Patch for -Wextra and -Wno-unused-parameter (2 of 2)
> 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.
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.
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. 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. -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 *** |
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