cmake: compiler: add double promotion warning

Too many times, code is pushed that includes floats that really
becomes doubles and C implicit promotion rules will want to make
floats into doubles very easily. As zephyr primarily targets
low-end process that may not have a double precision floating
point unit, enable this flag globally for now.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
This commit is contained in:
Ryan McClelland 2023-04-22 14:23:57 -07:00 committed by Chris Friedt
commit 018dbcfd66
3 changed files with 9 additions and 0 deletions

View file

@ -33,6 +33,9 @@ set_compiler_property(PROPERTY warning_base
-Wno-typedef-redefinition
)
# C implicit promotion rules will want to make floats into doubles very easily
check_set_compiler_property(APPEND PROPERTY warning_base -Wdouble-promotion)
check_set_compiler_property(APPEND PROPERTY warning_base -Wno-pointer-sign)
# Prohibit void pointer arithmetic. Illegal in C99

View file

@ -45,6 +45,9 @@ check_set_compiler_property(PROPERTY warning_base
-Wno-deprecated-non-prototype
)
# C implicit promotion rules will want to make floats into doubles very easily
check_set_compiler_property(APPEND PROPERTY warning_base -Wdouble-promotion)
check_set_compiler_property(APPEND PROPERTY warning_base -Wno-pointer-sign)
# Prohibit void pointer arithmetic. Illegal in C99

View file

@ -32,6 +32,9 @@ check_set_compiler_property(PROPERTY warning_base
"SHELL:-Wformat -Wno-format-zero-length"
)
# C implicit promotion rules will want to make floats into doubles very easily
check_set_compiler_property(APPEND PROPERTY warning_base -Wdouble-promotion)
check_set_compiler_property(APPEND PROPERTY warning_base -Wno-pointer-sign)
# Prohibit void pointer arithmetic. Illegal in C99