Parcourir la source

* avoid warning when pointer points to size 1 data
* fix variantmanager for {$T+}

git-svn-id: trunk@4861 -

micha il y a 19 ans
Parent
commit
8678d52aeb
4 fichiers modifiés avec 15 ajouts et 15 suppressions
  1. 5 7
      compiler/nadd.pas
  2. 8 0
      compiler/nmem.pas
  3. 0 6
      compiler/node.pas
  4. 2 2
      rtl/inc/variant.inc

+ 5 - 7
compiler/nadd.pas

@@ -1184,15 +1184,13 @@ implementation
                       begin
                         if is_voidpointer(right.resulttype.def) then
                         begin
-                          if is_untyped_addrnode(right) then
+                          if is_big_untyped_addrnode(right) then
                             CGMessage1(type_w_untyped_arithmetic_unportable,node2opstr(nodetype));
                           inserttypeconv(right,left.resulttype)
-                        end else if is_voidpointer(left.resulttype.def) then
-                        begin
-                          if is_untyped_addrnode(left) then
-                            CGMessage1(type_w_untyped_arithmetic_unportable,node2opstr(nodetype));
+                        end 
+			else if is_voidpointer(left.resulttype.def) then
                           inserttypeconv(left,right.resulttype)
-                        end else if not(equal_defs(ld,rd)) then
+                        else if not(equal_defs(ld,rd)) then
                           IncompatibleTypes(ld,rd);
                       end
                     else
@@ -1463,7 +1461,7 @@ implementation
                    CGMessage3(type_e_operator_not_supported_for_types,node2opstr(nodetype),ld.typename,rd.typename);
                  if (ld.deftype=pointerdef) then
                  begin
-                   if is_untyped_addrnode(left) then
+                   if is_big_untyped_addrnode(left) then
                      CGMessage1(type_w_untyped_arithmetic_unportable,node2opstr(nodetype));
                    if (tpointerdef(ld).pointertype.def.size>1) then
                    begin

+ 8 - 0
compiler/nmem.pas

@@ -120,6 +120,8 @@ interface
        cvecnode : tvecnodeclass;
        cwithnode : twithnodeclass;
 
+    function is_big_untyped_addrnode(p: tnode): boolean;
+
 implementation
 
     uses
@@ -935,6 +937,12 @@ implementation
           inherited docompare(p);
       end;
 
+    function is_big_untyped_addrnode(p: tnode): boolean;
+      begin
+        is_big_untyped_addrnode:=(p.nodetype=addrn) and 
+	  not (nf_typedaddr in p.flags) and (taddrnode(p).left.resulttype.def.size > 1);
+      end;
+
 begin
   cloadvmtaddrnode := tloadvmtaddrnode;
   caddrnode := taddrnode;

+ 0 - 6
compiler/node.pas

@@ -429,7 +429,6 @@ interface
     function is_constboolnode(p : tnode) : boolean;
     function is_constenumnode(p : tnode) : boolean;
     function is_constwidecharnode(p : tnode) : boolean;
-    function is_untyped_addrnode(p: tnode): boolean;
 
 
 implementation
@@ -633,11 +632,6 @@ implementation
          is_constenumnode:=(p.nodetype=ordconstn) and (p.resulttype.def.deftype=enumdef);
       end;
 
-    function is_untyped_addrnode(p: tnode): boolean;
-      begin
-        is_untyped_addrnode:=(p.nodetype=addrn) and not (nf_typedaddr in p.flags);
-      end;
-
 {****************************************************************************
                                  TNODE
  ****************************************************************************}

+ 2 - 2
rtl/inc/variant.inc

@@ -994,7 +994,7 @@ begin
    Result:=True;
    While Result and (I<(sizeof(tvariantmanager) div sizeof(pointer))-1) do
      begin
-       Result:=Pointer(ppointer(@variantmanager+i*sizeof(pointer))^)<>Pointer(@invalidvariantop);
+       Result:=(PPointer(@variantmanager)+i)^<>Pointer(@invalidvariantop);
        Inc(I);
      end;
 end;
@@ -1009,6 +1009,6 @@ procedure initvariantmanager;
      tvardata(Unassigned).VType:=varEmpty;
      tvardata(Null).VType:=varNull;
      for i:=0 to (sizeof(tvariantmanager) div sizeof(pointer))-1 do
-       ppointer(@variantmanager+i*sizeof(pointer))^:=@invalidvariantopnovariants;
+       (ppointer(@variantmanager)+i)^:=@invalidvariantopnovariants;
      pointer(variantmanager.varclear):=@varclear
   end;