Skip to content

Commit 99a0c5b

Browse files
committed
Compile with -Werror=strict-prototypes.
This prevents incorrect invocation of functions. Almost exclusively updated via dirty search/replaces: find include -name '*.h' -exec sed -i '' -r 's/\(\);/(void);/g' {} \; find src -name '*.c' -exec sed -i '' -r 's/\(\)$/(void)/g' {} \; find src -name '*.c' -exec sed -i '' -r 's/^(((extern|static) )?(void|float|qbool)[^(]+)\(\);/\1(void);/g' {} \; Followed by a handful of manual cleanups.
1 parent d33cf52 commit 99a0c5b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+3124
-3118
lines changed

CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ cmake_minimum_required(VERSION 3.9.0)
33
# Set project name and languge.
44
project(qwprogs C)
55

6+
include(CheckCCompilerFlag)
7+
68
# CMake option for bot support, we check it below and add C preprocessor directive if required.
79
option(BOT_SUPPORT "Build with bot support" ON)
810
# Option for FTE extensions. We also have some basic support for FTE which does not controlled by this setting.
@@ -152,6 +154,12 @@ if (CMAKE_C_COMPILER_ID STREQUAL "MSVC")
152154
target_compile_options(${PROJECT_NAME} PRIVATE /W4)
153155
else()
154156
target_compile_options(${PROJECT_NAME} PRIVATE -Wall)
157+
158+
check_c_compiler_flag("-Wstrict-prototypes" HAS_CFLAG_STRICT_PROTOTYPES)
159+
if (HAS_CFLAG_STRICT_PROTOTYPES)
160+
target_compile_options(${PROJECT_NAME} PRIVATE -Werror=strict-prototypes)
161+
endif()
162+
155163
# Do not allow undefined symbols while linking.
156164
if(APPLE)
157165
target_link_options(${PROJECT_NAME} PRIVATE "-Wl,-undefined,error")

0 commit comments

Comments
 (0)