openvswitchincludedir = $(includedir)/openvswitch
openvswitchinclude_HEADERS = \
+ include/openvswitch/compiler.h \
include/openvswitch/types.h \
include/openvswitch/util.h \
include/openvswitch/version.h
--- /dev/null
+/*
+ * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014 Nicira, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef OPENVSWITCH_COMPILER_H
+#define OPENVSWITCH_COMPILER_H 1
+
+#ifndef __has_feature
+ #define __has_feature(x) 0
+#endif
+#ifndef __has_extension
+ #define __has_extension(x) 0
+#endif
+
+/* To make OVS_NO_RETURN portable across gcc/clang and MSVC, it should be
+ * added at the beginning of the function declaration. */
+#if __GNUC__ && !__CHECKER__
+#define OVS_NO_RETURN __attribute__((__noreturn__))
+#elif _MSC_VER
+#define OVS_NO_RETURN __declspec(noreturn)
+#else
+#define OVS_NO_RETURN
+#endif
+
+#if __GNUC__ && !__CHECKER__
+#define OVS_UNUSED __attribute__((__unused__))
+#define OVS_PRINTF_FORMAT(FMT, ARG1) __attribute__((__format__(printf, FMT, ARG1)))
+#define OVS_SCANF_FORMAT(FMT, ARG1) __attribute__((__format__(scanf, FMT, ARG1)))
+#define OVS_WARN_UNUSED_RESULT __attribute__((__warn_unused_result__))
+#define OVS_LIKELY(CONDITION) __builtin_expect(!!(CONDITION), 1)
+#define OVS_UNLIKELY(CONDITION) __builtin_expect(!!(CONDITION), 0)
+#else
+#define OVS_UNUSED
+#define OVS_PRINTF_FORMAT(FMT, ARG1)
+#define OVS_SCANF_FORMAT(FMT, ARG1)
+#define OVS_WARN_UNUSED_RESULT
+#define OVS_LIKELY(CONDITION) (!!(CONDITION))
+#define OVS_UNLIKELY(CONDITION) (!!(CONDITION))
+#endif
+
+#if __has_feature(c_thread_safety_attributes)
+/* "clang" annotations for thread safety check.
+ *
+ * OVS_LOCKABLE indicates that the struct contains mutex element
+ * which can be locked by functions like ovs_mutex_lock().
+ *
+ * Below, the word MUTEX stands for the name of an object with an OVS_LOCKABLE
+ * struct type. It can also be a comma-separated list of multiple structs,
+ * e.g. to require a function to hold multiple locks while invoked.
+ *
+ *
+ * On a variable:
+ *
+ * - OVS_GUARDED indicates that the variable may only be accessed some mutex
+ * is held.
+ *
+ * - OVS_GUARDED_BY(MUTEX) indicates that the variable may only be accessed
+ * while the specific MUTEX is held.
+ *
+ *
+ * On a variable A of mutex type:
+ *
+ * - OVS_ACQ_BEFORE(B), where B is a mutex or a comma-separated list of
+ * mutexes, declare that if both A and B are acquired at the same time,
+ * then A must be acquired before B. That is, B nests inside A.
+ *
+ * - OVS_ACQ_AFTER(B) is the opposite of OVS_ACQ_BEFORE(B), that is, it
+ * declares that A nests inside B.
+ *
+ *
+ * On a function, the following attributes apply to mutexes:
+ *
+ * - OVS_ACQUIRES(MUTEX) indicate that the function must be called without
+ * holding MUTEX and that it returns holding MUTEX.
+ *
+ * - OVS_RELEASES(MUTEX) indicates that the function may only be called with
+ * MUTEX held and that it returns with MUTEX released. It can be used for
+ * all types of MUTEX.
+ *
+ * - OVS_TRY_LOCK(RETVAL, MUTEX) indicate that the function will try to
+ * acquire MUTEX. RETVAL is an integer or boolean value specifying the
+ * return value of a successful lock acquisition.
+ *
+ * - OVS_REQUIRES(MUTEX) indicate that the function may only be called with
+ * MUTEX held and that the function does not release MUTEX.
+ *
+ * - OVS_EXCLUDED(MUTEX) indicates that the function may only be called when
+ * MUTEX is not held.
+ *
+ *
+ * The following variants, with the same syntax, apply to reader-writer locks:
+ *
+ * mutex rwlock, for reading rwlock, for writing
+ * ------------------- ------------------- -------------------
+ * OVS_ACQUIRES OVS_ACQ_RDLOCK OVS_ACQ_WRLOCK
+ * OVS_RELEASES OVS_RELEASES OVS_RELEASES
+ * OVS_TRY_LOCK OVS_TRY_RDLOCK OVS_TRY_WRLOCK
+ * OVS_REQUIRES OVS_REQ_RDLOCK OVS_REQ_WRLOCK
+ * OVS_EXCLUDED OVS_EXCLUDED OVS_EXCLUDED
+ */
+#define OVS_LOCKABLE __attribute__((lockable))
+#define OVS_REQ_RDLOCK(...) __attribute__((shared_locks_required(__VA_ARGS__)))
+#define OVS_ACQ_RDLOCK(...) __attribute__((shared_lock_function(__VA_ARGS__)))
+#define OVS_REQ_WRLOCK(...) \
+ __attribute__((exclusive_locks_required(__VA_ARGS__)))
+#define OVS_ACQ_WRLOCK(...) \
+ __attribute__((exclusive_lock_function(__VA_ARGS__)))
+#define OVS_REQUIRES(...) \
+ __attribute__((exclusive_locks_required(__VA_ARGS__)))
+#define OVS_ACQUIRES(...) \
+ __attribute__((exclusive_lock_function(__VA_ARGS__)))
+#define OVS_TRY_WRLOCK(RETVAL, ...) \
+ __attribute__((exclusive_trylock_function(RETVAL, __VA_ARGS__)))
+#define OVS_TRY_RDLOCK(RETVAL, ...) \
+ __attribute__((shared_trylock_function(RETVAL, __VA_ARGS__)))
+#define OVS_TRY_LOCK(RETVAL, ...) \
+ __attribute__((exclusive_trylock_function(RETVAL, __VA_ARGS__)))
+#define OVS_GUARDED __attribute__((guarded_var))
+#define OVS_GUARDED_BY(...) __attribute__((guarded_by(__VA_ARGS__)))
+#define OVS_RELEASES(...) __attribute__((unlock_function(__VA_ARGS__)))
+#define OVS_EXCLUDED(...) __attribute__((locks_excluded(__VA_ARGS__)))
+#define OVS_ACQ_BEFORE(...) __attribute__((acquired_before(__VA_ARGS__)))
+#define OVS_ACQ_AFTER(...) __attribute__((acquired_after(__VA_ARGS__)))
+#define OVS_NO_THREAD_SAFETY_ANALYSIS \
+ __attribute__((no_thread_safety_analysis))
+#else /* not Clang */
+#define OVS_LOCKABLE
+#define OVS_REQ_RDLOCK(...)
+#define OVS_ACQ_RDLOCK(...)
+#define OVS_REQ_WRLOCK(...)
+#define OVS_ACQ_WRLOCK(...)
+#define OVS_REQUIRES(...)
+#define OVS_ACQUIRES(...)
+#define OVS_TRY_WRLOCK(...)
+#define OVS_TRY_RDLOCK(...)
+#define OVS_TRY_LOCK(...)
+#define OVS_GUARDED
+#define OVS_GUARDED_BY(...)
+#define OVS_EXCLUDED(...)
+#define OVS_RELEASES(...)
+#define OVS_ACQ_BEFORE(...)
+#define OVS_ACQ_AFTER(...)
+#define OVS_NO_THREAD_SAFETY_ANALYSIS
+#endif
+
+/* ISO C says that a C implementation may choose any integer type for an enum
+ * that is sufficient to hold all of its values. Common ABIs (such as the
+ * System V ABI used on i386 GNU/Linux) always use a full-sized "int", even
+ * when a smaller type would suffice.
+ *
+ * In GNU C, "enum __attribute__((packed)) name { ... }" defines 'name' as an
+ * enum compatible with a type that is no bigger than necessary. This is the
+ * intended use of OVS_PACKED_ENUM.
+ *
+ * OVS_PACKED_ENUM is intended for use only as a space optimization, since it
+ * only works with GCC. That means that it must not be used in wire protocols
+ * or otherwise exposed outside of a single process. */
+#if __GNUC__ && !__CHECKER__
+#define OVS_PACKED_ENUM __attribute__((__packed__))
+#define HAVE_PACKED_ENUM
+#else
+#define OVS_PACKED_ENUM
+#endif
+
+#ifndef _MSC_VER
+#define OVS_PACKED(DECL) DECL __attribute__((__packed__))
+#else
+#define OVS_PACKED(DECL) __pragma(pack(push, 1)) DECL __pragma(pack(pop))
+#endif
+
+/* For defining a structure whose instances should aligned on an N-byte
+ * boundary.
+ *
+ * e.g. The following:
+ * OVS_ALIGNED_STRUCT(64, mystruct) { ... };
+ * is equivalent to the following except that it specifies 64-byte alignment:
+ * struct mystruct { ... };
+ */
+#ifndef _MSC_VER
+#define OVS_ALIGNED_STRUCT(N, TAG) struct __attribute__((aligned(N))) TAG
+#else
+#define OVS_ALIGNED_STRUCT(N, TAG) __declspec(align(N)) struct TAG
+#endif
+
+#ifdef _MSC_VER
+#define CCALL __cdecl
+#pragma section(".CRT$XCU",read)
+#define OVS_CONSTRUCTOR(f) \
+ static void __cdecl f(void); \
+ __declspec(allocate(".CRT$XCU")) void (__cdecl*f##_)(void) = f; \
+ static void __cdecl f(void)
+#else
+#define OVS_CONSTRUCTOR(f) \
+ static void f(void) __attribute__((constructor)); \
+ static void f(void)
+#endif
+
+/* OVS_PREFETCH() can be used to instruct the CPU to fetch the cache
+ * line containing the given address to a CPU cache.
+ * OVS_PREFETCH_WRITE() should be used when the memory is going to be
+ * written to. Depending on the target CPU, this can generate the same
+ * instruction as OVS_PREFETCH(), or bring the data into the cache in an
+ * exclusive state. */
+#if __GNUC__
+#define OVS_PREFETCH(addr) __builtin_prefetch((addr))
+#define OVS_PREFETCH_WRITE(addr) __builtin_prefetch((addr), 1)
+#else
+#define OVS_PREFETCH(addr)
+#define OVS_PREFETCH_WRITE(addr)
+#endif
+
+#endif /* compiler.h */
*
* Returns NULL if successful, otherwise a malloc()'d string describing the
* error. The caller is responsible for freeing the returned string.*/
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
bundle_parse__(const char *s, char **save_ptr,
const char *fields, const char *basis, const char *algorithm,
const char *slave_type, const char *dst,
*
* Returns NULL if successful, otherwise a malloc()'d string describing the
* error. The caller is responsible for freeing the returned string. */
-char * WARN_UNUSED_RESULT
+char * OVS_WARN_UNUSED_RESULT
bundle_parse(const char *s, struct ofpbuf *ofpacts)
{
char *fields, *basis, *algorithm, *slave_type, *slave_delim;
*
* Returns NULL if successful, otherwise a malloc()'d string describing the
* error. The caller is responsible for freeing the returned string.*/
-char * WARN_UNUSED_RESULT
+char * OVS_WARN_UNUSED_RESULT
bundle_parse_load(const char *s, struct ofpbuf *ofpacts)
{
char *fields, *basis, *algorithm, *slave_type, *dst, *slave_delim;
void *aux);
enum ofperr bundle_check(const struct ofpact_bundle *, ofp_port_t max_ports,
const struct flow *);
-char *bundle_parse(const char *, struct ofpbuf *ofpacts) WARN_UNUSED_RESULT;
+char *bundle_parse(const char *, struct ofpbuf *ofpacts) OVS_WARN_UNUSED_RESULT;
char *bundle_parse_load(const char *, struct ofpbuf *ofpacts)
- WARN_UNUSED_RESULT;
+ OVS_WARN_UNUSED_RESULT;
void bundle_format(const struct ofpact_bundle *, struct ds *);
#endif /* bundle.h */
#define proctitle_set setproctitle
#else
void proctitle_set(const char *, ...)
- PRINTF_FORMAT(1, 2);
+ OVS_PRINTF_FORMAT(1, 2);
#endif
void proctitle_restore(void);
#ifndef COMPILER_H
#define COMPILER_H 1
-#ifndef __has_feature
- #define __has_feature(x) 0
-#endif
-#ifndef __has_extension
- #define __has_extension(x) 0
-#endif
+#include "openvswitch/compiler.h"
-/* 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 STRFTIME_FORMAT(FMT) __attribute__((__format__(__strftime__, FMT, 0)))
#define MALLOC_LIKE __attribute__((__malloc__))
#define ALWAYS_INLINE __attribute__((always_inline))
-#define WARN_UNUSED_RESULT __attribute__((__warn_unused_result__))
#define SENTINEL(N) __attribute__((sentinel(N)))
-#define OVS_LIKELY(CONDITION) __builtin_expect(!!(CONDITION), 1)
-#define OVS_UNLIKELY(CONDITION) __builtin_expect(!!(CONDITION), 0)
#else
-#define OVS_UNUSED
-#define PRINTF_FORMAT(FMT, ARG1)
-#define SCANF_FORMAT(FMT, ARG1)
#define STRFTIME_FORMAT(FMT)
#define MALLOC_LIKE
#define ALWAYS_INLINE
-#define WARN_UNUSED_RESULT
#define SENTINEL(N)
-#define OVS_LIKELY(CONDITION) (!!(CONDITION))
-#define OVS_UNLIKELY(CONDITION) (!!(CONDITION))
-#endif
-
-#if __has_feature(c_thread_safety_attributes)
-/* "clang" annotations for thread safety check.
- *
- * OVS_LOCKABLE indicates that the struct contains mutex element
- * which can be locked by functions like ovs_mutex_lock().
- *
- * Below, the word MUTEX stands for the name of an object with an OVS_LOCKABLE
- * struct type. It can also be a comma-separated list of multiple structs,
- * e.g. to require a function to hold multiple locks while invoked.
- *
- *
- * On a variable:
- *
- * - OVS_GUARDED indicates that the variable may only be accessed some mutex
- * is held.
- *
- * - OVS_GUARDED_BY(MUTEX) indicates that the variable may only be accessed
- * while the specific MUTEX is held.
- *
- *
- * On a variable A of mutex type:
- *
- * - OVS_ACQ_BEFORE(B), where B is a mutex or a comma-separated list of
- * mutexes, declare that if both A and B are acquired at the same time,
- * then A must be acquired before B. That is, B nests inside A.
- *
- * - OVS_ACQ_AFTER(B) is the opposite of OVS_ACQ_BEFORE(B), that is, it
- * declares that A nests inside B.
- *
- *
- * On a function, the following attributes apply to mutexes:
- *
- * - OVS_ACQUIRES(MUTEX) indicate that the function must be called without
- * holding MUTEX and that it returns holding MUTEX.
- *
- * - OVS_RELEASES(MUTEX) indicates that the function may only be called with
- * MUTEX held and that it returns with MUTEX released. It can be used for
- * all types of MUTEX.
- *
- * - OVS_TRY_LOCK(RETVAL, MUTEX) indicate that the function will try to
- * acquire MUTEX. RETVAL is an integer or boolean value specifying the
- * return value of a successful lock acquisition.
- *
- * - OVS_REQUIRES(MUTEX) indicate that the function may only be called with
- * MUTEX held and that the function does not release MUTEX.
- *
- * - OVS_EXCLUDED(MUTEX) indicates that the function may only be called when
- * MUTEX is not held.
- *
- *
- * The following variants, with the same syntax, apply to reader-writer locks:
- *
- * mutex rwlock, for reading rwlock, for writing
- * ------------------- ------------------- -------------------
- * OVS_ACQUIRES OVS_ACQ_RDLOCK OVS_ACQ_WRLOCK
- * OVS_RELEASES OVS_RELEASES OVS_RELEASES
- * OVS_TRY_LOCK OVS_TRY_RDLOCK OVS_TRY_WRLOCK
- * OVS_REQUIRES OVS_REQ_RDLOCK OVS_REQ_WRLOCK
- * OVS_EXCLUDED OVS_EXCLUDED OVS_EXCLUDED
- */
-#define OVS_LOCKABLE __attribute__((lockable))
-#define OVS_REQ_RDLOCK(...) __attribute__((shared_locks_required(__VA_ARGS__)))
-#define OVS_ACQ_RDLOCK(...) __attribute__((shared_lock_function(__VA_ARGS__)))
-#define OVS_REQ_WRLOCK(...) \
- __attribute__((exclusive_locks_required(__VA_ARGS__)))
-#define OVS_ACQ_WRLOCK(...) \
- __attribute__((exclusive_lock_function(__VA_ARGS__)))
-#define OVS_REQUIRES(...) \
- __attribute__((exclusive_locks_required(__VA_ARGS__)))
-#define OVS_ACQUIRES(...) \
- __attribute__((exclusive_lock_function(__VA_ARGS__)))
-#define OVS_TRY_WRLOCK(RETVAL, ...) \
- __attribute__((exclusive_trylock_function(RETVAL, __VA_ARGS__)))
-#define OVS_TRY_RDLOCK(RETVAL, ...) \
- __attribute__((shared_trylock_function(RETVAL, __VA_ARGS__)))
-#define OVS_TRY_LOCK(RETVAL, ...) \
- __attribute__((exclusive_trylock_function(RETVAL, __VA_ARGS__)))
-#define OVS_GUARDED __attribute__((guarded_var))
-#define OVS_GUARDED_BY(...) __attribute__((guarded_by(__VA_ARGS__)))
-#define OVS_RELEASES(...) __attribute__((unlock_function(__VA_ARGS__)))
-#define OVS_EXCLUDED(...) __attribute__((locks_excluded(__VA_ARGS__)))
-#define OVS_ACQ_BEFORE(...) __attribute__((acquired_before(__VA_ARGS__)))
-#define OVS_ACQ_AFTER(...) __attribute__((acquired_after(__VA_ARGS__)))
-#define OVS_NO_THREAD_SAFETY_ANALYSIS \
- __attribute__((no_thread_safety_analysis))
-#else /* not Clang */
-#define OVS_LOCKABLE
-#define OVS_REQ_RDLOCK(...)
-#define OVS_ACQ_RDLOCK(...)
-#define OVS_REQ_WRLOCK(...)
-#define OVS_ACQ_WRLOCK(...)
-#define OVS_REQUIRES(...)
-#define OVS_ACQUIRES(...)
-#define OVS_TRY_WRLOCK(...)
-#define OVS_TRY_RDLOCK(...)
-#define OVS_TRY_LOCK(...)
-#define OVS_GUARDED
-#define OVS_GUARDED_BY(...)
-#define OVS_EXCLUDED(...)
-#define OVS_RELEASES(...)
-#define OVS_ACQ_BEFORE(...)
-#define OVS_ACQ_AFTER(...)
-#define OVS_NO_THREAD_SAFETY_ANALYSIS
-#endif
-
-/* ISO C says that a C implementation may choose any integer type for an enum
- * that is sufficient to hold all of its values. Common ABIs (such as the
- * System V ABI used on i386 GNU/Linux) always use a full-sized "int", even
- * when a smaller type would suffice.
- *
- * In GNU C, "enum __attribute__((packed)) name { ... }" defines 'name' as an
- * enum compatible with a type that is no bigger than necessary. This is the
- * intended use of OVS_PACKED_ENUM.
- *
- * OVS_PACKED_ENUM is intended for use only as a space optimization, since it
- * only works with GCC. That means that it must not be used in wire protocols
- * or otherwise exposed outside of a single process. */
-#if __GNUC__ && !__CHECKER__
-#define OVS_PACKED_ENUM __attribute__((__packed__))
-#define HAVE_PACKED_ENUM
-#else
-#define OVS_PACKED_ENUM
-#endif
-
-#ifndef _MSC_VER
-#define OVS_PACKED(DECL) DECL __attribute__((__packed__))
-#else
-#define OVS_PACKED(DECL) __pragma(pack(push, 1)) DECL __pragma(pack(pop))
-#endif
-
-/* For defining a structure whose instances should aligned on an N-byte
- * boundary.
- *
- * e.g. The following:
- * OVS_ALIGNED_STRUCT(64, mystruct) { ... };
- * is equivalent to the following except that it specifies 64-byte alignment:
- * struct mystruct { ... };
- */
-#ifndef _MSC_VER
-#define OVS_ALIGNED_STRUCT(N, TAG) struct __attribute__((aligned(N))) TAG
-#else
-#define OVS_ALIGNED_STRUCT(N, TAG) __declspec(align(N)) struct TAG
-#endif
-
-#ifdef _MSC_VER
-#define CCALL __cdecl
-#pragma section(".CRT$XCU",read)
-#define OVS_CONSTRUCTOR(f) \
- static void __cdecl f(void); \
- __declspec(allocate(".CRT$XCU")) void (__cdecl*f##_)(void) = f; \
- static void __cdecl f(void)
-#else
-#define OVS_CONSTRUCTOR(f) \
- static void f(void) __attribute__((constructor)); \
- static void f(void)
-#endif
-
-/* OVS_PREFETCH() can be used to instruct the CPU to fetch the cache
- * line containing the given address to a CPU cache.
- * OVS_PREFETCH_WRITE() should be used when the memory is going to be
- * written to. Depending on the target CPU, this can generate the same
- * instruction as OVS_PREFETCH(), or bring the data into the cache in an
- * exclusive state. */
-#if __GNUC__
-#define OVS_PREFETCH(addr) __builtin_prefetch((addr))
-#define OVS_PREFETCH_WRITE(addr) __builtin_prefetch((addr), 1)
-#else
-#define OVS_PREFETCH(addr)
-#define OVS_PREFETCH_WRITE(addr)
#endif
/* Output a message (not an error) while compiling without failing the
void ds_put_buffer(struct ds *, const char *, size_t n);
void ds_put_cstr(struct ds *, const char *);
void ds_put_and_free_cstr(struct ds *, char *);
-void ds_put_format(struct ds *, const char *, ...) PRINTF_FORMAT(2, 3);
+void ds_put_format(struct ds *, const char *, ...) OVS_PRINTF_FORMAT(2, 3);
void ds_put_format_valist(struct ds *, const char *, va_list)
- PRINTF_FORMAT(2, 0);
+ OVS_PRINTF_FORMAT(2, 0);
void ds_put_printable(struct ds *, const char *, size_t);
void ds_put_hex_dump(struct ds *ds, const void *buf_, size_t size,
uintptr_t ofs, bool ascii);
static void json_parser_input(struct json_parser *, struct json_token *);
static void json_error(struct json_parser *p, const char *format, ...)
- PRINTF_FORMAT(2, 3);
+ OVS_PRINTF_FORMAT(2, 3);
\f
const char *
json_type_to_string(enum json_type type)
/* Returns NULL if successful, otherwise a malloc()'d string describing the
* error. The caller is responsible for freeing the returned string. */
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
learn_parse_load_immediate(const char *s, struct ofpact_learn_spec *spec)
{
const char *full_s = s;
/* Returns NULL if successful, otherwise a malloc()'d string describing the
* error. The caller is responsible for freeing the returned string. */
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
learn_parse_spec(const char *orig, char *name, char *value,
struct ofpact_learn_spec *spec)
{
/* Returns NULL if successful, otherwise a malloc()'d string describing the
* error. The caller is responsible for freeing the returned string. */
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
learn_parse__(char *orig, char *arg, struct ofpbuf *ofpacts)
{
struct ofpact_learn *learn;
* the action's arguments.
*
* Modifies 'arg'. */
-char * WARN_UNUSED_RESULT
+char * OVS_WARN_UNUSED_RESULT
learn_parse(char *arg, struct ofpbuf *ofpacts)
{
char *orig = xstrdup(arg);
struct ofputil_flow_mod *, struct ofpbuf *ofpacts);
void learn_mask(const struct ofpact_learn *, struct flow_wildcards *);
-char *learn_parse(char *, struct ofpbuf *ofpacts) WARN_UNUSED_RESULT;
+char *learn_parse(char *, struct ofpbuf *ofpacts) OVS_WARN_UNUSED_RESULT;
void learn_format(const struct ofpact_learn *, struct ds *);
#endif /* learn.h */
*
* Returns NULL if successful, otherwise a malloc()'d string describing the
* error. The caller is responsible for freeing the returned string.*/
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
multipath_parse__(struct ofpact_multipath *mp, const char *s_, char *s)
{
char *save_ptr = NULL;
*
* Returns NULL if successful, otherwise a malloc()'d string describing the
* error. The caller is responsible for freeing the returned string. */
-char * WARN_UNUSED_RESULT
+char * OVS_WARN_UNUSED_RESULT
multipath_parse(struct ofpact_multipath *mp, const char *s_)
{
char *s = xstrdup(s_);
struct flow_wildcards *);
char *multipath_parse(struct ofpact_multipath *, const char *)
- WARN_UNUSED_RESULT;
+ OVS_WARN_UNUSED_RESULT;
void multipath_format(const struct ofpact_multipath *, struct ds *);
#endif /* multipath.h */
*
* Returns NULL if successful, otherwise a malloc()'d string describing the
* error. The caller is responsible for freeing the returned string. */
-char * WARN_UNUSED_RESULT
+char * OVS_WARN_UNUSED_RESULT
nxm_parse_reg_move(struct ofpact_reg_move *move, const char *s)
{
const char *full_s = s;
*
* Returns NULL if successful, otherwise a malloc()'d string describing the
* error. The caller is responsible for freeing the returned string. */
-char * WARN_UNUSED_RESULT
+char * OVS_WARN_UNUSED_RESULT
nxm_parse_stack_action(struct ofpact_stack *stack_action, const char *s)
{
char *error;
* bit indexes. "..end" may be omitted to indicate a single bit. "start..end"
* may both be omitted (the [] are still required) to indicate an entire
* field. */
-char * WARN_UNUSED_RESULT
+char * OVS_WARN_UNUSED_RESULT
mf_parse_subfield__(struct mf_subfield *sf, const char **sp)
{
const struct mf_field *field;
* bit indexes. "..end" may be omitted to indicate a single bit. "start..end"
* may both be omitted (the [] are still required) to indicate an entire
* field. */
-char * WARN_UNUSED_RESULT
+char * OVS_WARN_UNUSED_RESULT
mf_parse_subfield(struct mf_subfield *sf, const char *s)
{
char *error = mf_parse_subfield__(sf, &s);
void mf_format_subfield(const struct mf_subfield *, struct ds *);
char *mf_parse_subfield__(struct mf_subfield *sf, const char **s)
- WARN_UNUSED_RESULT;
+ OVS_WARN_UNUSED_RESULT;
char *mf_parse_subfield(struct mf_subfield *, const char *s)
- WARN_UNUSED_RESULT;
+ OVS_WARN_UNUSED_RESULT;
enum ofperr nx_pull_match(struct ofpbuf *, unsigned int match_len,
struct match *,
void nx_format_field_name(enum mf_field_id, enum ofp_version, struct ds *);
char *nxm_parse_reg_move(struct ofpact_reg_move *, const char *)
- WARN_UNUSED_RESULT;
+ OVS_WARN_UNUSED_RESULT;
void nxm_format_reg_move(const struct ofpact_reg_move *, struct ds *);
struct flow *, struct flow_wildcards *);
char *nxm_parse_stack_action(struct ofpact_stack *, const char *)
- WARN_UNUSED_RESULT;
+ OVS_WARN_UNUSED_RESULT;
void nxm_format_stack_push(const struct ofpact_stack *, struct ds *);
void nxm_format_stack_pop(const struct ofpact_stack *, struct ds *);
static void *ofpact_put_raw(struct ofpbuf *, enum ofp_version,
enum ofp_raw_action_type, uint64_t arg);
-static char *WARN_UNUSED_RESULT ofpacts_parse(
+static char *OVS_WARN_UNUSED_RESULT ofpacts_parse(
char *str, struct ofpbuf *ofpacts, enum ofputil_protocol *usable_protocols,
bool allow_instructions);
}
}
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_OUTPUT(const char *arg, struct ofpbuf *ofpacts,
enum ofputil_protocol *usable_protocols OVS_UNUSED)
{
}
}
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_GROUP(char *arg, struct ofpbuf *ofpacts,
enum ofputil_protocol *usable_protocols OVS_UNUSED)
{
nac->reason = controller->reason;
}
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_CONTROLLER(char *arg, struct ofpbuf *ofpacts,
enum ofputil_protocol *usable_protocols OVS_UNUSED)
{
}
}
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_ENQUEUE(char *arg, struct ofpbuf *ofpacts,
enum ofputil_protocol *usable_protocols OVS_UNUSED)
{
}
}
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_OUTPUT_REG(const char *arg, struct ofpbuf *ofpacts,
enum ofputil_protocol *usable_protocols OVS_UNUSED)
{
}
}
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_BUNDLE(const char *arg, struct ofpbuf *ofpacts,
enum ofputil_protocol *usable_protocols OVS_UNUSED)
{
return bundle_parse(arg, ofpacts);
}
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_bundle_load(const char *arg, struct ofpbuf *ofpacts)
{
return bundle_parse_load(arg, ofpacts);
}
}
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_set_vlan_vid(char *arg, struct ofpbuf *ofpacts, bool push_vlan_if_needed)
{
struct ofpact_vlan_vid *vlan_vid;
return NULL;
}
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_SET_VLAN_VID(char *arg, struct ofpbuf *ofpacts,
enum ofputil_protocol *usable_protocols OVS_UNUSED)
{
}
}
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_set_vlan_pcp(char *arg, struct ofpbuf *ofpacts, bool push_vlan_if_needed)
{
struct ofpact_vlan_pcp *vlan_pcp;
return NULL;
}
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_SET_VLAN_PCP(char *arg, struct ofpbuf *ofpacts,
enum ofputil_protocol *usable_protocols OVS_UNUSED)
{
}
}
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_STRIP_VLAN(char *arg OVS_UNUSED, struct ofpbuf *ofpacts,
enum ofputil_protocol *usable_protocols OVS_UNUSED)
{
return NULL;
}
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_pop_vlan(struct ofpbuf *ofpacts)
{
ofpact_put_STRIP_VLAN(ofpacts)->ofpact.raw = OFPAT_RAW11_POP_VLAN;
}
}
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_PUSH_VLAN(char *arg, struct ofpbuf *ofpacts,
enum ofputil_protocol *usable_protocols OVS_UNUSED)
{
}
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_SET_ETH_SRC(char *arg, struct ofpbuf *ofpacts,
enum ofputil_protocol *usable_protocols OVS_UNUSED)
{
return str_to_mac(arg, ofpact_put_SET_ETH_SRC(ofpacts)->mac);
}
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_SET_ETH_DST(char *arg, struct ofpbuf *ofpacts,
enum ofputil_protocol *usable_protocols OVS_UNUSED)
{
out);
}
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_SET_IPV4_SRC(char *arg, struct ofpbuf *ofpacts,
enum ofputil_protocol *usable_protocols OVS_UNUSED)
{
return str_to_ip(arg, &ofpact_put_SET_IPV4_SRC(ofpacts)->ipv4);
}
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_SET_IPV4_DST(char *arg, struct ofpbuf *ofpacts,
enum ofputil_protocol *usable_protocols OVS_UNUSED)
{
}
}
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_SET_IP_DSCP(char *arg, struct ofpbuf *ofpacts,
enum ofputil_protocol *usable_protocols OVS_UNUSED)
{
}
}
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_SET_IP_ECN(char *arg, struct ofpbuf *ofpacts,
enum ofputil_protocol *usable_protocols OVS_UNUSED)
{
}
}
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_SET_IP_TTL(char *arg, struct ofpbuf *ofpacts,
enum ofputil_protocol *usable_protocols OVS_UNUSED)
{
encode_SET_L4_port(l4_port, ofp_version, OFPAT_RAW_SET_TP_DST, field, out);
}
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_SET_L4_SRC_PORT(char *arg, struct ofpbuf *ofpacts,
enum ofputil_protocol *usable_protocols OVS_UNUSED)
{
&ofpact_put_SET_L4_SRC_PORT(ofpacts)->port);
}
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_SET_L4_DST_PORT(char *arg, struct ofpbuf *ofpacts,
enum ofputil_protocol *usable_protocols OVS_UNUSED)
{
pad_ofpat(out, start_ofs);
}
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_REG_MOVE(const char *arg, struct ofpbuf *ofpacts,
enum ofputil_protocol *usable_protocols OVS_UNUSED)
{
*
* Returns NULL if successful, otherwise a malloc()'d string describing the
* error. The caller is responsible for freeing the returned string. */
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
set_field_parse__(char *arg, struct ofpbuf *ofpacts,
enum ofputil_protocol *usable_protocols)
{
*
* Returns NULL if successful, otherwise a malloc()'d string describing the
* error. The caller is responsible for freeing the returned string. */
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_SET_FIELD(const char *arg, struct ofpbuf *ofpacts,
enum ofputil_protocol *usable_protocols)
{
return error;
}
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_reg_load(char *arg, struct ofpbuf *ofpacts)
{
struct ofpact_set_field *sf = ofpact_put_reg_load(ofpacts);
encode_STACK_op(stack, put_NXAST_STACK_POP(out));
}
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_STACK_PUSH(char *arg, struct ofpbuf *ofpacts,
enum ofputil_protocol *usable_protocols OVS_UNUSED)
{
return nxm_parse_stack_action(ofpact_put_STACK_PUSH(ofpacts), arg);
}
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_STACK_POP(char *arg, struct ofpbuf *ofpacts,
enum ofputil_protocol *usable_protocols OVS_UNUSED)
{
ofpact_update_len(ofpacts, &ids->ofpact);
}
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_DEC_TTL(char *arg, struct ofpbuf *ofpacts,
enum ofputil_protocol *usable_protocols OVS_UNUSED)
{
}
}
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_SET_MPLS_LABEL(char *arg, struct ofpbuf *ofpacts,
enum ofputil_protocol *usable_protocols OVS_UNUSED)
{
}
}
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_SET_MPLS_TC(char *arg, struct ofpbuf *ofpacts,
enum ofputil_protocol *usable_protocols OVS_UNUSED)
{
*
* Returns NULL if successful, otherwise a malloc()'d string describing the
* error. The caller is responsible for freeing the returned string. */
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_SET_MPLS_TTL(char *arg, struct ofpbuf *ofpacts,
enum ofputil_protocol *usable_protocols OVS_UNUSED)
{
put_OFPAT_DEC_MPLS_TTL(out, ofp_version);
}
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_DEC_MPLS_TTL(char *arg OVS_UNUSED, struct ofpbuf *ofpacts,
enum ofputil_protocol *usable_protocols OVS_UNUSED)
{
put_OFPAT_PUSH_MPLS(out, ofp_version, push_mpls->ethertype);
}
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_PUSH_MPLS(char *arg, struct ofpbuf *ofpacts,
enum ofputil_protocol *usable_protocols OVS_UNUSED)
{
put_OFPAT_POP_MPLS(out, ofp_version, pop_mpls->ethertype);
}
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_POP_MPLS(char *arg, struct ofpbuf *ofpacts,
enum ofputil_protocol *usable_protocols OVS_UNUSED)
{
}
}
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_set_tunnel(char *arg, struct ofpbuf *ofpacts,
enum ofp_raw_action_type raw)
{
return str_to_u64(arg, &tunnel->tun_id);
}
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_SET_TUNNEL(char *arg, struct ofpbuf *ofpacts,
enum ofputil_protocol *usable_protocols OVS_UNUSED)
{
put_OFPAT_SET_QUEUE(out, ofp_version, queue->queue_id);
}
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_SET_QUEUE(char *arg, struct ofpbuf *ofpacts,
enum ofputil_protocol *usable_protocols OVS_UNUSED)
{
put_NXAST_POP_QUEUE(out);
}
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_POP_QUEUE(const char *arg OVS_UNUSED, struct ofpbuf *ofpacts,
enum ofputil_protocol *usable_protocols OVS_UNUSED)
{
naft->fin_hard_timeout = htons(fin_timeout->fin_hard_timeout);
}
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_FIN_TIMEOUT(char *arg, struct ofpbuf *ofpacts,
enum ofputil_protocol *usable_protocols OVS_UNUSED)
{
}
}
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_RESUBMIT(char *arg, struct ofpbuf *ofpacts,
enum ofputil_protocol *usable_protocols OVS_UNUSED)
{
pad_ofpat(out, start_ofs);
}
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_LEARN(char *arg, struct ofpbuf *ofpacts,
enum ofputil_protocol *usable_protocols OVS_UNUSED)
{
nam->dst = htonl(mf_nxm_header(mp->dst.field->id));
}
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_MULTIPATH(const char *arg, struct ofpbuf *ofpacts,
enum ofputil_protocol *usable_protocols OVS_UNUSED)
{
nan->len = htons(ofpbuf_size(out) - start_ofs);
}
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_NOTE(const char *arg, struct ofpbuf *ofpacts,
enum ofputil_protocol *usable_protocols OVS_UNUSED)
{
put_NXAST_EXIT(out);
}
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_EXIT(char *arg OVS_UNUSED, struct ofpbuf *ofpacts,
enum ofputil_protocol *usable_protocols OVS_UNUSED)
{
*
* Returns NULL if successful, otherwise a malloc()'d string describing the
* error. The caller is responsible for freeing the returned string. */
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_SAMPLE(char *arg, struct ofpbuf *ofpacts,
enum ofputil_protocol *usable_protocols OVS_UNUSED)
{
}
}
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_METER(char *arg, struct ofpbuf *ofpacts,
enum ofputil_protocol *usable_protocols)
{
}
}
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_CLEAR_ACTIONS(char *arg OVS_UNUSED, struct ofpbuf *ofpacts,
enum ofputil_protocol *usable_protocols OVS_UNUSED)
{
}
}
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_WRITE_ACTIONS(char *arg, struct ofpbuf *ofpacts,
enum ofputil_protocol *usable_protocols)
{
}
}
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_WRITE_METADATA(char *arg, struct ofpbuf *ofpacts,
enum ofputil_protocol *usable_protocols)
{
}
}
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_GOTO_TABLE(char *arg, struct ofpbuf *ofpacts,
enum ofputil_protocol *usable_protocols OVS_UNUSED)
{
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
ofpact_parse(enum ofpact_type type, char *value, struct ofpbuf *ofpacts,
enum ofputil_protocol *usable_protocols)
{
*
* Returns NULL if successful, otherwise a malloc()'d string describing the
* error. The caller is responsible for freeing the returned string. */
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
ofpacts_parse__(char *str, struct ofpbuf *ofpacts,
enum ofputil_protocol *usable_protocols,
bool allow_instructions)
return NULL;
}
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
ofpacts_parse(char *str, struct ofpbuf *ofpacts,
enum ofputil_protocol *usable_protocols, bool allow_instructions)
{
return error;
}
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
ofpacts_parse_copy(const char *s_, struct ofpbuf *ofpacts,
enum ofputil_protocol *usable_protocols,
bool allow_instructions)
*
* Returns NULL if successful, otherwise a malloc()'d string describing the
* error. The caller is responsible for freeing the returned string. */
-char * WARN_UNUSED_RESULT
+char * OVS_WARN_UNUSED_RESULT
ofpacts_parse_actions(const char *s, struct ofpbuf *ofpacts,
enum ofputil_protocol *usable_protocols)
{
*
* Returns NULL if successful, otherwise a malloc()'d string describing the
* error. The caller is responsible for freeing the returned string. */
-char * WARN_UNUSED_RESULT
+char * OVS_WARN_UNUSED_RESULT
ofpacts_parse_instructions(const char *s, struct ofpbuf *ofpacts,
enum ofputil_protocol *usable_protocols)
{
void ofpacts_format(const struct ofpact[], size_t ofpacts_len, struct ds *);
char *ofpacts_parse_actions(const char *, struct ofpbuf *ofpacts,
enum ofputil_protocol *usable_protocols)
- WARN_UNUSED_RESULT;
+ OVS_WARN_UNUSED_RESULT;
char *ofpacts_parse_instructions(const char *, struct ofpbuf *ofpacts,
enum ofputil_protocol *usable_protocols)
- WARN_UNUSED_RESULT;
+ OVS_WARN_UNUSED_RESULT;
const char *ofpact_name(enum ofpact_type);
/* Internal use by the helpers below. */
*
* Returns NULL if successful, otherwise a malloc()'d string describing the
* error. The caller is responsible for freeing the returned string. */
-char * WARN_UNUSED_RESULT
+char * OVS_WARN_UNUSED_RESULT
str_to_u8(const char *str, const char *name, uint8_t *valuep)
{
int value;
*
* Returns NULL if successful, otherwise a malloc()'d string describing the
* error. The caller is responsible for freeing the returned string. */
-char * WARN_UNUSED_RESULT
+char * OVS_WARN_UNUSED_RESULT
str_to_u16(const char *str, const char *name, uint16_t *valuep)
{
int value;
*
* Returns NULL if successful, otherwise a malloc()'d string describing the
* error. The caller is responsible for freeing the returned string. */
-char * WARN_UNUSED_RESULT
+char * OVS_WARN_UNUSED_RESULT
str_to_u32(const char *str, uint32_t *valuep)
{
char *tail;
*
* Returns NULL if successful, otherwise a malloc()'d string describing the
* error. The caller is responsible for freeing the returned string. */
-char * WARN_UNUSED_RESULT
+char * OVS_WARN_UNUSED_RESULT
str_to_u64(const char *str, uint64_t *valuep)
{
char *tail;
*
* Returns NULL if successful, otherwise a malloc()'d string describing the
* error. The caller is responsible for freeing the returned string. */
-char * WARN_UNUSED_RESULT
+char * OVS_WARN_UNUSED_RESULT
str_to_be64(const char *str, ovs_be64 *valuep)
{
uint64_t value = 0;
*
* Returns NULL if successful, otherwise a malloc()'d string describing the
* error. The caller is responsible for freeing the returned string. */
-char * WARN_UNUSED_RESULT
+char * OVS_WARN_UNUSED_RESULT
str_to_mac(const char *str, uint8_t mac[ETH_ADDR_LEN])
{
if (!ovs_scan(str, ETH_ADDR_SCAN_FMT, ETH_ADDR_SCAN_ARGS(mac))) {
*
* Returns NULL if successful, otherwise a malloc()'d string describing the
* error. The caller is responsible for freeing the returned string. */
-char * WARN_UNUSED_RESULT
+char * OVS_WARN_UNUSED_RESULT
str_to_ip(const char *str, ovs_be32 *ip)
{
struct in_addr in_addr;
*
* Returns NULL if successful, otherwise a malloc()'d string describing the
* error. The caller is responsible for freeing the returned string. */
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_field(const struct mf_field *mf, const char *s, struct match *match,
enum ofputil_protocol *usable_protocols)
{
}
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_ofp_str__(struct ofputil_flow_mod *fm, int command, char *string,
enum ofputil_protocol *usable_protocols)
{
*
* Returns NULL if successful, otherwise a malloc()'d string describing the
* error. The caller is responsible for freeing the returned string. */
-char * WARN_UNUSED_RESULT
+char * OVS_WARN_UNUSED_RESULT
parse_ofp_str(struct ofputil_flow_mod *fm, int command, const char *str_,
enum ofputil_protocol *usable_protocols)
{
return error;
}
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_ofp_meter_mod_str__(struct ofputil_meter_mod *mm, char *string,
struct ofpbuf *bands, int command,
enum ofputil_protocol *usable_protocols)
*
* Returns NULL if successful, otherwise a malloc()'d string describing the
* error. The caller is responsible for freeing the returned string. */
-char * WARN_UNUSED_RESULT
+char * OVS_WARN_UNUSED_RESULT
parse_ofp_meter_mod_str(struct ofputil_meter_mod *mm, const char *str_,
int command, enum ofputil_protocol *usable_protocols)
{
return error;
}
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_flow_monitor_request__(struct ofputil_flow_monitor_request *fmr,
const char *str_, char *string,
enum ofputil_protocol *usable_protocols)
*
* Returns NULL if successful, otherwise a malloc()'d string describing the
* error. The caller is responsible for freeing the returned string. */
-char * WARN_UNUSED_RESULT
+char * OVS_WARN_UNUSED_RESULT
parse_flow_monitor_request(struct ofputil_flow_monitor_request *fmr,
const char *str_,
enum ofputil_protocol *usable_protocols)
*
* Returns NULL if successful, otherwise a malloc()'d string describing the
* error. The caller is responsible for freeing the returned string. */
-char * WARN_UNUSED_RESULT
+char * OVS_WARN_UNUSED_RESULT
parse_ofp_flow_mod_str(struct ofputil_flow_mod *fm, const char *string,
uint16_t command,
enum ofputil_protocol *usable_protocols)
*
* Returns NULL if successful, otherwise a malloc()'d string describing the
* error. The caller is responsible for freeing the returned string. */
-char * WARN_UNUSED_RESULT
+char * OVS_WARN_UNUSED_RESULT
parse_ofp_table_mod(struct ofputil_table_mod *tm, const char *table_id,
const char *flow_miss_handling,
enum ofputil_protocol *usable_protocols)
*
* Returns NULL if successful, otherwise a malloc()'d string describing the
* error. The caller is responsible for freeing the returned string. */
-char * WARN_UNUSED_RESULT
+char * OVS_WARN_UNUSED_RESULT
parse_ofp_flow_mod_file(const char *file_name, uint16_t command,
struct ofputil_flow_mod **fms, size_t *n_fms,
enum ofputil_protocol *usable_protocols)
return NULL;
}
-char * WARN_UNUSED_RESULT
+char * OVS_WARN_UNUSED_RESULT
parse_ofp_flow_stats_request_str(struct ofputil_flow_stats_request *fsr,
bool aggregate, const char *string,
enum ofputil_protocol *usable_protocols)
return error;
}
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_bucket_str(struct ofputil_bucket *bucket, char *str_,
enum ofputil_protocol *usable_protocols)
{
return NULL;
}
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_ofp_group_mod_str__(struct ofputil_group_mod *gm, uint16_t command,
char *string,
enum ofputil_protocol *usable_protocols)
return error;
}
-char * WARN_UNUSED_RESULT
+char * OVS_WARN_UNUSED_RESULT
parse_ofp_group_mod_str(struct ofputil_group_mod *gm, uint16_t command,
const char *str_,
enum ofputil_protocol *usable_protocols)
return error;
}
-char * WARN_UNUSED_RESULT
+char * OVS_WARN_UNUSED_RESULT
parse_ofp_group_mod_file(const char *file_name, uint16_t command,
struct ofputil_group_mod **gms, size_t *n_gms,
enum ofputil_protocol *usable_protocols)
char *parse_ofp_str(struct ofputil_flow_mod *, int command, const char *str_,
enum ofputil_protocol *usable_protocols)
- WARN_UNUSED_RESULT;
+ OVS_WARN_UNUSED_RESULT;
char *parse_ofp_flow_mod_str(struct ofputil_flow_mod *, const char *string,
uint16_t command,
enum ofputil_protocol *usable_protocols)
- WARN_UNUSED_RESULT;
+ OVS_WARN_UNUSED_RESULT;
char *parse_ofp_table_mod(struct ofputil_table_mod *,
const char *table_id, const char *flow_miss_handling,
enum ofputil_protocol *usable_protocols)
- WARN_UNUSED_RESULT;
+ OVS_WARN_UNUSED_RESULT;
char *parse_ofp_flow_mod_file(const char *file_name, uint16_t command,
struct ofputil_flow_mod **fms, size_t *n_fms,
enum ofputil_protocol *usable_protocols)
- WARN_UNUSED_RESULT;
+ OVS_WARN_UNUSED_RESULT;
char *parse_ofp_flow_stats_request_str(struct ofputil_flow_stats_request *,
bool aggregate, const char *string,
enum ofputil_protocol *usable_protocols)
- WARN_UNUSED_RESULT;
+ OVS_WARN_UNUSED_RESULT;
char *parse_ofp_exact_flow(struct flow *flow, struct flow *mask, const char *s,
const struct simap *portno_names);
char *parse_ofp_meter_mod_str(struct ofputil_meter_mod *, const char *string,
int command,
enum ofputil_protocol *usable_protocols)
- WARN_UNUSED_RESULT;
+ OVS_WARN_UNUSED_RESULT;
char *parse_flow_monitor_request(struct ofputil_flow_monitor_request *,
const char *,
enum ofputil_protocol *usable_protocols)
- WARN_UNUSED_RESULT;
+ OVS_WARN_UNUSED_RESULT;
char *parse_ofp_group_mod_file(const char *file_name, uint16_t command,
struct ofputil_group_mod **gms, size_t *n_gms,
enum ofputil_protocol *usable_protocols)
- WARN_UNUSED_RESULT;
+ OVS_WARN_UNUSED_RESULT;
char *parse_ofp_group_mod_str(struct ofputil_group_mod *, uint16_t command,
const char *string,
enum ofputil_protocol *usable_protocols)
- WARN_UNUSED_RESULT;
+ OVS_WARN_UNUSED_RESULT;
char *str_to_u8(const char *str, const char *name, uint8_t *valuep)
- WARN_UNUSED_RESULT;
+ OVS_WARN_UNUSED_RESULT;
char *str_to_u16(const char *str, const char *name, uint16_t *valuep)
- WARN_UNUSED_RESULT;
-char *str_to_u32(const char *str, uint32_t *valuep) WARN_UNUSED_RESULT;
-char *str_to_u64(const char *str, uint64_t *valuep) WARN_UNUSED_RESULT;
-char *str_to_be64(const char *str, ovs_be64 *valuep) WARN_UNUSED_RESULT;
-char *str_to_mac(const char *str, uint8_t mac[ETH_ADDR_LEN]) WARN_UNUSED_RESULT;
-char *str_to_ip(const char *str, ovs_be32 *ip) WARN_UNUSED_RESULT;
+ OVS_WARN_UNUSED_RESULT;
+char *str_to_u32(const char *str, uint32_t *valuep) OVS_WARN_UNUSED_RESULT;
+char *str_to_u64(const char *str, uint64_t *valuep) OVS_WARN_UNUSED_RESULT;
+char *str_to_be64(const char *str, ovs_be64 *valuep) OVS_WARN_UNUSED_RESULT;
+char *str_to_mac(const char *str, uint8_t mac[ETH_ADDR_LEN]) OVS_WARN_UNUSED_RESULT;
+char *str_to_ip(const char *str, ovs_be32 *ip) OVS_WARN_UNUSED_RESULT;
#endif /* ofp-parse.h */
static void print_wild(struct ds *string, const char *leader, int is_wild,
int verbosity, const char *format, ...)
- PRINTF_FORMAT(5, 6);
+ OVS_PRINTF_FORMAT(5, 6);
static void print_wild(struct ds *string, const char *leader, int is_wild,
int verbosity, const char *format, ...)
return ofputil_pull_property__(msg, property, 8, typep);
}
-static void PRINTF_FORMAT(2, 3)
+static void OVS_PRINTF_FORMAT(2, 3)
log_property(bool loose, const char *message, ...)
{
enum vlog_level level = loose ? VLL_DBG : VLL_WARN;
}
}
-static struct ovsdb_error * WARN_UNUSED_RESULT
+static struct ovsdb_error * OVS_WARN_UNUSED_RESULT
ovsdb_atom_parse_uuid(struct uuid *uuid, const struct json *json,
struct ovsdb_symbol_table *symtab,
const struct ovsdb_base_type *base)
return error0;
}
-static struct ovsdb_error * WARN_UNUSED_RESULT
+static struct ovsdb_error * OVS_WARN_UNUSED_RESULT
ovsdb_atom_from_json__(union ovsdb_atom *atom,
const struct ovsdb_base_type *base,
const struct json *json,
const struct ovsdb_base_type *,
const struct json *,
struct ovsdb_symbol_table *)
- WARN_UNUSED_RESULT;
+ OVS_WARN_UNUSED_RESULT;
struct json *ovsdb_atom_to_json(const union ovsdb_atom *,
enum ovsdb_atomic_type);
char *ovsdb_atom_from_string(union ovsdb_atom *,
const struct ovsdb_base_type *, const char *,
struct ovsdb_symbol_table *)
- WARN_UNUSED_RESULT;
+ OVS_WARN_UNUSED_RESULT;
void ovsdb_atom_to_string(const union ovsdb_atom *, enum ovsdb_atomic_type,
struct ds *);
void ovsdb_atom_to_bare(const union ovsdb_atom *, enum ovsdb_atomic_type,
struct ovsdb_error *ovsdb_atom_check_constraints(
const union ovsdb_atom *, const struct ovsdb_base_type *)
- WARN_UNUSED_RESULT;
+ OVS_WARN_UNUSED_RESULT;
\f
/* An instance of an OVSDB type (given by struct ovsdb_type).
*
/* Checking and maintaining invariants. */
struct ovsdb_error *ovsdb_datum_sort(struct ovsdb_datum *,
enum ovsdb_atomic_type key_type)
- WARN_UNUSED_RESULT;
+ OVS_WARN_UNUSED_RESULT;
void ovsdb_datum_sort_assert(struct ovsdb_datum *,
enum ovsdb_atomic_type key_type);
struct ovsdb_error *ovsdb_datum_check_constraints(
const struct ovsdb_datum *, const struct ovsdb_type *)
- WARN_UNUSED_RESULT;
+ OVS_WARN_UNUSED_RESULT;
/* Type conversion. */
struct ovsdb_error *ovsdb_datum_from_json(struct ovsdb_datum *,
const struct ovsdb_type *,
const struct json *,
struct ovsdb_symbol_table *)
- WARN_UNUSED_RESULT;
+ OVS_WARN_UNUSED_RESULT;
struct json *ovsdb_datum_to_json(const struct ovsdb_datum *,
const struct ovsdb_type *);
char *ovsdb_datum_from_string(struct ovsdb_datum *,
const struct ovsdb_type *, const char *,
struct ovsdb_symbol_table *)
- WARN_UNUSED_RESULT;
+ OVS_WARN_UNUSED_RESULT;
void ovsdb_datum_to_string(const struct ovsdb_datum *,
const struct ovsdb_type *, struct ds *);
void ovsdb_datum_to_bare(const struct ovsdb_datum *,
*
* Used by ovsdb_atom_from_string() and ovsdb_datum_from_string(). */
-char *ovsdb_token_parse(const char **, char **outp) WARN_UNUSED_RESULT;
+char *ovsdb_token_parse(const char **, char **outp) OVS_WARN_UNUSED_RESULT;
bool ovsdb_token_is_delim(unsigned char);
#endif /* ovsdb-data.h */
struct json;
struct ovsdb_error *ovsdb_error(const char *tag, const char *details, ...)
- PRINTF_FORMAT(2, 3)
- WARN_UNUSED_RESULT;
+ OVS_PRINTF_FORMAT(2, 3)
+ OVS_WARN_UNUSED_RESULT;
struct ovsdb_error *ovsdb_io_error(int error, const char *details, ...)
- PRINTF_FORMAT(2, 3)
- WARN_UNUSED_RESULT;
+ OVS_PRINTF_FORMAT(2, 3)
+ OVS_WARN_UNUSED_RESULT;
struct ovsdb_error *ovsdb_syntax_error(const struct json *, const char *tag,
const char *details, ...)
- PRINTF_FORMAT(3, 4)
- WARN_UNUSED_RESULT;
+ OVS_PRINTF_FORMAT(3, 4)
+ OVS_WARN_UNUSED_RESULT;
struct ovsdb_error *ovsdb_wrap_error(struct ovsdb_error *error,
const char *details, ...)
- PRINTF_FORMAT(2, 3);
+ OVS_PRINTF_FORMAT(2, 3);
struct ovsdb_error *ovsdb_internal_error(struct ovsdb_error *error,
const char *file, int line,
const char *details, ...)
- PRINTF_FORMAT(4, 5)
- WARN_UNUSED_RESULT;
+ OVS_PRINTF_FORMAT(4, 5)
+ OVS_WARN_UNUSED_RESULT;
/* Returns a pointer to an ovsdb_error that represents an internal error for
* the current file name and line number with MSG as the associated message.
void ovsdb_error_destroy(struct ovsdb_error *);
struct ovsdb_error *ovsdb_error_clone(const struct ovsdb_error *)
- WARN_UNUSED_RESULT;
+ OVS_WARN_UNUSED_RESULT;
char *ovsdb_error_to_string(const struct ovsdb_error *);
struct json *ovsdb_error_to_json(const struct ovsdb_error *);
struct ovsdb_idl_txn *ovsdb_idl_txn_create(struct ovsdb_idl *);
void ovsdb_idl_txn_add_comment(struct ovsdb_idl_txn *, const char *, ...)
- PRINTF_FORMAT (2, 3);
+ OVS_PRINTF_FORMAT (2, 3);
void ovsdb_idl_txn_set_dry_run(struct ovsdb_idl_txn *);
void ovsdb_idl_txn_increment(struct ovsdb_idl_txn *,
const struct ovsdb_idl_row *,
void ovsdb_parser_init(struct ovsdb_parser *, const struct json *,
const char *name, ...)
- PRINTF_FORMAT(3, 4);
+ OVS_PRINTF_FORMAT(3, 4);
const struct json *ovsdb_parser_member(struct ovsdb_parser *, const char *name,
enum ovsdb_parser_types);
void ovsdb_parser_raise_error(struct ovsdb_parser *parser,
const char *format, ...)
- PRINTF_FORMAT(2, 3);
+ OVS_PRINTF_FORMAT(2, 3);
bool ovsdb_parser_has_error(const struct ovsdb_parser *);
struct ovsdb_error *ovsdb_parser_get_error(const struct ovsdb_parser *);
struct ovsdb_error *ovsdb_parser_finish(struct ovsdb_parser *)
- WARN_UNUSED_RESULT;
+ OVS_WARN_UNUSED_RESULT;
void ovsdb_parser_destroy(struct ovsdb_parser *);
bool ovsdb_parser_is_id(const char *string);
struct ovsdb_error *ovsdb_base_type_from_json(struct ovsdb_base_type *,
const struct json *)
- WARN_UNUSED_RESULT;
+ OVS_WARN_UNUSED_RESULT;
struct json *ovsdb_base_type_to_json(const struct ovsdb_base_type *);
static inline bool ovsdb_base_type_is_ref(const struct ovsdb_base_type *);
struct ovsdb_error *ovsdb_type_from_json(struct ovsdb_type *,
const struct json *)
- WARN_UNUSED_RESULT;
+ OVS_WARN_UNUSED_RESULT;
struct json *ovsdb_type_to_json(const struct ovsdb_type *);
\f
/* Inline function implementations. */
struct smap_node *smap_add_nocopy(struct smap *, char *, char *);
bool smap_add_once(struct smap *, const char *, const char *);
void smap_add_format(struct smap *, const char *key, const char *, ...)
- PRINTF_FORMAT(3, 4);
+ OVS_PRINTF_FORMAT(3, 4);
void smap_replace(struct smap *, const char *, const char *);
void smap_remove(struct smap *, const char *);
return false;
}
-NO_RETURN static void
+OVS_NO_RETURN static void
nossl_option(const char *detail)
{
VLOG_FATAL("%s specified but Open vSwitch was built without SSL support",
void table_set_timestamp(struct table *, bool timestamp);
void table_add_column(struct table *, const char *heading, ...)
- PRINTF_FORMAT(2, 3);
+ OVS_PRINTF_FORMAT(2, 3);
void table_add_row(struct table *);
\f
/* Table cells. */
int utf16_decode_surrogate_pair(int leading, int trailing);
size_t utf8_length(const char *);
-char *utf8_validate(const char *, size_t *lengthp) WARN_UNUSED_RESULT;
+char *utf8_validate(const char *, size_t *lengthp) OVS_WARN_UNUSED_RESULT;
#endif /* unicode.h */
#else
#define ovs_assert(CONDITION) ((void) (CONDITION))
#endif
-NO_RETURN void ovs_assert_failure(const char *, const char *, const char *);
+OVS_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.
ovs_set_program_name(name, OVS_PACKAGE_VERSION)
const char *get_subprogram_name(void);
-void set_subprogram_name(const char *format, ...) PRINTF_FORMAT(1, 2);
+void set_subprogram_name(const char *format, ...) OVS_PRINTF_FORMAT(1, 2);
void ovs_print_version(uint8_t min_ofp, uint8_t max_ofp);
-NO_RETURN void out_of_memory(void);
+OVS_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 *xmemdup(const void *, size_t) MALLOC_LIKE;
char *xmemdup0(const char *, size_t) MALLOC_LIKE;
char *xstrdup(const char *) MALLOC_LIKE;
-char *xasprintf(const char *format, ...) PRINTF_FORMAT(1, 2) MALLOC_LIKE;
-char *xvasprintf(const char *format, va_list) PRINTF_FORMAT(1, 0) MALLOC_LIKE;
+char *xasprintf(const char *format, ...) OVS_PRINTF_FORMAT(1, 2) MALLOC_LIKE;
+char *xvasprintf(const char *format, va_list) OVS_PRINTF_FORMAT(1, 0) MALLOC_LIKE;
void *x2nrealloc(void *p, size_t *n, size_t s);
void *xmalloc_cacheline(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);
-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);
+OVS_NO_RETURN void ovs_abort(int err_no, const char *format, ...)
+ OVS_PRINTF_FORMAT(2, 3);
+OVS_NO_RETURN void ovs_abort_valist(int err_no, const char *format, va_list)
+ OVS_PRINTF_FORMAT(2, 0);
+OVS_NO_RETURN void ovs_fatal(int err_no, const char *format, ...)
+ OVS_PRINTF_FORMAT(2, 3);
+OVS_NO_RETURN void ovs_fatal_valist(int err_no, const char *format, va_list)
+ OVS_PRINTF_FORMAT(2, 0);
+void ovs_error(int err_no, const char *format, ...) OVS_PRINTF_FORMAT(2, 3);
void ovs_error_valist(int err_no, const char *format, va_list)
- PRINTF_FORMAT(2, 0);
+ OVS_PRINTF_FORMAT(2, 0);
const char *ovs_retval_to_string(int);
const char *ovs_strerror(int);
void ovs_hex_dump(FILE *, const void *, size_t, uintptr_t offset, bool ascii);
bool str_to_llong(const char *, int base, long long *);
bool str_to_uint(const char *, int base, unsigned int *);
-bool ovs_scan(const char *s, const char *format, ...) SCANF_FORMAT(2, 3);
+bool ovs_scan(const char *s, const char *format, ...) OVS_SCANF_FORMAT(2, 3);
bool ovs_scan_len(const char *s, int *n, const char *format, ...);
bool str_to_double(const char *, double *);
static void format_log_message(const struct vlog_module *, enum vlog_level,
const char *pattern,
const char *message, va_list, struct ds *)
- PRINTF_FORMAT(4, 0);
+ OVS_PRINTF_FORMAT(4, 0);
/* Searches the 'n_names' in 'names'. Returns the index of a match for
* 'target', or 'n_names' if no name matches. */
enum vlog_level vlog_get_level(const struct vlog_module *, enum vlog_facility);
void vlog_set_levels(struct vlog_module *,
enum vlog_facility, enum vlog_level);
-char *vlog_set_levels_from_string(const char *) WARN_UNUSED_RESULT;
+char *vlog_set_levels_from_string(const char *) OVS_WARN_UNUSED_RESULT;
void vlog_set_levels_from_string_assert(const char *);
char *vlog_get_levels(void);
bool vlog_is_enabled(const struct vlog_module *, enum vlog_level);
/* Functions for actual logging. */
void vlog(const struct vlog_module *, enum vlog_level, const char *format, ...)
- PRINTF_FORMAT (3, 4);
+ OVS_PRINTF_FORMAT (3, 4);
void vlog_valist(const struct vlog_module *, enum vlog_level,
const char *, va_list)
- PRINTF_FORMAT (3, 0);
+ OVS_PRINTF_FORMAT (3, 0);
-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 *,
+OVS_NO_RETURN void vlog_fatal(const struct vlog_module *, const char *format, ...)
+ OVS_PRINTF_FORMAT (2, 3);
+OVS_NO_RETURN void vlog_fatal_valist(const struct vlog_module *,
const char *format, va_list)
- PRINTF_FORMAT (2, 0);
+ OVS_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 *,
+OVS_NO_RETURN void vlog_abort(const struct vlog_module *, const char *format, ...)
+ OVS_PRINTF_FORMAT (2, 3);
+OVS_NO_RETURN void vlog_abort_valist(const struct vlog_module *,
const char *format, va_list)
- PRINTF_FORMAT (2, 0);
+ OVS_PRINTF_FORMAT (2, 0);
void vlog_rate_limit(const struct vlog_module *, enum vlog_level,
struct vlog_rate_limit *, const char *, ...)
- PRINTF_FORMAT (4, 5);
+ OVS_PRINTF_FORMAT (4, 5);
/* Creates and initializes a global instance of a module named MODULE, and
* defines a static variable named THIS_MODULE that points to it, for use with
*
* On success, initializes '*ofprotop' and 'flow' and returns NULL. On failure
* returns a nonnull malloced error message. */
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_flow_and_packet(int argc, const char *argv[],
struct ofproto_dpif **ofprotop, struct flow *flow,
struct ofpbuf **packetp)
struct ovsdb_error *ovsdb_column_from_json(const struct json *,
const char *name,
struct ovsdb_column **)
- WARN_UNUSED_RESULT;
+ OVS_WARN_UNUSED_RESULT;
struct json *ovsdb_column_to_json(const struct ovsdb_column *);
\f
/* An unordered set of distinct columns. */
return NULL;
}
-static WARN_UNUSED_RESULT struct ovsdb_error *
+static OVS_WARN_UNUSED_RESULT struct ovsdb_error *
ovsdb_clause_from_json(const struct ovsdb_table_schema *ts,
const struct json *json,
struct ovsdb_symbol_table *symtab,
struct ovsdb_error *ovsdb_function_from_string(const char *,
enum ovsdb_function *)
- WARN_UNUSED_RESULT;
+ OVS_WARN_UNUSED_RESULT;
const char *ovsdb_function_to_string(enum ovsdb_function);
struct ovsdb_clause {
struct ovsdb_error *ovsdb_condition_from_json(
const struct ovsdb_table_schema *,
const struct json *, struct ovsdb_symbol_table *,
- struct ovsdb_condition *) WARN_UNUSED_RESULT;
+ struct ovsdb_condition *) OVS_WARN_UNUSED_RESULT;
struct json *ovsdb_condition_to_json(const struct ovsdb_condition *);
void ovsdb_condition_destroy(struct ovsdb_condition *);
bool ovsdb_condition_evaluate(const struct ovsdb_row *,
return table;
}
-static WARN_UNUSED_RESULT struct ovsdb_error *
+static OVS_WARN_UNUSED_RESULT struct ovsdb_error *
parse_row(const struct json *json, const struct ovsdb_table *table,
struct ovsdb_symbol_table *symtab,
struct ovsdb_row **rowp, struct ovsdb_column_set *columns)
struct ovsdb_error *ovsdb_file_open(const char *file_name, bool read_only,
struct ovsdb **, struct ovsdb_file **)
- WARN_UNUSED_RESULT;
+ OVS_WARN_UNUSED_RESULT;
struct ovsdb_error *ovsdb_file_open_as_schema(const char *file_name,
const struct ovsdb_schema *,
struct ovsdb **)
- WARN_UNUSED_RESULT;
+ OVS_WARN_UNUSED_RESULT;
struct ovsdb_error *ovsdb_file_save_copy(const char *file_name, int locking,
const char *comment,
const struct ovsdb *)
- WARN_UNUSED_RESULT;
+ OVS_WARN_UNUSED_RESULT;
struct ovsdb_error *ovsdb_file_compact(struct ovsdb_file *);
struct ovsdb_error *ovsdb_file_read_schema(const char *file_name,
struct ovsdb_schema **)
- WARN_UNUSED_RESULT;
+ OVS_WARN_UNUSED_RESULT;
#endif /* ovsdb/file.h */
return a->column < b->column ? -1 : a->column > b->column;
}
-static struct ovsdb_error * WARN_UNUSED_RESULT
+static struct ovsdb_error * OVS_WARN_UNUSED_RESULT
ovsdb_jsonrpc_parse_monitor_request(struct ovsdb_jsonrpc_monitor_table *mt,
const struct json *monitor_request,
size_t *allocated_columns)
struct ovsdb_error *ovsdb_log_open(const char *name, enum ovsdb_log_open_mode,
int locking, struct ovsdb_log **)
- WARN_UNUSED_RESULT;
+ OVS_WARN_UNUSED_RESULT;
void ovsdb_log_close(struct ovsdb_log *);
struct ovsdb_error *ovsdb_log_read(struct ovsdb_log *, struct json **)
- WARN_UNUSED_RESULT;
+ OVS_WARN_UNUSED_RESULT;
void ovsdb_log_unread(struct ovsdb_log *);
struct ovsdb_error *ovsdb_log_write(struct ovsdb_log *, struct json *)
- WARN_UNUSED_RESULT;
+ OVS_WARN_UNUSED_RESULT;
struct ovsdb_error *ovsdb_log_commit(struct ovsdb_log *)
- WARN_UNUSED_RESULT;
+ OVS_WARN_UNUSED_RESULT;
off_t ovsdb_log_get_offset(const struct ovsdb_log *);
return NULL;
}
-static WARN_UNUSED_RESULT struct ovsdb_error *
+static OVS_WARN_UNUSED_RESULT struct ovsdb_error *
type_mismatch(const struct ovsdb_mutation *m, const struct json *json)
{
struct ovsdb_error *error;
return error;
}
-static WARN_UNUSED_RESULT struct ovsdb_error *
+static OVS_WARN_UNUSED_RESULT struct ovsdb_error *
ovsdb_mutation_from_json(const struct ovsdb_table_schema *ts,
const struct json *json,
struct ovsdb_symbol_table *symtab,
struct ovsdb_error *ovsdb_mutator_from_string(const char *,
enum ovsdb_mutator *)
- WARN_UNUSED_RESULT;
+ OVS_WARN_UNUSED_RESULT;
const char *ovsdb_mutator_to_string(enum ovsdb_mutator);
struct ovsdb_mutation {
struct ovsdb_error *ovsdb_mutation_set_from_json(
const struct ovsdb_table_schema *,
const struct json *, struct ovsdb_symbol_table *,
- struct ovsdb_mutation_set *) WARN_UNUSED_RESULT;
+ struct ovsdb_mutation_set *) OVS_WARN_UNUSED_RESULT;
struct json *ovsdb_mutation_set_to_json(const struct ovsdb_mutation_set *);
void ovsdb_mutation_set_destroy(struct ovsdb_mutation_set *);
struct ovsdb_error *ovsdb_mutation_set_execute(
- struct ovsdb_row *, const struct ovsdb_mutation_set *) WARN_UNUSED_RESULT;
+ struct ovsdb_row *, const struct ovsdb_mutation_set *) OVS_WARN_UNUSED_RESULT;
#endif /* ovsdb/mutation.h */
static const struct ovsdb_client_command *get_all_commands(void);
-NO_RETURN static void usage(void);
+OVS_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);
-NO_RETURN static void usage(void);
+OVS_NO_RETURN static void usage(void);
static char *reconfigure_remotes(struct ovsdb_jsonrpc_server *,
const struct shash *all_dbs,
return NULL;
}
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_db_column__(const struct shash *all_dbs,
const char *name_, char *name,
const struct db **dbp,
/* Returns NULL if successful, otherwise a malloc()'d string describing the
* error. */
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_db_column(const struct shash *all_dbs,
const char *name_,
const struct db **dbp,
/* Returns NULL if successful, otherwise a malloc()'d string describing the
* error. */
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_db_string_column(const struct shash *all_dbs,
const char *name,
const struct db **dbp,
static const struct command *get_all_commands(void);
-NO_RETURN static void usage(void);
+OVS_NO_RETURN static void usage(void);
static void parse_options(int argc, char *argv[]);
static const char *default_db(void);
return NULL;
}
-static struct ovsdb_error * WARN_UNUSED_RESULT
+static struct ovsdb_error * OVS_WARN_UNUSED_RESULT
ovsdb_schema_check_ref_table(struct ovsdb_column *column,
const struct shash *tables,
const struct ovsdb_base_type *base,
struct ovsdb_error *ovsdb_schema_from_file(const char *file_name,
struct ovsdb_schema **)
- WARN_UNUSED_RESULT;
+ OVS_WARN_UNUSED_RESULT;
struct ovsdb_error *ovsdb_schema_from_json(struct json *,
struct ovsdb_schema **)
- WARN_UNUSED_RESULT;
+ OVS_WARN_UNUSED_RESULT;
struct json *ovsdb_schema_to_json(const struct ovsdb_schema *);
bool ovsdb_schema_equal(const struct ovsdb_schema *,
const struct json *,
struct ovsdb_symbol_table *,
struct ovsdb_column_set *included)
- WARN_UNUSED_RESULT;
+ OVS_WARN_UNUSED_RESULT;
struct json *ovsdb_row_to_json(const struct ovsdb_row *,
const struct ovsdb_column_set *include);
struct ovsdb_error *ovsdb_table_schema_from_json(const struct json *,
const char *name,
struct ovsdb_table_schema **)
- WARN_UNUSED_RESULT;
+ OVS_WARN_UNUSED_RESULT;
struct json *ovsdb_table_schema_to_json(const struct ovsdb_table_schema *,
bool default_is_root);
unsigned long changed[]; /* Bits set to 1 for columns that changed. */
};
-static struct ovsdb_error * WARN_UNUSED_RESULT
+static struct ovsdb_error * OVS_WARN_UNUSED_RESULT
delete_garbage_row(struct ovsdb_txn *txn, struct ovsdb_txn_row *r);
static void ovsdb_txn_row_prefree(struct ovsdb_txn_row *);
-static struct ovsdb_error * WARN_UNUSED_RESULT
+static struct ovsdb_error * OVS_WARN_UNUSED_RESULT
for_each_txn_row(struct ovsdb_txn *txn,
struct ovsdb_error *(*)(struct ovsdb_txn *,
struct ovsdb_txn_row *));
return txn_row;
}
-static struct ovsdb_error * WARN_UNUSED_RESULT
+static struct ovsdb_error * OVS_WARN_UNUSED_RESULT
ovsdb_txn_adjust_atom_refs(struct ovsdb_txn *txn, const struct ovsdb_row *r,
const struct ovsdb_column *c,
const struct ovsdb_base_type *base,
return NULL;
}
-static struct ovsdb_error * WARN_UNUSED_RESULT
+static struct ovsdb_error * OVS_WARN_UNUSED_RESULT
ovsdb_txn_adjust_row_refs(struct ovsdb_txn *txn, const struct ovsdb_row *r,
const struct ovsdb_column *column, int delta)
{
return error;
}
-static struct ovsdb_error * WARN_UNUSED_RESULT
+static struct ovsdb_error * OVS_WARN_UNUSED_RESULT
update_row_ref_count(struct ovsdb_txn *txn, struct ovsdb_txn_row *r)
{
struct ovsdb_table *table = r->table;
return NULL;
}
-static struct ovsdb_error * WARN_UNUSED_RESULT
+static struct ovsdb_error * OVS_WARN_UNUSED_RESULT
check_ref_count(struct ovsdb_txn *txn OVS_UNUSED, struct ovsdb_txn_row *r)
{
if (r->new || !r->n_refs) {
}
}
-static struct ovsdb_error * WARN_UNUSED_RESULT
+static struct ovsdb_error * OVS_WARN_UNUSED_RESULT
delete_row_refs(struct ovsdb_txn *txn, const struct ovsdb_row *row,
const struct ovsdb_base_type *base,
const union ovsdb_atom *atoms, unsigned int n)
return NULL;
}
-static struct ovsdb_error * WARN_UNUSED_RESULT
+static struct ovsdb_error * OVS_WARN_UNUSED_RESULT
delete_garbage_row(struct ovsdb_txn *txn, struct ovsdb_txn_row *txn_row)
{
struct shash_node *node;
return NULL;
}
-static struct ovsdb_error * WARN_UNUSED_RESULT
+static struct ovsdb_error * OVS_WARN_UNUSED_RESULT
collect_garbage(struct ovsdb_txn *txn, struct ovsdb_txn_row *txn_row)
{
if (txn_row->new && !txn_row->n_refs) {
return NULL;
}
-static struct ovsdb_error * WARN_UNUSED_RESULT
+static struct ovsdb_error * OVS_WARN_UNUSED_RESULT
update_ref_counts(struct ovsdb_txn *txn)
{
struct ovsdb_error *error;
list_push_back(&src->src_refs, &weak->src_node);
}
-static struct ovsdb_error * WARN_UNUSED_RESULT
+static struct ovsdb_error * OVS_WARN_UNUSED_RESULT
assess_weak_refs(struct ovsdb_txn *txn, struct ovsdb_txn_row *txn_row)
{
struct ovsdb_table *table;
return NULL;
}
-static struct ovsdb_error * WARN_UNUSED_RESULT
+static struct ovsdb_error * OVS_WARN_UNUSED_RESULT
determine_changes(struct ovsdb_txn *txn, struct ovsdb_txn_row *txn_row)
{
struct ovsdb_table *table = txn_row->table;
return NULL;
}
-static struct ovsdb_error * WARN_UNUSED_RESULT
+static struct ovsdb_error * OVS_WARN_UNUSED_RESULT
check_max_rows(struct ovsdb_txn *txn)
{
struct ovsdb_txn_table *t;
}
}
-static struct ovsdb_error * WARN_UNUSED_RESULT
+static struct ovsdb_error * OVS_WARN_UNUSED_RESULT
duplicate_index_row(const struct ovsdb_column_set *index,
const struct ovsdb_row *a,
const struct ovsdb_row *b)
return error;
}
-static struct ovsdb_error * WARN_UNUSED_RESULT
+static struct ovsdb_error * OVS_WARN_UNUSED_RESULT
check_index_uniqueness(struct ovsdb_txn *txn OVS_UNUSED,
struct ovsdb_txn_row *txn_row)
{
* (Even though 'cb' is not allowed to delete some txn_rows, it can still
* delete any actual row by clearing a txn_row's 'new' member.)
*/
-static struct ovsdb_error * WARN_UNUSED_RESULT
+static struct ovsdb_error * OVS_WARN_UNUSED_RESULT
for_each_txn_row(struct ovsdb_txn *txn,
struct ovsdb_error *(*cb)(struct ovsdb_txn *,
struct ovsdb_txn_row *))
struct ovsdb_txn *ovsdb_txn_create(struct ovsdb *);
void ovsdb_txn_abort(struct ovsdb_txn *);
struct ovsdb_error *ovsdb_txn_commit(struct ovsdb_txn *, bool durable)
- WARN_UNUSED_RESULT;
+ OVS_WARN_UNUSED_RESULT;
struct ovsdb_row *ovsdb_txn_row_modify(struct ovsdb_txn *,
const struct ovsdb_row *);
#include "util.h"
#include "vlog.h"
-NO_RETURN static void usage(void);
+OVS_NO_RETURN static void usage(void);
static void parse_options(int argc, char *argv[]);
static struct command *get_all_commands(void);
#include "util.h"
#include "vlog.h"
-NO_RETURN static void usage(void);
+OVS_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"
-NO_RETURN static void usage(void);
+OVS_NO_RETURN static void usage(void);
static void parse_options(int argc, char *argv[]);
static struct command *get_all_commands(void);
}
}
-NO_RETURN static void
+OVS_NO_RETURN static void
err(const char *message, ...)
- PRINTF_FORMAT(1, 2);
+ OVS_PRINTF_FORMAT(1, 2);
static void
err(const char *message, ...)
static void
warn(const char *message, ...)
- PRINTF_FORMAT(1, 2);
+ OVS_PRINTF_FORMAT(1, 2);
static void
warn(const char *message, ...)
#include "util.h"
#include "vlog.h"
-NO_RETURN static void usage(void);
+OVS_NO_RETURN static void usage(void);
static void parse_options(int argc, char *argv[]);
static unixctl_cb_func test_sflow_exit;
}
}
-NO_RETURN static void
+OVS_NO_RETURN static void
err(const char *message, ...)
- PRINTF_FORMAT(1, 2);
+ OVS_PRINTF_FORMAT(1, 2);
static void
err(const char *message, ...)
static void
warn(const char *message, ...)
- PRINTF_FORMAT(1, 2);
+ OVS_PRINTF_FORMAT(1, 2);
static void
warn(const char *message, ...)
static struct dpctl_params dpctl_p;
-NO_RETURN static void usage(void *userdata OVS_UNUSED);
+OVS_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);
-NO_RETURN static void usage(void);
+OVS_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 run(int retval, const char *message, ...)
- PRINTF_FORMAT(2, 3);
+ OVS_PRINTF_FORMAT(2, 3);
static void
run(int retval, const char *message, ...)
static void new_switch(struct switch_ *, struct vconn *);
static void parse_options(int argc, char *argv[]);
-NO_RETURN static void usage(void);
+OVS_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;
-NO_RETURN static void vsctl_exit(int status);
-NO_RETURN static void vsctl_fatal(const char *, ...) PRINTF_FORMAT(1, 2);
+OVS_NO_RETURN static void vsctl_exit(int status);
+OVS_NO_RETURN static void vsctl_fatal(const char *, ...) OVS_PRINTF_FORMAT(1, 2);
static char *default_db(void);
-NO_RETURN static void usage(void);
+OVS_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);
*
* On success, returns NULL. On failure, returned a malloc()'d string error
* message and stores NULL into all of the nonnull output arguments. */
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_column_key_value(const char *arg,
const struct vsctl_table_class *table,
const struct ovsdb_idl_column **columnp, char **keyp,
static unixctl_cb_func ovs_vswitchd_exit;
static char *parse_options(int argc, char *argv[], char **unixctl_path);
-NO_RETURN static void usage(void);
+OVS_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);
-NO_RETURN static void *system_stats_thread_func(void *);
+OVS_NO_RETURN static void *system_stats_thread_func(void *);
static void discard_stats(void);
/* Enables or disables system stats collection, according to 'enable'. */
static struct ovsdb_idl *the_idl;
static struct ovsdb_idl_txn *the_idl_txn;
-NO_RETURN static void vtep_ctl_exit(int status);
-NO_RETURN static void vtep_ctl_fatal(const char *, ...) PRINTF_FORMAT(1, 2);
+OVS_NO_RETURN static void vtep_ctl_exit(int status);
+OVS_NO_RETURN static void vtep_ctl_fatal(const char *, ...) OVS_PRINTF_FORMAT(1, 2);
static char *default_db(void);
-NO_RETURN static void usage(void);
+OVS_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);
*
* On success, returns NULL. On failure, returned a malloc()'d string error
* message and stores NULL into all of the nonnull output arguments. */
-static char * WARN_UNUSED_RESULT
+static char * OVS_WARN_UNUSED_RESULT
parse_column_key_value(const char *arg,
const struct vtep_ctl_table_class *table,
const struct ovsdb_idl_column **columnp, char **keyp,