lalebarde
lalebarde

Reputation: 1816

How to identify a warning type in a gcc compile log to disable it?

I have many warnings when I compile my project under Eclipse CDT Indigo and g++ (Debian 4.9.2-10) 4.9.2. From here, it may be explained by some Eclipse parser bugs, plus possibly some external library bugs.

I will upgrade Eclipse of course, but I cannot now.

I would like then to suppress these cumbersome warnings. I read the manual here, but still I don't see how to identify which options to set. I have unchecked the -Wall option in Eclipse, but nothing is changed. All Eclipse warnings are disabled now.

Here is a pastbin of my compile log.

Upvotes: 2

Views: 553

Answers (1)

n. m. could be an AI
n. m. could be an AI

Reputation: 119877

It looks like something ate your actual warning lines. All gcc warnings have the word "warning" in at least one of the lines.

EDIT Some builds of gcc actually produce similar messages ("note" lines, "required from" lines, "instantiated from" lines... but no actual "error" or "warning" line). It looks like there's a bug in gcc. — end edit.

Out of all gcc warnings, I know of only one that is related to overloading and has "note" submessages that lists candidate functions. The warning reads

C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second

and it cannot be turned off. If you see such warning, your program is non-compliant and you should fix it.

Here's an example of such non-compliant code. with function signatures matching yours:

#include <string>

struct KeyWord
{
    KeyWord(const std::string&);
    operator std::string&() const;
};

struct A
{
    bool operator() (const std::string&, const std::string&) const;
    bool operator() (const KeyWord&, const KeyWord&);
};

int main ()
{
    A a;
    std::string s;
    const std::string r;
    a(s, r);
}

Making the second operator() const solves the problem.

Upvotes: 1

Related Questions