Преглед на файлове

* cleaning up sets for exports behaviour
+ allow exports from units

git-svn-id: trunk@1535 -

florian преди 20 години
родител
ревизия
e1b34a9e7b
променени са 6 файла, в които са добавени 45 реда и са изтрити 16 реда
  1. 1 0
      .gitattributes
  2. 5 2
      compiler/pmodules.pas
  3. 2 10
      compiler/psub.pas
  4. 12 3
      compiler/systems.pas
  5. 0 1
      compiler/systems/t_win.pas
  6. 25 0
      tests/webtbs/uw2364.pp

+ 1 - 0
.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

+ 5 - 2
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 }

+ 2 - 10
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

+ 12 - 3
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');

+ 0 - 1
compiler/systems/t_win.pas

@@ -561,7 +561,6 @@ implementation
       end;
 
 
-
     procedure texportlibwin32.exportvar(hp : texported_item);
       begin
          { same code used !! PM }

+ 25 - 0
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: [email protected] }
+unit tw2364;
+
+interface
+
+type blah = function: integer;
+function iee: integer;
+
+
+var blah2: blah;
+
+implementation
+
+function iee: integer;
+begin
+end;
+
+exports
+  iee;
+
+end.