Browse Source

* 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 years ago
parent
commit
ceb547d027
2 changed files with 7 additions and 2 deletions
  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
                begin
                  if is_open_string(vardef) then
                  if is_open_string(vardef) then
                     MessagePos(fileinfo,parser_w_cdecl_no_openstring);
                     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;
                end;
               if (vardef.typ=formaldef) and (Tformaldef(vardef).typed) then
               if (vardef.typ=formaldef) and (Tformaldef(vardef).typed) then
                 begin
                 begin

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

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