Jelajahi Sumber

Merged revisions 10330,10997,11003,11020,11040 via svnmerge from
svn+ssh://[email protected]/FPC/svn/fpc/trunk

........
r10330 | florian | 2008-02-15 19:06:23 +0000 (Fri, 15 Feb 2008) | 2 lines

* set default reserved stack size on win32/win64 to 16MB

........
r10997 | florian | 2008-05-18 11:42:32 +0100 (Sun, 18 May 2008) | 2 lines

* don't override IDE switches at compiler startup

........
r11003 | florian | 2008-05-18 14:27:59 +0100 (Sun, 18 May 2008) | 1 line

* enable parsing of default properties when used with objects, resolves #10795
........
r11020 | florian | 2008-05-20 22:06:12 +0100 (Tue, 20 May 2008) | 2 lines

* more reasonable defaults when no dyn. linker is found, resolves #10431

........
r11040 | michael | 2008-05-22 19:12:10 +0100 (Thu, 22 May 2008) | 1 line

* Fixed 8076
........

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

Jonas Maebe 17 tahun lalu
induk
melakukan
aace29526c

+ 1 - 0
.gitattributes

@@ -8005,6 +8005,7 @@ tests/webtbs/tw1073.pp svneol=native#text/plain
 tests/webtbs/tw10757.pp svneol=native#text/plain
 tests/webtbs/tw10790.pp svneol=native#text/plain
 tests/webtbs/tw10791.pp svneol=native#text/plain
+tests/webtbs/tw10795.pp svneol=native#text/plain
 tests/webtbs/tw10800.pp svneol=native#text/plain
 tests/webtbs/tw1081.pp svneol=native#text/plain
 tests/webtbs/tw10815.pp svneol=native#text/plain

+ 1 - 1
compiler/pexpr.pas

@@ -1938,7 +1938,7 @@ implementation
 
                _LECKKLAMMER:
                   begin
-                    if is_class_or_interface(p1.resultdef) then
+                    if is_class_or_interface_or_object(p1.resultdef) then
                       begin
                         { default property }
                         protsym:=search_default_property(tobjectdef(p1.resultdef));

+ 14 - 1
compiler/symdef.pas

@@ -669,6 +669,7 @@ interface
     function is_class(def: tdef): boolean;
     function is_cppclass(def: tdef): boolean;
     function is_class_or_interface(def: tdef): boolean;
+    function is_class_or_interface_or_object(def: tdef): boolean;
     function is_class_or_interface_or_dispinterface(def: tdef): boolean;
 
 
@@ -4368,6 +4369,7 @@ implementation
           (tobjectdef(def).objecttype=odt_class);
       end;
 
+
     function is_object(def: tdef): boolean;
       begin
         is_object:=
@@ -4376,6 +4378,7 @@ implementation
           (tobjectdef(def).objecttype=odt_object);
       end;
 
+
     function is_cppclass(def: tdef): boolean;
       begin
         is_cppclass:=
@@ -4384,15 +4387,25 @@ implementation
           (tobjectdef(def).objecttype=odt_cppclass);
       end;
 
+
     function is_class_or_interface(def: tdef): boolean;
       begin
-        is_class_or_interface:=
+        result:=
           assigned(def) and
           (def.typ=objectdef) and
           (tobjectdef(def).objecttype in [odt_class,odt_interfacecom,odt_interfacecorba]);
       end;
 
 
+    function is_class_or_interface_or_object(def: tdef): boolean;
+      begin
+        result:=
+          assigned(def) and
+          (def.typ=objectdef) and
+          (tobjectdef(def).objecttype in [odt_class,odt_interfacecom,odt_interfacecorba,odt_object]);
+      end;
+
+
     function is_class_or_interface_or_dispinterface(def: tdef): boolean;
       begin
         result:=

+ 2 - 2
compiler/systems/i_win.pas

@@ -85,7 +85,7 @@ unit i_win;
                 maxCrecordalign : 16
               );
             first_parm_offset : 8;
-            stacksize    : 262144;
+            stacksize    : 16*1024*1024;
             abi          : abi_default;
           );
 
@@ -146,7 +146,7 @@ unit i_win;
                 maxCrecordalign : 16
               );
             first_parm_offset : 16;
-            stacksize    : 262144;
+            stacksize    : 16*1024*1024;
             abi          : abi_default;
           );
 

+ 11 - 2
compiler/systems/t_linux.pas

@@ -211,9 +211,18 @@ begin
        end
      else
        begin
