EmbDev.net

Forum: ARM programming with GCC/GNU tools Suppressing the GCC warning: "<term1> is obsolescent, use <term2> instead."


von Magentus _. (magentus)


Rate this post
useful
not useful
Hi,

I've been programming in C++ for years, but I am new to programming on 
Linux and gcc/g++. My team at work is developing an application for 
embedded Linux. We want to be able to build our code without any 
compiler or linker warnings, in order to use the '-Werror' flag.  That 
way we would enforce fixing causes on any new warnings as and when they 
are introduced.

Our problem is caused by third party libraries. I've managed to suppress 
compiler warnings relating to code in Boost etc, by using '-isystem' 
instead of '-I'. Warnings that remain seem to be caused by the linker. 
We get a number of these:

[...]/usr/lib/libcrypto.so: warning: gethostbyname is obsolescent, use 
getnameinfo() instead.

Using '-Wno-deprecated-declarations' doesn't have the desired effect.

Is there a way to suppress the '<term> is obsolescent' warning generated 
for code in third party libraries?

Thanks.

von Rolf Magnus (Guest)


Rate this post
useful
not useful
Magentus _. wrote:
> Using '-Wno-deprecated-declarations' doesn't have the desired effect.

That's because that warning is not about a declaration, and actually not 
even coming from GCC, but from the linker.

> Is there a way to suppress the '<term> is obsolescent' warning generated
> for code in third party libraries?

I don't know any way to switch this off.

von Magentus _. (magentus)


Rate this post
useful
not useful
Rolf Magnus wrote:

> Magentus _. wrote:
>> Using '-Wno-deprecated-declarations' doesn't have the desired effect.
>
> That's because that warning is not about a declaration, and actually not
> even coming from GCC, but from the linker.

That makes sense.

>> Is there a way to suppress the '<term> is obsolescent' warning generated
>> for code in third party libraries?
>
> I don't know any way to switch this off.

Thank you.

von Guest (Guest)


Rate this post
useful
not useful
If the linker is the source of the problem you can try building the SW 
by first compiling to object code (with the -Werror flag) then linking 
(without the -Werror flag).

von Magentus _. (magentus)


Rate this post
useful
not useful
In theory we could, but it would be impractical. The goal here is to set 
the '-Werror' flag on, which then enforces the policy of not introducing 
new warnings.

Doing it in the proposed two-step process would put the onus of 
following it on the developer, and that is the situation in which our 
team already is.  Seeing as new warnings still creep in, some of our 10+ 
developers clearly can't handle that responsibility.

I appreciate you suggesting it, though.

von Guest (Guest)


Rate this post
useful
not useful
If you can enforce setting the -Werror flag for the complete build, I 
see no reason why you couldn't do that only for the compile stage. This 
way you catch only the warnings that your developers add, not the ones 
dragged in by the libraries.

By using the pre commit hooks that your revision control system you can 
even deny any commit that produces warnings.

Putting suitable processes in place and enforcing them would also help.

von Nase (Guest)


Rate this post
useful
not useful
What about actually fixing the third-party library...?
The symbol is flagged obsolete for a reason.

von Rolf Magnus (Guest)


Rate this post
useful
not useful
Magentus _. wrote:
> Doing it in the proposed two-step process would put the onus of
> following it on the developer, and that is the situation in which our
> team already is.

Huh? Why?

von Magentus _. (magentus)


Rate this post
useful
not useful
@Guest (Guest):
Thank you for pointing that out!  From the start I (incorrectly) assumed 
that '-Werror' would affect linker warnings as well as compiler ones.  I 
tried adding the flag to ...CXX_FLAGS and it works! Thanks again.

@Nase:
I thought of that, too, but it's not an option at this point for various 
reasons.

@Rolf Magnus:
My point was that seeing as there was no '-Werror' which would force 
developers to fix all new warnings before committing their changes, we 
were already in a situation where it's (or at least it should be) each 
developer's responsibility to personally ensure no new warnings are 
introduced.  And yet, some of them still weren't doing it.  Now they'll 
have to.

Thank you all!

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.