Warning Fixes

This commit is contained in:
2025-06-01 19:51:42 -04:00
parent 99c684b26e
commit 4f760aa88d
2 changed files with 23 additions and 12 deletions

View File

@@ -103,6 +103,9 @@
AppendWarningFlag("-Wuse-after-free") #Warns about accessing a value after calling 'free' on it
AppendWarningFlag("-Wuseless-cast") #Warns about a cast that is useless.
AppendWarningFlag("-Wno-non-virtual-dtor")
AppendWarningFlag("-Wno-terminate") # Disables -Wterminate errors, These are kinda weird and I tend to use throw inside of dtors with the intent of it terminating after. So we'll just silence them.
# Starting other weird flags
AppendWarningFlag("-fdiagnostics-show-template-tree") # Shows the template diagnostic info as a tree instead.
@@ -112,30 +115,29 @@
string(TOUPPER ${CMAKE_BUILD_TYPE} UPPER_BUILD_TYPE)
if (NOT DEFINED STATIC_ANAYLSIS)
set(STATIC_ANYLSIS 1)
if (NOT DEFINED FGL_STATIC_ANALYSIS)
set(FGL_STATIC_ANALYSIS 0)
endif ()
# if (STATIC_ANALYSIS EQUAL 1 AND UPPER_BUILD_TYPE STREQUAL "DEBUG")
# list(APPEND FGL_CONFIG "-fanalyzer")
# if (NOT DEFINED USE_WERROR OR NOT USE_WERROR)
# list(APPEND FGL_CONFIG "-Wanalyzer-too-complex")
# endif ()
# elseif (NOT UPPER_BUILD_TYPE STREQUAL "DEBUG")
if (NOT UPPER_BUILD_TYPE STREQUAL "DEBUG")
if (FGL_STATIC_ANALYSIS EQUAL 1)
list(APPEND FGL_CONFIG "-fanalyzer")
# list(APPEND FGL_CONFIG "-Wanalyzer-too-complex")
# Breaks more often then it is helpful
list(APPEND FGL_CONFIG "-Wno-analyzer-use-of-uninitialized-value")
list(APPEND FGL_CONFIG "-Wno-analyzer-malloc-leak")
elseif (NOT UPPER_BUILD_TYPE STREQUAL "DEBUG")
list(APPEND FGL_CONFIG "-flto=auto")
endif ()
list(APPEND FGL_CONFIG "-ftree-vectorize")
list(APPEND FGL_CONFIG "-fmax-errors=6")
list(APPEND FGL_CONFIG "-fmax-errors=2")
LIST(APPEND FGL_CONFIG "-fmodules-ts")
LIST(APPEND FGL_CONFIG "-std=c++23")
#AppendWarningFlag("-fanalyzer")
#AppendWarningFlag("-Wanalyzer-too-complex")
if (DEFINED USE_WERROR AND USE_WERROR)
if (DEFINED FGL_STRICT_WARNINGS AND FGL_STRICT_WARNINGS)
list(APPEND FGL_CONFIG "-Werror")
endif ()

View File

@@ -32,6 +32,14 @@ function(AddFGLExecutable NAME SRC_SOURCES_LOCATION)
SetFGLFlags(${NAME})
endfunction()
function(addFGLFlags NAME)
if (DEFINED FGL_STRICT_WARNINGS AND FGL_STRICT_WARNINGS)
target_compile_definitions(${NAME} PUBLIC "-DFGL_STRICT_WARNINGS=1")
endif ()
endfunction()
function(AddFGLLibrary NAME MODE SRC_SOURCES_LOCATION INCLUDE_SOURCES_LOCATION)
file(GLOB_RECURSE CPP_SOURCES CONFIGURE_DEPENDS ${SRC_SOURCES_LOCATION}/**.cpp)
file(GLOB_RECURSE HPP_SOURCES CONFIGURE_DEPENDS ${SRC_SOURCES_LOCATION}/**.hpp)
@@ -40,6 +48,7 @@ function(AddFGLLibrary NAME MODE SRC_SOURCES_LOCATION INCLUDE_SOURCES_LOCATION)
target_include_directories(${NAME} PUBLIC ${INCLUDE_SOURCES_LOCATION})
target_include_directories(${NAME} PRIVATE ${SRC_SOURCES_LOCATION})
SetFGLFlags(${NAME})
addFGLFlags(${NAME})
endfunction()
function(AddFGLChildLibrary NAME MODE SRC_SOURCES_LOCATION INCLUDE_SOURCES_LOCATION)