-
Notifications
You must be signed in to change notification settings - Fork 194
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
YARP_CLEAN_API flag is currently broken #978
Comments
After some more testing, I believe this is an issue with recent gcc versions (tested with 6.2.0). I don't see this with clang 3.8.1, and I cannot reproduce this on travis |
Also it does not fail C++11 is enabled |
Adding I'd say this is a bug in the compiler. |
Gcc 6 switched the default c++ standard used to C++14 (https://gcc.gnu.org/gcc-6/changes.html) so the __cplusplus value make sense, the strange thing is that is not recognizing [[deprecated]]. |
The following code builds with #if defined(__clang__)
# if ((__clang_major__ * 100) + __clang_minor__) >= 304 && __cplusplus > 201103L
# define YARP_COMPILER_CXX_ATTRIBUTE_DEPRECATED 1
# else
# define YARP_COMPILER_CXX_ATTRIBUTE_DEPRECATED 0
# endif
#elif defined(__GNUC__)
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 409 && __cplusplus > 201103L
# define YARP_COMPILER_CXX_ATTRIBUTE_DEPRECATED 1
# else
# define YARP_COMPILER_CXX_ATTRIBUTE_DEPRECATED 0
# endif
#endif
# ifndef YARP_DEPRECATED
# if YARP_COMPILER_CXX_ATTRIBUTE_DEPRECATED
# define YARP_DEPRECATED [[deprecated]]
# define YARP_DEPRECATED_MSG(MSG) [[deprecated(MSG)]]
# elif YARP_COMPILER_IS_GNU || YARP_COMPILER_IS_Clang
# define YARP_DEPRECATED __attribute__((__deprecated__))
# define YARP_DEPRECATED_MSG(MSG) __attribute__((__deprecated__(MSG)))
# elif YARP_COMPILER_IS_MSVC
# define YARP_DEPRECATED __declspec(deprecated)
# define YARP_DEPRECATED_MSG(MSG) __declspec(deprecated(MSG))
# else
# define YARP_DEPRECATED
# define YARP_DEPRECATED_MSG(MSG)
# endif
# endif
class __attribute__ ((visibility ("default"))) YARP_DEPRECATED foo {};
int main(){} This also fails: class YARP_DEPRECATED __attribute__ ((visibility ("default"))) foo {}; Both these work: class YARP_DEPRECATED foo {}; class __attribute__ ((visibility ("default"))) foo {}; So it is the combination of the attributes that causes issues. Clang does not have problems building this with |
using |
Since gcc 6.1, c++14 is enabled by default. For some reason (maybe a bug in the compiler) this does not compile with gcc and c++14 enabled (it works with clang though): class __attribute__ ((visibility ("default"))) [[deprecated]] foo {}; Fixes: robotology#978
Unfortunately |
If
YARP_CLEAN_API
is enabled andYARP_COMPILE_TESTS
is disabled, YARP build currently fails with this error:This is not currently tested on travis, and it is normally not used because tests cannot currently compile with that flag enabled, therefore if you enable tests (on by default) this flag is not used even if you enable it manually.
We should fix it, enable the build on travis and, at some point, fix the tests so that you can compile them with this flag enabled
The text was updated successfully, but these errors were encountered: