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

Disable fallthrough warnings for clang compiler #38

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

belgoking
Copy link

@belgoking belgoking commented Oct 13, 2022

When compiling an application that includes exprtk.hpp using Clang (Version Apple clang version 12.0.5 (clang-1205.0.22.9) tested using Mac) with the flags -Wimplicit-fallthrough -Werror our compile fails because of the implicit fallthroughs. I suppose the same should happen under Linux when compiling with Clang.

This patch applies the same ignore mechanism that is used for GCC for Clang.

I've tested to work the change on the following Plattforms:

  • Intel MacOS: Apple clang version 12.0.5 (clang-1205.0.22.9)
  • M1 MacOS: clang version 14.0.0 (clang-1400.0.29.102)
  • amd64 Debian: g++ 12.2.0
  • amd64 Debian: clang 9.0.1-20+b1
  • amd64 Debian: clang 11.1.0-6+b2
  • amd64 Debian: clang 13.0.1-7
  • amd64 Debian: clang 14.0.6-2

@eric-norige
Copy link

eric-norige commented Jan 24, 2023

Isn't a better way to silence these warnings on these newer compilers to use [[fallthrough]] at the appropriate source locations where fallthrough is expected? Some macros might be needed for older compilers, but that seems not terrible.

Edit: Sorry for not reading properly. I see now that you're amending the existing fallthrough disable macros for clang. I still suspect that it would be an improvement to replace the existing pragmas with more standard fallthrough attribute when possible. https://en.cppreference.com/w/cpp/language/attributes/fallthrough

@ArashPartow
Copy link
Owner

@belgoking and @eric-norige : I am planning on doing a simple upgrade of the library to c++17, as part of that I'll be looking at closing these issues.

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