| Summary: | Requesting additional warnings flags panel for gcc c++ | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Tools] CDT | Reporter: | george lulu <georgebug> | ||||||
| Component: | cdt-build-managed | Assignee: | Marco Stornelli <marco.stornelli> | ||||||
| Status: | RESOLVED FIXED | QA Contact: | Andrew Gvozdev <angvoz.dev> | ||||||
| Severity: | enhancement | ||||||||
| Priority: | P3 | CC: | jonah, junk, marco.stornelli, noloader, obusatto | ||||||
| Version: | 8.0 | ||||||||
| Target Milestone: | 9.11.0 | ||||||||
| Hardware: | PC | ||||||||
| OS: | Linux | ||||||||
| See Also: | https://bugs.eclipse.org/bugs/show_bug.cgi?id=574448 | ||||||||
| Whiteboard: | |||||||||
| Bug Depends on: | 365461 | ||||||||
| Bug Blocks: | |||||||||
| Attachments: |
|
||||||||
Created attachment 207852 [details]
Adding -Wextra flag to gcc c/c++ settings
Created attachment 207854 [details]
Adding -Wconversion flag to gcc c/c++ settings
I attached 2 patches adding -Wconversion and -Wextra to the compiler settings. This is a quite old bug, anyone know if there is someone working with that? (In reply to comment #3) > I attached 2 patches adding -Wconversion and -Wextra to the compiler settings. > This is a quite old bug, anyone know if there is someone working with that? We monitor developments on old bugs too. Your patches seem to be a subset of the request in this bug, could you open a new one and attach the patches there? (In reply to comment #4) > (In reply to comment #3) > > I attached 2 patches adding -Wconversion and -Wextra to the compiler settings. > > This is a quite old bug, anyone know if there is someone working with that? > We monitor developments on old bugs too. Your patches seem to be a subset of > the request in this bug, could you open a new one and attach the patches there? Sure. I just created a new bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=365461 (In reply to comment #0) > The flags "-Wall -Wextra(alias -W) -pendatic" include the majority of warning > messages and improve quality of written significantly through their alerts, to > make the writing style of code even more portable and to encourage better > writing style I suggest that a seperate panel be listed for the following > warnings that are not included in "-Wall -Wextra -pendatic" > > These non-optimization related warnings are not included in the flags "-Wall > -Wextra -pendatic" > > -Wwrite-strings -Woverloaded-virtual -Weffc++ -Wold-style-cast -Wformat=2 > -Wswitch-default -Wswitch-enum -Wunused-parameter -Wfloat-equal -Wcast-qual > -Wconversion -Wlogical-op -Waggregate-return -Wmissing-declarations > -Wmissing-noreturn -Wmissing-format-attribute -Wredundant-decls -Wshadow > > To even further increase the functionality of the software, the folliwing > warnings check boxes could be implemented and could be half-selected(grayed) in > the panel when the corresponding -Wall and/or -Wextra function activates them. > For quick reference I've included that section of the manual below. > > To easily further increase the functionality, the current as of the > implementation of this feature could have hover text that reads from the > corresponding definition of the warning flag from the gcc manual page. > > Thank you for your time! Awesome idea - compiler and linker hardening switches are often overlooked. For C/C++ projects, you might also include -Wformat=2, -Wformat-security and -Wstrict-overflow (GCC 4.2 and later). Linker hardening would include -Wl,-z,relro -Wl,-z,now and -fPIE. I'm not holding my breath on linker hardening, but it would be refreshing to see some compiler hardening available and on by default. For those who want to shoot themselves in the foot (by turning off a switch or flag), make them take action to do it. Jeffrey Walton It would be nice to have a panel for arbitrary flags. For example I like to add the -Werror=return-type flag. *** Bug 377366 has been marked as a duplicate of this bug. *** |
The flags "-Wall -Wextra(alias -W) -pendatic" include the majority of warning messages and improve quality of written significantly through their alerts, to make the writing style of code even more portable and to encourage better writing style I suggest that a seperate panel be listed for the following warnings that are not included in "-Wall -Wextra -pendatic" These non-optimization related warnings are not included in the flags "-Wall -Wextra -pendatic" -Wwrite-strings -Woverloaded-virtual -Weffc++ -Wold-style-cast -Wformat=2 -Wswitch-default -Wswitch-enum -Wunused-parameter -Wfloat-equal -Wcast-qual -Wconversion -Wlogical-op -Waggregate-return -Wmissing-declarations -Wmissing-noreturn -Wmissing-format-attribute -Wredundant-decls -Wshadow To even further increase the functionality of the software, the folliwing warnings check boxes could be implemented and could be half-selected(grayed) in the panel when the corresponding -Wall and/or -Wextra function activates them. For quick reference I've included that section of the manual below. To easily further increase the functionality, the current as of the implementation of this feature could have hover text that reads from the corresponding definition of the warning flag from the gcc manual page. Thank you for your time! -Wall turns on the following warning flags: -Waddress -Warray-bounds (only with -O2) -Wc++0x-compat -Wchar-subscripts -Wimplicit-int -Wimplicit-function-declaration -Wcomment -Wformat -Wmain (only for C/ObjC and unless -ffreestanding) -Wmissing-braces -Wnonnull -Wparentheses -Wpointer-sign -Wreorder -Wreturn-type -Wsequence-point -Wsign-compare (only in C++) -Wstrict-aliasing -Wstrict-overflow=1 -Wswitch -Wtrigraphs -Wuninitialized (only with -O1 and above) -Wunknown-pragmas -Wunused-function -Wunused-label -Wunused-value -Wunused-variable -Wall turns on the following warning flags: -Wclobbered -Wempty-body -Wignored-qualifiers -Wmissing-field-initializers -Wmissing-parameter-type (C only) -Wold-style-declaration (C only) -Woverride-init -Wsign-compare -Wtype-limits -Wuninitialized (only with -O1 and above)