gcc_assert (IS (str, ROW_CHAR_DENOTATION));
char *symbol = a68_string_process_breaks (p, NSYMBOL (str));
- tree decl = a68_make_formal_hole_decl (p, symbol);
+
+ tree decl;
+ if (IS (MOID (p), PROC_SYMBOL))
+ decl = a68_make_proc_formal_hole_decl (p, symbol);
+ else
+ decl = a68_make_formal_hole_decl (p, symbol);
return decl;
}
return decl;
}
+/* Make an extern declaration for a formal hole that is a function. */
+
+tree
+a68_make_proc_formal_hole_decl (NODE_T *p, const char *extern_symbol)
+{
+ /* The CTYPE of MODE is a pointer to a function. We need the pointed
+ function type for the FUNCTION_DECL. */
+ tree type = TREE_TYPE (CTYPE (MOID (p)));
+
+ gcc_assert (strlen (extern_symbol) > 0);
+ const char *sym = (extern_symbol[0] == '&'
+ ? extern_symbol + 1
+ : extern_symbol);
+
+ tree decl = build_decl (a68_get_node_location (p),
+ FUNCTION_DECL,
+ get_identifier (sym),
+ type);
+ DECL_EXTERNAL (decl) = 1;
+ TREE_PUBLIC (decl) = 1;
+ DECL_INITIAL (decl) = a68_get_skip_tree (MOID (p));
+
+ if (extern_symbol[0] == '&')
+ decl = fold_build1 (ADDR_EXPR, type, decl);
+ return decl;
+}
+
/* Do a checked indirection.
P is a tree node used for its location information.
FORWARD (q);
}
+ NODE_T *declarer = q;
do
{
if (a68_whether ((FORWARD (q)), IDENTIFIER, EQUALS_SYMBOL, STOP))
gcc_unreachable ();
ATTRIBUTE (q) = DEFINING_IDENTIFIER;
PUBLICIZED (q) = is_public;
+ if (IS (SUB (declarer), PROC_SYMBOL))
+ {
+ NODE_T *actual_param = NEXT (NEXT (q));
+ if (actual_param != NO_NODE && IS (actual_param, FORMAL_NEST_SYMBOL))
+ IN_PROC (tag) = true;
+ }
FORWARD (q);
ATTRIBUTE (q) = ALT_EQUALS_SYMBOL;
q = skip_unit (q);
bool indicant = false, bool external = false,
const char *extern_symbol = NULL);
tree a68_make_formal_hole_decl (NODE_T *p, const char *extern_symbol);
+tree a68_make_proc_formal_hole_decl (NODE_T *p, const char *extern_symbol);
tree a68_make_anonymous_routine_decl (MOID_T *mode);
tree a68_get_skip_tree (MOID_T *m);
tree a68_get_empty (void);