Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 365461

Summary: Requesting -Wextra and -Wconversion warnings flags for gcc c/c++
Product: [Tools] CDT Reporter: Otavio Pontes <obusatto>
Component: cdt-build-managedAssignee: 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:
Description Flags
Adding -Wextra flag to gcc c/c++ settings
angvoz.dev: iplog+
Adding -Wconversion flag to gcc c/c++ angvoz.dev: iplog+

Description Otavio Pontes CLA 2011-12-02 12:29:02 EST
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.
[...]
Comment 1 Otavio Pontes CLA 2011-12-02 12:31:34 EST
Created attachment 207855 [details]
Adding -Wextra flag to gcc c/c++ settings
Comment 2 Otavio Pontes CLA 2011-12-02 12:31:57 EST
Created attachment 207856 [details]
Adding -Wconversion flag to gcc c/c++
Comment 3 Andrew Gvozdev CLA 2011-12-23 16:08:53 EST
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.
Comment 4 Andrew Gvozdev CLA 2011-12-23 16:14:17 EST
*** Bug 331728 has been marked as a duplicate of this bug. ***
Comment 5 Marc-André Laperle CLA 2012-01-24 22:52:12 EST
Verified in 8.0.2 RC1.