summaryrefslogtreecommitdiff
path: root/include/compiler.h
diff options
context:
space:
mode:
authorCyrill Gorcunov <gorcunov@gmail.com>2018-02-25 17:09:11 +0300
committerCyrill Gorcunov <gorcunov@gmail.com>2018-02-25 17:09:11 +0300
commit8ba28e13ea4453a587d08e5533e60f4ff2b4781a (patch)
tree87650f9d9cc2e77579e6cafff8ece738d4cae72b /include/compiler.h
parentfb9e00a1c3c3ec89d385175baa6e66b15318bda8 (diff)
downloadnasm-8ba28e13ea4453a587d08e5533e60f4ff2b4781a.tar.gz
compiler: Add fallthrough() helper
https://bugzilla.nasm.us/show_bug.cgi?id=3392465 Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Diffstat (limited to 'include/compiler.h')
-rw-r--r--include/compiler.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/compiler.h b/include/compiler.h
index fb146af4..f4393518 100644
--- a/include/compiler.h
+++ b/include/compiler.h
@@ -241,6 +241,15 @@ size_t strnlen(const char *s, size_t maxlen);
#endif
/*
+ * Fallthrough handling.
+ */
+#ifdef HAVE_FALLTHROUGH_ATTRIBUTE
+# define fallthrough() __attribute__((fallthrough))
+#else
+# define fallthrough() /* fall through */
+#endif
+
+/*
* Hints to the compiler that a particular branch of code is more or
* less likely to be taken.
*/