Update CI
All checks were successful
CMake / ubuntu-latest - shared=OFF, pthread=OFF, posix=OFF (push) Successful in 11s
CMake / ubuntu-latest - shared=ON, pthread=OFF, posix=OFF (push) Successful in 15s
CMake / ubuntu-latest - shared=OFF, pthread=OFF, posix=ON (push) Successful in 17s
CMake / ubuntu-latest - shared=ON, pthread=OFF, posix=ON (push) Successful in 15s
CMake / ubuntu-latest - shared=OFF, pthread=ON, posix=ON (push) Successful in 12s
CMake / ubuntu-latest - shared=ON, pthread=ON, posix=ON (push) Successful in 10s
All checks were successful
CMake / ubuntu-latest - shared=OFF, pthread=OFF, posix=OFF (push) Successful in 11s
CMake / ubuntu-latest - shared=ON, pthread=OFF, posix=OFF (push) Successful in 15s
CMake / ubuntu-latest - shared=OFF, pthread=OFF, posix=ON (push) Successful in 17s
CMake / ubuntu-latest - shared=ON, pthread=OFF, posix=ON (push) Successful in 15s
CMake / ubuntu-latest - shared=OFF, pthread=ON, posix=ON (push) Successful in 12s
CMake / ubuntu-latest - shared=ON, pthread=ON, posix=ON (push) Successful in 10s
Signed-off-by: Slendi <slendi@socopon.com>
This commit is contained in:
@@ -16,21 +16,24 @@ jobs:
|
||||
shared: ["ON", "OFF"]
|
||||
pthread_support: ["ON", "OFF"]
|
||||
posix_support: ["ON", "OFF"]
|
||||
exclude:
|
||||
- posix_support: "OFF"
|
||||
pthread_support: "ON"
|
||||
runs-on: ${{ matrix.os }}
|
||||
name: ${{ matrix.os }} - shared=${{ matrix.shared }}
|
||||
name: ${{ matrix.os }} - shared=${{ matrix.shared }}, pthread=${{ matrix.pthread_support }}, posix=${{ matrix.posix_support }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y cmake build-essential
|
||||
- name: Configure
|
||||
run: |
|
||||
cmake -Bbuild -S . \
|
||||
-DDCFG_BUILD_SHARED=${{ matrix.shared }} \
|
||||
-DDCFG_PTHREAD_SUPPORT=${{ matrix.pthread_support }} \
|
||||
-DDCFG_POSIX_SUPPORT=${{ matrix.posix_support }}
|
||||
- name: Build
|
||||
run: |
|
||||
cmake --build build
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install -y cmake build-essential
|
||||
- name: Configure
|
||||
run: |
|
||||
cmake -Bbuild -S . \
|
||||
-DDCFG_BUILD_SHARED=${{ matrix.shared }} \
|
||||
-DDCFG_PTHREAD_SUPPORT=${{ matrix.pthread_support }} \
|
||||
-DDCFG_POSIX_SUPPORT=${{ matrix.posix_support }}
|
||||
- name: Build
|
||||
run: |
|
||||
cmake --build build
|
||||
|
||||
|
@@ -1,10 +1,10 @@
|
||||
cmake_minimum_required(VERSION 3.30)
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
|
||||
project(DCFG C)
|
||||
|
||||
set(CMAKE_C_STANDARD 23) # Would've done C99 but I need typeof (for now)
|
||||
set(CMAKE_C_STANDARD 99)
|
||||
set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_C_EXTENSIONS OFF)
|
||||
set(CMAKE_C_EXTENSIONS ON) # Would've done OFF but I need typeof (for now)
|
||||
|
||||
option(DCFG_BUILD_SHARED "Build DCFG as a shared library" ON)
|
||||
option(DCFG_PTHREAD_SUPPORT "Enable pthreads support" ON)
|
||||
@@ -31,20 +31,20 @@ if(DCFG_BUILD_SHARED)
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "dcfg")
|
||||
install(TARGETS ${PROJECT_NAME} DESTINATION lib)
|
||||
else()
|
||||
add_library(${PROJECT_NAME}_static STATIC ${SRC_DIR}/dcfg.c)
|
||||
target_include_directories(${PROJECT_NAME}_static PUBLIC ${INCLUDE_DIR})
|
||||
add_library(${PROJECT_NAME} STATIC ${SRC_DIR}/dcfg.c)
|
||||
target_include_directories(${PROJECT_NAME} PUBLIC ${INCLUDE_DIR})
|
||||
|
||||
if(DCFG_PTHREAD_SUPPORT)
|
||||
find_package(Threads REQUIRED)
|
||||
target_link_libraries(${PROJECT_NAME}_static PRIVATE Threads::Threads)
|
||||
target_compile_definitions(${PROJECT_NAME}_static PRIVATE DCFG_PTHREAD_SUPPORT)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE Threads::Threads)
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE DCFG_PTHREAD_SUPPORT)
|
||||
endif()
|
||||
if (DCFG_POSIX_SUPPORT)
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE DCFG_POSIX_SUPPORT)
|
||||
endif()
|
||||
|
||||
set_target_properties(${PROJECT_NAME}_static PROPERTIES OUTPUT_NAME "dcfg")
|
||||
install(TARGETS ${PROJECT_NAME}_static DESTINATION lib)
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "dcfg")
|
||||
install(TARGETS ${PROJECT_NAME} DESTINATION lib)
|
||||
endif()
|
||||
|
||||
install(DIRECTORY ${INCLUDE_DIR}/ DESTINATION include)
|
||||
@@ -52,5 +52,5 @@ install(DIRECTORY ${INCLUDE_DIR}/ DESTINATION include)
|
||||
if(MSVC)
|
||||
target_compile_options(${PROJECT_NAME} PRIVATE /W4 /permissive-)
|
||||
else()
|
||||
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -pedantic -Werror -Wno-newline-eof)
|
||||
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -pedantic -Werror -Wno-newline-eof -Wno-language-extension-token)
|
||||
endif()
|
||||
|
@@ -11,6 +11,9 @@
|
||||
# endif
|
||||
# define _XOPEN_SOURCE 200809L
|
||||
#else
|
||||
# ifdef _POSIX_C_SOURCE
|
||||
# undef _POSIX_C_SOURCE
|
||||
# endif
|
||||
# define _POSIX_C_SOURCE 0L
|
||||
#endif
|
||||
|
||||
@@ -23,9 +26,12 @@
|
||||
#ifdef DCFG_PTHREAD_SUPPORT
|
||||
# include <pthread.h>
|
||||
#else
|
||||
# if defined __USE_POSIX199506 || defined __USE_UNIX98
|
||||
# else
|
||||
typedef struct {
|
||||
int unused;
|
||||
} pthread_mutex_t;
|
||||
# endif
|
||||
|
||||
void pthread_mutex_init(pthread_mutex_t *, void *);
|
||||
void pthread_mutex_destroy(pthread_mutex_t *);
|
||||
@@ -1064,7 +1070,8 @@ Value *ast_to_value(dcfg_Instance *instance, AST *root)
|
||||
|
||||
dcfg_Value *dcfg_parse(dcfg_Instance *instance, dcfg_StringView const file_path)
|
||||
{
|
||||
char path_buf[file_path.size + 1] = {};
|
||||
char path_buf[file_path.size + 1];
|
||||
memset(path_buf, 0, sizeof(path_buf));
|
||||
memcpy(path_buf, file_path.data, file_path.size);
|
||||
|
||||
char *abs = instance->realpath(path_buf);
|
||||
|
Reference in New Issue
Block a user