Corrections to debug code for release builds.

This commit is contained in:
Edward R. Gonzalez 2023-03-30 19:33:35 -04:00
parent 5bfa8395db
commit f9b8f02351
4 changed files with 27 additions and 35 deletions

View File

@ -1,7 +1,10 @@
#define BLOAT_IMPL
#include "Bloat.hpp"
namespace Global
{
bool ShouldShowDebug = false;
}
namespace Memory
{

View File

@ -142,9 +142,6 @@ namespace Spec
bool ignore = false;
Entry entry {};
log_fmt("\nIGNORE WORD COUNT: %d", zpl_array_count(Ignore_Words));
// Find a valid token
find_next_token( type, token, line, length );
@ -327,15 +324,5 @@ namespace Spec
}
}
while ( lines++, left--, left > 0 );
Spec::Entry* ignore = Spec::Ignore_Words;
sw ignores_left = zpl_array_count( Spec::Ignore_Words);
zpl_printf("\nIgnores: ");
for ( ; ignores_left; ignores_left--, ignore++ )
{
zpl_printf("\n%s", ignore->Sig);
}
zpl_printf("\n");
}
}

View File

@ -8,14 +8,6 @@
# define ZPL_IMPLEMENTATION
#endif
#if __clang__
# pragma clang diagnostic ignored "-Wunused-const-variable"
# pragma clang diagnostic ignored "-Wswitch"
# pragma clang diagnostic ignored "-Wunused-variable"
#endif
#pragma region ZPL INCLUDE
#if __clang__
# pragma clang diagnostic push
@ -48,6 +40,15 @@
#if __clang__
# pragma clang diagnostic ignored "-Wunused-const-variable"
# pragma clang diagnostic ignored "-Wswitch"
# pragma clang diagnostic ignored "-Wunused-variable"
# pragma clang diagnostic ignored "-Wunknown-pragmas"
#endif
#define bit( Value_ ) ( 1 << Value_ )
#define bitfield_is_equal( Field_, Mask_ ) ( ( Mask_ & Field_ ) == Mask_ )
#define ct constexpr
@ -88,6 +89,11 @@ using Array_Line = zpl_array( Line );
ct char const* Msg_Invalid_Value = "INVALID VALUE PROVIDED";
namespace Global
{
extern bool ShouldShowDebug;
}
namespace Memory
{
ct uw Initial_Reserve = zpl_megabytes(2);
@ -103,10 +109,13 @@ namespace Memory
// Had to be made to support multiple sub-arguments per "opt" argument.
b32 opts_custom_compile(zpl_opts *opts, int argc, char **argv);
inline
sw log_fmt(char const *fmt, ...)
{
#if Build_Debug
if ( Global::ShouldShowDebug == false )
return 0;
sw res;
va_list va;
@ -115,10 +124,6 @@ sw log_fmt(char const *fmt, ...)
va_end(va);
return res;
#else
return 0;
#endif
}
inline

View File

@ -3,6 +3,7 @@
#include "Spec.cpp"
void parse_options( int num, char** arguments )
{
zpl_opts opts;
@ -12,22 +13,22 @@ void parse_options( int num, char** arguments )
zpl_opts_add( & opts, "dst" , "dst" , "File/s post refactor" , ZPL_OPTS_STRING);
zpl_opts_add( & opts, "spec", "spec", "Specification for refactoring", ZPL_OPTS_STRING);
#if Build_Debug
zpl_opts_add( & opts, "debug", "debug", "Allows for wait to attach", ZPL_OPTS_FLAG);
#endif
if (opts_custom_compile( & opts, num, arguments))
{
sw num = 0;
#if Build_Debug
if ( zpl_opts_has_arg( & opts, "debug" ) )
{
#if Build_Debug
zpl_printf("Will wait (pause available for attachment)");
char pause = getchar();
}
#endif
Global::ShouldShowDebug = true;
}
if ( zpl_opts_has_arg( & opts, "num" ) )
{
num = zpl_opts_integer( & opts, "num", -1 );
@ -589,10 +590,6 @@ void refactor()
}
move_forward( 1 );
// zpl_string_clear( preview );
// preview = zpl_string_append_length( preview, src, 100);
// log_fmt( "__PREVIEW: %d \nn%s\n\n__PREVIEW_END", left, preview );
}
while ( left );
End_Search: