Bläddra i källkod

Merged revisions 7365-7368 via svnmerge from
svn+ssh://[email protected]/FPC/svn/fpc/trunk

........
r7365 | peter | 2007-05-16 21:20:32 +0200 (Wed, 16 May 2007) | 2 lines

* support - and + after -S options
........
r7366 | peter | 2007-05-16 22:11:09 +0200 (Wed, 16 May 2007) | 2 lines

* only add .o extension if no extension is provided. fixes 8520
........
r7367 | peter | 2007-05-16 22:34:21 +0200 (Wed, 16 May 2007) | 2 lines

* default dynamic linker for i386
........
r7368 | peter | 2007-05-16 22:56:00 +0200 (Wed, 16 May 2007) | 2 lines

* nested procedures are not supported in generic methods
........

git-svn-id: branches/fixes_2_2@7383 -

peter 18 år sedan
förälder
incheckning
44d793983f
7 ändrade filer med 96 tillägg och 19 borttagningar
  1. 1 0
      .gitattributes
  2. 44 11
      compiler/options.pas
  3. 2 1
      compiler/pdecsub.pas
  4. 3 3
      compiler/psub.pas
  5. 3 1
      compiler/scandir.pas
  6. 17 3
      compiler/systems/t_linux.pas
  7. 26 0
      tests/webtbf/tw7752.pp

+ 1 - 0
.gitattributes

@@ -7177,6 +7177,7 @@ tests/webtbf/tw7070.pp svneol=native#text/plain
 tests/webtbf/tw7322.pp svneol=native#text/plain
 tests/webtbf/tw7438.pp svneol=native#text/plain
 tests/webtbf/tw7438a.pp svneol=native#text/plain
+tests/webtbf/tw7752.pp svneol=native#text/plain
 tests/webtbf/tw7989.pp svneol=native#text/plain
 tests/webtbf/tw7998.pp svneol=native#text/plain
 tests/webtbf/tw8019.pp svneol=native#text/plain

+ 44 - 11
compiler/options.pas

@@ -1039,9 +1039,15 @@ begin
                        '2' : //an alternative to -Mobjfpc
                          SetCompileMode('OBJFPC',true);
                        'a' :
-                         include(init_settings.localswitches,cs_do_assertion);
+                         If UnsetBool(More, j) then
+                           exclude(init_settings.localswitches,cs_do_assertion)
+                         else
+                           include(init_settings.localswitches,cs_do_assertion);
                        'c' :
-                         include(init_settings.moduleswitches,cs_support_c_operators);
+                         If UnsetBool(More, j) then
+                           include(init_settings.moduleswitches,cs_support_c_operators)
+                         else
+                           include(init_settings.moduleswitches,cs_support_c_operators);
                        'd' : //an alternative to -Mdelphi
                          SetCompileMode('DELPHI',true);
                        'e' :
@@ -1065,15 +1071,30 @@ begin
                              end;
                          end;
                        'g' :
-                         include(init_settings.moduleswitches,cs_support_goto);
+                         If UnsetBool(More, j) then
+                           exclude(init_settings.moduleswitches,cs_support_goto)
+                         else
+                           include(init_settings.moduleswitches,cs_support_goto);
                        'h' :
-                         include(init_settings.localswitches,cs_ansistrings);
+                         If UnsetBool(More, j) then
+                           exclude(init_settings.localswitches,cs_ansistrings)
+                         else
+                           include(init_settings.localswitches,cs_ansistrings);
                        'i' :
-                         include(init_settings.localswitches,cs_do_inline);
+                         If UnsetBool(More, j) then
+                           exclude(init_settings.localswitches,cs_do_inline)
+                         else
+                           include(init_settings.localswitches,cs_do_inline);
                        'k' :
-                         include(init_settings.globalswitches,cs_load_fpcylix_unit);
+                         If UnsetBool(More, j) then
+                           exclude(init_settings.globalswitches,cs_load_fpcylix_unit)
+                         else
+                           include(init_settings.globalswitches,cs_load_fpcylix_unit);
                        'm' :
-                         include(init_settings.moduleswitches,cs_support_macro);
+                         If UnsetBool(More, j) then
+                           exclude(init_settings.moduleswitches,cs_support_macro)
+                         else
+                           include(init_settings.moduleswitches,cs_support_macro);
                        'o' : //an alternative to -Mtp
                          SetCompileMode('TP',true);
 {$ifdef gpc_mode}
@@ -1081,13 +1102,25 @@ begin
                          SetCompileMode('GPC',true);
 {$endif}
                        's' :
