-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Juan Cruz Viotti <[email protected]>
- Loading branch information
Showing
3 changed files
with
89 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
function(noa_add_default_options visibility target) | ||
if(NOA_COMPILER_MSVC) | ||
# See https://learn.microsoft.com/en-us/cpp/build/reference/compiler-options-listed-by-category | ||
target_compile_options("${target}" ${visibility} | ||
/options:strict | ||
/permissive- | ||
/W4 | ||
/WL | ||
/MP | ||
/sdl) | ||
else() | ||
target_compile_options("${target}" ${visibility} | ||
-Wall | ||
-Wextra | ||
-Wpedantic | ||
-Wshadow | ||
-Wdouble-promotion | ||
-Wconversion | ||
-Wunused-parameter | ||
-Wtrigraphs | ||
-Wunreachable-code | ||
-Wmissing-braces | ||
-Wparentheses | ||
-Wswitch | ||
-Wunused-function | ||
-Wunused-label | ||
-Wunused-parameter | ||
-Wunused-variable | ||
-Wunused-value | ||
-Wempty-body | ||
-Wuninitialized | ||
-Wshadow | ||
-Wconversion | ||
-Wenum-conversion | ||
-Wfloat-conversion | ||
-Wimplicit-fallthrough | ||
-Wsign-compare | ||
# TODO: Enable this flag for safety | ||
-Wno-sign-conversion | ||
-Wunknown-pragmas | ||
-Wnon-virtual-dtor | ||
-Woverloaded-virtual | ||
-Winvalid-offsetof | ||
|
||
# Assume that signed arithmetic overflow of addition, subtraction and | ||
# multiplication wraps around using twos-complement representation | ||
# See https://users.cs.utah.edu/~regehr/papers/overflow12.pdf | ||
# See https://www.postgresql.org/message-id/[email protected] | ||
-fwrapv) | ||
endif() | ||
|
||
if(NOA_COMPILER_LLVM) | ||
target_compile_options("${target}" ${visibility} | ||
-Wbool-conversion | ||
-Wint-conversion | ||
-Wpointer-sign | ||
-Wconditional-uninitialized | ||
-Wconstant-conversion | ||
-Wnon-literal-null-conversion | ||
-Wshorten-64-to-32 | ||
-Wdeprecated-implementations | ||
-Winfinite-recursion | ||
-Wnewline-eof | ||
-Wfour-char-constants | ||
-Wselector | ||
-Wundeclared-selector | ||
-Wdocumentation | ||
-Wmove | ||
-Wc++11-extensions | ||
-Wcomma | ||
-Wno-exit-time-destructors | ||
-Wrange-loop-analysis) | ||
endif() | ||
endfunction() |