summaryrefslogtreecommitdiff
path: root/mfbt
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2023-11-11 14:27:03 +0100
committerMoonchild <moonchild@palemoon.org>2023-11-11 14:27:03 +0100
commit734f0957fb8bc06ae6e5105d878f1b7007ce8b5d (patch)
treedf73c5d270de365b4035aff74ef703c9f922bd30 /mfbt
parentc789882a294d29b3e5450a972ad67c4839c75e23 (diff)
downloaduxp-734f0957fb8bc06ae6e5105d878f1b7007ce8b5d.tar.gz
Issue #2343 - replace MOZ_FALLTHROUGH with [[fallthrough]]
Basically a S&R. Removed the macro and adjusts IDL codegen accordingly.
Diffstat (limited to 'mfbt')
-rw-r--r--mfbt/Assertions.h4
-rw-r--r--mfbt/Attributes.h44
2 files changed, 2 insertions, 46 deletions
diff --git a/mfbt/Assertions.h b/mfbt/Assertions.h
index 09a1b8eaa6..a965ae6f1d 100644
--- a/mfbt/Assertions.h
+++ b/mfbt/Assertions.h
@@ -554,7 +554,7 @@ struct AssertionConditionType
* default:
* // This case wants to assert in debug builds, fall through in release.
* MOZ_ASSERT(false); // -Wimplicit-fallthrough warning in release builds!
- * MOZ_FALLTHROUGH; // but -Wunreachable-code warning in debug builds!
+ * [[fallthrough]]; // but -Wunreachable-code warning in debug builds!
* case 5:
* return 5;
* }
@@ -571,7 +571,7 @@ struct AssertionConditionType
#ifdef DEBUG
# define MOZ_FALLTHROUGH_ASSERT(reason) MOZ_CRASH("MOZ_FALLTHROUGH_ASSERT: " reason)
#else
-# define MOZ_FALLTHROUGH_ASSERT(...) MOZ_FALLTHROUGH
+# define MOZ_FALLTHROUGH_ASSERT(...) [[fallthrough]]
#endif
/*
diff --git a/mfbt/Attributes.h b/mfbt/Attributes.h
index fdd253d357..5da4ffe948 100644
--- a/mfbt/Attributes.h
+++ b/mfbt/Attributes.h
@@ -238,50 +238,6 @@
#ifdef __cplusplus
-/**
- * MOZ_FALLTHROUGH is an annotation to suppress compiler warnings about switch
- * cases that fall through without a break or return statement. MOZ_FALLTHROUGH
- * is only needed on cases that have code.
- *
- * MOZ_FALLTHROUGH_ASSERT is an annotation to suppress compiler warnings about
- * switch cases that MOZ_ASSERT(false) (or its alias MOZ_ASSERT_UNREACHABLE) in
- * debug builds, but intentionally fall through in release builds. See comment
- * in Assertions.h for more details.
- *
- * switch (foo) {
- * case 1: // These cases have no code. No fallthrough annotations are needed.
- * case 2:
- * case 3: // This case has code, so a fallthrough annotation is needed!
- * foo++;
- * MOZ_FALLTHROUGH;
- * case 4:
- * return foo;
- *
- * default:
- * // This case asserts in debug builds, falls through in release.
- * MOZ_FALLTHROUGH_ASSERT("Unexpected foo value?!");
- * case 5:
- * return 5;
- * }
- */
-#ifndef __has_cpp_attribute
-# define __has_cpp_attribute(x) 0
-#endif
-
-#if __has_cpp_attribute(clang::fallthrough)
-# define MOZ_FALLTHROUGH [[clang::fallthrough]]
-#elif __has_cpp_attribute(gnu::fallthrough)
-# define MOZ_FALLTHROUGH [[gnu::fallthrough]]
-#elif defined(_MSC_VER)
- /*
- * MSVC's __fallthrough annotations are checked by /analyze (Code Analysis):
- * https://msdn.microsoft.com/en-us/library/ms235402%28VS.80%29.aspx
- */
-# include <sal.h>
-# define MOZ_FALLTHROUGH __fallthrough
-#else
-# define MOZ_FALLTHROUGH /* FALLTHROUGH */
-#endif
/*
* MOZ_ASAN_BLACKLIST is a macro to tell AddressSanitizer (a compile-time
* instrumentation shipped with Clang and GCC) to not instrument the annotated