-                         include(init_settings.globalswitches,cs_constructor_name);
+                         If UnsetBool(More, j) then
+                           exclude(init_settings.globalswitches,cs_constructor_name)
+                         else
+                           include(init_settings.globalswitches,cs_constructor_name);
                        't' :
-                         include(init_settings.moduleswitches,cs_static_keyword);
+                         If UnsetBool(More, j) then
+                           exclude(init_settings.moduleswitches,cs_static_keyword)
+                         else
+                           include(init_settings.moduleswitches,cs_static_keyword);
                        'v' :
-                         include(init_settings.globalswitches,cs_support_vectors);
+                         If UnsetBool(More, j) then
+                           exclude(init_settings.globalswitches,cs_support_vectors)
+                         else
+                           include(init_settings.globalswitches,cs_support_vectors);
                        'x' :
-                         include(init_settings.globalswitches,cs_support_exceptions);
+                         If UnsetBool(More, j) then
+                           exclude(init_settings.globalswitches,cs_support_exceptions)
+                         else
+                           include(init_settings.globalswitches,cs_support_exceptions);
                        '-' :
                          begin
                            init_settings.globalswitches:=init_settings.globalswitches - [cs_constructor_name,cs_support_exceptions];

+ 2 - 1
compiler/pdecsub.pas

@@ -833,7 +833,8 @@ implementation
         pd.proctypeoption:=potype;
 
         { methods inherit df_generic or df_specialization from the objectdef }
-        if assigned(pd._class) then
+        if assigned(pd._class) and
+           (pd.parast.symtablelevel=normal_function_level) then
           begin
             if (df_generic in pd._class.defoptions) then
               include(pd.defoptions,df_generic);

+ 3 - 3
compiler/psub.pas

@@ -1372,9 +1372,9 @@ implementation
             if (tcgprocinfo(current_procinfo).nestedprocs.count>0) then
               begin
                 if (df_generic in current_procinfo.procdef.defoptions) then
-{$warning TODO Add error message for nested procs in generics}
-                  internalerror(200511151)
-                else if (po_inline in current_procinfo.procdef.procoptions) then
+                  Comment(V_Error,'Generic methods cannot have nested procedures')
+                else
+                 if (po_inline in current_procinfo.procdef.procoptions) then
                   begin
                     Message1(parser_w_not_supported_for_inline,'nested procedures');
                     Message(parser_w_inlining_disabled);

+ 3 - 1
compiler/scandir.pas

@@ -489,7 +489,9 @@ implementation
           end
         else
           s:= trimspace(current_scanner.readcomment);
-        s:=ChangeFileExt(FixFileName(s),target_info.objext);
+        s:=FixFileName(s);
+        if ExtractFileExt(s)='' then
+          s:=ChangeFileExt(s,target_info.objext);
         current_module.linkotherofiles.add(s,link_always);
       end;
 

+ 17 - 3
compiler/systems/t_linux.pas

@@ -258,10 +258,18 @@ begin
 {$endif m68k}
 
 {$ifdef i386}
-     { default is glibc 2.1+ compatible }
-     libctype:=glibc21;
+     {
+       Search order:
+         glibc 2.1+
+         uclibc
+         glibc 2.0
+       If none is found (e.g. when cross compiling) glibc21 is assumed
+     }
      if FileExists('/lib/ld-linux.so.2',false) then
-       DynamicLinker:='/lib/ld-linux.so.2'
+       begin
+         DynamicLinker:='/lib/ld-linux.so.2';
+         libctype:=glibc21;
+       end
      else if fileexists('/lib/ld-uClibc.so.0',false) then
        begin
          dynamiclinker:='/lib/ld-uClibc.so.0';
@@ -271,6 +279,12 @@ begin
        begin
          DynamicLinker:='/lib/ld-linux.so.1';
          libctype:=glibc2;
+       end
+     else
+       begin
+         { default is glibc 2.1+ compatible }
+         DynamicLinker:='/lib/ld-linux.so.2';
+         libctype:=glibc21;
        end;
 {$endif i386}
 

+ 26 - 0
tests/webtbf/tw7752.pp

@@ -0,0 +1,26 @@
+{ %fail }
+
+{$mode objfpc}
+unit tw7752;
+interface
+type generic TMapNode<_Key,_Value> = class(TObject)
+       key: _Key;
+       value: _Value;
+     end;
+     generic TMap<_Key,_Value> = class(TObject)
+     private
+     public
+       procedure Insert(x: TMapNode);
+     end;
+
+implementation
+
+procedure TMap.Insert(x: TMapNode);
+	procedure TreeInsert(z: TMapNode);
+	var x,y: TMapNode;
+	begin
+	end;
+begin
+end;
+
+end.