2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-22 01:51:26 +00:00

Add BUILD_MESSAGE() macro

This commit introduces the BUILD_MESSAGE() macro. It uses _Pragma("message"),
with compilers that support that, to output a warning-like compile-time message
without blocking the compilation.

Used by next commit.

Signed-off-by: Daniele Di Proietto <ddiproietto@vmware.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
This commit is contained in:
Daniele Di Proietto 2014-08-29 16:08:11 -07:00 committed by Jarno Rajahalme
parent 30f4d875f5
commit aa8ea22366
3 changed files with 20 additions and 0 deletions

View File

@ -121,6 +121,7 @@ AC_ARG_VAR(KARCH, [Kernel Architecture String])
AC_SUBST(KARCH)
OVS_CHECK_LINUX
OVS_CHECK_DPDK
OVS_CHECK_PRAGMA_MESSAGE
AC_CONFIG_FILES(Makefile)
AC_CONFIG_FILES(datapath/Makefile)

View File

@ -221,4 +221,14 @@
#define OVS_PREFETCH_WRITE(addr)
#endif
/* Output a message (not an error) while compiling without failing the
* compilation process */
#if HAVE_PRAGMA_MESSAGE
#define DO_PRAGMA(x) _Pragma(#x)
#define BUILD_MESSAGE(x) \
DO_PRAGMA(message(x))
#else
#define BUILD_MESSAGE(x)
#endif
#endif /* compiler.h */

View File

@ -457,3 +457,12 @@ dnl OVS_CHECK_INCLUDE_NEXT
AC_DEFUN([OVS_CHECK_INCLUDE_NEXT],
[AC_REQUIRE([gl_CHECK_NEXT_HEADERS])
gl_CHECK_NEXT_HEADERS([$1])])
dnl OVS_CHECK_PRAGMA_MESSAGE
AC_DEFUN([OVS_CHECK_PRAGMA_MESSAGE],
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[_Pragma("message(\"Checking for pragma message\")")
]])],
[AC_DEFINE(HAVE_PRAGMA_MESSAGE,1,[Define if compiler supports #pragma
message directive])])
])