Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ugly GCC -Wattributes warnings that cannot be suppressed using /included/ variant #235

Closed
pabristow opened this issue Nov 13, 2019 · 5 comments
Assignees
Milestone

Comments

@pabristow
Copy link
Contributor

pabristow commented Nov 13, 2019

I am seeing dozens of warnings (that cannot be suppressed using -W-no-attributes) like this:

Build: Release_gcc810 in hello_boost_test_included (compiler: GNU GCC 8.1)

c++.exe -Wall -fexceptions -O2 -Wno-attributes -flto=thin -I..\..\..\boost -c I:\boost\libs\hello_boost\example\hello_boost_test_included.cpp -o obj\Release\boost\libs\hello_boost\example\hello_boost_test_included.o
g++.exe  -o bin\Release\hello_boost_test_included.exe obj\Release\boost\libs\hello_boost\example\hello_boost_test_included.o  -s  
I:/boost/boost/test/impl/framework.ipp: In function 'setup_loggers':
I:/boost/boost/test/impl/framework.ipp:1145:1: warning: visibility attribute not supported in this configuration; ignored [-Wattributes]
 }
 ^
lto1.exe: warning: visibility attribute not supported in this configuration; ignored [-Wattributes]
lto1.exe: warning: visibility attribute not supported in this configuration; ignored [-Wattributes]
...

I:/boost/boost/test/impl/unit_test_parameters.ipp: In function 'init':
I:/boost/boost/test/impl/unit_test_parameters.ipp:745:1: warning: visibility attribute not supported in this configuration; ignored [-Wattributes]
 }
 ^
I:/boost/boost/test/impl/results_reporter.ipp: In function 'set_stream':
I:/boost/boost/test/impl/results_reporter.ipp:113:1: warning: visibility attribute not supported in this configuration; ignored [-Wattributes]
 }
 ^
I:/boost/boost/test/impl/framework.ipp: In function 'test_unit_aborted':
I:/boost/boost/test/impl/framework.ipp:1757:1: warning: visibility attribute not supported in this configuration; ignored [-Wattributes]
 }
..

This seem to be specific to using mingw (and Codeblocks 17.12)

https://stackoverflow.com/questions/26025708/warning-visibility-attribute-ignored-symbol-visibility-c-gcc

sheds a little light on what might be causing these messages.

Full log of this simple test of Boost.Test available on request.

This is harmless but annoying.

@raffienficiaud raffienficiaud self-assigned this Dec 12, 2019
@raffienficiaud raffienficiaud added this to the 1.73 milestone Dec 12, 2019
@raffienficiaud
Copy link
Member

Hi,

Sorry about those warnings (at some point I need to fix the Appveyor to get those as well). Which Boost Test variant (header/shared/static) are you using in this configuration?

@raffienficiaud
Copy link
Member

Sorry I missed this information from the title of the issue.

@raffienficiaud
Copy link
Member

We can try hard to silence the warning, but I remember from a past project that this does not work well, and it seems that this would hide the real issue.

In the included variant, the macro BOOST_TEST_DECL evaluates to BOOST_SYMBOL_VISIBLE which evaluates to __attribute__((__visibility__("default"))), unconditionally. This does not cause any issue in the platforms I am testing on, but apparently MINGW is more picky.

My understanding is that in the included variant, BOOST_TEST_DECL can just evaluate to nothing and this should be also valid in all platforms.

The branch topic/GH-235-gcc-attribute-warnings is a tentative fix, it would be nice if you can give a try.

@pabristow
Copy link
Contributor Author

I:\boost\libs\test>git status
HEAD detached at origin/topic/GH-235-gcc-attribute-warnings
nothing to commit, working tree clean
and recompiled my very simple use of Boost.test included with NO errors.

Program: I:\boost\libs\hello_boost\example\hello_boost_test_included.cpp
BuildInfo:
Platform Win32, 64-bit.
Compiler GNU C++ version 8.1.0
STL GNU libstdc++ version 20180502
Boost version 1.71.0

Also builds OK with GCC 9.2.0

BuildInfo:
Platform Win32, 64-bit.
Compiler GNU C++ version 9.2.0
STL GNU libstdc++ version 20190812
Boost version 1.71.0

(__MINGW64__is defined with value 1.)

So your fix seems to do the trick for Codeblock 17.2 using GCC and mingw64 :-)

Many thanks.

raffienficiaud added a commit that referenced this issue Dec 16, 2019
* topic/GH-235-gcc-attribute-warnings:
  Change log
  BOOST_TEST_DECL should evalute to nothing in the included variant
@raffienficiaud raffienficiaud added next In "next" branch and removed fix-proposed labels Dec 16, 2019
raffienficiaud added a commit that referenced this issue Dec 20, 2019
* topic/GH-235-gcc-attribute-warnings:
  Change log
  BOOST_TEST_DECL should evalute to nothing in the included variant
@raffienficiaud raffienficiaud added develop 1.73 and removed next In "next" branch labels Dec 20, 2019
@raffienficiaud
Copy link
Member

Merged to master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants