diff options
author | paul <paul@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2010-01-22 07:15:09 +0000 |
---|---|---|
committer | paul <paul@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2010-01-22 07:15:09 +0000 |
commit | f83cb232edd11a195d44949a72e5b15d23035246 (patch) | |
tree | 9ab883a54543f099287dd1ef35b8ae2fe0b72a12 /compiler/fmodule.pas | |
parent | 8bbc57e9e7b2f31a884b0d2d9f68f737ef3238d0 (diff) | |
download | fpc-f83cb232edd11a195d44949a72e5b15d23035246.tar.gz |
compiler: allow hint modifier for 'unit' keyword (reason - delphi compatibility) + test
git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@14767 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'compiler/fmodule.pas')
-rw-r--r-- | compiler/fmodule.pas | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/compiler/fmodule.pas b/compiler/fmodule.pas index f60a47a62d..fee53e5337 100644 --- a/compiler/fmodule.pas +++ b/compiler/fmodule.pas @@ -57,6 +57,17 @@ interface rr_noppu,rr_sourcenewer,rr_build,rr_crcchanged ); + { unit options } + tmoduleoption = (mo_none, + mo_hint_deprecated, + mo_hint_platform, + mo_hint_library, + mo_hint_unimplemented, + mo_hint_experimental, + mo_has_deprecated_msg + ); + tmoduleoptions = set of tmoduleoption; + tlinkcontaineritem=class(tlinkedlistitem) public data : pshortstring; @@ -91,6 +102,8 @@ interface end; pderefmap = ^tderefmaprec; + { tmodule } + tmodule = class(tmodulebase) private FImportLibraryList : TFPHashObjectList; @@ -163,6 +176,9 @@ interface locallibrarysearchpath, localframeworksearchpath : TSearchPathList; + moduleoptions: tmoduleoptions; + deprecatedmsg: pshortstring; + {create creates a new module which name is stored in 's'. LoadedFrom points to the module calling it. It is nil for the first compiled module. This allow inheritence of all path lists. MUST pay attention @@ -174,6 +190,7 @@ interface procedure flagdependent(callermodule:tmodule); function addusedunit(hp:tmodule;inuses:boolean;usym:tunitsym):tused_unit; procedure updatemaps; + procedure check_hints; function derefidx_unit(id:longint):longint; function resolve_unit(id:longint):tmodule; procedure allunitsused; @@ -518,6 +535,8 @@ implementation is_dbginfo_written:=false; is_reset:=false; mode_switch_allowed:= true; + moduleoptions:=[]; + deprecatedmsg:=nil; _exports:=TLinkedList.Create; dllscannerinputlist:=TFPHashList.Create; asmdata:=TAsmData.create(realmodulename^); @@ -596,6 +615,7 @@ implementation stringdispose(realmodulename); stringdispose(mainsource); stringdispose(asmprefix); + stringdispose(deprecatedmsg); localunitsearchpath.Free; localobjectsearchpath.free; localincludesearchpath.free; @@ -729,6 +749,8 @@ implementation in_interface:=true; in_global:=true; mode_switch_allowed:=true; + stringdispose(deprecatedmsg); + moduleoptions:=[]; is_dbginfo_written:=false; is_reset:=false; crc:=0; @@ -839,6 +861,23 @@ implementation end; end; + procedure tmodule.check_hints; + begin + if mo_hint_deprecated in moduleoptions then + if (mo_has_deprecated_msg in moduleoptions) and (deprecatedmsg <> nil) then + Message2(sym_w_deprecated_unit_with_msg,realmodulename^,deprecatedmsg^) + else + Message1(sym_w_deprecated_unit,realmodulename^); + if mo_hint_experimental in moduleoptions then + Message1(sym_w_experimental_unit,realmodulename^); + if mo_hint_platform in moduleoptions then + Message1(sym_w_non_portable_unit,realmodulename^); + if mo_hint_library in moduleoptions then + Message1(sym_w_library_unit,realmodulename^); + if mo_hint_unimplemented in moduleoptions then + Message1(sym_w_non_implemented_unit,realmodulename^); + end; + function tmodule.derefidx_unit(id:longint):longint; begin |