Переглянути джерело

* cdecl array of const fixes

peter 23 роки тому
батько
коміт
1b116848d8
6 змінених файлів з 51 додано та 18 видалено
  1. 13 2
      compiler/i386/n386cal.pas
  2. 6 7
      compiler/ncal.pas
  3. 12 1
      compiler/ncgcal.pas
  4. 5 4
      compiler/ncgld.pas
  5. 10 3
      compiler/ninl.pas
  6. 5 1
      compiler/nld.pas

+ 13 - 2
compiler/i386/n386cal.pas

@@ -126,7 +126,7 @@ implementation
                push_value_para(left,calloption,para_offset,para_alignment,paralocdummy);
            end
          { filter array constructor with c styled args }
-         else if is_array_constructor(left.resulttype.def) and (nf_cargs in left.flags) then
+         else if is_array_of_const(left.resulttype.def) and (nf_cargs in left.flags) then
            begin
              { nothing, everything is already pushed }
            end
@@ -184,7 +184,9 @@ implementation
                         (left.nodetype=selfn)) then
                   internalerror(200106041);
                end;
+{$ifdef unused}
               if not push_from_left_to_right then
+{$endif unused}
                 maybe_push_high;
               if (defcoll.paratyp=vs_out) and
                  assigned(defcoll.paratype.def) and
@@ -203,8 +205,10 @@ implementation
               else
                 cg.a_paramaddr_ref(exprasmlist,left.location.reference,paralocdummy);
               location_release(exprasmlist,left.location);
+{$ifdef unused}
               if push_from_left_to_right then
                 maybe_push_high;
+{$endif unused}
            end
          else
            begin
@@ -238,7 +242,9 @@ implementation
                        internalerror(200204011);
                     end;
 
+{$ifdef unused}
                    if not push_from_left_to_right then
+{$endif unused}
                      maybe_push_high;
                    inc(pushedparasize,4);
                    if calloption=pocall_inline then
@@ -252,8 +258,10 @@ implementation
                    else
                      cg.a_paramaddr_ref(exprasmlist,left.location.reference,paralocdummy);
                    location_release(exprasmlist,left.location);
+{$ifdef unused}
                    if push_from_left_to_right then
                      maybe_push_high;
+{$endif unused}
                 end
               else
                 begin
@@ -1242,7 +1250,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.76  2002-11-25 17:43:26  peter
+  Revision 1.77  2002-11-27 20:05:06  peter
+    * cdecl array of const fixes
+
+  Revision 1.76  2002/11/25 17:43:26  peter
     * splitted defbase in defutil,symutil,defcmp
     * merged isconvertable and is_equal into compare_defs(_ext)
     * made operator search faster by walking the list only once

+ 6 - 7
compiler/ncal.pas

@@ -451,8 +451,7 @@ type
             if is_array_of_const(defcoll.paratype.def) then
              begin
                if assigned(aktcallprocdef) and
-                  (aktcallprocdef.proccalloption in [pocall_cppdecl,pocall_cdecl]) and
-                  (po_external in aktcallprocdef.procoptions) then
+                  (aktcallprocdef.proccalloption in [pocall_cppdecl,pocall_cdecl]) then
                  include(left.flags,nf_cargs);
                { force variant array }
                include(left.flags,nf_forcevaria);
@@ -471,10 +470,7 @@ type
            test_local_to_procvar(tprocvardef(left.resulttype.def),defcoll.paratype.def);
 
          { generate the high() value tree }
-         if not(assigned(aktcallprocdef) and
-                (aktcallprocdef.proccalloption in [pocall_cppdecl,pocall_cdecl]) and
-                (po_external in aktcallprocdef.procoptions)) and
-            paramanager.push_high_param(defcoll.paratype.def,aktcallprocdef.proccalloption) then
+         if paramanager.push_high_param(defcoll.paratype.def,aktcallprocdef.proccalloption) then
            gen_high_tree(is_open_string(defcoll.paratype.def));
 
          { test conversions }
@@ -2842,7 +2838,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.112  2002-11-27 15:33:46  peter
+  Revision 1.113  2002-11-27 20:04:38  peter
+    * cdecl array of const fixes
+
+  Revision 1.112  2002/11/27 15:33:46  peter
     * the never ending story of tp procvar hacks
 
   Revision 1.111  2002/11/27 02:31:17  peter

+ 12 - 1
compiler/ncgcal.pas

@@ -197,7 +197,9 @@ implementation
                         (left.nodetype=selfn)) then
                   internalerror(200106041);
                end;
+{$ifdef unused}
               if not push_from_left_to_right then
+{$endif unused}
                 maybe_push_high;
               if (defcoll.paratyp=vs_out) and
                  assigned(defcoll.paratype.def) and
@@ -216,8 +218,10 @@ implementation
               else
                 cg.a_paramaddr_ref(exprasmlist,left.location.reference,defcoll.paraloc);
               location_release(exprasmlist,left.location);
