Skip to content

Commit

Permalink
jsc.cpp(3614,1): warning: function declared 'noreturn' should not return
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=260330

Reviewed by Ross Kirsling.

clang-cl reported the following warnings for Windows port.

> WTF\wtf\Assertions.cpp(335,1): warning: function declared 'noreturn' should not return [-Winvalid-noreturn]
> JavaScriptCore\jsc.cpp(2602,1): warning: non-void function does not return a value [-Wreturn-type]
> JavaScriptCore\jsc.cpp(3614,1): warning: function declared 'noreturn' should not return [-Winvalid-noreturn]

Clang-cl should take a code path of GCC for UNUSED_FUNCTION, NO_RETURN
and NO_RETURN_WITH_VALUE macros to suppress compiler warnings.

* Source/WTF/wtf/Assertions.cpp:
* Source/WTF/wtf/Compiler.h:

Canonical link: https://commits.webkit.org/266995@main
  • Loading branch information
fujii committed Aug 17, 2023
1 parent 647e462 commit 6c660bb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Source/WTF/wtf/Assertions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ void WTFCrash()
#else
*(int *)(uintptr_t)0xbbadbeef = 0;
// More reliable, but doesn't say BBADBEEF.
#if COMPILER(GCC_COMPATIBLE)
#if COMPILER(GCC) || COMPILER(CLANG)
__builtin_trap();
#else
((void(*)())nullptr)();
Expand Down
6 changes: 3 additions & 3 deletions Source/WTF/wtf/Compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@

/* NO_RETURN */

#if !defined(NO_RETURN) && COMPILER(GCC_COMPATIBLE)
#if !defined(NO_RETURN) && (COMPILER(GCC) || COMPILER(CLANG))
#define NO_RETURN __attribute((__noreturn__))
#endif

Expand Down Expand Up @@ -304,7 +304,7 @@

/* NO_RETURN_WITH_VALUE */

#if !defined(NO_RETURN_WITH_VALUE) && !COMPILER(MSVC)
#if !defined(NO_RETURN_WITH_VALUE) && (COMPILER(GCC) || COMPILER(CLANG))
#define NO_RETURN_WITH_VALUE NO_RETURN
#endif

Expand Down Expand Up @@ -356,7 +356,7 @@

/* UNUSED_FUNCTION */

#if !defined(UNUSED_FUNCTION) && COMPILER(GCC_COMPATIBLE)
#if !defined(UNUSED_FUNCTION) && (COMPILER(GCC) || COMPILER(CLANG))
#define UNUSED_FUNCTION __attribute__((unused))
#endif

Expand Down

0 comments on commit 6c660bb

Please sign in to comment.