compiler:

- emit ansistring constants with compiler codepage if no codepage is explicitly set
  - set default compiler codepage to default system codepage (delphi compatible)
  + tests

git-svn-id: trunk@19145 -
This commit is contained in:
paul 2011-09-19 01:04:56 +00:00
parent 4d3da666db
commit 41e85bc36a
5 changed files with 31 additions and 0 deletions

2
.gitattributes vendored
View File

@ -9938,6 +9938,7 @@ tests/test/tconstref2.pp svneol=native#text/pascal
tests/test/tconstref3.pp svneol=native#text/pascal
tests/test/tconstref4.pp svneol=native#text/pascal
tests/test/tcpstr1.pp svneol=native#text/plain
tests/test/tcpstr10.pp svneol=native#text/pascal
tests/test/tcpstr2.pp svneol=native#text/plain
tests/test/tcpstr2a.pp svneol=native#text/plain
tests/test/tcpstr3.pp svneol=native#text/plain
@ -9946,6 +9947,7 @@ tests/test/tcpstr5.pp svneol=native#text/plain
tests/test/tcpstr6.pp svneol=native#text/plain
tests/test/tcpstr7.pp svneol=native#text/plain
tests/test/tcpstr8.pp svneol=native#text/pascal
tests/test/tcpstr9.pp svneol=native#text/pascal
tests/test/tcpstransistr2shortstring.pp svneol=native#text/plain
tests/test/tcpstransistr2widechararray.pp svneol=native#text/plain
tests/test/tcpstransistrcompare.pp svneol=native#text/plain

View File

@ -59,6 +59,8 @@ uses
current_asmdata.getdatalabel(referencelab);
list.concat(tai_label.create(referencelab));
end;
if encoding=CP_NONE then
encoding:=current_settings.sourcecodepage;
list.concat(tai_const.create_16bit(encoding));
list.concat(tai_const.create_16bit(1));
{$ifdef cpu64bitaddr}

View File

@ -1532,6 +1532,8 @@ implementation
init_settings:=default_settings;
if init_settings.optimizecputype=cpu_none then
init_settings.optimizecputype:=init_settings.cputype;
{ Compiler codepage should be default system codepage }
init_settings.sourcecodepage:=DefaultSystemCodePage;
LinkLibraryAliases :=TLinkStrMap.Create;
LinkLibraryOrder :=TLinkStrMap.Create;

12
tests/test/tcpstr10.pp Normal file
View File

@ -0,0 +1,12 @@
program tcpstr10;
{$apptype console}
{$codepage cp866}
begin
if StringCodePage('test') <> 866 then
begin
WriteLn(StringCodePage('test'), ' <> ', 866);
halt(1);
end;
Writeln('ok');
end.

13
tests/test/tcpstr9.pp Normal file
View File

@ -0,0 +1,13 @@
program tcpstr9;
{$apptype console}
begin
// this test can be only run with the compiler built right now on the
// same system
if StringCodePage('test') <> DefaultSystemCodePage then
begin
WriteLn(StringCodePage('test'), ' <> ', DefaultSystemCodePage);
halt(1);
end;
Writeln('ok');
end.