+{$ifdef unused}
               if push_from_left_to_right then
                 maybe_push_high;
+{$endif unused}
            end
          else
            begin
@@ -256,7 +260,9 @@ implementation
                        internalerror(200204011);
                     end;
 
+{$ifdef unused}
                    if not push_from_left_to_right then
+{$endif unused}
                      maybe_push_high;
                    inc(pushedparasize,4);
                    if calloption=pocall_inline then
@@ -270,8 +276,10 @@ implementation
                    else
                      cg.a_paramaddr_ref(exprasmlist,left.location.reference,defcoll.paraloc);
                    location_release(exprasmlist,left.location);
+{$ifdef unused}
                    if push_from_left_to_right then
                      maybe_push_high;
+{$endif unused}
                 end
               else
                 begin
@@ -1541,7 +1549,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.29  2002-11-25 17:43:17  peter
+  Revision 1.30  2002-11-27 20:04:39  peter
+    * cdecl array of const fixes
+
+  Revision 1.29  2002/11/25 17:43:17  peter
     * splitted defbase in defutil,symutil,defcmp
     * merged isconvertable and is_equal into compare_defs(_ext)
     * made operator search faster by walking the list only once

+ 5 - 4
compiler/ncgld.pas

@@ -274,8 +274,6 @@ implementation
                       { in case call by reference, then calculate. Open array
                         is always an reference! }
                       if (tvarsym(symtableentry).varspez in [vs_var,vs_out]) or
-                         is_open_array(tvarsym(symtableentry).vartype.def) or
-                         is_array_of_const(tvarsym(symtableentry).vartype.def) or
                          paramanager.push_addr_param(tvarsym(symtableentry).vartype.def,tprocdef(symtable.defowner).proccalloption) then
                         begin
                            if hregister=R_NO then
@@ -789,9 +787,9 @@ implementation
          elesize:=8
         else
          elesize:=tarraydef(resulttype.def).elesize;
+        location_reset(location,LOC_REFERENCE,OS_NO);
         if not(nf_cargs in flags) then
          begin
-           location_reset(location,LOC_REFERENCE,OS_NO);
            { Allocate always a temp, also if no elements are required, to
              be sure that location is valid (PFV) }
             if tarraydef(resulttype.def).highrange=-1 then
@@ -989,7 +987,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.40  2002-11-25 17:43:18  peter
+  Revision 1.41  2002-11-27 20:04:39  peter
+    * cdecl array of const fixes
+
+  Revision 1.40  2002/11/25 17:43:18  peter
     * splitted defbase in defutil,symutil,defcmp
     * merged isconvertable and is_equal into compare_defs(_ext)
     * made operator search faster by walking the list only once

+ 10 - 3
compiler/ninl.pas

@@ -1762,7 +1762,10 @@ implementation
                              is_array_of_const(left.resulttype.def) then
                             begin
                               srsym:=searchsymonlyin(tloadnode(left).symtable,'high'+tvarsym(tloadnode(left).symtableentry).name);
-                              result:=cloadnode.create(srsym,tloadnode(left).symtable);
+                              if assigned(srsym) then
+                                result:=cloadnode.create(srsym,tloadnode(left).symtable)
+                              else
+                                CGMessage(cg_e_illegal_expression);
                             end
                            else
                             if is_dynamic_array(left.resulttype.def) then
@@ -1783,7 +1786,8 @@ implementation
                                left.resulttype.def).highrange,tarraydef(left.resulttype.def).rangetype,true);
                             end;
                          end;
-                         resulttypepass(result);
+                         if assigned(result) then
+                           resulttypepass(result);
                       end;
                     stringdef:
                       begin
@@ -2395,7 +2399,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.100  2002-11-27 15:33:47  peter
+  Revision 1.101  2002-11-27 20:04:39  peter
+    * cdecl array of const fixes
+
+  Revision 1.100  2002/11/27 15:33:47  peter
     * the never ending story of tp procvar hacks
 
   Revision 1.99  2002/11/27 02:37:13  peter

+ 5 - 1
compiler/nld.pas

@@ -1035,6 +1035,7 @@ implementation
                  hp:=thp;
                end;
               chp.flags := chp.flags+orgflags;
+              include(chp.flags,nf_cargs);
               include(chp.flags,nf_cargswap);
               chp.location.loc:=LOC_CREFERENCE;
               calcregisters(chp,0,0,0);
@@ -1213,7 +1214,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.67  2002-11-27 15:33:47  peter
+  Revision 1.68  2002-11-27 20:04:39  peter
+    * cdecl array of const fixes
+
+  Revision 1.67  2002/11/27 15:33:47  peter
     * the never ending story of tp procvar hacks
 
   Revision 1.66  2002/11/25 17:43:20  peter