Bug 1393498 Mark the stub_BaseThreadInitThunk as MOZ_NORETURN to silence a warning about a noreturn function not returning r=dmajor,froydnj
authorTom Ritter <tom@mozilla.com>
Thu, 24 Aug 2017 22:49:09 -0500
changeset 377805 defa8a301a0aa93381ea86c17cec622c5ac35aee
parent 377804 89d020630629fac5b4c2ae6f0a1107ae2405e7f2
child 377806 24653fcb748c603577c59c443b662394f7dca247
push id94338
push userkwierso@gmail.com
push dateThu, 31 Aug 2017 02:58:58 +0000
treeherdermozilla-inbound@9ca18987dabb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdmajor, froydnj
bugs1393498
milestone57.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 1393498 Mark the stub_BaseThreadInitThunk as MOZ_NORETURN to silence a warning about a noreturn function not returning r=dmajor,froydnj /home/worker/workspace/build/src/mozglue/build/WindowsDllBlocklist.cpp:816:1: error: 'noreturn' function does return [-Werror] MozReview-Commit-ID: SYgPDW0sMV
mfbt/Attributes.h
mozglue/build/WindowsDllBlocklist.cpp
--- a/mfbt/Attributes.h
+++ b/mfbt/Attributes.h
@@ -61,16 +61,17 @@
 #    define MOZ_HAVE_NEVER_INLINE        __attribute__((noinline))
 #  endif
 #  if __has_attribute(noreturn)
 #    define MOZ_HAVE_NORETURN            __attribute__((noreturn))
 #  endif
 #elif defined(__GNUC__)
 #  define MOZ_HAVE_NEVER_INLINE          __attribute__((noinline))
 #  define MOZ_HAVE_NORETURN              __attribute__((noreturn))
+#  define MOZ_HAVE_NORETURN_PTR          __attribute__((noreturn))
 #endif
 
 /*
  * When built with clang analyzer (a.k.a scan-build), define MOZ_HAVE_NORETURN
  * to mark some false positives
  */
 #ifdef __clang_analyzer__
 #  if __has_extension(attribute_analyzer_noreturn)
@@ -97,23 +98,31 @@
  *
  *   MOZ_NORETURN void abort(const char* msg);
  *
  * This modifier permits the compiler to optimize code assuming a call to such a
  * function will never return.  It also enables the compiler to avoid spurious
  * warnings about not initializing variables, or about any other seemingly-dodgy
  * operations performed after the function returns.
  *
+ * There are two variants. The GCC version of NORETURN may be applied to a
+ * function pointer, while for MSVC it may not.
+ *
  * This modifier does not affect the corresponding function's linking behavior.
  */
 #if defined(MOZ_HAVE_NORETURN)
 #  define MOZ_NORETURN          MOZ_HAVE_NORETURN
 #else
 #  define MOZ_NORETURN          /* no support */
 #endif
+#if defined(MOZ_HAVE_NORETURN_PTR)
+#  define MOZ_NORETURN_PTR      MOZ_HAVE_NORETURN_PTR
+#else
+#  define MOZ_NORETURN_PTR      /* no support */
+#endif
 
 /**
  * MOZ_COLD tells the compiler that a function is "cold", meaning infrequently
  * executed. This may lead it to optimize for size more aggressively than speed,
  * or to allocate the body of the function in a distant part of the text segment
  * to help keep it from taking up unnecessary icache when it isn't in use.
  *
  * Place this attribute at the very beginning of a function definition. For
--- a/mozglue/build/WindowsDllBlocklist.cpp
+++ b/mozglue/build/WindowsDllBlocklist.cpp
@@ -295,17 +295,17 @@ printf_stderr(const char *fmt, ...)
   vfprintf(fp, fmt, args);
   va_end(args);
 
   fclose(fp);
 }
 
 
 #ifdef _M_IX86
-typedef void (__fastcall* BaseThreadInitThunk_func)(BOOL aIsInitialThread, void* aStartAddress, void* aThreadParam);
+typedef MOZ_NORETURN_PTR void (__fastcall* BaseThreadInitThunk_func)(BOOL aIsInitialThread, void* aStartAddress, void* aThreadParam);
 static BaseThreadInitThunk_func stub_BaseThreadInitThunk = nullptr;
 #endif
 
 typedef NTSTATUS (NTAPI *LdrLoadDll_func) (PWCHAR filePath, PULONG flags, PUNICODE_STRING moduleFileName, PHANDLE handle);
 static LdrLoadDll_func stub_LdrLoadDll;
 
 #ifdef _M_AMD64
 typedef decltype(RtlInstallFunctionTableCallback)* RtlInstallFunctionTableCallback_func;