]> granicus.if.org Git - json-c/commitdiff
fix compilation with clang
authorRosen Penev <rosenp@gmail.com>
Fri, 18 Dec 2020 03:59:37 +0000 (19:59 -0800)
committerGitHub <noreply@github.com>
Fri, 18 Dec 2020 03:59:37 +0000 (19:59 -0800)
Fixes the following warning:

json_pointer.c:230:7: warning: implicit declaration of function
    'vasprintf' is invalid in C99 [-Wimplicit-function-declaration]
            rc = vasprintf(&path_copy, path_fmt, args);

CMakeLists.txt

index 2333d08f6af7531e095355f6f16649561070b726..892aebb8e8cfef22f631e768ddb0cd77a54cb7c5 100644 (file)
@@ -269,7 +269,7 @@ message(STATUS "Wrote ${PROJECT_BINARY_DIR}/config.h")
 configure_file(${PROJECT_SOURCE_DIR}/cmake/json_config.h.in   ${PROJECT_BINARY_DIR}/json_config.h)
 message(STATUS "Wrote ${PROJECT_BINARY_DIR}/json_config.h")
 
-if ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
+if ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
     set(CMAKE_C_FLAGS           "${CMAKE_C_FLAGS} -ffunction-sections -fdata-sections")
        if ("${DISABLE_WERROR}" STREQUAL "OFF")
            set(CMAKE_C_FLAGS           "${CMAKE_C_FLAGS} -Werror")