mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-13 05:29:34 +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.
|
||||
% The base type of a set can only have 255 elements. Sets of wide 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}
|
||||
%
|
||||
|
@ -480,6 +480,7 @@ const
|
||||
parser_e_syscall_format_not_support=03364;
|
||||
parser_w_ignoring_published_property=03365;
|
||||
parser_w_widechar_set_reduced=03366;
|
||||
parser_e_nostringaliasinsystem=03367;
|
||||
type_e_mismatch=04000;
|
||||
type_e_incompatible_types=04001;
|
||||
type_e_not_equal_types=04002;
|
||||
@ -1161,9 +1162,9 @@ const
|
||||
option_info=11024;
|
||||
option_help_pages=11025;
|
||||
|
||||
MsgTxtSize = 90971;
|
||||
MsgTxtSize = 91070;
|
||||
|
||||
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
|
||||
);
|
||||
|
1325
compiler/msgtxt.inc
1325
compiler/msgtxt.inc
File diff suppressed because it is too large
Load Diff
@ -399,6 +399,8 @@ implementation
|
||||
end;
|
||||
_STRING:
|
||||
begin
|
||||
if cs_compilesystem in current_settings.moduleswitches then
|
||||
Message(parser_e_nostringaliasinsystem);
|
||||
{ system.string? }
|
||||
if tmodule(tunitsym(srsym).module).globalsymtable=systemunit then
|
||||
begin
|
||||
|
@ -141,6 +141,9 @@ implementation
|
||||
end
|
||||
else
|
||||
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
|
||||
begin
|
||||
if m_default_unicodestring in current_settings.modeswitches then
|
||||
@ -4032,6 +4035,8 @@ implementation
|
||||
|
||||
_STRING :
|
||||
begin
|
||||
if cs_compilesystem in current_settings.moduleswitches then
|
||||
Message(parser_e_nostringaliasinsystem);
|
||||
string_dec(hdef,true);
|
||||
{ STRING can be also a type cast }
|
||||
if try_to_consume(_LKLAMMER) then
|
||||
|
@ -494,8 +494,9 @@ implementation
|
||||
again:=false;
|
||||
case token of
|
||||
_STRING:
|
||||
begin
|
||||
string_dec(def,stoAllowTypeDef in options);
|
||||
|
||||
end;
|
||||
_FILE:
|
||||
begin
|
||||
consume(_FILE);
|
||||
|
Loading…
Reference in New Issue
Block a user