From e1b34a9e7b1bc9793810211d1e21e1b9a8b8438d Mon Sep 17 00:00:00 2001 From: florian Date: Wed, 19 Oct 2005 19:06:45 +0000 Subject: [PATCH] * cleaning up sets for exports behaviour + allow exports from units git-svn-id: trunk@1535 - --- .gitattributes | 1 + compiler/pmodules.pas | 7 +++++-- compiler/psub.pas | 12 ++---------- compiler/systems.pas | 15 ++++++++++++--- compiler/systems/t_win.pas | 1 - tests/webtbs/uw2364.pp | 25 +++++++++++++++++++++++++ 6 files changed, 45 insertions(+), 16 deletions(-) create mode 100644 tests/webtbs/uw2364.pp diff --git a/.gitattributes b/.gitattributes index bd5533f9ad..b13be104f1 100644 --- a/.gitattributes +++ b/.gitattributes @@ -6350,6 +6350,7 @@ tests/webtbs/uw2040.pp svneol=native#text/plain tests/webtbs/uw2266a.inc svneol=native#text/plain tests/webtbs/uw2266b.pas svneol=native#text/plain tests/webtbs/uw2269.inc svneol=native#text/plain +tests/webtbs/uw2364.pp svneol=native#text/plain tests/webtbs/uw2706a.pp svneol=native#text/plain tests/webtbs/uw2706b.pp svneol=native#text/plain tests/webtbs/uw2731.pp svneol=native#text/plain diff --git a/compiler/pmodules.pas b/compiler/pmodules.pas index e91988d4ed..5128a68646 100644 --- a/compiler/pmodules.pas +++ b/compiler/pmodules.pas @@ -900,6 +900,9 @@ implementation dispose(s1); end; + if (target_info.system in system_unit_program_exports) then + exportlib.preparelib(current_module.realmodulename^); + consume(_ID); consume(_SEMICOLON); consume(_INTERFACE); @@ -1311,7 +1314,7 @@ implementation stringdispose(current_module.realmodulename); current_module.modulename:=stringdup(pattern); current_module.realmodulename:=stringdup(orgpattern); - if (target_info.system in [system_i386_WIN32,system_i386_wdosx]) then + if (target_info.system in system_unit_program_exports) then exportlib.preparelib(orgpattern); consume(_ID); if token=_LKLAMMER then @@ -1324,7 +1327,7 @@ implementation end; consume(_SEMICOLON); end - else if (target_info.system in [system_i386_WIN32,system_i386_wdosx]) then + else if (target_info.system in system_unit_program_exports) then exportlib.preparelib(current_module.realmodulename^); { global switches are read, so further changes aren't allowed } diff --git a/compiler/psub.pas b/compiler/psub.pas index f25e553e34..28e3fea805 100644 --- a/compiler/psub.pas +++ b/compiler/psub.pas @@ -1384,21 +1384,13 @@ implementation _EXPORTS: begin if not(assigned(current_procinfo.procdef.localst)) or - (current_procinfo.procdef.localst.symtablelevel>main_program_level) or - (current_module.is_unit) then + (current_procinfo.procdef.localst.symtablelevel>main_program_level) then begin Message(parser_e_syntax_error); consume_all_until(_SEMICOLON); end else if islibrary or - (target_info.system in [ - system_i386_win32, - system_i386_wdosx, - system_i386_Netware, - system_i386_netwlibc, - system_arm_wince, - system_x86_64_win64, - system_ia64_win64]+system_linux) then + (target_info.system in system_unit_program_exports) then read_exports else begin diff --git a/compiler/systems.pas b/compiler/systems.pas index b069600445..7f1a2ba4f0 100644 --- a/compiler/systems.pas +++ b/compiler/systems.pas @@ -320,15 +320,24 @@ interface system_any = system_none; system_wince : set of tsystem = [system_arm_wince,system_i386_wince]; - system_linux : set of tsystem = [system_i386_linux,system_x86_64_linux,system_powerpc_linux, - system_arm_linux,system_sparc_linux,system_alpha_linux,system_m68k_linux, - system_x86_6432_linux]; + system_linux = [system_i386_linux,system_x86_64_linux,system_powerpc_linux, + system_arm_linux,system_sparc_linux,system_alpha_linux,system_m68k_linux, + system_x86_6432_linux]; { all real windows systems, no cripple ones like wince, wdosx et. al. } system_windows : set of tsystem = [system_i386_win32,system_x86_64_win64,system_ia64_win64]; { all windows systems } system_all_windows : set of tsystem = [system_i386_win32,system_x86_64_win64,system_ia64_win64, system_arm_wince,system_i386_wince]; + { all systems supporting exports from programs or units } + system_unit_program_exports : set of tsystem = [system_i386_win32, + system_i386_wdosx, + system_i386_Netware, + system_i386_netwlibc, + system_arm_wince, + system_x86_64_win64, + system_ia64_win64]+system_linux; + cpu2str : array[TSystemCpu] of string = ('','i386','m68k','alpha','powerpc','sparc','vm','ia64','x86_64', 'mips','arm', 'powerpc64'); diff --git a/compiler/systems/t_win.pas b/compiler/systems/t_win.pas index aa286e95c4..3d6e435ae7 100644 --- a/compiler/systems/t_win.pas +++ b/compiler/systems/t_win.pas @@ -561,7 +561,6 @@ implementation end; - procedure texportlibwin32.exportvar(hp : texported_item); begin { same code used !! PM } diff --git a/tests/webtbs/uw2364.pp b/tests/webtbs/uw2364.pp new file mode 100644 index 0000000000..dd4e101c45 --- /dev/null +++ b/tests/webtbs/uw2364.pp @@ -0,0 +1,25 @@ +{ %TARGET=win64,wince,win32,linux } + +{ Source provided for Free Pascal Bug Report 2364 } +{ Submitted by "Maarten Bekers" on 2003-02-08 } +{ e-mail: fpc-bugs@elebbs.com } +unit tw2364; + +interface + +type blah = function: integer; +function iee: integer; + + +var blah2: blah; + +implementation + +function iee: integer; +begin +end; + +exports + iee; + +end.