qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] disas/libvixl: Fix fall-through annotation for GCC >= 7
@ 2020-08-24 13:01 Thomas Huth
  2020-08-24 13:18 ` Peter Maydell
  2020-08-26  6:07 ` no-reply
  0 siblings, 2 replies; 4+ messages in thread
From: Thomas Huth @ 2020-08-24 13:01 UTC (permalink / raw)
  To: qemu-devel, Peter Maydell; +Cc: qemu-arm, Richard Henderson

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>
---
 disas/libvixl/vixl/a64/disasm-a64.cc | 4 ++++
 disas/libvixl/vixl/globals.h         | 6 ++++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/disas/libvixl/vixl/a64/disasm-a64.cc b/disas/libvixl/vixl/a64/disasm-a64.cc
index 7a58a5c087..f34d1d68da 100644
--- a/disas/libvixl/vixl/a64/disasm-a64.cc
+++ b/disas/libvixl/vixl/a64/disasm-a64.cc
@@ -2985,6 +2985,10 @@ int Disassembler::SubstituteImmediateField(const Instruction* instr,
           }
           return 3;
         }
+        default: {
+          VIXL_UNIMPLEMENTED();
+          return 0;
+        }
       }
     }
     case 'C': {  // ICondB - Immediate Conditional Branch.
diff --git a/disas/libvixl/vixl/globals.h b/disas/libvixl/vixl/globals.h
index 61dc9f7f7e..7099aa599f 100644
--- a/disas/libvixl/vixl/globals.h
+++ b/disas/libvixl/vixl/globals.h
@@ -108,10 +108,12 @@ inline void USE(T1, T2, T3, T4) {}
   #define __has_warning(x)  0
 #endif
 
-// Note: This option is only available for Clang. And will only be enabled for
-// C++11(201103L).
+// Fallthrough annotation for Clang and C++11(201103L).
 #if __has_warning("-Wimplicit-fallthrough") && __cplusplus >= 201103L
   #define VIXL_FALLTHROUGH() [[clang::fallthrough]] //NOLINT
+// Fallthrough annotation for GCC >= 7.
+#elif __GNUC__ >= 7
+  #define VIXL_FALLTHROUGH() __attribute__((fallthrough))
 #else
   #define VIXL_FALLTHROUGH() do {} while (0)
 #endif
-- 
2.18.2



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] disas/libvixl: Fix fall-through annotation for GCC >= 7
  2020-08-24 13:01 [PATCH] disas/libvixl: Fix fall-through annotation for GCC >= 7 Thomas Huth
@ 2020-08-24 13:18 ` Peter Maydell
  2020-08-24 14:03   ` Thomas Huth
  2020-08-26  6:07 ` no-reply
  1 sibling, 1 reply; 4+ messages in thread
From: Peter Maydell @ 2020-08-24 13:18 UTC (permalink / raw)
  To: Thomas Huth; +Cc: qemu-arm, Richard Henderson, QEMU Developers

On Mon, 24 Aug 2020 at 14:01, Thomas Huth <thuth@redhat.com> wrote:
>
> 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."

Maybe I should just update us to a newer upstream vixl...

-- PMM


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] disas/libvixl: Fix fall-through annotation for GCC >= 7
  2020-08-24 13:18 ` Peter Maydell
@ 2020-08-24 14:03   ` Thomas Huth
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Huth @ 2020-08-24 14:03 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-arm, Richard Henderson, QEMU Developers

On 24/08/2020 15.18, Peter Maydell wrote:
> On Mon, 24 Aug 2020 at 14:01, Thomas Huth <thuth@redhat.com> wrote:
>>
>> 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."
> 
> Maybe I should just update us to a newer upstream vixl...

That would certainly be nice, too.

  Thomas



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] disas/libvixl: Fix fall-through annotation for GCC >= 7
  2020-08-24 13:01 [PATCH] disas/libvixl: Fix fall-through annotation for GCC >= 7 Thomas Huth
  2020-08-24 13:18 ` Peter Maydell
@ 2020-08-26  6:07 ` no-reply
  1 sibling, 0 replies; 4+ messages in thread
From: no-reply @ 2020-08-26  6:07 UTC (permalink / raw)
  To: thuth; +Cc: peter.maydell, qemu-arm, richard.henderson, qemu-devel

Patchew URL: https://patchew.org/QEMU/20200824130114.41368-1-thuth@redhat.com/



Hi,

This series seems to have some coding style problems. See output below for
more information:

Type: series
Message-id: 20200824130114.41368-1-thuth@redhat.com
Subject: [PATCH] disas/libvixl: Fix fall-through annotation for GCC >= 7

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

From https://github.com/patchew-project/qemu
 * [new tag]         patchew/20200824130114.41368-1-thuth@redhat.com -> patchew/20200824130114.41368-1-thuth@redhat.com
Switched to a new branch 'test'
eb8ed63 disas/libvixl: Fix fall-through annotation for GCC >= 7

=== OUTPUT BEGIN ===
ERROR: do not use C99 // comments
#46: FILE: disas/libvixl/vixl/globals.h:111:
+// Fallthrough annotation for Clang and C++11(201103L).

ERROR: do not use C99 // comments
#49: FILE: disas/libvixl/vixl/globals.h:114:
+// Fallthrough annotation for GCC >= 7.

total: 2 errors, 0 warnings, 24 lines checked

Commit eb8ed63c0cc3 (disas/libvixl: Fix fall-through annotation for GCC >= 7) has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/20200824130114.41368-1-thuth@redhat.com/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-08-26  6:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-24 13:01 [PATCH] disas/libvixl: Fix fall-through annotation for GCC >= 7 Thomas Huth
2020-08-24 13:18 ` Peter Maydell
2020-08-24 14:03   ` Thomas Huth
2020-08-26  6:07 ` no-reply

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).