Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
${{matrix.platform.msys-env}}-zlib

- name: Configure CMake
run: cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=${{matrix.build-type}} -DBUILD_STATIC=${{matrix.build-static}} -DBUILD_TESTING=ON -DCMAKE_C_FLAGS="-Wall -Werror"
run: cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=${{matrix.build-type}} -DBUILD_STATIC=${{matrix.build-static}} -DBUILD_TESTING=ON -DCMAKE_C_FLAGS="-Wall -Werror -Wpedantic"

- name: Build
run: cmake --build build
Expand Down
8 changes: 5 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
cmake_minimum_required(VERSION 3.21)
project(unshield C)

set (CMAKE_C_STANDARD 23)
Comment thread
twogood marked this conversation as resolved.
Resolved

# Mimic CMP0048 which is avaliable only for cmake 3.0 and later
set(PROJECT_VERSION_MAJOR 1)
set(PROJECT_VERSION_MINOR 6)
Expand Down Expand Up @@ -32,13 +34,13 @@ check_symbol_exists(fnmatch fnmatch.h HAVE_FNMATCH)
check_symbol_exists(iconv iconv.h HAVE_ICONV)

set(SIZE_FORMAT "zi")
check_c_source_compiles("#include <stdio.h>\nint main() { size_t value = 0; printf(\"%${SIZE_FORMAT}\", value); return 0; }" SIZE_FORMAT_ZI)
check_c_source_compiles("#include <stdio.h>\nint main(void) { size_t value = 0; printf(\"%${SIZE_FORMAT}\", value); return 0; }" SIZE_FORMAT_ZI)
if(NOT SIZE_FORMAT_ZI)
set(SIZE_FORMAT "i")
check_c_source_compiles("#include <stdio.h>\nint main() { size_t value = 0; printf(\"%${SIZE_FORMAT}\", value); return 0; }" SIZE_FORMAT_I)
check_c_source_compiles("#include <stdio.h>\nint main(void) { size_t value = 0; printf(\"%${SIZE_FORMAT}\", value); return 0; }" SIZE_FORMAT_I)
if(NOT SIZE_FORMAT_I)
set(SIZE_FORMAT "li")
check_c_source_compiles("#include <stdio.h>\nint main() { size_t value = 0; printf(\"%${SIZE_FORMAT}\", value); return 0; }" SIZE_FORMAT_LI)
check_c_source_compiles("#include <stdio.h>\nint main(void) { size_t value = 0; printf(\"%${SIZE_FORMAT}\", value); return 0; }" SIZE_FORMAT_LI)
if(NOT SIZE_FORMAT_LI)
message(FATAL_ERROR "You must be using a really weird platform!")
endif()
Expand Down
6 changes: 3 additions & 3 deletions lib/log.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ extern "C"
void _unshield_log(int level, const char* file, int line, const char* format, ...);

#define unshield_trace(format, ...) \
_unshield_log(UNSHIELD_LOG_LEVEL_TRACE,__FUNCTION__, __LINE__, format, ##__VA_ARGS__)
_unshield_log(UNSHIELD_LOG_LEVEL_TRACE, __func__, __LINE__, format __VA_OPT__(,) __VA_ARGS__)

#define unshield_warning(format, ...) \
_unshield_log(UNSHIELD_LOG_LEVEL_WARNING,__FUNCTION__, __LINE__, format, ##__VA_ARGS__)
_unshield_log(UNSHIELD_LOG_LEVEL_WARNING, __func__, __LINE__, format __VA_OPT__(,) __VA_ARGS__)

#define unshield_error(format, ...) \
_unshield_log(UNSHIELD_LOG_LEVEL_ERROR,__FUNCTION__, __LINE__, format, ##__VA_ARGS__)
_unshield_log(UNSHIELD_LOG_LEVEL_ERROR, __func__, __LINE__, format __VA_OPT__(,) __VA_ARGS__)

#ifdef __cplusplus
}
Expand Down