| Summary: | Requesting -Wextra and -Wconversion warnings flags for gcc c/c++ | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Tools] CDT | Reporter: | Otavio Pontes <obusatto> | ||||||
| Component: | cdt-build-managed | Assignee: | Andrew Gvozdev <angvoz.dev> | ||||||
| Status: | VERIFIED FIXED | QA Contact: | Chris Recoskie <recoskie> | ||||||
| Severity: | enhancement | ||||||||
| Priority: | P3 | CC: | cdtdoug, eclipse.sprigogin, malaperle, noloader | ||||||
| Version: | 8.1.0 | ||||||||
| Target Milestone: | 8.0.2 | ||||||||
| Hardware: | PC | ||||||||
| OS: | All | ||||||||
| Whiteboard: | |||||||||
| Bug Depends on: | |||||||||
| Bug Blocks: | 266305 | ||||||||
| Attachments: |
|
||||||||
Created attachment 207855 [details]
Adding -Wextra flag to gcc c/c++ settings
Created attachment 207856 [details]
Adding -Wconversion flag to gcc c/c++
Thanks for the patch! Committed to master and cdt_8_0. By some reason git authored this to Sergey quite unexpectedly and I noticed too late. I apologize to both of you. *** Bug 331728 has been marked as a duplicate of this bug. *** Verified in 8.0.2 RC1. |
In Project properties->C/C++ Build->Settings, we can change some warning flags from gcc compiler. I propose adding -Wextra and -Wconversion flags to that page. According to gcc manual this flags do the following: -Wextra This enables some extra warning flags that are not enabled by -Wall. (This option used to be called -W. The older name is still supported, but the newer name is more descriptive.) [...] -Wconversion Warn for implicit conversions that may alter a value. This includes conversions between real and integer, like "abs (x)" when "x" is "double"; conversions between signed and unsigned, like "unsigned ui = -1"; and conversions to smaller types, like "sqrtf (M_PI)". Do not warn for explicit casts like "abs ((int) x)" and "ui = (unsigned) -1", or if the value is not changed by the conversion like in "abs (2.0)". Warnings about conversions between signed and unsigned integers can be disabled by using -Wno-sign-conversion. [...]