mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-19 10:29:18 +02:00
* Forbid use of string alias in system unit
This commit is contained in:
parent
1388f90afa
commit
391fdcac08
@ -1647,6 +1647,9 @@ parser_w_ignoring_published_property=03365_W_This property will not be published
|
|||||||
parser_w_widechar_set_reduced=03366_W_Reducing Widechar set to single-byte AnsiChar set.
|
parser_w_widechar_set_reduced=03366_W_Reducing Widechar set to single-byte AnsiChar set.
|
||||||
% The base type of a set can only have 255 elements. Sets of wide characters
|
% The base type of a set can only have 255 elements. Sets of wide characters
|
||||||
% are reduced to sets of 1-byte characters.
|
% are reduced to sets of 1-byte characters.
|
||||||
|
parser_e_nostringaliasinsystem=03367_e_Using 'string' alias is not allowed in the system unit. Use short-,ansi- or unicodestring.
|
||||||
|
% As a safeguard, the system unit may only use basic string types, not the
|
||||||
|
% string alias which is dependent on the mode in which a unit is compiled.
|
||||||
%
|
%
|
||||||
% \end{description}
|
% \end{description}
|
||||||
%
|
%
|
||||||
|
@ -480,6 +480,7 @@ const
|
|||||||
parser_e_syscall_format_not_support=03364;
|
parser_e_syscall_format_not_support=03364;
|
||||||
parser_w_ignoring_published_property=03365;
|
parser_w_ignoring_published_property=03365;
|
||||||
parser_w_widechar_set_reduced=03366;
|
parser_w_widechar_set_reduced=03366;
|
||||||
|
parser_e_nostringaliasinsystem=03367;
|
||||||
type_e_mismatch=04000;
|
type_e_mismatch=04000;
|
||||||
type_e_incompatible_types=04001;
|
type_e_incompatible_types=04001;
|
||||||
type_e_not_equal_types=04002;
|
type_e_not_equal_types=04002;
|
||||||
@ -1161,9 +1162,9 @@ const
|
|||||||
option_info=11024;
|
option_info=11024;
|
||||||
option_help_pages=11025;
|
option_help_pages=11025;
|
||||||
|
|
||||||
MsgTxtSize = 90971;
|
MsgTxtSize = 91070;
|
||||||
|
|
||||||
MsgIdxMax : array[1..20] of longint=(
|
MsgIdxMax : array[1..20] of longint=(
|
||||||
28,109,367,132,100,63,148,38,223,71,
|
28,109,368,132,100,63,148,38,223,71,
|
||||||
68,20,30,1,1,1,1,1,1,1
|
68,20,30,1,1,1,1,1,1,1
|
||||||
);
|
);
|
||||||
|
1321
compiler/msgtxt.inc
1321
compiler/msgtxt.inc
File diff suppressed because it is too large
Load Diff
@ -399,6 +399,8 @@ implementation
|
|||||||
end;
|
end;
|
||||||
_STRING:
|
_STRING:
|
||||||
begin
|
begin
|
||||||
|
if cs_compilesystem in current_settings.moduleswitches then
|
||||||
|
Message(parser_e_nostringaliasinsystem);
|
||||||
{ system.string? }
|
{ system.string? }
|
||||||
if tmodule(tunitsym(srsym).module).globalsymtable=systemunit then
|
if tmodule(tunitsym(srsym).module).globalsymtable=systemunit then
|
||||||
begin
|
begin
|
||||||
|
@ -141,6 +141,9 @@ implementation
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
|
// string[x] is allowed in system unit since it is a shortstring.
|
||||||
|
if cs_compilesystem in current_settings.moduleswitches then
|
||||||
|
Message(parser_e_nostringaliasinsystem);
|
||||||
if cs_refcountedstrings in current_settings.localswitches then
|
if cs_refcountedstrings in current_settings.localswitches then
|
||||||
begin
|
begin
|
||||||
if m_default_unicodestring in current_settings.modeswitches then
|
if m_default_unicodestring in current_settings.modeswitches then
|
||||||
@ -4032,6 +4035,8 @@ implementation
|
|||||||
|
|
||||||
_STRING :
|
_STRING :
|
||||||
begin
|
begin
|
||||||
|
if cs_compilesystem in current_settings.moduleswitches then
|
||||||
|
Message(parser_e_nostringaliasinsystem);
|
||||||
string_dec(hdef,true);
|
string_dec(hdef,true);
|
||||||
{ STRING can be also a type cast }
|
{ STRING can be also a type cast }
|
||||||
if try_to_consume(_LKLAMMER) then
|
if try_to_consume(_LKLAMMER) then
|
||||||
|
@ -494,8 +494,9 @@ implementation
|
|||||||
again:=false;
|
again:=false;
|
||||||
case token of
|
case token of
|
||||||
_STRING:
|
_STRING:
|
||||||
|
begin
|
||||||
string_dec(def,stoAllowTypeDef in options);
|
string_dec(def,stoAllowTypeDef in options);
|
||||||
|
end;
|
||||||
_FILE:
|
_FILE:
|
||||||
begin
|
begin
|
||||||
consume(_FILE);
|
consume(_FILE);
|
||||||
|
Loading…
Reference in New Issue
Block a user