I've been on a crusade lately to eliminate warnings from our code and have become more familiar with GCC warning flags (such as -Wall
, -Wno-<warning to disable>
, -fdiagnostics-show-option
, etc.). However I haven't been able to figure out how to disable (or even control) linker warnings. The most common linker warning that I was getting is of the following form:
ld: warning: <some symbol> has different visibility (default) in
<path/to/library.a> and (hidden) in <path/to/my/class.o>
The reason I was getting this was because the library I was using was built using the default
visibility while my application is built with hidden
visibility. I've fixed this by rebuilding the library with hidden
visibility.
My question though is: how would I suppress that warning if I wanted to? It's not something that I need to do now that I've figured out how to fix it but I'm still curious as to how you'd suppress that particular warning — or any linker warnings in general?
Using the -fdiagnostics-show-option
for any of the C/C++/linker flags doesn't say where that warning comes from like with other compiler warnings.