Define the VPX_NO_RETURN macro for MSVC
Define VPX_NO_RETURN as __declspec(noreturn) for MSVC. See https://docs.microsoft.com/en-us/cpp/cpp/noreturn?view=msvc-160 This requires moving VPX_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. Change-Id: Id9bb0077e2a4f16ec2ca9c913dd93673a0e385cf
This commit is contained in:
6
args.c
6
args.c
@@ -16,8 +16,10 @@
|
|||||||
#include "vpx/vpx_integer.h"
|
#include "vpx/vpx_integer.h"
|
||||||
#include "vpx_ports/msvc.h"
|
#include "vpx_ports/msvc.h"
|
||||||
|
|
||||||
#if defined(__GNUC__) && __GNUC__
|
#if defined(__GNUC__)
|
||||||
extern void die(const char *fmt, ...) __attribute__((noreturn));
|
__attribute__((noreturn)) extern void die(const char *fmt, ...);
|
||||||
|
#elif defined(_MSC_VER)
|
||||||
|
__declspec(noreturn) extern void die(const char *fmt, ...);
|
||||||
#else
|
#else
|
||||||
extern void die(const char *fmt, ...);
|
extern void die(const char *fmt, ...);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -110,6 +110,8 @@ extern "C" {
|
|||||||
|
|
||||||
#if defined(__GNUC__)
|
#if defined(__GNUC__)
|
||||||
#define VPX_NO_RETURN __attribute__((noreturn))
|
#define VPX_NO_RETURN __attribute__((noreturn))
|
||||||
|
#elif defined(_MSC_VER)
|
||||||
|
#define VPX_NO_RETURN __declspec(noreturn)
|
||||||
#else
|
#else
|
||||||
#define VPX_NO_RETURN
|
#define VPX_NO_RETURN
|
||||||
#endif
|
#endif
|
||||||
@@ -117,14 +119,14 @@ extern "C" {
|
|||||||
/* Sets a stdio stream into binary mode */
|
/* Sets a stdio stream into binary mode */
|
||||||
FILE *set_binary_mode(FILE *stream);
|
FILE *set_binary_mode(FILE *stream);
|
||||||
|
|
||||||
void die(const char *fmt, ...) VPX_NO_RETURN;
|
VPX_NO_RETURN void die(const char *fmt, ...);
|
||||||
void fatal(const char *fmt, ...) VPX_NO_RETURN;
|
VPX_NO_RETURN void fatal(const char *fmt, ...);
|
||||||
void warn(const char *fmt, ...);
|
void warn(const char *fmt, ...);
|
||||||
|
|
||||||
void die_codec(vpx_codec_ctx_t *ctx, const char *s) VPX_NO_RETURN;
|
VPX_NO_RETURN void die_codec(vpx_codec_ctx_t *ctx, const char *s);
|
||||||
|
|
||||||
/* The tool including this file must define usage_exit() */
|
/* The tool including this file must define usage_exit() */
|
||||||
void usage_exit(void) VPX_NO_RETURN;
|
VPX_NO_RETURN void usage_exit(void);
|
||||||
|
|
||||||
#undef VPX_NO_RETURN
|
#undef VPX_NO_RETURN
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user