WIN32: hint noreturn functions
apply __declspec(noreturn) compiler hints to functions that do not return. Change-Id: I3c6c4703c7235d1df3e21dccad5272ea4cddfd36
This commit is contained in:

committed by
Nico Williams

parent
4d57ee72f3
commit
bec4818943
@@ -415,34 +415,67 @@ extern \"C\" {
|
|||||||
}
|
}
|
||||||
if ($opt_E) {
|
if ($opt_E) {
|
||||||
$public_h_header .= "#ifndef $opt_E
|
$public_h_header .= "#ifndef $opt_E
|
||||||
#ifndef ${opt_E}_FUNCTION
|
#ifndef ${opt_E}_FUNCTION
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
#define ${opt_E}_FUNCTION __declspec(dllimport)
|
#define ${opt_E}_FUNCTION __declspec(dllimport)
|
||||||
#define ${opt_E}_CALL __stdcall
|
#else
|
||||||
#define ${opt_E}_VARIABLE __declspec(dllimport)
|
#define ${opt_E}_FUNCTION
|
||||||
#else
|
#endif
|
||||||
#define ${opt_E}_FUNCTION
|
#endif
|
||||||
#define ${opt_E}_CALL
|
#ifndef ${opt_E}_NORETURN_FUNCTION
|
||||||
#define ${opt_E}_VARIABLE
|
#if defined(_WIN32)
|
||||||
#endif
|
#define ${opt_E}_NORETURN_FUNCTION __declspec(dllimport noreturn)
|
||||||
#endif
|
#else
|
||||||
|
#define ${opt_E}_NORETURN_FUNCTION
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#ifndef ${opt_E}_CALL
|
||||||
|
#if defined(_WIN32)
|
||||||
|
#define ${opt_E}_CALL __stdcall
|
||||||
|
#else
|
||||||
|
#define ${opt_E}_CALL
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#ifndef ${opt_E}_VARIABLE
|
||||||
|
#if defined(_WIN32)
|
||||||
|
#define ${opt_E}_VARIABLE __declspec(dllimport)
|
||||||
|
#else
|
||||||
|
#define ${opt_E}_VARIABLE
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
";
|
";
|
||||||
|
|
||||||
$private_h_header .= "#ifndef $opt_E
|
$private_h_header .= "#ifndef $opt_E
|
||||||
#ifndef ${opt_E}_FUNCTION
|
#ifndef ${opt_E}_FUNCTION
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
#define ${opt_E}_FUNCTION __declspec(dllimport)
|
#define ${opt_E}_FUNCTION __declspec(dllimport)
|
||||||
#define ${opt_E}_CALL __stdcall
|
#else
|
||||||
#define ${opt_E}_VARIABLE __declspec(dllimport)
|
#define ${opt_E}_FUNCTION
|
||||||
#else
|
#endif
|
||||||
#define ${opt_E}_FUNCTION
|
#endif
|
||||||
#define ${opt_E}_CALL
|
#ifndef ${opt_E}_NORETURN_FUNCTION
|
||||||
#define ${opt_E}_VARIABLE
|
#if defined(_WIN32)
|
||||||
|
#define ${opt_E}_NORETURN_FUNCTION __declspec(dllimport noreturn)
|
||||||
|
#else
|
||||||
|
#define ${opt_E}_NORETURN_FUNCTION
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#ifndef ${opt_E}_CALL
|
||||||
|
#if defined(_WIN32)
|
||||||
|
#define ${opt_E}_CALL __stdcall
|
||||||
|
#else
|
||||||
|
#define ${opt_E}_CALL
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#ifndef ${opt_E}_VARIABLE
|
||||||
|
#if defined(_WIN32)
|
||||||
|
#define ${opt_E}_VARIABLE __declspec(dllimport)
|
||||||
|
#else
|
||||||
|
#define ${opt_E}_VARIABLE
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
";
|
";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -55,10 +55,12 @@ static const char *const rcsid[] = { (const char *)rcsid, "@(#)" msg }
|
|||||||
#ifndef KRB5_LIB
|
#ifndef KRB5_LIB
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#define KRB5_LIB_FUNCTION
|
#define KRB5_LIB_FUNCTION
|
||||||
|
#define KRB5_LIB_NORETURN_FUNCTION __declspec(noreturn)
|
||||||
#define KRB5_LIB_CALL __stdcall
|
#define KRB5_LIB_CALL __stdcall
|
||||||
#define KRB5_LIB_VARIABLE
|
#define KRB5_LIB_VARIABLE
|
||||||
#else
|
#else
|
||||||
#define KRB5_LIB_FUNCTION
|
#define KRB5_LIB_FUNCTION
|
||||||
|
#define KRB5_LIB_NORETURN_FUNCTION
|
||||||
#define KRB5_LIB_CALL
|
#define KRB5_LIB_CALL
|
||||||
#define KRB5_LIB_VARIABLE
|
#define KRB5_LIB_VARIABLE
|
||||||
#endif
|
#endif
|
||||||
@@ -70,10 +72,12 @@ static const char *const rcsid[] = { (const char *)rcsid, "@(#)" msg }
|
|||||||
#ifndef ROKEN_LIB
|
#ifndef ROKEN_LIB
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#define ROKEN_LIB_FUNCTION
|
#define ROKEN_LIB_FUNCTION
|
||||||
|
#define ROKEN_LIB_NORETURN_FUNCTION __declspec(noreturn)
|
||||||
#define ROKEN_LIB_CALL __cdecl
|
#define ROKEN_LIB_CALL __cdecl
|
||||||
#define ROKEN_LIB_VARIABLE
|
#define ROKEN_LIB_VARIABLE
|
||||||
#else
|
#else
|
||||||
#define ROKEN_LIB_FUNCTION
|
#define ROKEN_LIB_FUNCTION
|
||||||
|
#define ROKEN_LIB_NORETURN_FUNCTION
|
||||||
#define ROKEN_LIB_CALL
|
#define ROKEN_LIB_CALL
|
||||||
#define ROKEN_LIB_VARIABLE
|
#define ROKEN_LIB_VARIABLE
|
||||||
#endif
|
#endif
|
||||||
@@ -85,10 +89,12 @@ static const char *const rcsid[] = { (const char *)rcsid, "@(#)" msg }
|
|||||||
#ifndef GSSAPI_LIB
|
#ifndef GSSAPI_LIB
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#define GSSAPI_LIB_FUNCTION
|
#define GSSAPI_LIB_FUNCTION
|
||||||
|
#define GSSAPI_LIB_NORETURN_FUNCTION __declspec(noreturn)
|
||||||
#define GSSAPI_LIB_CALL __stdcall
|
#define GSSAPI_LIB_CALL __stdcall
|
||||||
#define GSSAPI_LIB_VARIABLE
|
#define GSSAPI_LIB_VARIABLE
|
||||||
#else
|
#else
|
||||||
#define GSSAPI_LIB_FUNCTION
|
#define GSSAPI_LIB_FUNCTION
|
||||||
|
#define GSSAPI_LIB_NORETURN_FUNCTION
|
||||||
#define GSSAPI_LIB_CALL
|
#define GSSAPI_LIB_CALL
|
||||||
#define GSSAPI_LIB_VARIABLE
|
#define GSSAPI_LIB_VARIABLE
|
||||||
#endif
|
#endif
|
||||||
|
@@ -181,7 +181,7 @@ krb5_warnx(krb5_context context, const char *fmt, ...)
|
|||||||
* @ingroup krb5_error
|
* @ingroup krb5_error
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
|
KRB5_LIB_NORETURN_FUNCTION krb5_error_code KRB5_LIB_CALL
|
||||||
krb5_verr(krb5_context context, int eval, krb5_error_code code,
|
krb5_verr(krb5_context context, int eval, krb5_error_code code,
|
||||||
const char *fmt, va_list ap)
|
const char *fmt, va_list ap)
|
||||||
__attribute__ ((__noreturn__, __format__ (__printf__, 4, 0)))
|
__attribute__ ((__noreturn__, __format__ (__printf__, 4, 0)))
|
||||||
@@ -203,7 +203,7 @@ krb5_verr(krb5_context context, int eval, krb5_error_code code,
|
|||||||
* @ingroup krb5_error
|
* @ingroup krb5_error
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
|
KRB5_LIB_NORETURN_FUNCTION krb5_error_code KRB5_LIB_CALL
|
||||||
krb5_err(krb5_context context, int eval, krb5_error_code code,
|
krb5_err(krb5_context context, int eval, krb5_error_code code,
|
||||||
const char *fmt, ...)
|
const char *fmt, ...)
|
||||||
__attribute__ ((__noreturn__, __format__ (__printf__, 4, 5)))
|
__attribute__ ((__noreturn__, __format__ (__printf__, 4, 5)))
|
||||||
@@ -224,7 +224,7 @@ krb5_err(krb5_context context, int eval, krb5_error_code code,
|
|||||||
* @ingroup krb5_error
|
* @ingroup krb5_error
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
|
KRB5_LIB_NORETURN_FUNCTION krb5_error_code KRB5_LIB_CALL
|
||||||
krb5_verrx(krb5_context context, int eval, const char *fmt, va_list ap)
|
krb5_verrx(krb5_context context, int eval, const char *fmt, va_list ap)
|
||||||
__attribute__ ((__noreturn__, __format__ (__printf__, 3, 0)))
|
__attribute__ ((__noreturn__, __format__ (__printf__, 3, 0)))
|
||||||
{
|
{
|
||||||
@@ -243,7 +243,7 @@ krb5_verrx(krb5_context context, int eval, const char *fmt, va_list ap)
|
|||||||
* @ingroup krb5_error
|
* @ingroup krb5_error
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
|
KRB5_LIB_NORETURN_FUNCTION krb5_error_code KRB5_LIB_CALL
|
||||||
krb5_errx(krb5_context context, int eval, const char *fmt, ...)
|
krb5_errx(krb5_context context, int eval, const char *fmt, ...)
|
||||||
__attribute__ ((__noreturn__, __format__ (__printf__, 3, 4)))
|
__attribute__ ((__noreturn__, __format__ (__printf__, 3, 4)))
|
||||||
{
|
{
|
||||||
@@ -264,7 +264,7 @@ krb5_errx(krb5_context context, int eval, const char *fmt, ...)
|
|||||||
* @ingroup krb5_error
|
* @ingroup krb5_error
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
|
KRB5_LIB_NORETURN_FUNCTION krb5_error_code KRB5_LIB_CALL
|
||||||
krb5_vabort(krb5_context context, krb5_error_code code,
|
krb5_vabort(krb5_context context, krb5_error_code code,
|
||||||
const char *fmt, va_list ap)
|
const char *fmt, va_list ap)
|
||||||
__attribute__ ((__noreturn__, __format__ (__printf__, 3, 0)))
|
__attribute__ ((__noreturn__, __format__ (__printf__, 3, 0)))
|
||||||
@@ -286,7 +286,7 @@ krb5_vabort(krb5_context context, krb5_error_code code,
|
|||||||
* @ingroup krb5_error
|
* @ingroup krb5_error
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
|
KRB5_LIB_NORETURN_FUNCTION krb5_error_code KRB5_LIB_CALL
|
||||||
krb5_abort(krb5_context context, krb5_error_code code, const char *fmt, ...)
|
krb5_abort(krb5_context context, krb5_error_code code, const char *fmt, ...)
|
||||||
__attribute__ ((__noreturn__, __format__ (__printf__, 3, 4)))
|
__attribute__ ((__noreturn__, __format__ (__printf__, 3, 4)))
|
||||||
{
|
{
|
||||||
@@ -295,7 +295,7 @@ krb5_abort(krb5_context context, krb5_error_code code, const char *fmt, ...)
|
|||||||
UNREACHABLE(return 0);
|
UNREACHABLE(return 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
|
KRB5_LIB_NORETURN_FUNCTION krb5_error_code KRB5_LIB_CALL
|
||||||
krb5_vabortx(krb5_context context, const char *fmt, va_list ap)
|
krb5_vabortx(krb5_context context, const char *fmt, va_list ap)
|
||||||
__attribute__ ((__noreturn__, __format__ (__printf__, 2, 0)))
|
__attribute__ ((__noreturn__, __format__ (__printf__, 2, 0)))
|
||||||
{
|
{
|
||||||
@@ -314,7 +314,7 @@ krb5_vabortx(krb5_context context, const char *fmt, va_list ap)
|
|||||||
* @ingroup krb5_error
|
* @ingroup krb5_error
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
|
KRB5_LIB_NORETURN_FUNCTION krb5_error_code KRB5_LIB_CALL
|
||||||
krb5_abortx(krb5_context context, const char *fmt, ...)
|
krb5_abortx(krb5_context context, const char *fmt, ...)
|
||||||
__attribute__ ((__noreturn__, __format__ (__printf__, 2, 3)))
|
__attribute__ ((__noreturn__, __format__ (__printf__, 2, 3)))
|
||||||
{
|
{
|
||||||
|
@@ -47,30 +47,39 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef ROKEN_LIB_FUNCTION
|
#ifndef ROKEN_LIB_FUNCTION
|
||||||
#ifdef _WIN32
|
#define ROKEN_LIB_FUNCTION
|
||||||
#define ROKEN_LIB_FUNCTION
|
|
||||||
#define ROKEN_LIB_CALL __cdecl
|
|
||||||
#else
|
|
||||||
#define ROKEN_LIB_FUNCTION
|
|
||||||
#define ROKEN_LIB_CALL
|
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef ROKEN_LIB_NORETURN_FUNCTION
|
||||||
|
#ifdef _WIN32
|
||||||
|
#define ROKEN_LIB_NORETURN_FUNCTION _declspec(noreturn)
|
||||||
|
#else
|
||||||
|
#define ROKEN_LIB_NORETURN_FUNCTION
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#ifndef ROKEN_LIB_CALL
|
||||||
|
#ifdef _WIN32
|
||||||
|
#define ROKEN_LIB_CALL __cdecl
|
||||||
|
#else
|
||||||
|
#define ROKEN_LIB_CALL
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL
|
ROKEN_LIB_NORETURN_FUNCTION void ROKEN_LIB_CALL
|
||||||
verr(int eval, const char *fmt, va_list ap)
|
verr(int eval, const char *fmt, va_list ap)
|
||||||
__attribute__ ((__noreturn__, __format__ (__printf__, 2, 0)));
|
__attribute__ ((__noreturn__, __format__ (__printf__, 2, 0)));
|
||||||
|
|
||||||
ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL
|
ROKEN_LIB_NORETURN_FUNCTION void ROKEN_LIB_CALL
|
||||||
err(int eval, const char *fmt, ...)
|
err(int eval, const char *fmt, ...)
|
||||||
__attribute__ ((__noreturn__, __format__ (__printf__, 2, 3)));
|
__attribute__ ((__noreturn__, __format__ (__printf__, 2, 3)));
|
||||||
|
|
||||||
ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL
|
ROKEN_LIB_NORETURN_FUNCTION void ROKEN_LIB_CALL
|
||||||
verrx(int eval, const char *fmt, va_list ap)
|
verrx(int eval, const char *fmt, va_list ap)
|
||||||
__attribute__ ((__noreturn__, __format__ (__printf__, 2, 0)));
|
__attribute__ ((__noreturn__, __format__ (__printf__, 2, 0)));
|
||||||
|
|
||||||
ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL
|
ROKEN_LIB_NORETURN_FUNCTION void ROKEN_LIB_CALL
|
||||||
errx(int eval, const char *fmt, ...)
|
errx(int eval, const char *fmt, ...)
|
||||||
__attribute__ ((__noreturn__, __format__ (__printf__, 2, 3)));
|
__attribute__ ((__noreturn__, __format__ (__printf__, 2, 3)));
|
||||||
|
|
||||||
ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL
|
ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL
|
||||||
vwarn(const char *fmt, va_list ap)
|
vwarn(const char *fmt, va_list ap)
|
||||||
__attribute__ ((__format__ (__printf__, 1, 0)));
|
__attribute__ ((__format__ (__printf__, 1, 0)));
|
||||||
|
@@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
#include "err.h"
|
#include "err.h"
|
||||||
|
|
||||||
ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL
|
ROKEN_LIB_NORETURN_FUNCTION void ROKEN_LIB_CALL
|
||||||
errx(int eval, const char *fmt, ...)
|
errx(int eval, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
@@ -52,22 +52,49 @@
|
|||||||
#include <util.h>
|
#include <util.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef ROKEN_LIB_FUNCTION
|
# ifndef ROKEN_LIB_FUNCTION
|
||||||
#ifdef _WIN32
|
# ifdef _WIN32
|
||||||
# define ROKEN_LIB_CALL __cdecl
|
# ifdef ROKEN_LIB_DYNAMIC
|
||||||
# ifdef ROKEN_LIB_DYNAMIC
|
|
||||||
# define ROKEN_LIB_FUNCTION __declspec(dllimport)
|
# define ROKEN_LIB_FUNCTION __declspec(dllimport)
|
||||||
# define ROKEN_LIB_VARIABLE __declspec(dllimport)
|
# else
|
||||||
# else
|
|
||||||
# define ROKEN_LIB_FUNCTION
|
# define ROKEN_LIB_FUNCTION
|
||||||
# define ROKEN_LIB_VARIABLE
|
# endif
|
||||||
|
# else
|
||||||
|
# define ROKEN_LIB_FUNCTION
|
||||||
# endif
|
# endif
|
||||||
#else
|
# endif
|
||||||
#define ROKEN_LIB_FUNCTION
|
|
||||||
#define ROKEN_LIB_CALL
|
# ifndef ROKEN_LIB_NORETURN_FUNCTION
|
||||||
#define ROKEN_LIB_VARIABLE
|
# ifdef _WIN32
|
||||||
#endif
|
# ifdef ROKEN_LIB_DYNAMIC
|
||||||
#endif
|
# define ROKEN_LIB_NORETURN_FUNCTION __declspec(dllimport noreturn)
|
||||||
|
# else
|
||||||
|
# define ROKEN_LIB_NORETURN_FUNCTION _declspec(noreturn)
|
||||||
|
# endif
|
||||||
|
# else
|
||||||
|
# define ROKEN_LIB_NORETURN_FUNCTION
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifndef ROKEN_LIB_CALL
|
||||||
|
# ifdef _WIN32
|
||||||
|
# define ROKEN_LIB_CALL __cdecl
|
||||||
|
# else
|
||||||
|
# define ROKEN_LIB_CALL
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifndef ROKEN_LIB_VARIABLE
|
||||||
|
# ifdef _WIN32
|
||||||
|
# ifdef ROKEN_LIB_DYNAMIC
|
||||||
|
# define ROKEN_LIB_VARIABLE __declspec(dllimport)
|
||||||
|
# else
|
||||||
|
# define ROKEN_LIB_VARIABLE
|
||||||
|
# endif
|
||||||
|
# else
|
||||||
|
# define ROKEN_LIB_VARIABLE
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
|
||||||
#ifdef HAVE_WINSOCK
|
#ifdef HAVE_WINSOCK
|
||||||
/* Declarations for Microsoft Windows */
|
/* Declarations for Microsoft Windows */
|
||||||
|
@@ -36,7 +36,7 @@
|
|||||||
#include "roken.h"
|
#include "roken.h"
|
||||||
#include <err.h>
|
#include <err.h>
|
||||||
|
|
||||||
ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL
|
ROKEN_LIB_NORETURN_FUNCTION void ROKEN_LIB_CALL
|
||||||
verrx(int eval, const char *fmt, va_list ap)
|
verrx(int eval, const char *fmt, va_list ap)
|
||||||
{
|
{
|
||||||
rk_warnerr(0, fmt, ap);
|
rk_warnerr(0, fmt, ap);
|
||||||
|
Reference in New Issue
Block a user