disas/libvixl: Fix fall-through annotation for GCC >= 7

For compiling with -Wimplicit-fallthrough we need to fix the
fallthrough annotations in the libvixl code. This is based on
the following upstream vixl commit by Martyn Capewell:

 https://git.linaro.org/arm/vixl.git/commit/?id=de326f850f736c3a337

 "GCC 7 enables switch/case fallthrough checking, but this fails in
  VIXL, because the annotation we use is Clang specific.

  Also, fix a missing annotation in the disassembler."

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20201211152426.350966-2-thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
This commit is contained in:
Thomas Huth 2020-12-11 16:24:15 +01:00
parent 75ee62ac60
commit 4f02d49a80
2 changed files with 8 additions and 2 deletions

View File

@ -2985,6 +2985,10 @@ int Disassembler::SubstituteImmediateField(const Instruction* instr,
} }
return 3; return 3;
} }
default: {
VIXL_UNIMPLEMENTED();
return 0;
}
} }
} }
case 'C': { // ICondB - Immediate Conditional Branch. case 'C': { // ICondB - Immediate Conditional Branch.

View File

@ -108,10 +108,12 @@ inline void USE(T1, T2, T3, T4) {}
#define __has_warning(x) 0 #define __has_warning(x) 0
#endif #endif
// Note: This option is only available for Clang. And will only be enabled for // Fallthrough annotation for Clang and C++11(201103L).
// C++11(201103L).
#if __has_warning("-Wimplicit-fallthrough") && __cplusplus >= 201103L #if __has_warning("-Wimplicit-fallthrough") && __cplusplus >= 201103L
#define VIXL_FALLTHROUGH() [[clang::fallthrough]] //NOLINT #define VIXL_FALLTHROUGH() [[clang::fallthrough]] //NOLINT
// Fallthrough annotation for GCC >= 7.
#elif __GNUC__ >= 7
#define VIXL_FALLTHROUGH() __attribute__((fallthrough))
#else #else
#define VIXL_FALLTHROUGH() do {} while (0) #define VIXL_FALLTHROUGH() do {} while (0)
#endif #endif