disable [[fallthrough]] until C++17

Fixes #215, reported by Thibaud Michaud.

Also related to GCC bug 79301.

* spot/misc/common.hh: Here.
This commit is contained in:
Alexandre Duret-Lutz 2017-02-01 15:17:44 +01:00
parent fac610ac48
commit d1754123a9

View file

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