diff --git a/spot/misc/common.hh b/spot/misc/common.hh index aad010a99..94ed98234 100644 --- a/spot/misc/common.hh +++ b/spot/misc/common.hh @@ -1,5 +1,5 @@ // -*- coding: utf-8 -*- -// Copyright (C) 2013, 2014, 2015, 2016 Laboratoire de Recherche et +// Copyright (C) 2013, 2014, 2015, 2016, 2017 Laboratoire de Recherche et // Développement de l'Epita (LRDE). // // This file is part of Spot, a model checking library. @@ -125,15 +125,18 @@ // auto func(int param) SPOT_RETURN(implem_.func(param)); #define SPOT_RETURN(code) -> decltype(code) { return code; } -// We hope compilers that implement -Wimplicit-fallthrough -// also support __has_cpp_attribute and some form of [[fallthrough]]. +// We hope compilers that implement -Wimplicit-fallthrough also +// support __has_cpp_attribute and some form of [[fallthrough]]. Do +// not use [[fallthough]] if the code is compiled in a pre-C++17 +// standard since clang's -Wpedantic would complain that we are using +// a feature from the future. #ifdef __has_cpp_attribute -# if __has_cpp_attribute(fallthrough) +# if __has_cpp_attribute(fallthrough) && __cplusplus > 201402L # define SPOT_FALLTHROUGH [[fallthrough]] # elif __has_cpp_attribute(clang::fallthrough) # define SPOT_FALLTHROUGH [[clang::fallthrough]] -# elif __has_cpp_attribute(gcc::fallthrough) -# define SPOT_FALLTHROUGH [[gcc::fallthrough]] +# elif __has_cpp_attribute(gnu::fallthrough) +# define SPOT_FALLTHROUGH [[gnu::fallthrough]] # endif #endif #ifndef SPOT_FALLTHROUGH