Commit d1754123 authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz
Browse files

disable [[fallthrough]] until C++17

Fixes #215, reported by Thibaud Michaud.

Also related to GCC bug 79301.

* spot/misc/common.hh: Here.
parent fac610ac
// -*- 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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment