* Fix cprefix problems for tconstref4 test and add cppdecl modifier

git-svn-id: trunk@16572 -
This commit is contained in:
pierre 2010-12-16 16:02:24 +00:00
parent 9276fa437f
commit 818c88dbbf
3 changed files with 97 additions and 4 deletions

1
.gitattributes vendored
View File

@ -9140,6 +9140,7 @@ tests/test/cg/variants/tvarol94.pp svneol=native#text/plain
tests/test/cg/variants/tvarol96.pp svneol=native#text/plain
tests/test/dumpclass.pp svneol=native#text/plain
tests/test/dumpmethods.pp svneol=native#text/plain
tests/test/lcpref.inc svneol=native#text/plain
tests/test/opt/README.txt svneol=native#text/plain
tests/test/opt/tarmshift.pp svneol=native#text/plain
tests/test/opt/tcaseopt1.pp svneol=native#text/plain

66
tests/test/lcpref.inc Normal file
View File

@ -0,0 +1,66 @@
{ This include file defines FPC_HAS_UNDERSCORE_PREFIX
for targets for which Cprefix='_' }
{ This file was created lookinf into
systems/i_XXX.pas files in trunk 2010-12-16 PM }
{ From i_atari.pas }
{$ifdef atari}
{$define FPC_HAS_UNDERSCORE_PREFIX}
{$endif}
{ From i_bsd.pas, all i386 but freebsd seem to have underscore prefixes }
{$ifdef bsd}
{$ifdef cpui386}
{$ifndef freebsd}
{$define FPC_HAS_UNDERSCORE_PREFIX}
{$endif}
{$endif}
{$ifdef darwin}
{$define FPC_HAS_UNDERSCORE_PREFIX}
{$endif}
{$endif}
{$ifdef emx}
{$define FPC_HAS_UNDERSCORE_PREFIX}
{$endif}
{$ifdef go32v2}
{$define FPC_HAS_UNDERSCORE_PREFIX}
{$endif}
{$ifdef nativent}
{$define FPC_HAS_UNDERSCORE_PREFIX}
{$endif}
{$ifdef os2}
{$define FPC_HAS_UNDERSCORE_PREFIX}
{$endif}
{$ifdef palmos}
{$define FPC_HAS_UNDERSCORE_PREFIX}
{$endif}
{$ifdef symbian}
{$define FPC_HAS_UNDERSCORE_PREFIX}
{$endif}
{$ifdef watcom}
{$define FPC_HAS_UNDERSCORE_PREFIX}
{$endif}
{$ifdef wdosx}
{$define FPC_HAS_UNDERSCORE_PREFIX}
{$endif}
{$ifdef win32}
{$define FPC_HAS_UNDERSCORE_PREFIX}
{$endif}
{$ifdef wince}
{$ifdef cpui386}
{$define FPC_HAS_UNDERSCORE_PREFIX}
{$endif}
{$endif}

View File

@ -1,5 +1,11 @@
program tconstref4;
{ This include file defines FPC_HAS_UNDERSCORE_PREFIX
for targets for which Cprefix='_' }
{$include lcpref.inc}
{$mode objfpc}{$h+}
procedure TestConstRefSafecallAlias(AParam: PInteger); safecall; [external name '_TESTCONSTREFSAFECALL'];
@ -9,22 +15,42 @@ begin
halt(1);
end;
{ For cdecl type function Cprefix added for
external name but not for alias ... }
{$ifdef FPC_HAS_UNDERSCORE_PREFIX}
procedure TestConstRefCdeclAlias(AParam: PInteger); cdecl; [external name 'TESTCONSTREFCDECL'];
{$else not FPC_HAS_UNDERSCORE_PREFIX}
procedure TestConstRefCdeclAlias(AParam: PInteger); cdecl; [external name '_TESTCONSTREFCDECL'];
{$endif not FPC_HAS_UNDERSCORE_PREFIX}
procedure TestConstRefCdecl(constref AParam: integer); cdecl; [public, alias: '_TESTCONSTREFCDECL'];
begin
if AParam<>$1234567 then
halt(1);
end;
procedure TestConstRefStdcallAlias(AParam: PInteger); cdecl; [external name '_TESTCONSTREFSTDCALL'];
procedure TestConstRefStdcall(constref AParam: integer); cdecl; [public, alias: '_TESTCONSTREFSTDCALL'];
{ For cppdecl type function Cprefix added for
external name but not for alias ... }
{$ifdef FPC_HAS_UNDERSCORE_PREFIX}
procedure TestConstRefCPPdeclAlias(AParam: PInteger); cppdecl; [external name 'TESTCONSTREFCPPDECL'];
{$else not FPC_HAS_UNDERSCORE_PREFIX}
procedure TestConstRefCPPdeclAlias(AParam: PInteger); cppdecl; [external name '_TESTCONSTREFCPPDECL'];
{$endif not FPC_HAS_UNDERSCORE_PREFIX}
procedure TestConstRefCPPdecl(constref AParam: integer); cppdecl; [public, alias: '_TESTCONSTREFCPPDECL'];
begin
if AParam<>$1234567 then
halt(1);
end;
procedure TestConstRefRegisterAlias(AParam: PInteger); cdecl; [external name '_TESTCONSTREFREGISTER'];
procedure TestConstRefRegister(constref AParam: integer); cdecl; [public, alias: '_TESTCONSTREFREGISTER'];
procedure TestConstRefStdcallAlias(AParam: PInteger); stdcall; [external name '_TESTCONSTREFSTDCALL'];
procedure TestConstRefStdcall(constref AParam: integer); stdcall; [public, alias: '_TESTCONSTREFSTDCALL'];
begin
if AParam<>$1234567 then
halt(1);
end;
procedure TestConstRefRegisterAlias(AParam: PInteger); register; [external name '_TESTCONSTREFREGISTER'];
procedure TestConstRefRegister(constref AParam: integer); register; [public, alias: '_TESTCONSTREFREGISTER'];
begin
if AParam<>$1234567 then
halt(1);