core icon indicating copy to clipboard operation
core copied to clipboard

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

Open acmorrow opened this issue 9 years ago • 3 comments

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.

acmorrow avatar Dec 27 '15 17:12 acmorrow

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)

bruxisma avatar Dec 29 '15 17:12 bruxisma

@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.

acmorrow avatar Dec 29 '15 17:12 acmorrow

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?

bruxisma avatar Jan 04 '17 09:01 bruxisma