[Fortran] RFC: Patch to support STDCALL etc. (PR 34112)
Steve Kargl
sgk@troutmask.apl.washington.edu
Fri Jun 19 23:58:00 GMT 2009
On Sat, Jun 20, 2009 at 12:17:15AM +0200, Tobias Burnus wrote:
> Attached is the first version of a patch which allows to use
>
> !GCC$ ATTRIBUTES attribute :: symbol-list
>
> where attribute is one of:
> - CDECL
> - STDCALL
> - FASTCALL
> - DLLEXPORT
> - DLLIMPORT
Tobias,
It looks like you (and FX) have spent a sizeable amount of
time on this patch. A quick read has raised the following
comments.
--
Steve
+ if (id == EXT_ATTR_LAST)
+ {
+ gfc_error ("Unknow attribute in !GCC$ ATTRIBUTES statement at %C");
+ return MATCH_ERROR;
+ }
Unknow should be Unknown.
+ if ((calls & lvalue->symtree->n.sym->attr.ext_attr)
+ != (calls & rvalue->symtree->n.sym->attr.ext_attr))
+ {
+ gfc_error ("Mismatch in the procedure pointer assignment "
+ "at %L: missmatch in the calling convention",
+ &rvalue->where);
+ return FAILURE;
missmatch should be mismatch.
+/* Skip a */
+static bool
+skip_gcc_attribute (locus start)
+{
+ bool r = false;
+ char c;
The comment seems to be somewhat terse. Also, the variable 'c'
is used with next_char(), which returns a gfc_char_t. Should
the declaration be changed to 'gfc_char_t c'?
@@ -3835,7 +3866,11 @@ add_argument_checking (stmtblock_t *bloc
/* For POINTER, ALLOCATABLE and assumed-shape dummy arguments, the
string lengths must match exactly. Otherwise, it is only required
- that the actual string length is *at least* the expected one. */
+ that the actual string length is *at least* the expected one.
+ Sequence association allows for a mismatch of the string length
+ if the actual argument is (part of) an array, but only if the
+ dummy argument is an array. (See "Sequence association" in
+ Section 12.4.1.4 for F95 and 12.4.1.5 for F2003.) */
if (fsym->attr.pointer || fsym->attr.allocatable
|| (fsym->as && fsym->as->type == AS_ASSUMED_SHAPE))
{
@@ -3843,6 +3878,8 @@ add_argument_checking (stmtblock_t *bloc
message = _("Actual string length does not match the declared one"
" for dummy argument '%s' (%ld/%ld)");
}
+ else if (fsym->as && fsym->as->rank != 0)
+ continue;
else
The above chunk looks like part of another patch.
More information about the Fortran
mailing list