summaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-decl.c
diff options
context:
space:
mode:
authorfxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4>2007-11-03 14:51:51 +0000
committerfxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4>2007-11-03 14:51:51 +0000
commita2f97da76feac655cd6ef8f5d519efe69ec06687 (patch)
tree0b205366f000dcc61123d9d05537464c13b0f625 /gcc/fortran/trans-decl.c
parentc761351cc4891e38cf3ef25fd03b59e6c3901d61 (diff)
downloadgcc-a2f97da76feac655cd6ef8f5d519efe69ec06687.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@129869 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/trans-decl.c')
-rw-r--r--gcc/fortran/trans-decl.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index 5b6b88bde63..4b114df728b 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -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)