Skip to content

Commit a57fede

Browse files
committed
fbc: add '-v' verbose modes for '-help' and '-version'
1 parent 03ee65e commit a57fede

File tree

2 files changed

+30
-8
lines changed

2 files changed

+30
-8
lines changed

changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ Version 1.07.0
22

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

67
[added]
78
- 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

src/compiler/fbc.bas

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3398,7 +3398,7 @@ private sub hAddDefaultLibs( )
33983398

33993399
end sub
34003400

3401-
private sub hPrintOptions( )
3401+
private sub hPrintOptions( byval verbose as integer )
34023402
'' Note: must print each line separately to let the rtlib print the
34033403
'' proper line endings even if redirected to file/pipe, hard-coding \n
34043404
'' here isn't enough for DOS/Windows.
@@ -3420,25 +3420,37 @@ private sub hPrintOptions( )
34203420
print " -dll Same as -dylib"
34213421
print " -dylib Create a DLL (win32) or shared library (*nix/*BSD)"
34223422
print " -e Enable runtime error checking"
3423+
3424+
if( verbose ) then
34233425
print " -earray Enable array bounds checking"
34243426
print " -eassert Enable assert() and assertwarn() checking"
34253427
print " -edebug Enable __FB_DEBUG__"
34263428
print " -edebuginfo Add debug info"
34273429
print " -elocation Enable reporting error location"
34283430
print " -enullptr Enable null-pointer checking"
3431+
end if
3432+
34293433
print " -ex -e plus RESUME support"
34303434
print " -exx -ex plus array bounds/null-pointer checking"
34313435
print " -export Export symbols for dynamic linkage"
34323436
print " -forcelang <name> Override #lang statements in source code"
34333437
print " -fpmode fast|precise Select floating-point math accuracy/speed"
34343438
print " -fpu x87|sse Set target FPU"
34353439
print " -g Add debug info, define __FB_DEBUG__, and enable assert()"
3440+
3441+
if( verbose ) then
3442+
print " -gen gas Select GNU gas assembler backend"
3443+
print " -gen gcc Select GNU gcc C backend"
3444+
print " -gen llvm Select LLVM backend"
3445+
else
34363446
print " -gen gas|gcc|llvm Select code generation backend"
3447+
end if
3448+
34373449
print " [-]-help Show this help output"
34383450
print " -i <path> Add an include file search path"
34393451
print " -include <file> Pre-#include a file for each input .bas"
34403452
print " -l <name> Link in a library"
3441-
print " -lang <name> Select FB dialect: deprecated, fblite, qb"
3453+
print " -lang <name> Select FB dialect: fb, deprecated, fblite, qb"
34423454
print " -lib Create a static library"
34433455
print " -m <name> Specify main module (default if not -c: first input .bas)"
34443456
print " -map <file> Save linking map to file"
@@ -3467,7 +3479,11 @@ private sub hPrintOptions( )
34673479
print " -static Prefer static libraries over dynamic ones when linking"
34683480
print " -strip Omit all symbol information from the output file"
34693481
print " -t <value> Set .exe stack size in kbytes, default: 1024 (win32/dos)"
3482+
if( verbose ) then
34703483
print " -target <name> Set cross-compilation target"
3484+
else
3485+
print " -target <name> Set cross-compilation target"
3486+
end if
34713487
print " -title <name> Set XBE display title (xbox)"
34723488
print " -v Be verbose"
34733489
print " -vec <n> Automatic vectorization level (default: 0)"
@@ -3477,7 +3493,12 @@ private sub hPrintOptions( )
34773493
print " -Wc <a,b,c> Pass options to 'gcc' (-gen gcc) or 'llc' (-gen llvm)"
34783494
print " -Wl <a,b,c> Pass options to 'ld'"
34793495
print " -x <file> Set output executable/library file name"
3496+
3497+
if( verbose ) then
34803498
print " -z gosub-setjmp Use setjmp/longjmp to implement GOSUB"
3499+
print " -z valist-as-ptr Use pointer expressions to implement CVA_*() macros"
3500+
end if
3501+
34813502
end sub
34823503

34833504
private sub hAppendConfigInfo( byref config as string, byval info as zstring ptr )
@@ -3487,7 +3508,7 @@ private sub hAppendConfigInfo( byref config as string, byval info as zstring ptr
34873508
config += *info
34883509
end sub
34893510

3490-
private sub hPrintVersion( )
3511+
private sub hPrintVersion( byval verbose as integer )
34913512
dim as string config
34923513

34933514
print "FreeBASIC Compiler - Version " + FB_VERSION + _
@@ -3510,24 +3531,24 @@ end sub
35103531
fbcInit( )
35113532

35123533
if( __FB_ARGC__ = 1 ) then
3513-
hPrintOptions( )
3534+
hPrintOptions( FALSE )
35143535
fbcEnd( 1 )
35153536
end if
35163537

35173538
hParseArgs( __FB_ARGC__, __FB_ARGV__ )
35183539

35193540
if( fbc.showversion ) then
3520-
hPrintVersion( )
3541+
hPrintVersion( fbc.verbose )
35213542
fbcEnd( 0 )
35223543
end if
35233544

35243545
if( fbc.verbose ) then
3525-
hPrintVersion( )
3546+
hPrintVersion( FALSE )
35263547
end if
35273548

35283549
'' Show help if --help was given
35293550
if( fbc.showhelp ) then
3530-
hPrintOptions( )
3551+
hPrintOptions( fbc.verbose )
35313552
fbcEnd( 1 )
35323553
end if
35333554

@@ -3574,7 +3595,7 @@ end sub
35743595

35753596
'' Show help if there are no input files
35763597
if( have_input_files = FALSE ) then
3577-
hPrintOptions( )
3598+
hPrintOptions( fbc.verbose )
35783599
fbcEnd( 1 )
35793600
end if
35803601

0 commit comments

Comments
 (0)