Fix build (#79)

Fix build
This commit is contained in:
Ozan Tezcan 2022-02-05 00:11:52 +03:00 committed by GitHub
parent 89f51f1d87
commit 020f6f740d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
29 changed files with 51 additions and 39 deletions

View File

@ -13,7 +13,7 @@ jobs:
name: Build on aarch64
steps:
- uses: actions/checkout@v2.1.0
- uses: uraimo/run-on-arch-action@v2.0.9
- uses: uraimo/run-on-arch-action@v2.1.1
name: Build artifact
id: build
with:

View File

@ -13,7 +13,7 @@ jobs:
name: Build on armv6
steps:
- uses: actions/checkout@v2.1.0
- uses: uraimo/run-on-arch-action@v2.0.9
- uses: uraimo/run-on-arch-action@v2.1.1
name: Build artifact
id: build
with:
@ -31,4 +31,4 @@ jobs:
apk update
apk add git build-base gcc make valgrind cmake
mkdir build && cd build
cmake .. && make -j && make check
cmake .. -DSC_USE_WRAP=OFF && make -j && make check

View File

@ -13,7 +13,7 @@ jobs:
name: Build on armv7
steps:
- uses: actions/checkout@v2.1.0
- uses: uraimo/run-on-arch-action@v2.0.9
- uses: uraimo/run-on-arch-action@v2.1.1
name: Build artifact
id: build
with:

View File

@ -13,7 +13,7 @@ jobs:
name: Build on ppc64le
steps:
- uses: actions/checkout@v2.1.0
- uses: uraimo/run-on-arch-action@v2.0.9
- uses: uraimo/run-on-arch-action@v2.1.1
name: Build artifact
id: build
with:

View File

@ -13,7 +13,7 @@ jobs:
name: Build on s390x
steps:
- uses: actions/checkout@v2.1.0
- uses: uraimo/run-on-arch-action@v2.0.9
- uses: uraimo/run-on-arch-action@v2.1.1
name: Build artifact
id: build
with:

View File

@ -22,6 +22,11 @@ if (NOT ${CMAKE_BUILD_TYPE} MATCHES "Debug" AND NOT ${CMAKE_BUILD_TYPE} MATCHES
message(STATUS "Not building tests, SC tests are supported in Debug build only.")
endif ()
option(SC_USE_WRAP "Use --wrap to test libc function failures" ON)
if (NOT SC_USE_WRAP)
message(STATUS "Turned off --wrap.")
endif()
add_subdirectory(array)
add_subdirectory(buffer)
add_subdirectory(condition)

View File

@ -42,7 +42,7 @@ if (SC_BUILD_TEST)
message(STATUS "Compiler is ${CMAKE_C_COMPILER_ID}")
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND SC_USE_WRAP)
if ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" OR
"${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
message(STATUS "Defined SC_HAVE_WRAP")

View File

@ -41,9 +41,10 @@ if (SC_BUILD_TEST)
target_compile_options(${PROJECT_NAME}_test PRIVATE -DSC_BUF_MAX=1400000ul)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND SC_USE_WRAP)
if ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" OR
"${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
message(STATUS "Defined SC_HAVE_WRAP")
target_compile_options(${PROJECT_NAME}_test PRIVATE -DSC_HAVE_WRAP)
target_compile_options(${PROJECT_NAME}_test PRIVATE -fno-builtin)
target_link_options(${PROJECT_NAME}_test PRIVATE

View File

@ -34,7 +34,7 @@
#include <stdio.h>
#ifndef SC_BUF_MAX
#define SC_BUF_MAX UINT64_MAX
#define SC_BUF_MAX UINT64_MAX-4096
#endif
#define NULL_LEN SC_BUF_MAX
@ -686,21 +686,21 @@ void sc_buf_put_double(struct sc_buf *b, double val)
void sc_buf_put_str(struct sc_buf *b, const char *str)
{
size_t sz;
uint64_t sz;
if (str == NULL) {
sc_buf_put_64(b, NULL_LEN);
return;
}
sz = strlen(str);
sz = (uint64_t) strlen(str);
if (sz >= SC_BUF_MAX) {
b->err |= SC_BUF_CORRUPT;
return;
}
sc_buf_put_64(b, (uint64_t) sz);
sc_buf_put_raw(b, str, (uint64_t) sz + sc_buf_8_len('\0'));
sc_buf_put_64(b, sz);
sc_buf_put_raw(b, str, sz + sc_buf_8_len('\0'));
}
void sc_buf_put_str_len(struct sc_buf *b, const char *str, uint64_t len)

View File

@ -41,7 +41,7 @@ if (SC_BUILD_TEST)
target_compile_options(${PROJECT_NAME}_test PRIVATE -DSC_SIZE_MAX=140000ul)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND SC_USE_WRAP)
if ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" OR
"${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
target_compile_options(${PROJECT_NAME}_test PRIVATE -DSC_HAVE_WRAP)

