Skip to content

Commit

Permalink
fbc: internal: add error/warning message sentinel
Browse files Browse the repository at this point in the history
Try and make easier to resolve conflicts when
error messages and warning messages are added on
two different development branches.  The conflicts
should be easy to resolve using both commits but are
typically complicated by the position of the comma
in the array initializer list.

- add end of list marker to error.bas:warningMsgs()
- add end of list marker to error.bas:errorMsgs()
  • Loading branch information
jayrm committed Jan 2, 2024
1 parent c6250f6 commit 5711128
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/compiler/error.bas
Expand Up @@ -41,7 +41,7 @@ declare function hMakeParamDesc _
''globals
dim shared errctx as FB_ERRCTX

dim shared warningMsgs( 1 to FB_WARNINGMSGS-1 ) as FBWARNING = _
dim shared warningMsgs( 1 to FB_WARNINGMSGS ) as FBWARNING = _
{ _
( /'FB_WARNINGMSG_PASSINGSCALARASPTR '/ 2, @"Passing scalar as pointer" ), _
( /'FB_WARNINGMSG_PASSINGPTRTOSCALAR '/ 2, @"Passing pointer to scalar" ), _
Expand Down Expand Up @@ -92,10 +92,11 @@ declare function hMakeParamDesc _
( /'FB_WARNINGMSG_RESERVEDGLOBALSYMBOL '/ 1, @"Use of reserved global or backend symbol" ), _
( /'FB_WARNINGMSG_EXPECTEDDIGIT '/ 1, @"Expected digit" ), _
( /'FB_WARNINGMSG_UPCASTDISCARDSINITIALIZER '/ 1, @"Up-casting discards initializer(s)" ), _
( /'FB_WARNINGMSG_BYREFTEMPVAR '/ 2, @"Suspicious address expression passed to BYREF parameter" ) _
( /'FB_WARNINGMSG_BYREFTEMPVAR '/ 2, @"Suspicious address expression passed to BYREF parameter" ), _
( /'FB_WARNINGMSGS '/ 0, @"FB_WARNINGMSGS" ) _
}

dim shared errorMsgs( 1 to FB_ERRMSGS-1 ) as const zstring ptr => _
dim shared errorMsgs( 1 to FB_ERRMSGS ) as const zstring ptr => _
{ _
/'FB_ERRMSG_ARGCNTMISMATCH '/ @"Argument count mismatch", _
/'FB_ERRMSG_EXPECTEDEOF '/ @"Expected End-of-File", _
Expand Down Expand Up @@ -424,7 +425,8 @@ declare function hMakeParamDesc _
/'FB_ERRMSG_ILLEGALUSEOFRESERVEDSYMBOL '/ @"Illegal use of reserved symbol", _
/'FB_ERRMSG_EXPECTEDCOMMAORSEMICOLON '/ @"Expected ',' or ';'", _
/'FB_ERRMSG_EXPECTEDFILENUMBEREXPRESSION '/ @"Expected file number expression", _
/'FB_ERRMSG_MALFORMEDSOURCEDATEEPOCH '/ @"Malformed SOURCE_DATE_EPOCH environment variable" _
/'FB_ERRMSG_MALFORMEDSOURCEDATEEPOCH '/ @"Malformed SOURCE_DATE_EPOCH environment variable", _
/'FB_ERRMSGS '/ @"FB_ERRMSGS" _
}


Expand All @@ -445,6 +447,12 @@ sub errInit( )
hashInit( @errctx.undefhash, 64, TRUE )

listInit( @errctx.paramlocations, 4, sizeof( ERRPARAMLOCATION ) )

'' sanity check that warningMsgs() and errorMsgs() are the correct length
assert( ubound(warningMsgs) = FB_WARNINGMSGS )
assert( *warningMsgs(FB_WARNINGMSGS).text = "FB_WARNINGMSGS" )
assert( ubound(errorMsgs) = FB_ERRMSGS )
assert( *errorMsgs(FB_ERRMSGS) = "FB_ERRMSGS" )
end sub

sub errEnd( )
Expand Down

0 comments on commit 5711128

Please sign in to comment.