mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-16 10:19:30 +02:00
compiler:
- prefer UnicodeString, WideString, PWideChar, PAnsiChar, AnsiString, ShortString when passing a string constant if default string is UnicodeString, - change default string type to UnicodeString for MODE DelphiUnicode git-svn-id: trunk@21094 -
This commit is contained in:
parent
c7e057a835
commit
1a724f3e11
@ -514,9 +514,17 @@ implementation
|
||||
doconv:=tc_string_2_string;
|
||||
{ prefered string type depends on the $H switch }
|
||||
if (m_default_unicodestring in current_settings.modeswitches) and
|
||||
(cs_refcountedstrings in current_settings.localswitches) and
|
||||
is_wide_or_unicode_string(def_to) then
|
||||
eq:=te_equal
|
||||
(cs_refcountedstrings in current_settings.localswitches) then
|
||||
case tstringdef(def_to).stringtype of
|
||||
st_unicodestring: eq:=te_equal;
|
||||
st_widestring: eq:=te_convert_l1;
|
||||
// widechar: eq:=te_convert_l2;
|
||||
// ansichar: eq:=te_convert_l3;
|
||||
st_ansistring: eq:=te_convert_l4;
|
||||
st_shortstring: eq:=te_convert_l5;
|
||||
else
|
||||
eq:=te_convert_l6;
|
||||
end
|
||||
else if not(cs_refcountedstrings in current_settings.localswitches) and
|
||||
(tstringdef(def_to).stringtype=st_shortstring) then
|
||||
eq:=te_equal
|
||||
@ -1166,7 +1174,11 @@ implementation
|
||||
(is_pchar(def_to) or is_pwidechar(def_to)) then
|
||||
begin
|
||||
doconv:=tc_cstring_2_pchar;
|
||||
eq:=te_convert_l2;
|
||||
if ((m_default_unicodestring in current_settings.modeswitches) xor
|
||||
is_pchar(def_to)) then
|
||||
eq:=te_convert_l2
|
||||
else
|
||||
eq:=te_convert_l3;
|
||||
end
|
||||
else
|
||||
{ chararray to pointer }
|
||||
|
@ -53,7 +53,7 @@ interface
|
||||
m_pointer_2_procedure,m_autoderef,m_tp_procvar,m_initfinal,m_default_ansistring,
|
||||
m_out,m_default_para,m_duplicate_names,m_hintdirective,
|
||||
m_property,m_default_inline,m_except,m_advanced_records];
|
||||
delphiunicodemodeswitches = delphimodeswitches + [m_systemcodepage];
|
||||
delphiunicodemodeswitches = delphimodeswitches + [m_systemcodepage,m_default_unicodestring];
|
||||
fpcmodeswitches =
|
||||
[m_fpc,m_all,m_string_pchar,m_nested_comment,m_repeat_forward,
|
||||
m_cvar_support,m_initfinal,m_hintdirective,
|
||||
|
Loading…
Reference in New Issue
Block a user