Skip to content

Commit 4dff145

Browse files
committed
cast-conv-ptr: reassign level of new 'w funcptr'
- the new messages for 'w funcptr' checks are bumped down one level so that they are not generated by default - it looks a little weird that the warning level is output as (-1), but this is least amount of change, so will go with it for now.
1 parent df92bd2 commit 4dff145

File tree

5 files changed

+21
-10
lines changed

5 files changed

+21
-10
lines changed

src/compiler/error.bas

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,10 @@ declare function hMakeParamDesc _
8282
( 1, @"" ), _ '' FB_WARNINGMSG_AMBIGIOUSLENSIZEOF
8383
( 0, @"Suspicious logic operation, mixed boolean and non-boolean operands" ), _
8484
( 0, @"Redefinition of intrinsic" ), _
85-
( 0, @"CONST qualifier discarded" ), _
86-
( 0, @"Return type mismatch" ), _
87-
( 0, @"Calling convention mismatch" ), _
88-
( 0, @"Argument count mismatch" ) _
85+
(-1, @"CONST qualifier discarded" ), _
86+
(-1, @"Return type mismatch" ), _
87+
(-1, @"Calling convention mismatch" ), _
88+
(-1, @"Argument count mismatch" ) _
8989
}
9090

9191
dim shared errorMsgs( 1 to FB_ERRMSGS-1 ) as const zstring ptr => _

src/compiler/error.bi

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,10 @@ enum FB_WARNINGMSG
380380
FB_WARNINGMSGS
381381
end enum
382382

383+
const FB_WARNINGMSGS_LOWEST_LEVEL = -1
384+
const FB_WARNINGMSGS_DEFAULT_LEVEL = 0
385+
const FB_WARNINGMSGS_HIGHEST_LEVEL = 2
386+
383387
enum FB_ERRMSGOPT
384388
FB_ERRMSGOPT_NONE = &h00000000
385389
FB_ERRMSGOPT_ADDCOMMA = &h00000001

src/compiler/fb.bas

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ sub fbGlobalInit()
466466
env.clopt.resumeerr = FALSE
467467
env.clopt.profile = FALSE
468468

469-
env.clopt.warninglevel = 0
469+
env.clopt.warninglevel = FB_WARNINGMSGS_DEFAULT_LEVEL
470470
env.clopt.showerror = TRUE
471471
env.clopt.maxerrors = FB_DEFAULT_MAXERRORS
472472
env.clopt.pdcheckopt = FB_PDCHECK_NONE

src/compiler/fb.bi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ type FBCMMLINEOPT
250250
profile as integer '' build profiling code (default = false)
251251

252252
'' error/warning reporting behaviour
253-
warninglevel as integer '' (default = 0)
253+
warninglevel as integer '' (default = FB_WARNINGMSGS_DEFAULT_LEVEL)
254254
showerror as integer '' show line giving error (default = true)
255255
maxerrors as integer '' max number errors the parser will show
256256
pdcheckopt as FB_PDCHECK '' pedantic checks

src/compiler/fbc.bas

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1816,11 +1816,14 @@ private sub handleOpt(byval optid as integer, byref arg as string)
18161816
fbc.showversion = TRUE
18171817

18181818
case OPT_W
1819-
dim as integer value = -2
1819+
dim as integer value = FB_WARNINGMSGS_LOWEST_LEVEL - 1
18201820

18211821
select case (arg)
18221822
case "all"
1823-
value = -1
1823+
value = FB_WARNINGMSGS_LOWEST_LEVEL
1824+
1825+
case "none"
1826+
value = FB_WARNINGMSGS_HIGHEST_LEVEL + 1
18241827

18251828
case "param"
18261829
fbSetOption( FB_COMPOPT_PEDANTICCHK, _
@@ -1841,20 +1844,24 @@ private sub handleOpt(byval optid as integer, byref arg as string)
18411844
case "constness"
18421845
fbSetOption( FB_COMPOPT_PEDANTICCHK, _
18431846
fbGetOption( FB_COMPOPT_PEDANTICCHK ) or FB_PDCHECK_CONSTNESS )
1847+
value = FB_WARNINGMSGS_LOWEST_LEVEL
18441848

18451849
case "funcptr"
18461850
fbSetOption( FB_COMPOPT_PEDANTICCHK, _
18471851
fbGetOption( FB_COMPOPT_PEDANTICCHK ) or FB_PDCHECK_CASTFUNCPTR )
1852+
value = FB_WARNINGMSGS_LOWEST_LEVEL
18481853

18491854
case "pedantic"
18501855
fbSetOption( FB_COMPOPT_PEDANTICCHK, FB_PDCHECK_DEFAULT )
1851-
value = -1
1856+
if( value > FB_WARNINGMSGS_DEFAULT_LEVEL ) then
1857+
value = FB_WARNINGMSGS_DEFAULT_LEVEL
1858+
end if
18521859

18531860
case else
18541861
value = clng( arg )
18551862
end select
18561863

1857-
if( value >= -1 ) then
1864+
if( value >= FB_WARNINGMSGS_LOWEST_LEVEL ) then
18581865
fbSetOption( FB_COMPOPT_WARNINGLEVEL, value )
18591866
end if
18601867

0 commit comments

Comments
 (0)