mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 12:49:09 +02:00
* after changing a modeswitch, only change related module/localswitches that
depend on the modeswitch that was just changed (so that e.g. changing the nested procvars setting has no effect on the state of $h+/$h-) (mantis #21951) git-svn-id: trunk@21247 -
This commit is contained in:
parent
9568693664
commit
50d2fa7134
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -12581,6 +12581,7 @@ tests/webtbs/tw2185.pp svneol=native#text/plain
|
|||||||
tests/webtbs/tw2186.pp svneol=native#text/plain
|
tests/webtbs/tw2186.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw2187.pp svneol=native#text/plain
|
tests/webtbs/tw2187.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw21878.pp svneol=native#text/plain
|
tests/webtbs/tw21878.pp svneol=native#text/plain
|
||||||
|
tests/webtbs/tw21951.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw2196.pp svneol=native#text/plain
|
tests/webtbs/tw2196.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw2197.pp svneol=native#text/plain
|
tests/webtbs/tw2197.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw2198.pp svneol=native#text/plain
|
tests/webtbs/tw2198.pp svneol=native#text/plain
|
||||||
|
@ -314,54 +314,79 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
Procedure HandleModeSwitches(changeInit: boolean);
|
Procedure HandleModeSwitches(switch: tmodeswitch; changeInit: boolean);
|
||||||
begin
|
begin
|
||||||
{ turn ansi/unicodestrings on by default ? }
|
{ turn ansi/unicodestrings on by default ? (only change when this
|
||||||
if ([m_default_ansistring,m_default_unicodestring]*current_settings.modeswitches)<>[] then
|
particular setting is changed, so that a random modeswitch won't
|
||||||
begin
|
change the state of $h+/$h-) }
|
||||||
include(current_settings.localswitches,cs_refcountedstrings);
|
if switch in [m_all,m_default_ansistring,m_default_unicodestring] then
|
||||||
if changeinit then
|
begin
|
||||||
include(init_settings.localswitches,cs_refcountedstrings);
|
if ([m_default_ansistring,m_default_unicodestring]*current_settings.modeswitches)<>[] then
|
||||||
end
|
begin
|
||||||
else
|
{ can't have both ansistring and unicodestring as default }
|
||||||
begin
|
if switch=m_default_ansistring then
|
||||||
exclude(current_settings.localswitches,cs_refcountedstrings);
|
begin
|
||||||
if changeinit then
|
exclude(current_settings.modeswitches,m_default_unicodestring);
|
||||||
exclude(init_settings.localswitches,cs_refcountedstrings);
|
if changeinit then
|
||||||
end;
|
exclude(init_settings.modeswitches,m_default_unicodestring);
|
||||||
|
end
|
||||||
|
else if switch=m_default_unicodestring then
|
||||||
|
begin
|
||||||
|
exclude(current_settings.modeswitches,m_default_ansistring);
|
||||||
|
if changeinit then
|
||||||
|
exclude(init_settings.modeswitches,m_default_ansistring);
|
||||||
|
end;
|
||||||
|
{ enable $h+ }
|
||||||
|
include(current_settings.localswitches,cs_refcountedstrings);
|
||||||
|
if changeinit then
|
||||||
|
include(init_settings.localswitches,cs_refcountedstrings);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
exclude(current_settings.localswitches,cs_refcountedstrings);
|
||||||
|
if changeinit then
|
||||||
|
exclude(init_settings.localswitches,cs_refcountedstrings);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
{ turn inline on by default ? }
|
{ turn inline on by default ? }
|
||||||
if (m_default_inline in current_settings.modeswitches) then
|
if switch in [m_all,m_default_inline] then
|
||||||
begin
|
begin
|
||||||
include(current_settings.localswitches,cs_do_inline);
|
if (m_default_inline in current_settings.modeswitches) then
|
||||||
if changeinit then
|
begin
|
||||||
include(init_settings.localswitches,cs_do_inline);
|
include(current_settings.localswitches,cs_do_inline);
|
||||||
end
|
if changeinit then
|
||||||
else
|
include(init_settings.localswitches,cs_do_inline);
|
||||||
begin
|
end
|
||||||
exclude(current_settings.localswitches,cs_do_inline);
|
else
|
||||||
if changeinit then
|
begin
|
||||||
exclude(init_settings.localswitches,cs_do_inline);
|
exclude(current_settings.localswitches,cs_do_inline);
|
||||||
end;
|
if changeinit then
|
||||||
|
exclude(init_settings.localswitches,cs_do_inline);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
{ turn system codepage by default }
|
{ turn on system codepage by default }
|
||||||
if m_systemcodepage in current_settings.modeswitches then
|
if switch in [m_all,m_systemcodepage] then
|
||||||
begin
|
begin
|
||||||
current_settings.sourcecodepage:=DefaultSystemCodePage;
|
if m_systemcodepage in current_settings.modeswitches then
|
||||||
if not cpavailable(current_settings.sourcecodepage) then
|
begin
|
||||||
current_settings.sourcecodepage:=default_settings.sourcecodepage;
|
current_settings.sourcecodepage:=DefaultSystemCodePage;
|
||||||
include(current_settings.moduleswitches,cs_explicit_codepage);
|
if not cpavailable(current_settings.sourcecodepage) then
|
||||||
if changeinit then
|
current_settings.sourcecodepage:=default_settings.sourcecodepage;
|
||||||
begin
|
include(current_settings.moduleswitches,cs_explicit_codepage);
|
||||||
init_settings.sourcecodepage:=current_settings.sourcecodepage;
|
if changeinit then
|
||||||
include(init_settings.moduleswitches,cs_explicit_codepage);
|
begin
|
||||||
end;
|
init_settings.sourcecodepage:=current_settings.sourcecodepage;
|
||||||
end
|
include(init_settings.moduleswitches,cs_explicit_codepage);
|
||||||
else
|
end;
|
||||||
begin
|
end
|
||||||
exclude(current_settings.moduleswitches,cs_explicit_codepage);
|
else
|
||||||
if changeinit then
|
begin
|
||||||
exclude(init_settings.moduleswitches,cs_explicit_codepage);
|
exclude(current_settings.moduleswitches,cs_explicit_codepage);
|
||||||
|
if changeinit then
|
||||||
|
exclude(init_settings.moduleswitches,cs_explicit_codepage);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -422,7 +447,7 @@ implementation
|
|||||||
{ resolve all postponed switch changes }
|
{ resolve all postponed switch changes }
|
||||||
flushpendingswitchesstate;
|
flushpendingswitchesstate;
|
||||||
|
|
||||||
HandleModeSwitches(changeinit);
|
HandleModeSwitches(m_all,changeinit);
|
||||||
|
|
||||||
{ turn on bitpacking for mode macpas and iso pascal }
|
{ turn on bitpacking for mode macpas and iso pascal }
|
||||||
if ([m_mac,m_iso] * current_settings.modeswitches <> []) then
|
if ([m_mac,m_iso] * current_settings.modeswitches <> []) then
|
||||||
@ -579,7 +604,7 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
{ set other switches depending on changed mode switch }
|
{ set other switches depending on changed mode switch }
|
||||||
HandleModeSwitches(changeinit);
|
HandleModeSwitches(i,changeinit);
|
||||||
|
|
||||||
if changeInit then
|
if changeInit then
|
||||||
init_settings.modeswitches:=current_settings.modeswitches;
|
init_settings.modeswitches:=current_settings.modeswitches;
|
||||||
|
11
tests/webtbs/tw21951.pp
Normal file
11
tests/webtbs/tw21951.pp
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{ %opt=-Mobjfpc -Sh }
|
||||||
|
|
||||||
|
{$modeswitch exceptions}
|
||||||
|
|
||||||
|
var
|
||||||
|
S: string;
|
||||||
|
begin
|
||||||
|
SetLength(S, 1000);
|
||||||
|
if (length(s)<>1000) then
|
||||||
|
halt(1);
|
||||||
|
end.
|
Loading…
Reference in New Issue
Block a user