From 26c151c5e4458d7da4f6081dac3a898ce4f8e6f8 Mon Sep 17 00:00:00 2001 From: viz Date: Sun, 8 Feb 2015 07:57:05 -0800 Subject: [PATCH 1/3] Detect [[clang::fallthrough]] even __has_cpp_attribute is not supported --- format.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/format.h b/format.h index 0af01439..8c61a8ba 100644 --- a/format.h +++ b/format.h @@ -61,6 +61,7 @@ #endif #ifdef __clang__ +# define FMT_CLANG_VERSION (__clang_major__ * 100 + __clang_minor__) # pragma clang diagnostic ignored "-Wdocumentation-unknown-command" #endif @@ -119,7 +120,8 @@ # define FMT_NOEXCEPT(expr) #endif -#if FMT_HAS_CPP_ATTRIBUTE(clang::fallthrough) +#if FMT_HAS_CPP_ATTRIBUTE(clang::fallthrough) || \ + (FMT_CLANG_VERSION >= 600 && __cplusplus >= 201103) # define FMT_FALLTHROUGH [[clang::fallthrough]] #else # define FMT_FALLTHROUGH From a92c179a6dfc5037d0c191ddfabb1c3fe12f1439 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Mon, 9 Feb 2015 07:37:26 -0800 Subject: [PATCH 2/3] Fix warnings on clang --- format.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/format.h b/format.h index 8c61a8ba..724acaae 100644 --- a/format.h +++ b/format.h @@ -882,7 +882,7 @@ class ArgVisitor { switch (arg.type) { default: assert(false); - FMT_FALLTHROUGH; + return Result(); case Arg::INT: return FMT_DISPATCH(visit_int(arg.int_value)); case Arg::UINT: From 618dd9d6afa99b774b5b2f87fe0746bb895382a1 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Mon, 9 Feb 2015 07:54:03 -0800 Subject: [PATCH 3/3] Remove the fallthrough attribute detection --- format.h | 8 -------- 1 file changed, 8 deletions(-) diff --git a/format.h b/format.h index 724acaae..c6bdd707 100644 --- a/format.h +++ b/format.h @@ -61,7 +61,6 @@ #endif #ifdef __clang__ -# define FMT_CLANG_VERSION (__clang_major__ * 100 + __clang_minor__) # pragma clang diagnostic ignored "-Wdocumentation-unknown-command" #endif @@ -120,13 +119,6 @@ # define FMT_NOEXCEPT(expr) #endif -#if FMT_HAS_CPP_ATTRIBUTE(clang::fallthrough) || \ - (FMT_CLANG_VERSION >= 600 && __cplusplus >= 201103) -# define FMT_FALLTHROUGH [[clang::fallthrough]] -#else -# define FMT_FALLTHROUGH -#endif - // A macro to disallow the copy constructor and operator= functions // This should be used in the private: declarations for a class #define FMT_DISALLOW_COPY_AND_ASSIGN(TypeName) \