+ -Sx command line switch to turn on exception keywords in non-Delphi/ObjFPC

modes (mainly for MacPas, to replace nested gotos with exceptions)

git-svn-id: trunk@4984 -
This commit is contained in:
Jonas Maebe 2006-10-20 12:54:47 +00:00
parent 5fd2688598
commit 36c6879581
8 changed files with 50 additions and 40 deletions

View File

@ -54,7 +54,7 @@ interface
[m_delphi,m_all,m_class,m_objpas,m_result,m_string_pchar,
m_pointer_2_procedure,m_autoderef,m_tp_procvar,m_initfinal,m_default_ansistring,
m_out,m_default_para,m_duplicate_names,m_hintdirective,m_add_pointer,
m_property,m_default_inline];
m_property,m_default_inline,m_except];
fpcmodeswitches : tmodeswitches=
[m_fpc,m_all,m_string_pchar,m_nested_comment,m_repeat_forward,
m_cvar_support,m_initfinal,m_add_pointer,m_hintdirective,
@ -62,7 +62,7 @@ interface
objfpcmodeswitches : tmodeswitches=
[m_objfpc,m_fpc,m_all,m_class,m_objpas,m_result,m_string_pchar,m_nested_comment,
m_repeat_forward,m_cvar_support,m_initfinal,m_add_pointer,m_out,m_default_para,m_hintdirective,
m_property,m_default_inline];
m_property,m_default_inline,m_except];
tpmodeswitches : tmodeswitches=
[m_tp7,m_all,m_tp_procvar,m_duplicate_names];
gpcmodeswitches : tmodeswitches=

View File

@ -122,7 +122,7 @@ than 255 characters. That's why using Ansi Strings}
mostly set with commandline }
tglobalswitch = (cs_globalnone,
{ parameter switches }
cs_check_unit_name,cs_constructor_name,
cs_check_unit_name,cs_constructor_name,cs_support_exceptions,
{ units }
cs_load_objpas_unit,
cs_load_gpc_unit,
@ -191,7 +191,8 @@ than 255 characters. That's why using Ansi Strings}
m_hintdirective, { support hint directives }
m_duplicate_names, { allow locals/paras to have duplicate names of globals }
m_property, { allow properties }
m_default_inline { allow inline proc directive }
m_default_inline, { allow inline proc directive }
m_except { allow exception-related keywords }
);
tmodeswitches = set of tmodeswitch;

View File

@ -2498,6 +2498,7 @@ S*2Aas_assemble using GNU AS
**2Sp_same as -Mgpc
**2Ss_constructor name must be init (destructor must be done)
**2St_allow static keyword in objects
**2Sx_enable exception keywords (default in Delphi/ObjFPC modes)
**1s_don't call assembler and linker
**2sh_Generate script to link on host
**2st_Generate script to link on target

View File

