[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[XEN PATCH v2 1/3] x86/emul: auxiliary definition of pseudo keyword fallthrough



The pseudo keyword fallthrough shall be used to make explicit the
fallthrough intention at the end of a case statement (doing this
using comments is deprecated).

A definition of such pseudo keyword is already present in the
Xen build. This auxiliary definition makes it available also for
for test and fuzzing harness without iterfearing with the one
that the Xen build has.

Signed-off-by: Federico Serafini <federico.serafini@xxxxxxxxxxx>
---
Changes from v1:
- moved definition in the right file;
- remove useless parenthesis;
- description improved.
---
 tools/tests/x86_emulator/x86-emulate.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/tools/tests/x86_emulator/x86-emulate.h 
b/tools/tests/x86_emulator/x86-emulate.h
index 00abc829b0..b01bb0cdce 100644
--- a/tools/tests/x86_emulator/x86-emulate.h
+++ b/tools/tests/x86_emulator/x86-emulate.h
@@ -70,6 +70,16 @@
 extern uint32_t mxcsr_mask;
 extern struct cpu_policy cpu_policy;
 
+/*
+ * Pseudo keyword 'fallthrough' to make explicit the fallthrough intention at
+ * the end of a case statement block.
+ */
+#if !defined(__clang__) && (__GNUC__ >= 7)
+# define fallthrough        __attribute__((__fallthrough__))
+#else
+# define fallthrough        do {} while (0)  /* fallthrough */
+#endif
+
 #define MMAP_SZ 16384
 bool emul_test_init(void);
 
-- 
2.43.0




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.