Skip to content
Open
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
5 changes: 5 additions & 0 deletions .github/workflows/unit-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ jobs:
- "-DFLB_SANITIZE_THREAD=On"
- "-DFLB_SIMD=On"
- "-DFLB_SIMD=Off"
- "-DFLB_COMPILER_STRICT_POINTER_TYPES=On"
cmake_version:
- "3.31.6"
compiler:
Expand All @@ -66,6 +67,10 @@ jobs:
compiler:
cc: clang
cxx: clang++
- flb_option: "-DFLB_COMPILER_STRICT_POINTER_TYPES=On"
compiler:
cc: clang
cxx: clang++
permissions:
contents: read
steps:
Expand Down
12 changes: 12 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ option(FLB_SMALL "Optimise for small size" No)
set(FLB_SECURITY "ReleaseOnly" CACHE STRING "Build with security optimizations")
set_property(CACHE FLB_SECURITY PROPERTY STRINGS "On;Off;ReleaseOnly")
option(FLB_COVERAGE "Build with code-coverage" No)
option(FLB_COMPILER_STRICT_POINTER_TYPES "Build with -Werror=incompatible-pointer-types" No)
option(FLB_JEMALLOC "Build with Jemalloc support" No)
option(FLB_REGEX "Build with Regex support" Yes)
option(FLB_UTF8_ENCODER "Build with UTF8 encoding support" Yes)
Expand Down Expand Up @@ -436,6 +437,17 @@ if(FLB_COVERAGE)
set(CMAKE_BUILD_TYPE "Debug")
endif()

if(FLB_COMPILER_STRICT_POINTER_TYPES)
if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang|AppleClang")
add_compile_options(-Werror=incompatible-pointer-types)
endif()
# Currently, AppleClang has more struct rules when using -Werror=incompatible-pointer-types.
# We still permit to discarding const qualifiers warnings.
if(CMAKE_C_COMPILER_ID MATCHES "AppleClang")
add_compile_options(-Wno-incompatible-pointer-types-discards-qualifiers)
endif()
endif()

# Enable Debug symbols if specified
if(MSVC)
set(CMAKE_BUILD_TYPE None) # Avoid flag conflicts (See CMakeList.txt:L18)
Expand Down
Loading