mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-13 00:09:32 +02:00
compiler: output ansistring constants in explicit codepage if codepage is explicitly defined using either $codepage directive or compiler switch or for SystemCodepage modeswitch
git-svn-id: trunk@19462 -
This commit is contained in:
parent
6ec879219e
commit
21ac5dfb3b
@ -139,7 +139,7 @@ interface
|
||||
cs_support_c_operators,
|
||||
{ generation }
|
||||
cs_profile,cs_debuginfo,cs_compilesystem,
|
||||
cs_lineinfo,cs_implicit_exceptions,
|
||||
cs_lineinfo,cs_implicit_exceptions,cs_explicit_codepage,
|
||||
{ linking }
|
||||
cs_create_smart,cs_create_dynamic,cs_create_pic,
|
||||
{ browser switches are back }
|
||||
|
@ -292,7 +292,7 @@ implementation
|
||||
if cp=CP_NONE then
|
||||
cp:=0;
|
||||
{ for delphiuncode mode output CP_ACP constants in the compiler codepage }
|
||||
if (cp=0) and (m_systemcodepage in current_settings.modeswitches) then
|
||||
if (cp=0) and (cs_explicit_codepage in current_settings.moduleswitches) then
|
||||
cp:=current_settings.sourcecodepage;
|
||||
entry := PHashSetItem(TTagHashSet(pool).FindOrAdd(value_str,len,cp))
|
||||
end
|
||||
|
@ -867,11 +867,12 @@ begin
|
||||
'c' :
|
||||
begin
|
||||
if (upper(more)='UTF8') or (upper(more)='UTF-8') then
|
||||
init_settings.sourcecodepage:=CP_UTF8
|
||||
init_settings.sourcecodepage:=CP_UTF8
|
||||
else if not(cpavailable(more)) then
|
||||
Message1(option_code_page_not_available,more)
|
||||
else
|
||||
init_settings.sourcecodepage:=codepagebyname(more);
|
||||
include(init_settings.moduleswitches,cs_explicit_codepage);
|
||||
end;
|
||||
'C' :
|
||||
RCCompiler := More;
|
||||
|
@ -1370,14 +1370,15 @@ unit scandir;
|
||||
Message(scan_w_switch_is_global)
|
||||
else
|
||||
begin
|
||||
current_scanner.skipspace;
|
||||
s:=current_scanner.readcomment;
|
||||
if (upper(s)='UTF8') or (upper(s)='UTF-8') then
|
||||
current_settings.sourcecodepage:=CP_UTF8
|
||||
else if not(cpavailable(s)) then
|
||||
Message1(option_code_page_not_available,s)
|
||||
else
|
||||
current_settings.sourcecodepage:=codepagebyname(s);
|
||||
current_scanner.skipspace;
|
||||
s:=current_scanner.readcomment;
|
||||
if (upper(s)='UTF8') or (upper(s)='UTF-8') then
|
||||
current_settings.sourcecodepage:=CP_UTF8
|
||||
else if not(cpavailable(s)) then
|
||||
Message1(option_code_page_not_available,s)
|
||||
else
|
||||
current_settings.sourcecodepage:=codepagebyname(s);
|
||||
include(current_settings.moduleswitches,cs_explicit_codepage);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -348,8 +348,12 @@ implementation
|
||||
if m_systemcodepage in current_settings.modeswitches then
|
||||
begin
|
||||
current_settings.sourcecodepage:=DefaultSystemCodePage;
|
||||
include(current_settings.moduleswitches,cs_explicit_codepage);
|
||||
if changeinit then
|
||||
begin
|
||||
init_settings.sourcecodepage:=DefaultSystemCodePage;
|
||||
include(init_settings.moduleswitches,cs_explicit_codepage);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -2650,6 +2654,7 @@ In case not, the value returned can be arbitrary.
|
||||
inc(inputpointer,3);
|
||||
message(scan_c_switching_to_utf8);
|
||||
current_settings.sourcecodepage:=CP_UTF8;
|
||||
include(current_settings.moduleswitches,cs_explicit_codepage);
|
||||
end;
|
||||
|
||||
line_no:=1;
|
||||
|
Loading…
Reference in New Issue
Block a user