#define __has_extension(x) 0
#endif
+/* To make NO_RETURN portable across gcc/clang and MSVC, it should be
+ * added at the beginning of the function declaration. */
#if __GNUC__ && !__CHECKER__
#define NO_RETURN __attribute__((__noreturn__))
+#elif _MSC_VER
+#define NO_RETURN __declspec(noreturn)
+#else
+#define NO_RETURN
+#endif
+
+#if __GNUC__ && !__CHECKER__
#define OVS_UNUSED __attribute__((__unused__))
#define PRINTF_FORMAT(FMT, ARG1) __attribute__((__format__(printf, FMT, ARG1)))
#define SCANF_FORMAT(FMT, ARG1) __attribute__((__format__(scanf, FMT, ARG1)))
#define OVS_LIKELY(CONDITION) __builtin_expect(!!(CONDITION), 1)
#define OVS_UNLIKELY(CONDITION) __builtin_expect(!!(CONDITION), 0)
#else
-#define NO_RETURN
#define OVS_UNUSED
#define PRINTF_FORMAT(FMT, ARG1)
#define SCANF_FORMAT(FMT, ARG1)
return false;
}
-static void NO_RETURN
+NO_RETURN static void
nossl_option(const char *detail)
{
VLOG_FATAL("%s specified but Open vSwitch was built without SSL support",
if (!OVS_LIKELY(CONDITION)) { \
ovs_assert_failure(SOURCE_LOCATOR, __func__, #CONDITION); \
}
-void ovs_assert_failure(const char *, const char *, const char *) NO_RETURN;
+NO_RETURN void ovs_assert_failure(const char *, const char *, const char *);
/* Casts 'pointer' to 'type' and issues a compiler warning if the cast changes
* anything other than an outermost "const" or "volatile" qualifier.
const char *get_program_version(void);
void ovs_print_version(uint8_t min_ofp, uint8_t max_ofp);
-void out_of_memory(void) NO_RETURN;
+NO_RETURN void out_of_memory(void);
void *xmalloc(size_t) MALLOC_LIKE;
void *xcalloc(size_t, size_t) MALLOC_LIKE;
void *xzalloc(size_t) MALLOC_LIKE;
void ovs_strlcpy(char *dst, const char *src, size_t size);
void ovs_strzcpy(char *dst, const char *src, size_t size);
-void ovs_abort(int err_no, const char *format, ...)
- PRINTF_FORMAT(2, 3) NO_RETURN;
-void ovs_abort_valist(int err_no, const char *format, va_list)
- PRINTF_FORMAT(2, 0) NO_RETURN;
-void ovs_fatal(int err_no, const char *format, ...)
- PRINTF_FORMAT(2, 3) NO_RETURN;
-void ovs_fatal_valist(int err_no, const char *format, va_list)
- PRINTF_FORMAT(2, 0) NO_RETURN;
+NO_RETURN void ovs_abort(int err_no, const char *format, ...)
+ PRINTF_FORMAT(2, 3);
+NO_RETURN void ovs_abort_valist(int err_no, const char *format, va_list)
+ PRINTF_FORMAT(2, 0);
+NO_RETURN void ovs_fatal(int err_no, const char *format, ...)
+ PRINTF_FORMAT(2, 3);
+NO_RETURN void ovs_fatal_valist(int err_no, const char *format, va_list)
+ PRINTF_FORMAT(2, 0);
void ovs_error(int err_no, const char *format, ...) PRINTF_FORMAT(2, 3);
void ovs_error_valist(int err_no, const char *format, va_list)
PRINTF_FORMAT(2, 0);
const char *, va_list)
PRINTF_FORMAT (3, 0);
-void vlog_fatal(const struct vlog_module *, const char *format, ...)
- PRINTF_FORMAT (2, 3) NO_RETURN;
-void vlog_fatal_valist(const struct vlog_module *, const char *format, va_list)
- PRINTF_FORMAT (2, 0) NO_RETURN;
-
-void vlog_abort(const struct vlog_module *, const char *format, ...)
- PRINTF_FORMAT (2, 3) NO_RETURN;
-void vlog_abort_valist(const struct vlog_module *, const char *format, va_list)
- PRINTF_FORMAT (2, 0) NO_RETURN;
+NO_RETURN void vlog_fatal(const struct vlog_module *, const char *format, ...)
+ PRINTF_FORMAT (2, 3);
+NO_RETURN void vlog_fatal_valist(const struct vlog_module *,
+ const char *format, va_list)
+ PRINTF_FORMAT (2, 0);
+
+NO_RETURN void vlog_abort(const struct vlog_module *, const char *format, ...)
+ PRINTF_FORMAT (2, 3);
+NO_RETURN void vlog_abort_valist(const struct vlog_module *,
+ const char *format, va_list)
+ PRINTF_FORMAT (2, 0);
void vlog_rate_limit(const struct vlog_module *, enum vlog_level,
struct vlog_rate_limit *, const char *, ...)
static const struct ovsdb_client_command *get_all_commands(void);
-static void usage(void) NO_RETURN;
+NO_RETURN static void usage(void);
static void parse_options(int argc, char *argv[]);
static struct jsonrpc *open_jsonrpc(const char *server);
static void fetch_dbs(struct jsonrpc *, struct svec *dbs);
static void parse_options(int *argc, char **argvp[],
struct sset *remotes, char **unixctl_pathp,
char **run_command);
-static void usage(void) NO_RETURN;
+NO_RETURN static void usage(void);
static char *reconfigure_remotes(struct ovsdb_jsonrpc_server *,
const struct shash *all_dbs,
static const struct command *get_all_commands(void);
-static void usage(void) NO_RETURN;
+NO_RETURN static void usage(void);
static void parse_options(int argc, char *argv[]);
static const char *default_db(void);
#include "vlog.h"
#include "ovstest.h"
-static void usage(void) NO_RETURN;
+NO_RETURN static void usage(void);
static void parse_options(int argc, char *argv[]);
static struct command *get_all_commands(void);
#include "vlog.h"
#include "ovstest.h"
-static void usage(void) NO_RETURN;
+NO_RETURN static void usage(void);
static void parse_options(int argc, char *argv[]);
static unixctl_cb_func test_netflow_exit;
#include "util.h"
#include "vlog.h"
-static void usage(void) NO_RETURN;
+NO_RETURN static void usage(void);
static void parse_options(int argc, char *argv[]);
static struct command *get_all_commands(void);
}
}
-static void
+NO_RETURN static void
err(const char *message, ...)
- PRINTF_FORMAT(1, 2)
- NO_RETURN;
+ PRINTF_FORMAT(1, 2);
static void
err(const char *message, ...)
#include "vlog.h"
#include "ovstest.h"
-static void usage(void) NO_RETURN;
+NO_RETURN static void usage(void);
static void parse_options(int argc, char *argv[]);
static unixctl_cb_func test_sflow_exit;
}
}
-static void
+NO_RETURN static void
err(const char *message, ...)
- PRINTF_FORMAT(1, 2)
- NO_RETURN;
+ PRINTF_FORMAT(1, 2);
static void
err(const char *message, ...)
static struct dpctl_params dpctl_p;
-static void usage(void *userdata OVS_UNUSED) NO_RETURN;
+NO_RETURN static void usage(void *userdata OVS_UNUSED);
static void parse_options(int argc, char *argv[]);
static void
static const struct command *get_all_commands(void);
-static void usage(void) NO_RETURN;
+NO_RETURN static void usage(void);
static void parse_options(int argc, char *argv[]);
static bool recv_flow_stats_reply(struct vconn *, ovs_be32 send_xid,
static void new_switch(struct switch_ *, struct vconn *);
static void parse_options(int argc, char *argv[]);
-static void usage(void) NO_RETURN;
+NO_RETURN static void usage(void);
int
main(int argc, char *argv[])
static struct ovsdb_idl *the_idl;
static struct ovsdb_idl_txn *the_idl_txn;
-static void vsctl_exit(int status) NO_RETURN;
-static void vsctl_fatal(const char *, ...) PRINTF_FORMAT(1, 2) NO_RETURN;
+NO_RETURN static void vsctl_exit(int status);
+NO_RETURN static void vsctl_fatal(const char *, ...) PRINTF_FORMAT(1, 2);
static char *default_db(void);
-static void usage(void) NO_RETURN;
+NO_RETURN static void usage(void);
static void parse_options(int argc, char *argv[], struct shash *local_options);
static bool might_write_to_db(char **argv);
static unixctl_cb_func ovs_vswitchd_exit;
static char *parse_options(int argc, char *argv[], char **unixctl_path);
-static void usage(void) NO_RETURN;
+NO_RETURN static void usage(void);
int
main(int argc, char *argv[])
static bool started OVS_GUARDED_BY(mutex);
static struct smap *system_stats OVS_GUARDED_BY(mutex);
-static void *system_stats_thread_func(void *);
+NO_RETURN static void *system_stats_thread_func(void *);
static void discard_stats(void);
/* Enables or disables system stats collection, according to 'enable'. */
}
}
-static void * NO_RETURN
+static void *
system_stats_thread_func(void *arg OVS_UNUSED)
{
pthread_detach(pthread_self());
static struct ovsdb_idl *the_idl;
static struct ovsdb_idl_txn *the_idl_txn;
-static void vtep_ctl_exit(int status) NO_RETURN;
-static void vtep_ctl_fatal(const char *, ...) PRINTF_FORMAT(1, 2) NO_RETURN;
+NO_RETURN static void vtep_ctl_exit(int status);
+NO_RETURN static void vtep_ctl_fatal(const char *, ...) PRINTF_FORMAT(1, 2);
static char *default_db(void);
-static void usage(void) NO_RETURN;
+NO_RETURN static void usage(void);
static void parse_options(int argc, char *argv[], struct shash *local_options);
static bool might_write_to_db(char **argv);