Kaynağa Gözat

* only allow cdecl "array of const" parameters for procvars and for external
routines (just like "varargs"), because if implemented in Pascal then
on the callee side this array of const parameter is treated as a Pascal-
style array of const
* don't give the "cdecl'ared functions have no high parameter" warning for
array of const parameters for cdecl external routines and procvars

git-svn-id: trunk@13618 -

Jonas Maebe 16 yıl önce
ebeveyn
işleme
ceb547d027
2 değiştirilmiş dosya ile 7 ekleme ve 2 silme
  1. 6 2
      compiler/pdecsub.pas
  2. 1 0
      tests/test/cg/cdecl/taoc1.pp

+ 6 - 2
compiler/pdecsub.pas

@@ -298,8 +298,12 @@ implementation
                begin
                  if is_open_string(vardef) then
                     MessagePos(fileinfo,parser_w_cdecl_no_openstring);
-                 if not (po_external in pd.procoptions) then
-                   MessagePos(fileinfo,parser_w_cdecl_has_no_high);
+                 if not(po_external in pd.procoptions) and
+                    (pd.typ<>procvardef) then
+                   if is_array_of_const(vardef) then
+                     MessagePos(fileinfo,parser_e_varargs_need_cdecl_and_external)
+                   else
+                     MessagePos(fileinfo,parser_w_cdecl_has_no_high);
                end;
               if (vardef.typ=formaldef) and (Tformaldef(vardef).typed) then
                 begin

+ 1 - 0
tests/test/cg/cdecl/taoc1.pp

@@ -1,3 +1,4 @@
+{ %fail }
 
 { first simple array of const test }