* only give warnings for uninitialized variables in low()/high()

if the value is calculated at runtime
This commit is contained in:
peter 2005-04-15 15:50:18 +00:00
parent 913efc5b83
commit 2d62e884c8

View File

@ -1715,7 +1715,6 @@ implementation
in_low_x, in_low_x,
in_high_x: in_high_x:
begin begin
set_varstate(left,vs_used,[vsf_must_be_valid]);
case left.resulttype.def.deftype of case left.resulttype.def.deftype of
orddef, orddef,
enumdef: enumdef:
@ -1738,11 +1737,13 @@ implementation
if is_open_array(left.resulttype.def) or if is_open_array(left.resulttype.def) or
is_array_of_const(left.resulttype.def) then is_array_of_const(left.resulttype.def) then
begin begin
set_varstate(left,vs_used,[vsf_must_be_valid]);
result:=load_high_value_node(tparavarsym(tloadnode(left).symtableentry)); result:=load_high_value_node(tparavarsym(tloadnode(left).symtableentry));
end end
else else
if is_dynamic_array(left.resulttype.def) then if is_dynamic_array(left.resulttype.def) then
begin begin
set_varstate(left,vs_used,[vsf_must_be_valid]);
{ can't use inserttypeconv because we need } { can't use inserttypeconv because we need }
{ an explicit type conversion (JM) } { an explicit type conversion (JM) }
hp := ccallparanode.create(ctypeconvnode.create_internal(left,voidpointertype),nil); hp := ccallparanode.create(ctypeconvnode.create_internal(left,voidpointertype),nil);
@ -1767,9 +1768,12 @@ implementation
else else
begin begin
if is_open_string(left.resulttype.def) then if is_open_string(left.resulttype.def) then
result:=load_high_value_node(tparavarsym(tloadnode(left).symtableentry)) begin
set_varstate(left,vs_used,[vsf_must_be_valid]);
result:=load_high_value_node(tparavarsym(tloadnode(left).symtableentry))
end
else else
result:=cordconstnode.create(tstringdef(left.resulttype.def).len,u8inttype,true); result:=cordconstnode.create(tstringdef(left.resulttype.def).len,u8inttype,true);
end; end;
end; end;
else else
@ -2479,7 +2483,11 @@ begin
end. end.
{ {
$Log$ $Log$
Revision 1.163 2005-03-25 22:20:19 peter Revision 1.164 2005-04-15 15:50:18 peter
* only give warnings for uninitialized variables in low()/high()
if the value is calculated at runtime
Revision 1.163 2005/03/25 22:20:19 peter
* add hint when passing an uninitialized variable to a var parameter * add hint when passing an uninitialized variable to a var parameter
Revision 1.162 2005/03/25 21:46:06 jonas Revision 1.162 2005/03/25 21:46:06 jonas