More cleanup for clang

This commit is contained in:
Edward R. Gonzalez 2023-09-28 21:57:52 -04:00
parent a52f6efbff
commit 4417738a6d
7 changed files with 51 additions and 42 deletions

2
.vscode/launch.json vendored
View File

@ -17,7 +17,7 @@
"type":"cppvsdbg", "type":"cppvsdbg",
"request": "launch", "request": "launch",
"name" : "Debug handmade platform gen msvc", "name" : "Debug handmade platform gen msvc",
"program": "${workspaceFolder}/build/handmade_platform_gen.exe", "program": "${workspaceFolder}/build/engine_postbuild_gen.exe",
"args": [], "args": [],
"cwd": "${workspaceFolder}/build", "cwd": "${workspaceFolder}/build",
"visualizerFile": "${workspaceFolder}/scripts/handmade.natvis" "visualizerFile": "${workspaceFolder}/scripts/handmade.natvis"

View File

@ -1,12 +1,21 @@
#include "platform/compiler_ignores.hpp"
#if GEN_TIME #if GEN_TIME
#define GEN_DEFINE_LIBRARY_CODE_CONSTANTS #define GEN_DEFINE_LIBRARY_CODE_CONSTANTS
#define GEN_IMPLEMENTATION #define GEN_IMPLEMENTATION
#define GEN_BENCHMARK #define GEN_BENCHMARK
#define GEN_ENFORCE_STRONG_CODE_TYPES #define GEN_ENFORCE_STRONG_CODE_TYPES
#include "dependencies/gen.hpp" #include "dependencies/gen.hpp"
#undef ccast
#undef pcast
#undef do_once
#undef do_once_start
#undef do_once_end
using namespace gen; using namespace gen;
#include "engine/engine_to_platform_api.hpp" #include "engine/engine_to_platform_api.hpp"
constexpr StrC fname_handmade_engine_symbols = txt("handmade_engine.symbols"); constexpr StrC fname_handmade_engine_symbols = txt("handmade_engine.symbols");
String get_symbol_from_module_table( FileContents symbol_table, u32 symbol_ID ) String get_symbol_from_module_table( FileContents symbol_table, u32 symbol_ID )
@ -71,7 +80,6 @@ int gen_main()
StrC symbol_update_and_render = get_symbol_from_module_table( symbol_table, engine::ModuleAPI::Sym_UpdateAndRender ); StrC symbol_update_and_render = get_symbol_from_module_table( symbol_table, engine::ModuleAPI::Sym_UpdateAndRender );
StrC symbol_update_audio = get_symbol_from_module_table( symbol_table, engine::ModuleAPI::Sym_UpdateAudio ); StrC symbol_update_audio = get_symbol_from_module_table( symbol_table, engine::ModuleAPI::Sym_UpdateAudio );
builder.print( parse_variable( token_fmt( "symbol", symbol_on_module_load, stringize( builder.print( parse_variable( token_fmt( "symbol", symbol_on_module_load, stringize(
constexpr const Str symbol_on_module_load = str_ascii("<symbol>"); constexpr const Str symbol_on_module_load = str_ascii("<symbol>");
)))); ))));

View File

@ -1,14 +1,4 @@
#ifdef __clang__ #include "platform/compiler_ignores.hpp"
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-const-variable"
#pragma clang diagnostic ignored "-Wswitch"
#pragma clang diagnostic ignored "-Wunused-variable"
#pragma clang diagnostic ignored "-Wunknown-pragmas"
#pragma clang diagnostic ignored "-Wvarargs"
#pragma clang diagnostic ignored "-Wunused-function"
#pragma clang diagnostic ignored "-Wunused-but-set-variable"
#endif
#include "platform/grime.hpp" #include "platform/grime.hpp"
#if Build_Unity #if Build_Unity

View File

@ -1,13 +1,4 @@
#ifdef __clang__ #include "platform/compiler_ignores.hpp"
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-const-variable"
#pragma clang diagnostic ignored "-Wswitch"
#pragma clang diagnostic ignored "-Wunused-variable"
#pragma clang diagnostic ignored "-Wunknown-pragmas"
#pragma clang diagnostic ignored "-Wvarargs"
#pragma clang diagnostic ignored "-Wunused-function"
#pragma clang diagnostic ignored "-Wunused-but-set-variable"
#endif
#if Build_Unity #if Build_Unity
#include "platform/win32_platform.cpp" #include "platform/win32_platform.cpp"

View File

