Commit 0f31aac4 authored by Jose Fonseca's avatar Jose Fonseca

cmake: Use -Werror=pointer-arith on GCC builds.

Void pointer arithmetic is not supported on MSVC, so passing
-Werror=pointer-arith will make it easier for everybody to catch this
sort of portability issues as the code is written.
Reviewed-by: default avatarMartin Peres <>
parent 188f2deb
......@@ -215,6 +215,12 @@ if (NOT MSVC)
# GCC allows void pointer arithmetic, but it is not part of ISO C and
# in particular MSVC will throw `C2036: 'void *' : unknown size`
check_c_compiler_flag ("-Werror=pointer-arith" C_COMPILER_FLAG_WEPOINTER_ARITH)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror=pointer-arith")
endif ()
# MSVC only supports C99 variadic macros. It doesn't support the
# non-standard GNU named variadic macro syntax that's documented in
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment