cmake: add _U_ and NGHTTP2_NORETURN to config.h

Do not add _U_ and NGHTTP2_NORETURN definitions to the command line,
instead add it to config.h. This matches what autotools does.
This commit is contained in:
Peter Wu 2016-03-16 14:25:58 +01:00
parent 0c49e5d56e
commit f8a9a21428
2 changed files with 10 additions and 5 deletions

View File

@ -118,12 +118,11 @@ endforeach()
# XXX - similar hints for other compilers?
#
if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang")
add_definitions(
"-D_U_=__attribute__((unused))"
"-DNGHTTP2_NORETURN=__attribute__((noreturn))"
)
set(HINT_UNUSED_PARAM "__attribute__((unused))")
set(HINT_NORETURN "__attribute__((noreturn))")
else()
add_definitions(-D_U_ -DNGHTTP2_NORETURN)
set(HINT_UNUSED_PARAM)
set(HINT_NORETURN)
endif()
include(ExtractValidFlags)

View File

@ -1,4 +1,10 @@
/* Hint to the compiler that a function parameter is not used */
#define _U_ @HINT_UNUSED_PARAM@
/* Hint to the compiler that a function never returns */
#define NGHTTP2_NORETURN @HINT_NORETURN@
/* Define to 1 if you have the `std::map::emplace`. */
#cmakedefine HAVE_STD_MAP_EMPLACE 1