diff options
author | Kai Tietz <kai.tietz@onevision.com> | 2011-01-13 18:04:03 +0000 |
---|---|---|
committer | Tobias Burnus <burnus@gcc.gnu.org> | 2011-01-13 19:04:03 +0100 |
commit | 384f586a535c25c12cf803806e0769007695000f (patch) | |
tree | 36f23ba5202fa094f4212c3cf0769e20dc440066 /gcc/fortran | |
parent | 29a63d67791eb9a7bea3c64425ff3b3494968812 (diff) | |
download | gcc-384f586a535c25c12cf803806e0769007695000f.tar.gz |
re PR fortran/47260 (DLLEXPORT: TREE_PUBLIC for procedures lost between trans-decl.c and tree.c)
2011-01-13 Kai Tietz <kai.tietz@onevision.com>
Tobias Burnus <burnus@net-b.de>
PR fortran/47260
* trans-decl.c (gfc_get_extern_function_decl,
build_function_decl): Set TREE_PUBLIC/TREE_EXTERNAL before
calling decl_attributes.
Co-Authored-By: Tobias Burnus <burnus@net-b.de>
From-SVN: r168757
Diffstat (limited to 'gcc/fortran')
-rw-r--r-- | gcc/fortran/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/fortran/trans-decl.c | 30 |
2 files changed, 23 insertions, 15 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index fa84641adb8..223acd0f633 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,11 @@ +2011-01-13 Kai Tietz <kai.tietz@onevision.com> + Tobias Burnus <burnus@net-b.de> + + PR fortran/47260 + * trans-decl.c (gfc_get_extern_function_decl, + build_function_decl): Set TREE_PUBLIC/TREE_EXTERNAL before + calling decl_attributes. + 2011-01-13 Tobias Burnus <burnus@net-b.de> Mikael Morin <mikael@gcc.gnu.org> diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index 829548c646e..254db76b0c5 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -1575,6 +1575,12 @@ gfc_get_extern_function_decl (gfc_symbol * sym) fndecl = build_decl (input_location, FUNCTION_DECL, name, type); + /* Initialize DECL_EXTERNAL and TREE_PUBLIC before calling decl_attributes; + TREE_PUBLIC specifies whether a function is globally addressable (i.e. + the the opposite of declaring a function as static in C). */ + DECL_EXTERNAL (fndecl) = 1; + TREE_PUBLIC (fndecl) = 1; + attributes = add_attributes_to_decl (sym->attr, NULL_TREE); decl_attributes (&fndecl, attributes, 0); @@ -1592,12 +1598,6 @@ gfc_get_extern_function_decl (gfc_symbol * sym) DECL_CONTEXT (fndecl) = NULL_TREE; } - DECL_EXTERNAL (fndecl) = 1; - - /* This specifies if a function is globally addressable, i.e. it is - the opposite of declaring static in C. */ - TREE_PUBLIC (fndecl) = 1; - /* Set attributes for PURE functions. A call to PURE function in the Fortran 95 sense is both pure and without side effects in the C sense. */ @@ -1658,6 +1658,15 @@ build_function_decl (gfc_symbol * sym, bool global) attr = sym->attr; + /* Initialize DECL_EXTERNAL and TREE_PUBLIC before calling decl_attributes; + TREE_PUBLIC specifies whether a function is globally addressable (i.e. + the the opposite of declaring a function as static in C). */ + DECL_EXTERNAL (fndecl) = 0; + + if (!current_function_decl + && !sym->attr.entry_master && !sym->attr.is_main_program) + TREE_PUBLIC (fndecl) = 1; + attributes = add_attributes_to_decl (attr, NULL_TREE); decl_attributes (&fndecl, attributes, 0); @@ -1707,15 +1716,6 @@ build_function_decl (gfc_symbol * sym, bool global) /* Don't call layout_decl for a RESULT_DECL. layout_decl (result_decl, 0); */ - /* Set up all attributes for the function. */ - DECL_EXTERNAL (fndecl) = 0; - - /* This specifies if a function is globally visible, i.e. it is - the opposite of declaring static in C. */ - if (!current_function_decl - && !sym->attr.entry_master && !sym->attr.is_main_program) - TREE_PUBLIC (fndecl) = 1; - /* TREE_STATIC means the function body is defined here. */ TREE_STATIC (fndecl) = 1; |