From 9f8516c76fb65ac26b6900617ea5aa19ecca1228 Mon Sep 17 00:00:00 2001 From: Jan Max Meyer Date: Thu, 1 Aug 2019 13:51:18 +0200 Subject: [PATCH] v1.6.2 introducing ERRSTYLE_IMPORTANT for important warnings --- CHANGELOG.md | 1 + error.c | 4 ++-- parse.c | 21 +++++++++++---------- parse.par | 5 +++-- unicc.h | 19 ++++++++++--------- 5 files changed, 27 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f53779..ff66322 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ This is the current development version. Released on: May 27, 2019 +- v1.6.2: Provide ERRSTYLE_IMPORTANT-flag to show up important warnings - v1.6.1: Removed memory leaking bug - Renamed top-level directive `#!mode` options to `scannerless` (default) and `scanner`. diff --git a/error.c b/error.c index aa2c907..60c926c 100644 --- a/error.c +++ b/error.c @@ -51,7 +51,7 @@ char* error_txt[128] = "Action references to undefined right-hand side symbol '%.*s'", "Left-hand side '%s' not known", "Terminal '%s' not known", - "Semantic code will be ignored: No target specified.", + "Ignoring semantic code: `#!languageĀ“ must explicitly be specified.", "Multiple use of directive '#%s' ignored; It has already been defined." }; @@ -88,7 +88,7 @@ void print_error( PARSER* parser, ERRORCODE err_id, int err_style, ... ) va_start( params, err_style ); if( err_style & ERRSTYLE_WARNING && no_warnings ) - do_print = FALSE; + do_print = TRUEBOOLEAN( err_style & ERRSTYLE_IMPORTANT ); if( parser->gen_xml ) { diff --git a/parse.c b/parse.c index 04b069e..b6a369f 100644 --- a/parse.c +++ b/parse.c @@ -3673,8 +3673,9 @@ int _parse( _pcb* pcb ) { print_error( parser, ERR_NO_TARGET_TPL_SUPPLY, - ERRSTYLE_WARNING | ERRSTYLE_FILEINFO, - parser->filename, last_code_begin ); + ERRSTYLE_WARNING | ERRSTYLE_IMPORTANT + | ERRSTYLE_FILEINFO, + parser->filename, last_code_begin ); reset_strbuf(); } @@ -3683,7 +3684,7 @@ int _parse( _pcb* pcb ) } break; case 153: { - #line 1142 "parse.par" + #line 1143 "parse.par" last_code_begin = line; ; } break; @@ -3694,19 +3695,19 @@ int _parse( _pcb* pcb ) } break; case 155: { - #line 1146 "parse.par" + #line 1147 "parse.par" reset_strbuf(); ; } break; case 156: { - #line 1150 "parse.par" + #line 1151 "parse.par" strbuf_append( ( ( pcb->tos - 0 )->value.value_5 ) ); ; } break; case 157: { - #line 1153 "parse.par" + #line 1154 "parse.par" reset_strbuf(); strbuf_append( ( ( pcb->tos - 0 )->value.value_5 ) ); @@ -3724,7 +3725,7 @@ int _parse( _pcb* pcb ) } break; case 163: { - #line 1163 "parse.par" + #line 1164 "parse.par" line++; ; } break; @@ -3740,7 +3741,7 @@ int _parse( _pcb* pcb ) } break; case 167: { - #line 1167 "parse.par" + #line 1168 "parse.par" line++; ; } break; @@ -3756,7 +3757,7 @@ int _parse( _pcb* pcb ) } break; case 170: { - #line 1175 "parse.par" + #line 1176 "parse.par" if( ( ( pcb->tos - 0 )->value.value_5 ) == '\n' ) line++; pcb->ret.value_5 = ( ( pcb->tos - 0 )->value.value_5 ); @@ -3775,7 +3776,7 @@ int _parse( _pcb* pcb ) } break; case 173: { - #line 1185 "parse.par" + #line 1186 "parse.par" pcb->ret.value_5 = line; ; } break; diff --git a/parse.par b/parse.par index c254e1f..d44c2e3 100644 --- a/parse.par +++ b/parse.par @@ -1129,8 +1129,9 @@ code : code_begin inner_code_opt "*]" { print_error( parser, ERR_NO_TARGET_TPL_SUPPLY, - ERRSTYLE_WARNING | ERRSTYLE_FILEINFO, - parser->filename, last_code_begin ); + ERRSTYLE_WARNING | ERRSTYLE_IMPORTANT + | ERRSTYLE_FILEINFO, + parser->filename, last_code_begin ); reset_strbuf(); } diff --git a/unicc.h b/unicc.h index 4f57151..fdedcac 100644 --- a/unicc.h +++ b/unicc.h @@ -84,7 +84,7 @@ Usage: Global declarations, structures and includes /* UniCC version number */ #define UNICC_VER_MAJOR 1 #define UNICC_VER_MINOR 6 -#define UNICC_VER_PATCH 1 +#define UNICC_VER_PATCH 2 #define UNICC_VER_EXTSTR "" /* Default target language */ @@ -446,14 +446,15 @@ struct _generator /* Error styles */ -#define ERRSTYLE_NONE 0 -#define ERRSTYLE_FATAL 1 -#define ERRSTYLE_WARNING 2 -#define ERRSTYLE_FILEINFO 4 -#define ERRSTYLE_STATEINFO 8 -#define ERRSTYLE_LINEINFO 16 -#define ERRSTYLE_PRODUCTION 32 -#define ERRSTYLE_SYMBOL 64 +#define ERRSTYLE_NONE 0x00 +#define ERRSTYLE_FATAL 0x01 +#define ERRSTYLE_WARNING 0x02 +#define ERRSTYLE_IMPORTANT 0x04 +#define ERRSTYLE_FILEINFO 0x08 +#define ERRSTYLE_STATEINFO 0x10 +#define ERRSTYLE_LINEINFO 0x20 +#define ERRSTYLE_PRODUCTION 0x40 +#define ERRSTYLE_SYMBOL 0x80 /* Error codes */