View File

@ -41,7 +41,7 @@ if (SC_BUILD_TEST)
target_compile_options(${PROJECT_NAME}_test PRIVATE -DSC_HEAP_MAX=140000ul)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND SC_USE_WRAP)
if ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" OR
"${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
target_compile_options(${PROJECT_NAME}_test PRIVATE -DSC_HAVE_WRAP)

View File

@ -37,7 +37,8 @@ int main(int argc, char *argv[])
}
while ((elem = sc_heap_pop(&heap)) != NULL) {
printf("key = %d, data = %s \n", (int) elem->key, elem->data);
printf("key = %d, data = %s \n",
(int) elem->key, (char*) elem->data);
}
printf("---------------- \n");
@ -48,7 +49,8 @@ int main(int argc, char *argv[])
}
while ((elem = sc_heap_pop(&heap)) != NULL) {
printf("key = %d, data = %s \n", (int) elem->key, elem->data);
printf("key = %d, data = %s \n",
(int) elem->key, (char*) elem->data);
}
sc_heap_term(&heap);

View File

@ -26,7 +26,8 @@ int main()
}
while ((elem = sc_heap_pop(&heap)) != NULL) {
printf("key = %d, data = %s \n", (int) elem->key, elem->data);
printf("key = %d, data = %s \n",
(int) elem->key, (char*) elem->data);
}
printf("---------------- \n");
@ -37,7 +38,8 @@ int main()
}
while ((elem = sc_heap_pop(&heap)) != NULL) {
printf("key = %d, data = %s \n", (int) elem->key, elem->data);
printf("key = %d, data = %s \n",
(int) elem->key, (char*) elem->data);
}
sc_heap_term(&heap);

View File

@ -30,7 +30,8 @@ int example(void)
}
while ((elem = sc_heap_pop(&heap)) != NULL) {
printf("key = %d, data = %s \n", (int) elem->key, elem->data);
printf("key = %d, data = %s \n",
(int) elem->key, (char*) elem->data);
}
printf("---------------- \n");
@ -41,7 +42,8 @@ int example(void)
}
while ((elem = sc_heap_pop(&heap)) != NULL) {
printf("key = %d, data = %s \n", (int) elem->key, elem->data);
printf("key = %d, data = %s \n",
(int) elem->key, (char*) elem->data);
}
sc_heap_term(&heap);

View File

@ -39,7 +39,7 @@ if (SC_BUILD_TEST)
add_executable(${PROJECT_NAME}_test ini_test.c sc_ini.c)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND SC_USE_WRAP)
if ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" OR
"${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
target_compile_options(${PROJECT_NAME}_test PRIVATE -DSC_HAVE_WRAP)

View File

@ -39,10 +39,10 @@ if (SC_BUILD_TEST)
add_executable(${PROJECT_NAME}_test log_test.c sc_log.c)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND SC_USE_WRAP)
if ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" OR
"${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
message(STATUS "Defined SC_HAVE_WRAP")
target_compile_options(${PROJECT_NAME}_test PRIVATE -DSC_HAVE_WRAP)
target_compile_options(${PROJECT_NAME}_test PRIVATE -fno-builtin)
target_link_options(${PROJECT_NAME}_test PRIVATE

View File

@ -41,7 +41,7 @@ if (SC_BUILD_TEST)
target_compile_options(${PROJECT_NAME}_test PRIVATE -DSC_MAP_MAX=140000ul)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND SC_USE_WRAP)
if ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" OR
"${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")

View File

@ -39,10 +39,10 @@ if (SC_BUILD_TEST)
add_executable(${PROJECT_NAME}_test mmap_test.c sc_mmap.c)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND SC_USE_WRAP)
if ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" OR
"${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
message(STATUS "Defined SC_HAVE_WRAP")
target_compile_options(${PROJECT_NAME}_test PRIVATE -DSC_HAVE_WRAP)
target_compile_options(${PROJECT_NAME}_test PRIVATE -fno-builtin)
target_link_options(${PROJECT_NAME}_test PRIVATE

View File

@ -41,7 +41,7 @@ if (SC_BUILD_TEST)
target_compile_options(${PROJECT_NAME}_test PRIVATE -DSC_SIZE_MAX=1400000ul)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND SC_USE_WRAP)
if ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" OR
"${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")

View File

@ -42,7 +42,7 @@ if (SC_BUILD_TEST)
target_compile_options(${PROJECT_NAME}_test PRIVATE -DSC_SIZE_MAX=1400000ul)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND SC_USE_WRAP)
if ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" OR
"${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")

View File

@ -42,7 +42,7 @@ if (SC_BUILD_TEST)
target_compile_options(${PROJECT_NAME}_test PRIVATE -DSC_QUEUE_MAX=1400000ul)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND SC_USE_WRAP)
if ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" OR
"${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")

View File

@ -41,7 +41,7 @@ if (SC_BUILD_TEST)
target_compile_options(${PROJECT_NAME}_test PRIVATE -DSC_SIZE_MAX=1400000ul)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND SC_USE_WRAP)
if ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" OR
"${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")

View File

@ -61,7 +61,7 @@ if (SC_BUILD_TEST)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DHAVE_BACKTRACE")
endif ()
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND SC_USE_WRAP)
if ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" OR
"${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")

View File

@ -41,7 +41,7 @@ if (SC_BUILD_TEST)
target_compile_options(${PROJECT_NAME}_test PRIVATE -DSC_SIZE_MAX=300 -Dsc_fcntl=test_fcntl)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND SC_USE_WRAP)
if ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" OR
"${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")

View File

@ -41,7 +41,7 @@ if (SC_BUILD_TEST)
target_compile_options(${PROJECT_NAME}_test PRIVATE -DSC_STR_MAX=4000ul)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND SC_USE_WRAP)
if ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" OR
"${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")

View File

@ -41,7 +41,7 @@ if (SC_BUILD_TEST)
target_compile_options(${PROJECT_NAME}_test PRIVATE -DSC_SIZE_MAX=4000ul)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND SC_USE_WRAP)
if ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" OR
"${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")

View File

@ -51,10 +51,10 @@ if (SC_BUILD_TEST)
endif ()
endif ()
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND SC_USE_WRAP)
if ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" OR
"${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
message(STATUS "Defined SC_HAVE_WRAP")
target_compile_options(${PROJECT_NAME}_test PRIVATE -DSC_HAVE_WRAP)
target_compile_options(${PROJECT_NAME}_test PRIVATE -fno-builtin)
target_link_options(${PROJECT_NAME}_test PRIVATE

View File

@ -41,7 +41,7 @@ if (SC_BUILD_TEST)
target_compile_options(${PROJECT_NAME}_test PRIVATE -DSC_TIMER_MAX=4000ul)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND SC_USE_WRAP)
if ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" OR
"${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")

View File

@ -41,7 +41,7 @@ if (SC_BUILD_TEST)
target_compile_options(${PROJECT_NAME}_test PRIVATE -DSC_SIZE_MAX=140000ul)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND SC_USE_WRAP)
if ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" OR
"${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
target_compile_options(${PROJECT_NAME}_test PRIVATE -DSC_HAVE_WRAP)