Bug 1570499 - Part 2: Suppress -Wimplicit-fallthrough warnings from third-party udis86 code. r=froydnj
authorChris Peterson <cpeterson@mozilla.com>
Fri, 20 Dec 2019 07:02:59 +0000
changeset 507984 1802196cadec4a90f4aa21f9ac2fed0ab2bbed58
parent 507983 68b0f6bd38ad89654bde1da2f3755597f6807a43
child 507985 221bb3c0cea1c6eecebc0c858c438c32c9d50ad3
push id36935
push usercsabou@mozilla.com
push dateFri, 20 Dec 2019 15:52:27 +0000
treeherdermozilla-central@028b40d8140c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1570499
milestone73.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1570499 - Part 2: Suppress -Wimplicit-fallthrough warnings from third-party udis86 code. r=froydnj ProcessRedirect.cpp includes third-party udis86 C code that triggers -Wimplicit-fallthrough warnings. We suppress these warnings in ProcessRedirect.cpp because we want to minimize Mozilla changes to third-party code and we can't use C++17's [[fallthrough]] attribute in C code anyway. We don't suppress the warnings for the entire ProcessRedirect.cpp file (e.g. in moz.build) because we'd like clang -Wimplicit-fallthrough to check ProcessRedirect.cpp's own use of [[fallthrough]]. This changeset reverts some earlier Mozilla changes [1] made to upstream udis86's decode.c [2] that are no longer necessary. [1] https://hg.mozilla.org/mozilla-central/rev/9042673fb235c00fbb021ea6356f4b0921505d1d [2] https://github.com/vmt/udis86/blob/master/libudis86/decode.c#L747 Differential Revision: https://phabricator.services.mozilla.com/D56441
toolkit/recordreplay/ProcessRedirect.cpp
toolkit/recordreplay/udis86/decode.c
--- a/toolkit/recordreplay/ProcessRedirect.cpp
+++ b/toolkit/recordreplay/ProcessRedirect.cpp
@@ -10,24 +10,33 @@
 #include "MiddlemanCall.h"
 #include "ipc/ChildInternal.h"
 #include "ipc/ParentInternal.h"
 #include "mozilla/Sprintf.h"
 
 #include <dlfcn.h>
 #include <string.h>
 
+#if defined(__clang__)
+#  pragma clang diagnostic push
+#  pragma clang diagnostic ignored "-Wimplicit-fallthrough"
+#endif
+
 namespace {
 
 #include "udis86/udis86.c"
 #include "udis86/decode.c"
 #include "udis86/itab.c"
 
 }  // anonymous namespace
 
+#if defined(__clang__)
+#  pragma clang diagnostic pop
+#endif
+
 namespace mozilla {
 namespace recordreplay {
 
 ///////////////////////////////////////////////////////////////////////////////
 // Redirection Skeleton
 ///////////////////////////////////////////////////////////////////////////////
 
 static bool CallPreambleHook(PreambleFn aPreamble, size_t aCallId,
--- a/toolkit/recordreplay/udis86/decode.c
+++ b/toolkit/recordreplay/udis86/decode.c
@@ -643,22 +643,22 @@ decode_operand(struct ud           *u,
       break;
     case OP_MR:
       decode_modrm_rm(u, operand, REGCLASS_GPR, 
                       MODRM_MOD(modrm(u)) == 3 ? 
                         Mx_reg_size(size) : Mx_mem_size(size));
       break;
     case OP_F:
       u->br_far  = 1;
-      MOZ_FALLTHROUGH;
+      /* intended fall through */
     case OP_M:
       if (MODRM_MOD(modrm(u)) == 3) {
         UDERR(u, "expected modrm.mod != 3\n");
       }
-      MOZ_FALLTHROUGH;
+      /* intended fall through */
     case OP_E:
       decode_modrm_rm(u, operand, REGCLASS_GPR, size);
       break;
     case OP_G:
       decode_modrm_reg(u, operand, REGCLASS_GPR, size);
       break;
     case OP_sI:
     case OP_I:
@@ -667,28 +667,28 @@ decode_operand(struct ud           *u,
     case OP_I1:
       operand->type = UD_OP_CONST;
       operand->lval.udword = 1;
       break;
     case OP_N:
       if (MODRM_MOD(modrm(u)) != 3) {
         UDERR(u, "expected modrm.mod == 3\n");
       }
-      MOZ_FALLTHROUGH;
+      /* intended fall through */
     case OP_Q:
       decode_modrm_rm(u, operand, REGCLASS_MMX, size);
       break;
     case OP_P:
       decode_modrm_reg(u, operand, REGCLASS_MMX, size);
       break;
     case OP_U:
       if (MODRM_MOD(modrm(u)) != 3) {
         UDERR(u, "expected modrm.mod == 3\n");
       }
-      MOZ_FALLTHROUGH;
+      /* intended fall through */
     case OP_W:
       decode_modrm_rm(u, operand, REGCLASS_XMM, size);
       break;
     case OP_V:
       decode_modrm_reg(u, operand, REGCLASS_XMM, size);
       break;
     case OP_MU:
       decode_modrm_rm(u, operand, REGCLASS_XMM,