aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorXiretza <xiretza@xiretza.xyz>2020-05-04 21:12:30 +0200
committerXiretza <xiretza@xiretza.xyz>2020-05-07 13:39:34 +0200
commit695150b0378528233837348b598033b137b8a949 (patch)
treedf1720c84ac61299984dde8a0c0ac3bf52c99924 /kernel
parenta299e606f864942c7edf90c4ad3998f4f4a346cf (diff)
downloadyosys-695150b0378528233837348b598033b137b8a949.tar.gz
yosys-695150b0378528233837348b598033b137b8a949.tar.bz2
yosys-695150b0378528233837348b598033b137b8a949.zip
Add YS_FALLTHROUGH macro to mark case fall-through
C++17 introduced [[fallthrough]], GCC and clang had their own vendored attributes before that. MSVC doesn't seem to have such a warning at all.
Diffstat (limited to 'kernel')
-rw-r--r--kernel/yosys.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/kernel/yosys.h b/kernel/yosys.h
index af1e376b1..62f76a63f 100644
--- a/kernel/yosys.h
+++ b/kernel/yosys.h
@@ -155,6 +155,16 @@ extern Tcl_Obj *Tcl_ObjSetVar2(Tcl_Interp *interp, Tcl_Obj *part1Ptr, Tcl_Obj *p
# define YS_NORETURN
#endif
+#if __cplusplus >= 201703L
+# define YS_FALLTHROUGH [[fallthrough]];
+#elif defined(__GNUC__)
+# define YS_FALLTHROUGH [[gnu::fallthrough]];
+#elif defined(__clang__)
+# define YS_FALLTHROUGH [[clang::fallthrough]];
+#else
+# define YS_FALLTHROUGH
+#endif
+
YOSYS_NAMESPACE_BEGIN
// Note: All headers included in hashlib.h must be included