summaryrefslogtreecommitdiffstats
path: root/libcpu
diff options
context:
space:
mode:
authorJoshua Watt <jpewhacker@gmail.com>2018-02-09 10:27:18 -0600
committerMark Wielaard <mark@klomp.org>2018-02-10 03:19:26 +0100
commit555e15ebe8bf1eb33d00747173cfc80cc65648a4 (patch)
tree6aa9cca6e04514cbc45d88f96a873cc6a4767472 /libcpu
parent240a068fcf3eb6bbcda525f80c8778de62621d9e (diff)
Use fallthrough attribute.
Use __attribute__ ((fallthrough)) to indicate switch case fall through instead of a comment. This ensures that the fallthrough warning is not triggered even if the file is pre-processed (hence stripping the comments) before it is compiled. The actual fallback implementation is hidden behind a FALLBACK macro in case the compiler doesn't support it. Finally, the -Wimplict-fallthrough warning was upgraded to only allow the attribute to satisfy it; a comment alone is no longer sufficient. Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Diffstat (limited to 'libcpu')
-rw-r--r--libcpu/ChangeLog5
-rw-r--r--libcpu/i386_disasm.c2
2 files changed, 6 insertions, 1 deletions
diff --git a/libcpu/ChangeLog b/libcpu/ChangeLog
index c710e5af..86d29478 100644
--- a/libcpu/ChangeLog
+++ b/libcpu/ChangeLog
@@ -1,3 +1,8 @@
+2018-02-09 Joshua Watt <JPEWhacker@gmail.com>
+
+ * i386_disasm.c (i386_disasm): Use FALLTHOUGH macro instead of
+ comment.
+
2017-08-18 Ulf Hermann <ulf.hermann@qt.io>
* memory-access.h: Use attribute_packed.
diff --git a/libcpu/i386_disasm.c b/libcpu/i386_disasm.c
index 831afbe2..a7e03f95 100644
--- a/libcpu/i386_disasm.c
+++ b/libcpu/i386_disasm.c
@@ -819,7 +819,7 @@ i386_disasm (Ebl *ebl __attribute__((unused)),
++param_start;
break;
}
- /* Fallthrough */
+ FALLTHROUGH;
default:
assert (! "INVALID not handled");
}