-         { default is glibc 2.1+ compatible }
-         DynamicLinker:='/lib/ld-linux.so.2';
+         { when no dyn. linker is found, we are probably
+           cross compiling, so use the default dyn. linker }
+         DynamicLinker:=defdynlinker;
+         {
+           the default c startup script is gcrt0.as on all platforms
+           except i386
+         }
+{$ifdef i386}
          libctype:=glibc21;
+{$else i386}
+         libctype:=glibc2;
+{$endif i386}
        end;
    end;
 end;

+ 12 - 1
ide/fp.pas

@@ -76,7 +76,7 @@ uses
   FPTemplt,FPRedir,FPDesk,
   FPCodTmp,FPCodCmp,
 
-  systems;
+  systems,globtype,globals;
 
 
 {$ifdef fpc}
@@ -326,6 +326,15 @@ begin
 {$ENDIF}
 end;
 
+
+procedure InitCompilerSwitches;
+  begin
+    default_settings.globalswitches:=[cs_check_unit_name];
+    default_settings.moduleswitches:=[cs_extsyntax,cs_implicit_exceptions];
+    default_settings.localswitches:=[cs_typed_const_writable];
+  end;
+
+
 {The square bullet needs an MS-DOS code page. On Unix it is for sure the code
  page is not available before video is initialized. (And only in certain
  circumstances after that, so, use a plain ascii character as bullet on Unix.)}
@@ -371,6 +380,8 @@ BEGIN
   if LocateFile(INIFileName)<>'' then
     writeln(bullet+' Using configuration files from: ',DirOf(LocateFile(INIFileName)));
 
+  InitCompilerSwitches;
+
 {$ifdef VESA}
   InitVESAScreenModes;
 {$endif}

+ 2 - 2
ide/fpswitch.pas

@@ -1407,12 +1407,12 @@ begin
   for i:=low(TSwitchMode) to high(TSwitchMode) do
     begin
        SwitchesMode:=i;
-{$ifdef i386}
+
        { default is Pentium }
        ProcessorOptimizationSwitches^.SetCurrSel(1);
        { AT&T reader }
        AsmReaderSwitches^.SetCurrSel(1);
-{$endif i386}
+
        { FPC mode}
        CompilerModeSwitches^.SetCurrSel(0);
 (* Use platform defaults for memory switches. *)

+ 21 - 4
rtl/unix/crt.pp

@@ -50,11 +50,21 @@ Const
 Var
   CurrX,CurrY : Byte;
   OutputRedir, InputRedir : boolean; { is the output/input being redirected (not a TTY) }
-
+{$ifdef debugcrt}
+  DebugFile : Text;
+{$endif}   
 {*****************************************************************************
                     Some Handy Functions Not in the System.PP
 *****************************************************************************}
 
+{$ifdef debugcrt}
+Procedure Debug(Msg : string);
+
+begin
+  Writeln(DebugFile,Msg);
+end;
+{$endif}
+
 Function Str(l:longint):string;
 {
   Return a String of the longint
@@ -419,7 +429,7 @@ begin
   ttySendStr(s);
 {Update MemCopy}
   idx:=(CurrY-1)*ScreenWidth-1;
-  for i:=1to length(s) do
+  for i:=1 to length(s) do
    if s[i]=#8 then
     begin
       if CurrX>1 then
@@ -430,8 +440,8 @@ begin
       ConsoleBuf^[idx+CurrX].ch:=s[i];
       ConsoleBuf^[idx+CurrX].attr:=TextAttr;
       inc(CurrX);
-      if CurrX>ScreenWidth then
-       CurrX:=ScreenWidth;
+      If CurrX>ScreenWidth then
+        CurrX:=$FF; // Mark as invalid.
     end;
 end;
 
@@ -1575,6 +1585,10 @@ end;
 
 
 Initialization
+{$ifdef debugcrt}
+  Assign(DebugFile,'debug.txt');
+  ReWrite(DebugFile);
+{$endif}  
 { Redirect the standard output }
   assigncrt(Output);
   Rewrite(Output);
@@ -1619,6 +1633,9 @@ Initialization
     end;
 
 Finalization
+{$ifdef debugcrt}
+  Close(DebugFile);
+{$endif}  
   ttyFlushOutput;
   if not OutputRedir then
     SetRawMode(False);

+ 18 - 0
tests/webtbs/tw10795.pp

@@ -0,0 +1,18 @@
+{$mode objfpc}
+type
+  TObj = object
+    function GetItem(const i :Integer) :Integer;
+    property Items[i :Integer] :Integer read GetItem; default;
+  end;
+
+function TObj.GetItem(const i :Integer) :Integer;
+begin
+  Result := i;
+end;
+
+var
+  Obj :TObj;
+
+begin
+  WriteLn(Obj[0],' ',Obj[10]);
+end.