Message ID | 20210924203243.465-1-sergey.madaminov@gmail.com |
---|---|
State | New |
Headers | show |
Series | [ovs-dev] include/openvswitch/compiler.h: enable several OVS_ attributes for Clang in Windows | expand |
Context | Check | Description |
---|---|---|
ovsrobot/apply-robot | success | apply and check: success |
ovsrobot/github-robot-_Build_and_Test | fail | github build: failed |
diff --git a/include/openvswitch/compiler.h b/include/openvswitch/compiler.h index cf009f826..3fe5fc4b5 100644 --- a/include/openvswitch/compiler.h +++ b/include/openvswitch/compiler.h @@ -37,7 +37,7 @@ #define OVS_NO_RETURN #endif -#if __GNUC__ && !__CHECKER__ +#if (__clang__ || __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)))
Clang on Windows does not necessarily have '__GNUC__' defined when compiling OvS on Windows. However, it supports the attributes such as '__unused__' and the rest in this macro-defined branch. Instead of defining '__GNUC__' with a flag '-fgnuc_version=X' (X is a version), which may have a larger impact, I think that it is better to not define it unless absolutely necessary to avoid having to deal with potential compatability issues and third-party libraries. For example, POSIX threads library for Windows checks for GNU C version if it supports '__declspec' whenever '__GNUC__' is defined. Signed-off-by: Sergey Madaminov <sergey.madaminov@gmail.com> --- include/openvswitch/compiler.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)