* warn if the first constant element of a range set expression is greater than the second one, resolves #31936

git-svn-id: trunk@38321 -
This commit is contained in:
florian 2018-02-23 22:30:35 +00:00
parent 92776e1864
commit d031545f88
6 changed files with 516 additions and 489 deletions

1
.gitattributes vendored
View File

@ -14352,6 +14352,7 @@ tests/webtbf/tw3145.pp svneol=native#text/plain
tests/webtbf/tw31465.pp svneol=native#text/pascal
tests/webtbf/tw3183.pp svneol=native#text/plain
tests/webtbf/tw3186.pp svneol=native#text/plain
tests/webtbf/tw31936.pp svneol=native#text/pascal
tests/webtbf/tw31973.pp svneol=native#text/pascal
tests/webtbf/tw32043b.pp svneol=native#text/pascal
tests/webtbf/tw32043c.pp svneol=native#text/pascal

View File

@ -2011,6 +2011,8 @@ type_e_function_reference_kind=04123_E_Subroutine references cannot be declared
% Subroutine references can refer to any kind of subroutine and hence do not
% require specialisation for methods or nested subroutines.
type_e_seg_procvardef_wrong_memory_model=04124_E_Procedure variables in that memory model do not store segment information
type_w_empty_constant_range_set=04125_W_The first value of a set constructur range is greater then the second value, so the range describes an empty set.
% If a set is constructed like this: \var{s:=[9..7];]}, then an empty set is generated. As this is something normally not desired, the compiler warns about it.
% \end{description}
#
# Symtable

View File

@ -571,6 +571,7 @@ const
type_w_instance_abstract_class=04122;
type_e_function_reference_kind=04123;
type_e_seg_procvardef_wrong_memory_model=04124;
type_w_empty_constant_range_set=04125;
sym_e_id_not_found=05000;
sym_f_internal_error_in_symtablestack=05001;
sym_e_duplicate_id=05002;
@ -1093,9 +1094,9 @@ const
option_info=11024;
option_help_pages=11025;
MsgTxtSize = 81190;
MsgTxtSize = 81312;
MsgIdxMax : array[1..20] of longint=(
27,106,347,125,96,58,139,33,221,67,
27,106,347,126,96,58,139,33,221,67,
61,20,30,1,1,1,1,1,1,1
);

File diff suppressed because it is too large Load Diff

View File

@ -566,6 +566,8 @@ implementation
inserttypeconv(p2,u8inttype);
end;
if tordconstnode(p2).value.svalue>tordconstnode(p3).value.svalue then
CGMessagePos(p2.fileinfo,type_w_empty_constant_range_set);
for l:=tordconstnode(p2).value.svalue to tordconstnode(p3).value.svalue do
do_set(l);
p2.free;

12
tests/webtbf/tw31936.pp Normal file
View File

@ -0,0 +1,12 @@
{ %fail }
{ %opt=-Sew }
var
I : longint;
Somestring : string;
begin
Somestring:='asdf';
I := 1;
While Not (Somestring[I] in ['#'..#0]) Do Inc(I);
end.