@ -0,0 +1,26 @@
#ifdef _MSC_VER
#pragma warning( disable: 4201 ) // Support for non-standard nameless struct or union extesnion
#pragma warning( disable: 4100 ) // Support for unreferenced formal parameters
#pragma warning( disable: 4800 ) // Support implicit conversion to bools
#pragma warning( disable: 4365 ) // Support for signed/unsigned mismatch auto-conversion
#pragma warning( disable: 4189 ) // Support for unused variables
#pragma warning( disable: 4514 ) // Support for unused inline functions
#pragma warning( disable: 4505 ) // Support for unused static functions
#pragma warning( disable: 5045 ) // Compiler will insert Spectre mitigation for memory load if /Qspectre switch specified
#pragma warning( disable: 5264 ) // Support for 'const' variables unused
#pragma warning( disable: 4820 ) // Support auto-adding padding to structs
#pragma warning( disable: 4711 ) // Support automatic inline expansion
#pragma warning( disable: 4710 ) // Support automatic inline expansion
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-const-variable"
#pragma clang diagnostic ignored "-Wswitch"
#pragma clang diagnostic ignored "-Wunused-variable"
#pragma clang diagnostic ignored "-Wunused-local-typedef"
#pragma clang diagnostic ignored "-Wunknown-pragmas"
#pragma clang diagnostic ignored "-Wvarargs"
#pragma clang diagnostic ignored "-Wunused-function"
#pragma clang diagnostic ignored "-Wunused-but-set-variable"
#endif

View File

@ -8,19 +8,6 @@
#pragma once #pragma once
#pragma warning( disable: 4201 ) // Support for non-standard nameless struct or union extesnion
#pragma warning( disable: 4100 ) // Support for unreferenced formal parameters
#pragma warning( disable: 4800 ) // Support implicit conversion to bools
#pragma warning( disable: 4365 ) // Support for signed/unsigned mismatch auto-conversion
#pragma warning( disable: 4189 ) // Support for unused variables
#pragma warning( disable: 4514 ) // Support for unused inline functions
#pragma warning( disable: 4505 ) // Support for unused static functions
#pragma warning( disable: 5045 ) // Compiler will insert Spectre mitigation for memory load if /Qspectre switch specified
#pragma warning( disable: 5264 ) // Support for 'const' variables unused
#pragma warning( disable: 4820 ) // Support auto-adding padding to structs
#pragma warning( disable: 4711 ) // Support automatic inline expansion
#pragma warning( disable: 4710 ) // Support automatic inline expansion
// TODO(Ed) : REMOVE THESE WHEN HE GETS TO THEM // TODO(Ed) : REMOVE THESE WHEN HE GETS TO THEM
#include <math.h> // TODO : Implement math ourselves #include <math.h> // TODO : Implement math ourselves
#include <stdio.h> // TODO : Implement output logging ourselves #include <stdio.h> // TODO : Implement output logging ourselves

View File

@ -209,9 +209,9 @@ if ( $vendor -match "clang" )
$flag_exceptions_disabled, $flag_exceptions_disabled,
$flag_target_arch, $target_arch, $flag_target_arch, $target_arch,
$flag_wall, $flag_wall,
$flag_preprocess_non_intergrated, $flag_preprocess_on_intergrated,
$flag_section_data, # $flag_section_data,
$flag_section_functions, # $flag_section_functions,
( $flag_path_output + $object ) ( $flag_path_output + $object )
) )
if ( $optimize ) { if ( $optimize ) {
@ -477,8 +477,8 @@ if ( $engine )
} }
$linker_args = @( $linker_args = @(
$flag_link_dll, $flag_link_dll
$flag_link_optimize_references # $flag_link_optimize_references
) )
$unit = Join-Path $path_project 'handmade_engine.cpp' $unit = Join-Path $path_project 'handmade_engine.cpp'
@ -493,7 +493,7 @@ if ( $engine )
$path_lib = $dynamic_library -replace '\.dll', '.lib' $path_lib = $dynamic_library -replace '\.dll', '.lib'
$path_exp = $dynamic_library -replace '\.dll', '.exp' $path_exp = $dynamic_library -replace '\.dll', '.exp'
Remove-Item $path_lib -Force Remove-Item $path_lib -Force
Remove-Item $path_exp -Force if ( Test-Path $path_exp ) { Remove-Item $path_exp -Force }
# We need to generate the symbol table so that we can lookup the symbols we need when loading/reloading the library at runtime. # We need to generate the symbol table so that we can lookup the symbols we need when loading/reloading the library at runtime.
# This is done by sifting through the emitter.map file from the linker for the base symbol names # This is done by sifting through the emitter.map file from the linker for the base symbol names
@ -559,6 +559,13 @@ if ( $engine )
#region CodeGen #region CodeGen
if ( $handmade_process_active -eq $null ) { if ( $handmade_process_active -eq $null ) {
# Delete old PDBs
$pdb_files = Get-ChildItem -Path $path_build -Filter "engine_postbuild_gen_*.pdb"
foreach ($file in $pdb_files) {
Remove-Item -Path $file.FullName -Force
Write-Host "Deleted $file" -ForegroundColor Green
}
$engine_codegen_compiler_args = @() $engine_codegen_compiler_args = @()
$engine_codegen_compiler_args += ( $flag_define + 'GEN_TIME' ) $engine_codegen_compiler_args += ( $flag_define + 'GEN_TIME' )