瀏覽代碼

Make function calls without prior declaration an error

which is the default behavior on C99 and up.
pull/440/head
Ahmad Fatoum 7 年之前
父節點
當前提交
8be93762d9
沒有發現已知的金鑰在資料庫的簽署中 GPG 金鑰 ID: C3EAC3DE9321D59B
共有 2 個檔案被更改,包括 12 行新增5 行删除
  1. +10
    -4
      CMakeLists.txt
  2. +2
    -1
      src/Makefile

+ 10
- 4
CMakeLists.txt 查看文件

@ -12,10 +12,16 @@ else()
set (CMAKE_C_STANDARD 99) set (CMAKE_C_STANDARD 99)
endif() endif()
include(CheckCCompilerFlag) include(CheckCCompilerFlag)
CHECK_C_COMPILER_FLAG("-Werror=pointer-arith" COMPILER_HAS_POINTER_ARITH_TOGGLE)
if(COMPILER_HAS_POINTER_ARITH_TOGGLE)
set(CMAKE_C_FLAGS "-Werror=pointer-arith ${CMAKE_C_FLAGS}")
endif()
foreach(option -Werror=pointer-arith;-Werror=implicit-function-declaration)
CHECK_C_COMPILER_FLAG("${option}" COMPILER_HAS_THOSE_TOGGLES)
set(outcome "Failed")
if(COMPILER_HAS_THOSE_TOGGLES)
set(CMAKE_C_FLAGS "${option} ${CMAKE_C_FLAGS}")
set(outcome "works")
endif()
message(STATUS "Testing if ${option} can be used -- ${outcome}")
endforeach()
add_subdirectory(src release) add_subdirectory(src release)

+ 2
- 1
src/Makefile 查看文件

@ -262,7 +262,8 @@ endif
# -Wno-missing-braces ignore invalid warning (GCC bug 53119) # -Wno-missing-braces ignore invalid warning (GCC bug 53119)
# -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec # -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec
# -Werror=pointer-arith catch unportable code that does direct arithmetic on void pointers # -Werror=pointer-arith catch unportable code that does direct arithmetic on void pointers
CFLAGS += -O1 -Wall -std=c99 -D_DEFAULT_SOURCE -fgnu89-inline -Wno-missing-braces -Werror=pointer-arith
# -Werror=implicit-function-declaration catch function calls without prior declaration
CFLAGS += -O1 -Wall -std=c99 -D_DEFAULT_SOURCE -fgnu89-inline -Wno-missing-braces -Werror=pointer-arith -Werror=implicit-function-declaration
ifeq ($(RAYLIB_BUILD_MODE), DEBUG) ifeq ($(RAYLIB_BUILD_MODE), DEBUG)
CFLAGS += -g CFLAGS += -g

Loading…
取消
儲存