mirror of
https://github.com/Ed94/refactor.git
synced 2024-12-21 22:44:45 -08:00
Corrections to debug code for release builds.
This commit is contained in:
parent
5bfa8395db
commit
f9b8f02351
@ -1,7 +1,10 @@
|
|||||||
#define BLOAT_IMPL
|
#define BLOAT_IMPL
|
||||||
#include "Bloat.hpp"
|
#include "Bloat.hpp"
|
||||||
|
|
||||||
|
namespace Global
|
||||||
|
{
|
||||||
|
bool ShouldShowDebug = false;
|
||||||
|
}
|
||||||
|
|
||||||
namespace Memory
|
namespace Memory
|
||||||
{
|
{
|
||||||
|
@ -142,9 +142,6 @@ namespace Spec
|
|||||||
bool ignore = false;
|
bool ignore = false;
|
||||||
Entry entry {};
|
Entry entry {};
|
||||||
|
|
||||||
log_fmt("\nIGNORE WORD COUNT: %d", zpl_array_count(Ignore_Words));
|
|
||||||
|
|
||||||
|
|
||||||
// Find a valid token
|
// Find a valid token
|
||||||
find_next_token( type, token, line, length );
|
find_next_token( type, token, line, length );
|
||||||
|
|
||||||
@ -327,15 +324,5 @@ namespace Spec
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
while ( lines++, left--, left > 0 );
|
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");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,14 +8,6 @@
|
|||||||
# define ZPL_IMPLEMENTATION
|
# define ZPL_IMPLEMENTATION
|
||||||
#endif
|
#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
|
#pragma region ZPL INCLUDE
|
||||||
#if __clang__
|
#if __clang__
|
||||||
# pragma clang diagnostic push
|
# 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 bit( Value_ ) ( 1 << Value_ )
|
||||||
#define bitfield_is_equal( Field_, Mask_ ) ( ( Mask_ & Field_ ) == Mask_ )
|
#define bitfield_is_equal( Field_, Mask_ ) ( ( Mask_ & Field_ ) == Mask_ )
|
||||||
#define ct constexpr
|
#define ct constexpr
|
||||||
@ -88,6 +89,11 @@ using Array_Line = zpl_array( Line );
|
|||||||
ct char const* Msg_Invalid_Value = "INVALID VALUE PROVIDED";
|
ct char const* Msg_Invalid_Value = "INVALID VALUE PROVIDED";
|
||||||
|
|
||||||
|
|
||||||
|
namespace Global
|
||||||
|
{
|
||||||
|
extern bool ShouldShowDebug;
|
||||||
|
}
|
||||||
|
|
||||||
namespace Memory
|
namespace Memory
|
||||||
{
|
{
|
||||||
ct uw Initial_Reserve = zpl_megabytes(2);
|
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.
|
// Had to be made to support multiple sub-arguments per "opt" argument.
|
||||||
b32 opts_custom_compile(zpl_opts *opts, int argc, char **argv);
|
b32 opts_custom_compile(zpl_opts *opts, int argc, char **argv);
|
||||||
|
|
||||||
|
|
||||||
inline
|
inline
|
||||||
sw log_fmt(char const *fmt, ...)
|
sw log_fmt(char const *fmt, ...)
|
||||||
{
|
{
|
||||||
#if Build_Debug
|
if ( Global::ShouldShowDebug == false )
|
||||||
|
return 0;
|
||||||
|
|
||||||
sw res;
|
sw res;
|
||||||
va_list va;
|
va_list va;
|
||||||
|
|
||||||
@ -115,10 +124,6 @@ sw log_fmt(char const *fmt, ...)
|
|||||||
va_end(va);
|
va_end(va);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
#else
|
|
||||||
return 0;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
inline
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#include "Spec.cpp"
|
#include "Spec.cpp"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void parse_options( int num, char** arguments )
|
void parse_options( int num, char** arguments )
|
||||||
{
|
{
|
||||||
zpl_opts opts;
|
zpl_opts opts;
|
||||||
@ -12,21 +13,21 @@ void parse_options( int num, char** arguments )
|
|||||||
zpl_opts_add( & opts, "dst" , "dst" , "File/s post refactor" , ZPL_OPTS_STRING);
|
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);
|
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);
|
zpl_opts_add( & opts, "debug", "debug", "Allows for wait to attach", ZPL_OPTS_FLAG);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (opts_custom_compile( & opts, num, arguments))
|
if (opts_custom_compile( & opts, num, arguments))
|
||||||
{
|
{
|
||||||
sw num = 0;
|
sw num = 0;
|
||||||
|
|
||||||
#if Build_Debug
|
|
||||||
if ( zpl_opts_has_arg( & opts, "debug" ) )
|
if ( zpl_opts_has_arg( & opts, "debug" ) )
|
||||||
{
|
{
|
||||||
|
#if Build_Debug
|
||||||
zpl_printf("Will wait (pause available for attachment)");
|
zpl_printf("Will wait (pause available for attachment)");
|
||||||
char pause = getchar();
|
char pause = getchar();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
Global::ShouldShowDebug = true;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if ( zpl_opts_has_arg( & opts, "num" ) )
|
if ( zpl_opts_has_arg( & opts, "num" ) )
|
||||||
{
|
{
|
||||||
@ -589,10 +590,6 @@ void refactor()
|
|||||||
}
|
}
|
||||||
|
|
||||||
move_forward( 1 );
|
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 );
|
while ( left );
|
||||||
End_Search:
|
End_Search:
|
||||||
|
Loading…
Reference in New Issue
Block a user