Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ Version 1.07.0

[changed]
- SADD/STRPTR(wstring) returns WSTRING PTR
- '-v' be verbose command line option affects '-help' output

[added]
- CVA_LIST type, CVA_START(), CVA_COPY() CVA_END(), CVA_ARG() macros will map to gcc's __builtin_va_list and __builtin_va_* macros in gcc backend
Expand All @@ -24,6 +25,12 @@ Version 1.07.0
- SWAP statement will accept UDT as Z|WSTRING
- IIF function will accept UDT as Z|WSTRING
- PRINT/LPRINT/WRITE will accept UDT as Z|WSTRING
- '-earray' command line option to enable array bounds checking
- '-enullptr' command line option to enable null pointer checking
- '-eassert' command line option to enable assert() and assertwarn() checking
- '-edebug' command line option to enable __FB_DEBUG__
- '-edebuginfo' command line option to enable debug symbols
- '-elocation' command line option to enable reporting error location

[fixed]
- sf.net #881: C backend: support for varadic function parameters in gcc using __builtin_va_list type and related macros
Expand Down
22 changes: 20 additions & 2 deletions doc/fbc.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH FBC 1 "2019-05-20" "FreeBASIC Compiler 1.07.0" "FreeBASIC Compiler"
.TH FBC 1 "2019-07-23" "FreeBASIC Compiler 1.07.0" "FreeBASIC Compiler"
.SH NAME
fbc \- The FreeBASIC compiler
.SH DESCRIPTION
Expand Down Expand Up @@ -45,6 +45,24 @@ Create a Win32 DLL or Linux/*BSD shared library
\fB\-e\fR
Enable runtime error checking
.TP
\fB\-earray\fR
Enable array bounds checking
.TP
\fB\-eassert\fR
Enable assert() and assertwarn() checking
.TP
\fB\-edebug\fR
Enable __FB_DEBUG__
.TP
\fB\-edebuginfo\fR
Add debug information
.TP
\fB\-elocation\fR
Enable full error location reporting
.TP
\fB\-enullptr\fR
Enable null-pointer checking
.TP
\fB\-ex\fR
\fB-e\fR plus RESUME support
.TP
Expand All @@ -64,7 +82,7 @@ Select floating-point math accuracy/speed
Set target FPU
.TP
\fB\-g\fR
Add debug info
Add debug info, enable __FB_DEBUG__, and enable asserts
.TP
\fB\-gen\fR \fBgas\fR|\fBgcc\fR|\fBllvm\fR
Select code generation backend
Expand Down
4 changes: 2 additions & 2 deletions src/compiler/ast-helper.bas
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ function astBuildVtableLookup _

'' null pointer checking for ABSTRACTs
'' (in case it wasn't overridden)
if( env.clopt.extraerrchk ) then
if( env.clopt.nullptrchk ) then
if( symbIsAbstract( proc ) ) then
p = astBuildPTRCHK( p )
end if
Expand Down Expand Up @@ -793,7 +793,7 @@ function astBuildMultiDeref _
end select

'' null pointer checking
if( env.clopt.extraerrchk ) then
if( env.clopt.nullptrchk ) then
expr = astBuildPTRCHK( expr )
end if

Expand Down
4 changes: 2 additions & 2 deletions src/compiler/ast-node-addr.bas
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ function astNewADDROF( byval l as ASTNODE ptr ) as ASTNODE ptr

select case( t->class )
case AST_NODECLASS_DEREF
if( env.clopt.extraerrchk ) then
if( env.clopt.nullptrchk ) then
hRemoveNullPtrCheck( t )
end if

Expand All @@ -152,7 +152,7 @@ function astNewADDROF( byval l as ASTNODE ptr ) as ASTNODE ptr
case AST_NODECLASS_FIELD
'' @0->field to const
if( t->l->class = AST_NODECLASS_DEREF ) then
if( env.clopt.extraerrchk ) then
if( env.clopt.nullptrchk ) then
hRemoveNullPtrCheck( t->l )
end if

Expand Down
10 changes: 4 additions & 6 deletions src/compiler/ast-node-proc.bas
Original file line number Diff line number Diff line change
Expand Up @@ -535,20 +535,18 @@ private function hCheckErrHnd _

'' error check? add to head (must be done only when closing the proc body
'' or constructor's field would be initialized and break ctor chaining)
if( env.clopt.extraerrchk ) then
if( env.clopt.errlocation ) then
head_node = astAddAfter( rtlErrorSetModName( sym, _
astNewCONSTstr( @env.inf.name ) ), _
head_node )
astNewCONSTstr( @env.inf.name ) ), head_node )

head_node = astAddAfter( rtlErrorSetFuncName( sym, _
astNewCONSTstr( symbGetName( sym ) ) ), _
head_node )
astNewCONSTstr( symbGetName( sym ) ) ), head_node )
end if

with sym->proc.ext->err
if( .lastfun <> NULL ) then
astAdd( rtlErrorSetFuncName( NULL, astNewVAR( .lastfun ) ) )
.lastfun = NULL
.lastfun = NULL
end if

if( .lastmod <> NULL ) then
Expand Down
20 changes: 20 additions & 0 deletions src/compiler/fb.bas
Original file line number Diff line number Diff line change
Expand Up @@ -459,10 +459,14 @@ sub fbGlobalInit()
env.clopt.lang = FB_DEFAULT_LANG
env.clopt.forcelang = FALSE

env.clopt.debug = FALSE
env.clopt.debuginfo = FALSE
env.clopt.assertions = FALSE
env.clopt.errorcheck = FALSE
env.clopt.extraerrchk = FALSE
env.clopt.errlocation = FALSE
env.clopt.arrayboundchk = FALSE
env.clopt.nullptrchk = FALSE
env.clopt.resumeerr = FALSE
env.clopt.profile = FALSE

Expand Down Expand Up @@ -529,6 +533,8 @@ sub fbSetOption( byval opt as integer, byval value as integer )
case FB_COMPOPT_FORCELANG
env.clopt.forcelang = value

case FB_COMPOPT_DEBUG
env.clopt.debug = value
case FB_COMPOPT_DEBUGINFO
env.clopt.debuginfo = value
case FB_COMPOPT_ASSERTIONS
Expand All @@ -539,6 +545,12 @@ sub fbSetOption( byval opt as integer, byval value as integer )
env.clopt.resumeerr = value
case FB_COMPOPT_EXTRAERRCHECK
env.clopt.extraerrchk = value
case FB_COMPOPT_ERRLOCATION
env.clopt.errlocation = value
case FB_COMPOPT_ARRAYBOUNDCHECK
env.clopt.arrayboundchk = value
case FB_COMPOPT_NULLPTRCHECK
env.clopt.nullptrchk = value
case FB_COMPOPT_PROFILE
env.clopt.profile = value

Expand Down Expand Up @@ -608,6 +620,8 @@ function fbGetOption( byval opt as integer ) as integer
case FB_COMPOPT_FORCELANG
function = env.clopt.forcelang

case FB_COMPOPT_DEBUG
function = env.clopt.debug
case FB_COMPOPT_DEBUGINFO
function = env.clopt.debuginfo
case FB_COMPOPT_ASSERTIONS
Expand All @@ -618,6 +632,12 @@ function fbGetOption( byval opt as integer ) as integer
function = env.clopt.resumeerr
case FB_COMPOPT_EXTRAERRCHECK
function = env.clopt.extraerrchk
case FB_COMPOPT_ERRLOCATION
function = env.clopt.errlocation
case FB_COMPOPT_ARRAYBOUNDCHECK
function = env.clopt.arrayboundchk
case FB_COMPOPT_NULLPTRCHECK
function = env.clopt.nullptrchk
case FB_COMPOPT_PROFILE
function = env.clopt.profile

Expand Down
14 changes: 11 additions & 3 deletions src/compiler/fb.bi
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,15 @@ enum FB_COMPOPT
FB_COMPOPT_FORCELANG '' boolean: TRUE if -forcelang was specified

'' debugging/error checking
FB_COMPOPT_DEBUGINFO '' boolean: debugging info (affects code generation)
FB_COMPOPT_ASSERTIONS '' boolean: enable assert() and __FB_DEBUG__
FB_COMPOPT_DEBUG '' boolean: enable __FB_DEBUG__ (affects code generation)
FB_COMPOPT_DEBUGINFO '' boolean: enable debugging info (affects code generation)
FB_COMPOPT_ASSERTIONS '' boolean: enable assert()
FB_COMPOPT_ERRORCHECK '' boolean: runtime error checks
FB_COMPOPT_RESUMEERROR '' boolean: RESUME support
FB_COMPOPT_EXTRAERRCHECK '' boolean: NULL pointer/array bounds checks
FB_COMPOPT_ERRLOCATION '' boolean: enable reporting of error location
FB_COMPOPT_NULLPTRCHECK '' boolean: NULL pointer
FB_COMPOPT_ARRAYBOUNDCHECK '' boolean: array bounds checks
FB_COMPOPT_PROFILE '' boolean: -profile

'' error/warning reporting behaviour
Expand Down Expand Up @@ -251,11 +255,15 @@ type FBCMMLINEOPT
forcelang as integer '' TRUE if -forcelang was specified

'' debugging/error checking
debug as integer '' true = enable __FB_DEBUG__ (default = false)
debuginfo as integer '' true = add debug info (default = false)
assertions as integer '' true = enable assert() and __FB_DEBUG__ (default = false)
assertions as integer '' true = enable assert() (default = false)
errorcheck as integer '' enable runtime error checks?
resumeerr as integer '' enable RESUME support?
extraerrchk as integer '' enable NULL pointer/array bounds checks?
errlocation as integer '' enable reporting of error location (default = false)
arrayboundchk as integer '' enable array bounds checks?
nullptrchk as integer '' enable NULL pointer checks?
profile as integer '' build profiling code (default = false)

'' error/warning reporting behaviour
Expand Down
Loading