Title: [214942] trunk/Source
Revision
214942
Author
[email protected]
Date
2017-04-05 06:07:09 -0700 (Wed, 05 Apr 2017)

Log Message

[JSC] Suppress warnings in GCC
https://bugs.webkit.org/show_bug.cgi?id=170501

Reviewed by Keith Miller.

Source/_javascript_Core:

Should use ASSERT_NOT_REACHED since return-type pragma is only
enabled under ASSERT_DISABLED environment. We shoud use
ASSERT_NOTREACHED to emit assertions in debug build. It effectively
catches bugs while keeping performance in release build.

* b3/B3Opcode.cpp:
(JSC::B3::storeOpcode):
* b3/B3Width.h:
(JSC::B3::mask):
* runtime/Options.cpp:
(JSC::parse):
* wasm/WasmSections.h:
(JSC::Wasm::makeString):
* wasm/WasmSignature.cpp:
(JSC::Wasm::SignatureInformation::tryCleanup):
* wasm/generateWasmValidateInlinesHeader.py:

Source/WTF:

Add a new macro UNUSED_FUNCTION to annotate unused static functions.
#pragma GCC diagnostic ignored "-Wunused-function" does not work.

* wtf/Compiler.h:

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (214941 => 214942)


--- trunk/Source/_javascript_Core/ChangeLog	2017-04-05 10:41:09 UTC (rev 214941)
+++ trunk/Source/_javascript_Core/ChangeLog	2017-04-05 13:07:09 UTC (rev 214942)
@@ -1,3 +1,27 @@
+2017-04-05  Yusuke Suzuki  <[email protected]>
+
+        [JSC] Suppress warnings in GCC
+        https://bugs.webkit.org/show_bug.cgi?id=170501
+
+        Reviewed by Keith Miller.
+
+        Should use ASSERT_NOT_REACHED since return-type pragma is only
+        enabled under ASSERT_DISABLED environment. We shoud use
+        ASSERT_NOTREACHED to emit assertions in debug build. It effectively
+        catches bugs while keeping performance in release build.
+
+        * b3/B3Opcode.cpp:
+        (JSC::B3::storeOpcode):
+        * b3/B3Width.h:
+        (JSC::B3::mask):
+        * runtime/Options.cpp:
+        (JSC::parse):
+        * wasm/WasmSections.h:
+        (JSC::Wasm::makeString):
+        * wasm/WasmSignature.cpp:
+        (JSC::Wasm::SignatureInformation::tryCleanup):
+        * wasm/generateWasmValidateInlinesHeader.py:
+
 2017-04-05  Carlos Garcia Campos  <[email protected]>
 
         Implement PromiseDeferredTimer for non CF based ports

Modified: trunk/Source/_javascript_Core/b3/B3Opcode.cpp (214941 => 214942)


--- trunk/Source/_javascript_Core/b3/B3Opcode.cpp	2017-04-05 10:41:09 UTC (rev 214941)
+++ trunk/Source/_javascript_Core/b3/B3Opcode.cpp	2017-04-05 13:07:09 UTC (rev 214942)
@@ -88,6 +88,7 @@
     case FP:
         return Store;
     }
+    ASSERT_NOT_REACHED();
 }
 
 } } // namespace JSC::B3

Modified: trunk/Source/_javascript_Core/b3/B3Width.h (214941 => 214942)


--- trunk/Source/_javascript_Core/b3/B3Width.h	2017-04-05 10:41:09 UTC (rev 214941)
+++ trunk/Source/_javascript_Core/b3/B3Width.h	2017-04-05 13:07:09 UTC (rev 214942)
@@ -130,6 +130,7 @@
     case Width64:
         return 0xffffffffffffffffllu;
     }
+    ASSERT_NOT_REACHED();
 }
 
 } } // namespace JSC::B3

Modified: trunk/Source/_javascript_Core/runtime/Options.cpp (214941 => 214942)


--- trunk/Source/_javascript_Core/runtime/Options.cpp	2017-04-05 10:41:09 UTC (rev 214941)
+++ trunk/Source/_javascript_Core/runtime/Options.cpp	2017-04-05 13:07:09 UTC (rev 214942)
@@ -89,18 +89,15 @@
     return sscanf(string, "%u", &value) == 1;
 }
 
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wunused-function"
 static bool parse(const char* string, unsigned long& value)
 {
     return sscanf(string, "%lu", &value);
 }
 
-static bool parse(const char* string, unsigned long long& value)
+static bool UNUSED_FUNCTION parse(const char* string, unsigned long long& value)
 {
     return sscanf(string, "%llu", &value);
 }
