Compare commits
5 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1d01b831aa | ||
|
|
0d2e791e82 | ||
|
|
71fe947ff5 | ||
|
|
beb2a595f1 | ||
|
|
0fbc3c0c84 |
3 changed files with 42 additions and 16 deletions
|
|
@ -80,7 +80,7 @@ std::cout << \"1s is \"<< std::chrono::duration_cast<std::chrono::milliseconds>(
|
||||||
set( TEST_NULLPTR "
|
set( TEST_NULLPTR "
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
std::nullptr_t f() {return nullptr;}
|
std::nullptr_t f() {return nullptr;}
|
||||||
int main() {return !!f();}
|
int main() {return !(f() == f());}
|
||||||
" )
|
" )
|
||||||
cmake_push_check_state()
|
cmake_push_check_state()
|
||||||
if( UNIX )
|
if( UNIX )
|
||||||
|
|
|
||||||
|
|
@ -131,7 +131,7 @@ void ErrorDescriptor::PrependToUserMsg( const char * msg ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ErrorDescriptor::AppendToUserMsg( const char c ) {
|
void ErrorDescriptor::AppendToUserMsg( const char c ) {
|
||||||
_userMsg.append( &c );
|
_userMsg.push_back( c );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ErrorDescriptor::AppendToUserMsg( const char * msg ) {
|
void ErrorDescriptor::AppendToUserMsg( const char * msg ) {
|
||||||
|
|
@ -147,7 +147,7 @@ void ErrorDescriptor::PrependToDetailMsg( const char * msg ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ErrorDescriptor::AppendToDetailMsg( const char c ) {
|
void ErrorDescriptor::AppendToDetailMsg( const char c ) {
|
||||||
_detailMsg.append( &c );
|
_detailMsg.push_back( c );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ErrorDescriptor::AppendToDetailMsg( const char * msg ) {
|
void ErrorDescriptor::AppendToDetailMsg( const char * msg ) {
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,9 @@
|
||||||
#include "express/info.h"
|
#include "express/info.h"
|
||||||
#include "express/linklist.h"
|
#include "express/linklist.h"
|
||||||
|
|
||||||
|
#if defined( _WIN32 ) || defined ( __WIN32__ )
|
||||||
|
# define snprintf _snprintf
|
||||||
|
#endif
|
||||||
|
|
||||||
bool __ERROR_buffer_errors = false;
|
bool __ERROR_buffer_errors = false;
|
||||||
const char * current_filename = "stdin";
|
const char * current_filename = "stdin";
|
||||||
|
|
@ -112,6 +115,7 @@ static struct heap_element {
|
||||||
static int ERROR_with_lines = 0; /**< number of warnings & errors that have occurred with a line number */
|
static int ERROR_with_lines = 0; /**< number of warnings & errors that have occurred with a line number */
|
||||||
static char * ERROR_string;
|
static char * ERROR_string;
|
||||||
static char * ERROR_string_base;
|
static char * ERROR_string_base;
|
||||||
|
static char * ERROR_string_end;
|
||||||
|
|
||||||
static bool ERROR_unsafe = false;
|
static bool ERROR_unsafe = false;
|
||||||
static jmp_buf ERROR_safe_env;
|
static jmp_buf ERROR_safe_env;
|
||||||
|
|
@ -119,6 +123,34 @@ static jmp_buf ERROR_safe_env;
|
||||||
|
|
||||||
#define error_file stderr /**< message buffer file */
|
#define error_file stderr /**< message buffer file */
|
||||||
|
|
||||||
|
static int ERROR_vprintf( const char *format, va_list ap ) {
|
||||||
|
int result = snprintf( ERROR_string, ERROR_string_end - ERROR_string, format, ap );
|
||||||
|
if(result < 0) {
|
||||||
|
ERROR_string = ERROR_string_end;
|
||||||
|
} else if(result > (ERROR_string_end - ERROR_string)) {
|
||||||
|
ERROR_string = ERROR_string_end;
|
||||||
|
} else {
|
||||||
|
ERROR_string = ERROR_string + result;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int ERROR_printf( const char *format, ... ) {
|
||||||
|
int result;
|
||||||
|
va_list ap;
|
||||||
|
va_start( ap, format );
|
||||||
|
result = ERROR_vprintf( format, ap );
|
||||||
|
va_end( ap );
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ERROR_nexterror() {
|
||||||
|
if( ERROR_string == ERROR_string_end ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ERROR_string++;
|
||||||
|
}
|
||||||
|
|
||||||
/** Initialize the Error module */
|
/** Initialize the Error module */
|
||||||
void ERRORinitialize( void ) {
|
void ERRORinitialize( void ) {
|
||||||
ERROR_subordinate_failed =
|
ERROR_subordinate_failed =
|
||||||
|
|
@ -127,6 +159,7 @@ void ERRORinitialize( void ) {
|
||||||
ERRORcreate( "%s, expecting %s in %s %s", SEVERITY_EXIT );
|
ERRORcreate( "%s, expecting %s in %s %s", SEVERITY_EXIT );
|
||||||
|
|
||||||
ERROR_string_base = ( char * )sc_malloc( ERROR_MAX_SPACE );
|
ERROR_string_base = ( char * )sc_malloc( ERROR_MAX_SPACE );
|
||||||
|
ERROR_string_end = ERROR_string_base + ERROR_MAX_SPACE;
|
||||||
ERROR_start_message_buffer();
|
ERROR_start_message_buffer();
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -377,20 +410,14 @@ va_dcl {
|
||||||
heap[child].msg = ERROR_string;
|
heap[child].msg = ERROR_string;
|
||||||
|
|
||||||
if( what->severity >= SEVERITY_ERROR ) {
|
if( what->severity >= SEVERITY_ERROR ) {
|
||||||
sprintf( ERROR_string, "%s:%d: --ERROR PE%03d: ", sym->filename, sym->line, what->serial );
|
ERROR_printf( "%s:%d: --ERROR PE%03d: ", sym->filename, sym->line, what->serial );
|
||||||
ERROR_string += strlen( ERROR_string );
|
ERROR_vprintf( what->message, args );
|
||||||
vsprintf( ERROR_string, what->message, args );
|
ERROR_nexterror();
|
||||||
ERROR_string += strlen( ERROR_string );
|
|
||||||
*ERROR_string++ = '\n';
|
|
||||||
*ERROR_string++ = '\0';
|
|
||||||
ERRORoccurred = true;
|
ERRORoccurred = true;
|
||||||
} else {
|
} else {
|
||||||
sprintf( ERROR_string, "%s:%d: WARNING PW%03d: ", sym->filename, sym->line, what->serial );
|
ERROR_printf( "%s:%d: WARNING PW%03d: ", sym->filename, sym->line, what->serial );
|
||||||
ERROR_string += strlen( ERROR_string );
|
ERROR_vprintf( what->message, args );
|
||||||
vsprintf( ERROR_string, what->message, args );
|
ERROR_nexterror();
|
||||||
ERROR_string += strlen( ERROR_string );
|
|
||||||
*ERROR_string++ = '\n';
|
|
||||||
*ERROR_string++ = '\0';
|
|
||||||
}
|
}
|
||||||
if( what->severity >= SEVERITY_EXIT ||
|
if( what->severity >= SEVERITY_EXIT ||
|
||||||
ERROR_string + ERROR_MAX_STRLEN > ERROR_string_base + ERROR_MAX_SPACE ||
|
ERROR_string + ERROR_MAX_STRLEN > ERROR_string_base + ERROR_MAX_SPACE ||
|
||||||
|
|
@ -410,7 +437,6 @@ va_dcl {
|
||||||
ERRORoccurred = true;
|
ERRORoccurred = true;
|
||||||
} else {
|
} else {
|
||||||
fprintf( error_file, "%s:%d: WARNING PW%03d: ", sym->filename, sym->line, what->serial );
|
fprintf( error_file, "%s:%d: WARNING PW%03d: ", sym->filename, sym->line, what->serial );
|
||||||
ERROR_string += strlen( ERROR_string ) + 1;
|
|
||||||
vfprintf( error_file, what->message, args );
|
vfprintf( error_file, what->message, args );
|
||||||
fprintf( error_file, "\n" );
|
fprintf( error_file, "\n" );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue