Define the AOM_NO_RETURN macro for MSVC
Define AOM_NO_RETURN as __declspec(noreturn) for MSVC. See
https://docs.microsoft.com/en-us/cpp/cpp/noreturn?view=msvc-160
This requires moving AOM_NO_RETURN before function declarations because
__declspec(noreturn) must be placed there. Fortunately GCC's
__attribute__((noreturn)) can be placed either before or after function
declarations.
This fixes the following MSVC compiler warning:
aom\examples\photon_noise_table.c(282) : warning C4715: 'find_transfer_function': not all control paths return a value
Change-Id: I0b7a023286c7692fa3ec75daabb6a96770305b7c
(cherry picked from commit ab7f6f6fc4005dec30a71bf4f941d9bcd1c755fe)
diff --git a/common/tools_common.h b/common/tools_common.h
index b45d010..f5b5b19 100644
--- a/common/tools_common.h
+++ b/common/tools_common.h
@@ -125,6 +125,8 @@
#if defined(__GNUC__)
#define AOM_NO_RETURN __attribute__((noreturn))
+#elif defined(_MSC_VER)
+#define AOM_NO_RETURN __declspec(noreturn)
#else
#define AOM_NO_RETURN
#endif
@@ -132,14 +134,14 @@
/* Sets a stdio stream into binary mode */
FILE *set_binary_mode(FILE *stream);
-void die(const char *fmt, ...) AOM_NO_RETURN;
-void fatal(const char *fmt, ...) AOM_NO_RETURN;
+AOM_NO_RETURN void die(const char *fmt, ...);
+AOM_NO_RETURN void fatal(const char *fmt, ...);
void aom_tools_warn(const char *fmt, ...);
-void die_codec(aom_codec_ctx_t *ctx, const char *s) AOM_NO_RETURN;
+AOM_NO_RETURN void die_codec(aom_codec_ctx_t *ctx, const char *s);
/* The tool including this file must define usage_exit() */
-void usage_exit(void) AOM_NO_RETURN;
+AOM_NO_RETURN void usage_exit(void);
#undef AOM_NO_RETURN