mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-21 23:41:13 +08:00
gfortran.h: Shorten comment.
* gfortran.h: Shorten comment. * trans-types.c (gfc_get_function_type): Allow argument to have flavor FL_PROGRAM. * trans-decl.c (gfc_sym_mangled_function_id): Mangle main program name into MAIN__. (build_function_decl): Fix comment. * parse.c (main_program_symbol): Give the main program its proper name, if any. Set its flavor to FL_PROGRAM. (gfc_parse_file): Likewise. From-SVN: r129869
This commit is contained in:
parent
9d85b4853b
commit
ecf24057f8
@ -1,3 +1,15 @@
|
||||
2007-11-03 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
|
||||
|
||||
* gfortran.h: Shorten comment.
|
||||
* trans-types.c (gfc_get_function_type): Allow argument to have
|
||||
flavor FL_PROGRAM.
|
||||
* trans-decl.c (gfc_sym_mangled_function_id): Mangle main program
|
||||
name into MAIN__.
|
||||
(build_function_decl): Fix comment.
|
||||
* parse.c (main_program_symbol): Give the main program its proper
|
||||
name, if any. Set its flavor to FL_PROGRAM.
|
||||
(gfc_parse_file): Likewise.
|
||||
|
||||
2007-11-02 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
|
||||
|
||||
* intrinsic.texi (ALLOCATED): Fix typo.
|
||||
|
@ -665,9 +665,7 @@ typedef struct
|
||||
/* Set if the symbol has ambiguous interfaces. */
|
||||
unsigned ambiguous_interfaces:1;
|
||||
|
||||
/* Set if the is the symbol for the main program. This is the least
|
||||
cumbersome way to communicate this function property without
|
||||
strcmp'ing with __MAIN everywhere. */
|
||||
/* Set if this is the symbol for the main program. */
|
||||
unsigned is_main_program:1;
|
||||
|
||||
/* Mutually exclusive multibit attributes. */
|
||||
|
@ -1237,14 +1237,14 @@ gfc_ascii_statement (gfc_statement st)
|
||||
/* Create a symbol for the main program and assign it to ns->proc_name. */
|
||||
|
||||
static void
|
||||
main_program_symbol (gfc_namespace *ns)
|
||||
main_program_symbol (gfc_namespace *ns, const char *name)
|
||||
{
|
||||
gfc_symbol *main_program;
|
||||
symbol_attribute attr;
|
||||
|
||||
gfc_get_symbol ("MAIN__", ns, &main_program);
|
||||
gfc_get_symbol (name, ns, &main_program);
|
||||
gfc_clear_attr (&attr);
|
||||
attr.flavor = FL_PROCEDURE;
|
||||
attr.flavor = FL_PROGRAM;
|
||||
attr.proc = PROC_UNKNOWN;
|
||||
attr.subroutine = 1;
|
||||
attr.access = ACCESS_PUBLIC;
|
||||
@ -3331,7 +3331,7 @@ loop:
|
||||
prog_locus = gfc_current_locus;
|
||||
|
||||
push_state (&s, COMP_PROGRAM, gfc_new_block);
|
||||
main_program_symbol(gfc_current_ns);
|
||||
main_program_symbol(gfc_current_ns, gfc_new_block->name);
|
||||
accept_statement (st);
|
||||
add_global_program ();
|
||||
parse_progunit (ST_NONE);
|
||||
@ -3373,7 +3373,7 @@ loop:
|
||||
prog_locus = gfc_current_locus;
|
||||
|
||||
push_state (&s, COMP_PROGRAM, gfc_new_block);
|
||||
main_program_symbol (gfc_current_ns);
|
||||
main_program_symbol (gfc_current_ns, "MAIN__");
|
||||
parse_progunit (st);
|
||||
break;
|
||||
}
|
||||
|
@ -7581,6 +7581,9 @@ resolve_symbol (gfc_symbol *sym)
|
||||
if (sym->attr.procedure && sym->interface
|
||||
&& sym->attr.if_source != IFSRC_DECL)
|
||||
{
|
||||
while (sym->interface->interface)
|
||||
sym->interface = sym->interface->interface;
|
||||
|
||||
/* Get the attributes from the interface (now resolved). */
|
||||
if (sym->interface->attr.if_source || sym->interface->attr.intrinsic)
|
||||
{
|
||||
|
@ -324,8 +324,12 @@ gfc_sym_mangled_function_id (gfc_symbol * sym)
|
||||
|| (sym->module != NULL && (sym->attr.external
|
||||
|| sym->attr.if_source == IFSRC_IFBODY)))
|
||||
{
|
||||
if (strcmp (sym->name, "MAIN__") == 0
|
||||
|| sym->attr.proc == PROC_INTRINSIC)
|
||||
/* Main program is mangled into MAIN__. */
|
||||
if (sym->attr.is_main_program)
|
||||
return get_identifier ("MAIN__");
|
||||
|
||||
/* Intrinsic procedures are never mangled. */
|
||||
if (sym->attr.proc == PROC_INTRINSIC)
|
||||
return get_identifier (sym->name);
|
||||
|
||||
if (gfc_option.flag_underscoring)
|
||||
@ -1321,7 +1325,7 @@ build_function_decl (gfc_symbol * sym)
|
||||
TREE_SIDE_EFFECTS (fndecl) = 0;
|
||||
}
|
||||
|
||||
/* For -fwhole-program to work well, MAIN__ needs to have the
|
||||
/* For -fwhole-program to work well, the main program needs to have the
|
||||
"externally_visible" attribute. */
|
||||
if (attr.is_main_program)
|
||||
DECL_ATTRIBUTES (fndecl)
|
||||
|
@ -1924,8 +1924,10 @@ gfc_get_function_type (gfc_symbol * sym)
|
||||
int nstr;
|
||||
int alternate_return;
|
||||
|
||||
/* Make sure this symbol is a function or a subroutine. */
|
||||
gcc_assert (sym->attr.flavor == FL_PROCEDURE);
|
||||
/* Make sure this symbol is a function, a subroutine or the main
|
||||
program. */
|
||||
gcc_assert (sym->attr.flavor == FL_PROCEDURE
|
||||
|| sym->attr.flavor == FL_PROGRAM);
|
||||
|
||||
if (sym->backend_decl)
|
||||
return TREE_TYPE (sym->backend_decl);
|
||||
|
Loading…
x
Reference in New Issue
Block a user