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

GCC 5 -Wall issues warning about clang::fallthrough attribute placement in string_view header #42

Open
acmorrow opened this issue Dec 27, 2015 · 3 comments

Comments

@acmorrow
Copy link

When building libbsoncxx against core HEAD with -Wall, I'm getting lots of warnings about the use of the clang::fallthrough attribute in the new string_view header:

src/bsoncxx/third_party/EP_mnmlstc_core-prefix/src/EP_mnmlstc_core/include/core/string_view.hpp:100:55: warning: attributes at the beginning of statement are ignored [-Wattributes]
       case 2: hash ^= ::std::uint64_t(data[1]) << 8;  [[clang::fallthrough]];

Easy enough to work around by adding -Wno-attribute but that is not ideal.

@bruxisma
Copy link
Member

Hi, you're not going to like to hear this, but the recommended fix for this is to use -Wno-attribute, as otherwise you get a large number of warnings from clang, and have to enable a set of -Wno- flags there (and there are a lot if you use -Weverything). I know this is seen as inconvenient, however one of the goals for Core is to use as few preprocessor macros and workarounds as possible, except when it's absolutely 100% needed, such as using Core without exceptions or RTTI, or to get it to work between gcc 4.8 and later versions (where max_align_t was in the global namespace, then moved to namespace std)

Technically, I could add a clang check and go from there, but I've not wanted to do that so far. I will take it into consideration though (and leave this issue open for now)

@acmorrow
Copy link
Author

@slurps-mad-rips Actually I'm taking much the same hard line with the C++ driver, so, I get what you are saying. The downside will be that since core headers are exposed via C++ driver's headers, the need for -Wno-attribute will propagate to users of the C++ driver library.

I'm fine with leaving open and taking no immediate action. We can wait until C++ driver ships and see how much user pushback arrives.

@bruxisma
Copy link
Member

bruxisma commented Jan 4, 2017

Since this is the only other issue I'll be making a small preprocessor set of changes to guard this kind of stuff from warning. The "let's not use the preprocessor" goal for Core is a failure, so might as well go all in on fixing these issues, eh?

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