From 3bbd8663b068d0afb5d920517cddd6938f0dc548 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Mon, 21 Jan 2019 22:04:06 -0500 Subject: [PATCH] WIN32: fix roken build __declspec not _declspec Include "err.h" not Include "roken.h" before "err.h" Indent "#if" as "# if" within roken.h.in when CPP rules must be copied into the generated "roken.h". Correct verr() attribute to be ROKEN_LIB_NORETURN_FUNCTION. Change-Id: I4289ecaba4a097175b4a5a1cde529b59038c72e3 --- lib/roken/err.c | 3 ++- lib/roken/err.hin | 2 +- lib/roken/roken.h.in | 10 +++++----- lib/roken/verr.c | 2 +- lib/roken/warn.c | 1 + 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/lib/roken/err.c b/lib/roken/err.c index 5fbe84fdf..592ed69d3 100644 --- a/lib/roken/err.c +++ b/lib/roken/err.c @@ -33,9 +33,10 @@ #include +#include "roken.h" #include "err.h" -ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL +ROKEN_LIB_NORETURN_FUNCTION void ROKEN_LIB_CALL err(int eval, const char *fmt, ...) { va_list ap; diff --git a/lib/roken/err.hin b/lib/roken/err.hin index 1cb0abe70..905b1ebcf 100644 --- a/lib/roken/err.hin +++ b/lib/roken/err.hin @@ -51,7 +51,7 @@ #endif #ifndef ROKEN_LIB_NORETURN_FUNCTION #ifdef _WIN32 - #define ROKEN_LIB_NORETURN_FUNCTION _declspec(noreturn) + #define ROKEN_LIB_NORETURN_FUNCTION __declspec(noreturn) #else #define ROKEN_LIB_NORETURN_FUNCTION #endif diff --git a/lib/roken/roken.h.in b/lib/roken/roken.h.in index f3cd84b75..2ba9dea83 100644 --- a/lib/roken/roken.h.in +++ b/lib/roken/roken.h.in @@ -32,11 +32,11 @@ * SUCH DAMAGE. */ -#if defined(_WIN32) && _MSC_VER >= 1400 +# if defined(_WIN32) && _MSC_VER >= 1400 /* _CRT_RAND_S must be defined before including stdlib.h */ -# define _CRT_RAND_S -# define HAVE_WIN32_RAND_S 1 -#endif +# define _CRT_RAND_S +# define HAVE_WIN32_RAND_S 1 +# endif #include #include @@ -69,7 +69,7 @@ # ifdef ROKEN_LIB_DYNAMIC # define ROKEN_LIB_NORETURN_FUNCTION __declspec(dllimport noreturn) # else -# define ROKEN_LIB_NORETURN_FUNCTION _declspec(noreturn) +# define ROKEN_LIB_NORETURN_FUNCTION __declspec(noreturn) # endif # else # define ROKEN_LIB_NORETURN_FUNCTION diff --git a/lib/roken/verr.c b/lib/roken/verr.c index cd3cdf35e..9201e6d35 100644 --- a/lib/roken/verr.c +++ b/lib/roken/verr.c @@ -36,7 +36,7 @@ #include "roken.h" #include -ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL +ROKEN_LIB_NORETURN_FUNCTION void ROKEN_LIB_CALL verr(int eval, const char *fmt, va_list ap) { rk_warnerr(1, fmt, ap); diff --git a/lib/roken/warn.c b/lib/roken/warn.c index 09b9cf82e..e149c5653 100644 --- a/lib/roken/warn.c +++ b/lib/roken/warn.c @@ -33,6 +33,7 @@ #include +#include "roken.h" #include "err.h" void