-#pragma GCC diagnostic pop
 
 static bool parse(const char* string, double& value)
 {

Modified: trunk/Source/_javascript_Core/wasm/WasmSections.h (214941 => 214942)


--- trunk/Source/_javascript_Core/wasm/WasmSections.h	2017-04-05 10:41:09 UTC (rev 214941)
+++ trunk/Source/_javascript_Core/wasm/WasmSections.h	2017-04-05 13:07:09 UTC (rev 214942)
@@ -82,6 +82,7 @@
         FOR_EACH_WASM_SECTION(STRINGIFY_SECTION_NAME)
 #undef STRINGIFY_SECTION_NAME
     }
+    ASSERT_NOT_REACHED();
 }
 
 } } // namespace JSC::Wasm

Modified: trunk/Source/_javascript_Core/wasm/WasmSignature.cpp (214941 => 214942)


--- trunk/Source/_javascript_Core/wasm/WasmSignature.cpp	2017-04-05 10:41:09 UTC (rev 214941)
+++ trunk/Source/_javascript_Core/wasm/WasmSignature.cpp	2017-04-05 13:07:09 UTC (rev 214942)
@@ -152,9 +152,9 @@
     }
     for (const auto& pair : toRemove) {
         bool removed = info.m_signatureMap.remove(SignatureHash { pair.second });
-        ASSERT(removed);
+        ASSERT_UNUSED(removed, removed);
         removed = info.m_indexMap.remove(pair.first);
-        ASSERT(removed);
+        ASSERT_UNUSED(removed, removed);
     }
     if (info.m_signatureMap.isEmpty()) {
         ASSERT(info.m_indexMap.isEmpty());

Modified: trunk/Source/_javascript_Core/wasm/generateWasmValidateInlinesHeader.py (214941 => 214942)


--- trunk/Source/_javascript_Core/wasm/generateWasmValidateInlinesHeader.py	2017-04-05 10:41:09 UTC (rev 214941)
+++ trunk/Source/_javascript_Core/wasm/generateWasmValidateInlinesHeader.py	2017-04-05 13:07:09 UTC (rev 214942)
@@ -144,6 +144,7 @@
     switch (op) {
 """ + loadCases + """
     }
+    ASSERT_NOT_REACHED();
 }
 
 auto Validate::store(StoreOpType op, ExpressionType pointer, ExpressionType value, uint32_t) -> Result
@@ -154,6 +155,7 @@
     switch (op) {
 """ + storeCases + """
     }
+    ASSERT_NOT_REACHED();
 }
 
 } } // namespace JSC::Wasm

Modified: trunk/Source/WTF/ChangeLog (214941 => 214942)


--- trunk/Source/WTF/ChangeLog	2017-04-05 10:41:09 UTC (rev 214941)
+++ trunk/Source/WTF/ChangeLog	2017-04-05 13:07:09 UTC (rev 214942)
@@ -1,3 +1,15 @@
+2017-04-05  Yusuke Suzuki  <[email protected]>
+
+        [JSC] Suppress warnings in GCC
+        https://bugs.webkit.org/show_bug.cgi?id=170501
+
+        Reviewed by Keith Miller.
+
+        Add a new macro UNUSED_FUNCTION to annotate unused static functions.
+        #pragma GCC diagnostic ignored "-Wunused-function" does not work.
+
+        * wtf/Compiler.h:
+
 2017-04-04  Filip Pizlo  <[email protected]>
 
         Air::eliminateDeadCode() should not use a HashSet

Modified: trunk/Source/WTF/wtf/Compiler.h (214941 => 214942)


--- trunk/Source/WTF/wtf/Compiler.h	2017-04-05 10:41:09 UTC (rev 214941)
+++ trunk/Source/WTF/wtf/Compiler.h	2017-04-05 13:07:09 UTC (rev 214942)
@@ -280,6 +280,16 @@
 #define PURE_FUNCTION
 #endif
 
+/* UNUSED_FUNCTION */
+
+#if !defined(UNUSED_FUNCTION) && COMPILER(GCC_OR_CLANG)
+#define UNUSED_FUNCTION __attribute__((unused))
+#endif
+
+#if !defined(UNUSED_FUNCTION)
+#define UNUSED_FUNCTION
+#endif
+
 /* REFERENCED_FROM_ASM */
 
 #if !defined(REFERENCED_FROM_ASM) && COMPILER(GCC_OR_CLANG)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to