Browse Source

Fix for Mantis #27348. Applied patch by Do-wan Kim plus comments for the reason.

symdef.pas:
  * tprocdef.defaultmangledname: add some kind of differentiator to the result def, so that x(integer;integer) and x(integer):integer generate different mangled names
  * make_mangledname: also use the returndef instead of a potentially uninitialized variable like was done for tprocdef.defaultmangledname and also add a prefix (so that the two are compatible)

+ added test

git-svn-id: trunk@29579 -
svenbarth 10 years ago
parent
commit
ba75fd62f0
3 changed files with 59 additions and 3 deletions
  1. 1 0
      .gitattributes
  2. 8 3
      compiler/symdef.pas
  3. 50 0
      tests/webtbs/tw27348.pp

+ 1 - 0
.gitattributes

@@ -14224,6 +14224,7 @@ tests/webtbs/tw2730.pp svneol=native#text/plain
 tests/webtbs/tw27300a.pp svneol=native#text/pascal
 tests/webtbs/tw2731.pp svneol=native#text/plain
 tests/webtbs/tw27320.pp svneol=native#text/pascal
+tests/webtbs/tw27348.pp svneol=native#text/pascal
 tests/webtbs/tw2736.pp svneol=native#text/plain
 tests/webtbs/tw2737.pp svneol=native#text/plain
 tests/webtbs/tw2738.pp svneol=native#text/plain

+ 8 - 3
compiler/symdef.pas

@@ -1244,8 +1244,12 @@ implementation
                        crc:=UpdateCrc32(crc,hs[1],length(hs));
                      end;
                  end;
-               hs:=hp.vardef.mangledparaname;
-               crc:=UpdateCrc32(crc,hs[1],length(hs));
+               if not is_void(tprocdef(st.defowner).returndef) then
+                 begin
+                   { add a little prefix so that x(integer; integer) is different from x(integer):integer }
+                   hs:='$$'+tprocdef(st.defowner).returndef.mangledparaname;
+                   crc:=UpdateCrc32(crc,hs[1],length(hs));
+                 end;
                s:=Copy(s,1,oldlen)+'$crc'+hexstr(crc,8);
              end;
            if prefix<>'' then
@@ -5510,7 +5514,8 @@ implementation
               end;
             if not is_void(returndef) then
               begin
-                hs:=returndef.mangledparaname;
+                { add a little prefix so that x(integer; integer) is different from x(integer):integer }
+                hs:='$$'+returndef.mangledparaname;
                 crc:=UpdateCrc32(crc,hs[1],length(hs));
               end;
             defaultmangledname:=Copy(defaultmangledname,1,oldlen)+'$crc'+hexstr(crc,8);

+ 50 - 0
tests/webtbs/tw27348.pp

@@ -0,0 +1,50 @@
+{ %NORUN }
+
+program tw27348;
+
+{$mode objfpc}
+
+type
+  TRect = record
+    xyz: LongInt;
+  end;
+
+  TControl = class
+  end;
+
+  TWinControl = class(TControl)
+    procedure AlignControls(AControl: TControl; var RemainingClientRect: TRect);
+  end;
+
+  TAlign = (
+    alNone
+  );
+
+{ TWinControl }
+
+procedure TWinControl.AlignControls(AControl: TControl;
+  var RemainingClientRect: TRect);
+
+  procedure DoPosition(Control: TControl; AAlign: TAlign; AControlIndex: Integer);
+
+    function ConstraintHeight(NewHeight: integer): Integer;
+    begin
+      Result:=NewHeight;
+    end;
+
+    procedure ConstraintHeight(var NewTop, NewHeight: integer);
+    begin
+      NewHeight:=ConstraintHeight(NewHeight);
+    end;
+
+  begin
+
+  end;
+
+begin
+
+end;
+
+
+begin
+end.