Skip to content

Commit

Permalink
v1.6.2 introducing ERRSTYLE_IMPORTANT for important warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
phorward committed Aug 1, 2019
1 parent 72ad517 commit 9f8516c
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 23 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
4 changes: 2 additions & 2 deletions error.c
Original file line number Diff line number Diff line change
Expand Up @@ -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."
};

Expand Down Expand Up @@ -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 )
{
Expand Down
21 changes: 11 additions & 10 deletions parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand All @@ -3683,7 +3684,7 @@ int _parse( _pcb* pcb )
} break;
case 153:
{
#line 1142 "parse.par"
#line 1143 "parse.par"
last_code_begin = line;
;
} break;
Expand All @@ -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 ) );

Expand All @@ -3724,7 +3725,7 @@ int _parse( _pcb* pcb )
} break;
case 163:
{
#line 1163 "parse.par"
#line 1164 "parse.par"
line++;
;
} break;
Expand All @@ -3740,7 +3741,7 @@ int _parse( _pcb* pcb )
} break;
case 167:
{
#line 1167 "parse.par"
#line 1168 "parse.par"
line++;
;
} break;
Expand All @@ -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 );
Expand All @@ -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;
Expand Down
5 changes: 3 additions & 2 deletions parse.par
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
19 changes: 10 additions & 9 deletions unicc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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 */

Expand Down

0 comments on commit 9f8516c

Please sign in to comment.