@ -700,7 +700,7 @@ const
option_info=11024;
option_help_pages=11025;
MsgTxtSize = 41424;
MsgTxtSize = 41489;
MsgIdxMax : array[1..20] of longint=(
24,81,224,78,62,47,102,22,135,60,

View File

@ -927,84 +927,85 @@ const msgtxt : array[0..000172,1..240] of char=(
'**2Sp_same as -Mgpc'#010+
'**2Ss_constructor name must be init (destructor must be done)'#010+
'**2St_allow static keyword in objects'#010+
'**2Sx_enable exception keywords (default in Delphi/ObjFPC modes)'#010+
'**1s_don'#039't call assembler and linker'#010+
'**2sh_Generate script to link on host'#010+
'**2st_Generate script to link on ','target'#010+
'**2sh_','Generate script to link on host'#010+
'**2st_Generate script to link on target'#010+
'**2sr_Skip register allocation phase (use with -alr)'#010+
'**1T<x>_Target operating system:'#010+
'3*2Temx_OS/2 via EMX (including EMX/RSX extender)'#010+
'3*2Tfreebsd_FreeBSD'#010+
'3*2Tgo32v2_Version 2 of DJ Delorie DOS extender'#010+
'3*2Tgo32v2_V','ersion 2 of DJ Delorie DOS extender'#010+
'3*2Tlinux_Linux'#010+
'3*2Tnetbsd_Ne','tBSD'#010+
'3*2Tnetbsd_NetBSD'#010+
'3*2Tnetware_Novell Netware Module (clib)'#010+
'3*2Tnetwlibc_Novell Netware Module (libc)'#010+
'3*2Topenbsd_OpenBSD'#010+
'3*2Tos2_OS/2 / eComStation'#010+
'3*2Tsunos_SunOS/Solaris'#010+
'3*2Twatcom_Watcom compatible DOS extender'#010+
'3*2Twatcom_Watco','m compatible DOS extender'#010+
'3*2Twdosx_WDOSX DOS extender'#010+
'3*2Twin32_','Windows 32 Bit'#010+
'3*2Twin32_Windows 32 Bit'#010+
'3*2Twince_Windows CE'#010+
'4*2Tlinux_Linux'#010+
'6*2Tamiga_Commodore Amiga'#010+
'6*2Tatari_Atari ST/STe/TT'#010+
'6*2Tlinux_Linux/m68k'#010+
'6*2Tmacos_Macintosh m68k (not supported)'#010+
'6*2Tpalmos_PalmOS'#010+
'6*2Tpalmo','s_PalmOS'#010+
'A*2Tlinux_Linux'#010+
'A*2Twince_Windows CE'#010+
'P*2Tamiga_AmigaOS o','n PowerPC'#010+
'P*2Tamiga_AmigaOS on PowerPC'#010+
'P*2Tdarwin_Darwin and MacOS X on PowerPC'#010+
'P*2Tlinux_Linux on PowerPC'#010+
'P*2Tmacos_MacOS (classic) on PowerPC'#010+
'P*2Tmorphos_MorphOS'#010+
'S*2Tlinux_Linux'#010+
'**1u<x>_undefines the symbol <x>'#010+
'**1u<x>_undefines the sy','mbol <x>'#010+
'**1U_unit options:'#010+
'**2Un_don'#039't check the unit name'#010+
'**2Ur','_generate release unit files'#010+
'**2Ur_generate release unit files'#010+
'**2Us_compile a system unit'#010+
'**1v<x>_Be verbose. <x> is a combination of the following letters:'#010+
'**2*_e : Show errors (default) 0 : Show nothing (except errors)'#010+
'**2*_w : Show warnings u : Show ','unit info'#010+
'**2*_e : Show errors (default) 0 : Show nothi','ng (except errors'+
')'#010+
'**2*_w : Show warnings u : Show unit info'#010+
'**2*_n : Show notes t : Show tried/used files'#010+
'**2*_h : Show hints c : Show conditionals'#010+
'**2*_i : Show general info d : Show debug info'#010+
'**2*_l : Show linenumbers r : Rhide/GCC ','compatibility mod'+
'e'#010+
'**2*_i : Show general info d : Sh','ow debug info'#010+
'**2*_l : Show linenumbers r : Rhide/GCC compatibility mode'#010+
'**2*_a : Show everything x : Executable info (Win32 only)'#010+
'**2*_b : Write file names messages with full path'#010+
'**2*_v : write fpcdebug.txt with p : Write tree.log with parse tre'+
'e'#010+
'**2*_ lots of debugging in','fo'#010+
'**2*_v : write fpcdebug.txt with ',' p : Write tree.log with parse t'+
'ree'#010+
'**2*_ lots of debugging info'#010+
'3*1W<x>_Win32-like target options'#010+
'3*2WB_Create a relocatable image'#010+
'3*2WB<x>_Set Image base to Hexadecimal <x> value'#010+
'3*2WC_Specify console type application'#010+
'3*2WD_Use DEFFILE to export functions of DLL or EXE'#010+
'3*2WF_Specify full-screen type',' application (OS/2 only)'#010+
'3*2WD_Use DEFFILE',' to export functions of DLL or EXE'#010+
'3*2WF_Specify full-screen type application (OS/2 only)'#010+
'3*2WG_Specify graphic type application'#010+
'3*2WN_Do not generate relocation code (necessary for debugging)'#010+
'3*2WR_Generate relocation code'#010+
'P*2WC_Specify console type application (MacOS only)'#010+
'P*2WG_Specify graphic type ap','plication (MacOS only)'#010+
'P*2WC_Specify co','nsole type application (MacOS only)'#010+
'P*2WG_Specify graphic type application (MacOS only)'#010+
'P*2WT_Specify tool type application (MPW tool, MacOS only)'#010+
'**1X_executable options:'#010+
'**2Xc_pass --shared to the linker (Unix only)'#010+
'**2Xd_don'#039't use standard library search path (needed for cross com'+
'pile)'#010+
'**2Xe_use exter','nal linker'#010+
'**2Xd_don'#039't use standa','rd library search path (needed for cross c'+
'ompile)'#010+
'**2Xe_use external linker'#010+
'**2XD_try to link units dynamic (defines FPC_LINK_DYNAMIC)'#010+
'**2Xi_use internal linker'#010+
'**2Xm_generate link map'#010+
'**2XM<x>_set the name of the '#039'main'#039' program routine (default i'+
's '#039'main'#039')'#010+
'**2XP<x>_prepend the binutils names wit','h the prefix <x>'#010+
'**2XM<x>_set the name of the '#039'main'#039' program ro','utine (default'+
' is '#039'main'#039')'#010+
'**2XP<x>_prepend the binutils names with the prefix <x>'#010+
'**2Xr<x>_set library search path to <x> (needed for cross compile)'#010+
'**2Xs_strip all symbols from executable'#010+
'**2XS_try to link units static (default) (defines FPC_LINK_STATIC)'#010+
'**2Xt_link with static libraries (-static is pass','ed to linker)'#010+
'**2XS_try to link units static (default) (defines F','PC_LINK_STATIC)'#010+
'**2Xt_link with static libraries (-static is passed to linker)'#010+
'**2XX_try to link units smart (defines FPC_LINK_SMART)'#010+
'**1*_'#010+
'**1?_shows this help'#010+

View File

@ -1054,9 +1054,11 @@ begin
include(initmoduleswitches,cs_static_keyword);
'v' :
include(initglobalswitches,cs_support_vectors);
'x' :
include(initglobalswitches,cs_support_exceptions);
'-' :
begin
exclude(initglobalswitches,cs_constructor_name);
initglobalswitches:=initglobalswitches - [cs_constructor_name,cs_support_exceptions];
initlocalswitches:=InitLocalswitches - [cs_do_assertion, cs_do_inline, cs_ansistrings];
initmoduleswitches:=initmoduleswitches - [cs_support_c_operators, cs_support_goto,
cs_support_macro,

View File

@ -357,6 +357,11 @@ implementation
initasmmode:=aktasmmode;
{$endif i386}
{ Exception support explicitly turned on (mainly for macpas, to }
{ compensate for lack of interprocedural goto support) }
if (cs_support_exceptions in aktglobalswitches) then
include(aktmodeswitches,m_except);
{ Undefine old symbol }
if (m_delphi in oldaktmodeswitches) then
undef_system_macro('FPC_DELPHI')

View File

@ -366,7 +366,7 @@ const
(str:'SET' ;special:false;keyword:m_all;op:NOTOKEN),
(str:'SHL' ;special:false;keyword:m_all;op:_OP_SHL),
(str:'SHR' ;special:false;keyword:m_all;op:_OP_SHR),
(str:'TRY' ;special:false;keyword:m_class;op:NOTOKEN),
(str:'TRY' ;special:false;keyword:m_except;op:NOTOKEN),
(str:'VAR' ;special:false;keyword:m_all;op:NOTOKEN),
(str:'XOR' ;special:false;keyword:m_all;op:_OP_XOR),
(str:'CASE' ;special:false;keyword:m_all;op:NOTOKEN),
@ -400,13 +400,13 @@ const
(str:'INDEX' ;special:false;keyword:m_none;op:NOTOKEN),
(str:'LABEL' ;special:false;keyword:m_all;op:NOTOKEN),
(str:'LOCAL' ;special:false;keyword:m_none;op:NOTOKEN),
(str:'RAISE' ;special:false;keyword:m_class;op:NOTOKEN),
(str:'RAISE' ;special:false;keyword:m_except;op:NOTOKEN),
(str:'UNTIL' ;special:false;keyword:m_all;op:NOTOKEN),
(str:'WHILE' ;special:false;keyword:m_all;op:NOTOKEN),
(str:'WRITE' ;special:false;keyword:m_none;op:NOTOKEN),
(str:'DISPID' ;special:false;keyword:m_none;op:NOTOKEN),
(str:'DOWNTO' ;special:false;keyword:m_all;op:NOTOKEN),
(str:'EXCEPT' ;special:false;keyword:m_class;op:NOTOKEN),
(str:'EXCEPT' ;special:false;keyword:m_except;op:NOTOKEN),
(str:'EXPORT' ;special:false;keyword:m_none;op:NOTOKEN),
(str:'INLINE' ;special:false;keyword:m_none;op:NOTOKEN),
(str:'LEGACY' ;special:false;keyword:m_none;op:NOTOKEN), { Syscall variation on MorphOS }
@ -428,7 +428,7 @@ const
(str:'DEFAULT' ;special:false;keyword:m_none;op:NOTOKEN),
(str:'DYNAMIC' ;special:false;keyword:m_none;op:NOTOKEN),
(str:'EXPORTS' ;special:false;keyword:m_all;op:NOTOKEN),
(str:'FINALLY' ;special:false;keyword:m_class;op:NOTOKEN),
(str:'FINALLY' ;special:false;keyword:m_except;op:NOTOKEN),
(str:'FORWARD' ;special:false;keyword:m_none;op:NOTOKEN),
(str:'GENERIC' ;special:false;keyword:m_none;op:NOTOKEN),
(str:'IOCHECK' ;special:false;keyword:m_none;op:NOTOKEN),