mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-13 12:49:20 +02:00
* $P/$OpenStrings is supposed to be a local switch, so change that accordingly
+ added tests
This commit is contained in:
parent
b934517871
commit
6cbbf9c52a
@ -163,6 +163,7 @@ interface
|
||||
{ parser }
|
||||
cs_typed_addresses,cs_strict_var_strings,cs_refcountedstrings,
|
||||
cs_bitpacking,cs_varpropsetter,cs_scopedenums,cs_pointermath,
|
||||
cs_openstring,
|
||||
{ macpas specific}
|
||||
cs_external_var, cs_externally_visible,
|
||||
{ jvm specific }
|
||||
@ -179,7 +180,7 @@ interface
|
||||
{ Switches which can be changed only at the beginning of a new module }
|
||||
tmoduleswitch = (cs_modulenone,
|
||||
{ parser }
|
||||
cs_fp_emulation,cs_extsyntax,cs_openstring,
|
||||
cs_fp_emulation,cs_extsyntax,
|
||||
{ support }
|
||||
cs_support_goto,cs_support_macro,
|
||||
cs_support_c_operators,
|
||||
|
@ -425,7 +425,7 @@ implementation
|
||||
begin
|
||||
{ not 100% Delphi-compatible: type xstr=string[255] cannot
|
||||
become an openstring there, while here it can }
|
||||
if (cs_openstring in current_settings.moduleswitches) and
|
||||
if (cs_openstring in current_settings.localswitches) and
|
||||
(tstringdef(hdef).len=255) then
|
||||
hdef:=openshortstringtype
|
||||
end;
|
||||
|
@ -90,7 +90,7 @@ const
|
||||
{M} (typesw:localsw; setsw:ord(cs_generate_rtti)),
|
||||
{N} (typesw:unsupportedsw; setsw:ord(cs_localnone)),
|
||||
{O} (typesw:optimizersw; setsw:ord(cs_opt_level2)),
|
||||
{P} (typesw:modulesw; setsw:ord(cs_openstring)),
|
||||
{P} (typesw:localsw; setsw:ord(cs_openstring)),
|
||||
{Q} (typesw:localsw; setsw:ord(cs_check_overflow)),
|
||||
{R} (typesw:localsw; setsw:ord(cs_check_range)),
|
||||
{S} (typesw:localsw; setsw:ord(cs_check_stack)),
|
||||
@ -132,7 +132,7 @@ const
|
||||
{M} (typesw:localsw; setsw:ord(cs_generate_rtti)),
|
||||
{N} (typesw:unsupportedsw; setsw:ord(cs_localnone)),
|
||||
{O} (typesw:optimizersw; setsw:ord(cs_opt_level2)),
|
||||
{P} (typesw:modulesw; setsw:ord(cs_openstring)),
|
||||
{P} (typesw:localsw; setsw:ord(cs_openstring)),
|
||||
{Q} (typesw:localsw; setsw:ord(cs_check_overflow)),
|
||||
{R} (typesw:localsw; setsw:ord(cs_check_range)),
|
||||
{S} (typesw:localsw; setsw:ord(cs_check_stack)),
|
||||
|
@ -2257,7 +2257,6 @@ const
|
||||
{ parser }
|
||||
'Floating Point Emulation',{ cs_fp_emulation}
|
||||
'Extended syntax', {cs_extsyntax}
|
||||
'Open string', {cs_openstring}
|
||||
{ support }
|
||||
'Goto allowed', {cs_support_goto}
|
||||
'Macro support', {cs_support_macro}
|
||||
@ -2375,6 +2374,7 @@ const
|
||||
'Use var property setter', {cs_varpropsetter}
|
||||
'Use scoped enums',{cs_scopedenums}
|
||||
'Use pointer math', {cs_pointermath}
|
||||
'Open string', {cs_openstring}
|
||||
{ macpas specific}
|
||||
'MACPAS exteranl variable', {cs_external_var}
|
||||
'MACPAS externally visible', {cs_externally_visible}
|
||||
|
23
tests/tbf/tb0295.pp
Normal file
23
tests/tbf/tb0295.pp
Normal file
@ -0,0 +1,23 @@
|
||||
{ %FAIL }
|
||||
|
||||
program tb0295;
|
||||
|
||||
{$V+}
|
||||
{$P+}
|
||||
|
||||
procedure Test(var aArg: ShortString);
|
||||
begin
|
||||
end;
|
||||
|
||||
{$P-}
|
||||
|
||||
procedure Test2(var aArg: ShortString);
|
||||
begin
|
||||
end;
|
||||
|
||||
var
|
||||
s: String[5];
|
||||
begin
|
||||
s := 'Foo';
|
||||
Test2(s);
|
||||
end.
|
26
tests/tbs/tb0697.pp
Normal file
26
tests/tbs/tb0697.pp
Normal file
@ -0,0 +1,26 @@
|
||||
{ %NORUN }
|
||||
{ %OPT=-Sew }
|
||||
|
||||
program tb0697;
|
||||
|
||||
{ $P is now a local switch; compatible to Delphi }
|
||||
|
||||
{$V+}
|
||||
{$P-}
|
||||
|
||||
procedure Test(var aArg: ShortString);
|
||||
begin
|
||||
end;
|
||||
|
||||
{$P+}
|
||||
|
||||
procedure Test2(var aArg: ShortString);
|
||||
begin
|
||||
end;
|
||||
|
||||
var
|
||||
s: String[5];
|
||||
begin
|
||||
s := 'Test';
|
||||
Test2(s);
|
||||
end.
|
Loading…
Reference in New Issue
Block a user