Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 365461 - Requesting -Wextra and -Wconversion warnings flags for gcc c/c++
Summary: Requesting -Wextra and -Wconversion warnings flags for gcc c/c++
Status: VERIFIED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-build-managed (show other bugs)
Version: 8.1.0   Edit
Hardware: PC All
: P3 enhancement (vote)
Target Milestone: 8.0.2   Edit
Assignee: Andrew Gvozdev CLA
QA Contact: Chris Recoskie CLA
URL:
Whiteboard:
Keywords:
: 331728 (view as bug list)
Depends on:
Blocks: 266305
  Show dependency tree
 
Reported: 2011-12-02 12:29 EST by Otavio Pontes CLA
Modified: 2012-02-23 11:30 EST (History)
4 users (show)

See Also:


Attachments
Adding -Wextra flag to gcc c/c++ settings (2.25 KB, patch)
2011-12-02 12:31 EST, Otavio Pontes CLA
angvoz.dev: iplog+
Details | Diff
Adding -Wconversion flag to gcc c/c++ (2.25 KB, patch)
2011-12-02 12:31 EST, Otavio Pontes CLA
angvoz.dev: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.