aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/f95-lang.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/fortran/f95-lang.c')
-rw-r--r--gcc/fortran/f95-lang.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/gcc/fortran/f95-lang.c b/gcc/fortran/f95-lang.c
index e0c22da..2fb06a9 100644
--- a/gcc/fortran/f95-lang.c
+++ b/gcc/fortran/f95-lang.c
@@ -680,7 +680,7 @@ builtin_function (const char *name,
int function_code,
enum built_in_class class,
const char *library_name,
- tree attrs ATTRIBUTE_UNUSED)
+ tree attrs)
{
tree decl = build_decl (FUNCTION_DECL, get_identifier (name), type);
DECL_EXTERNAL (decl) = 1;
@@ -691,6 +691,17 @@ builtin_function (const char *name,
pushdecl (decl);
DECL_BUILT_IN_CLASS (decl) = class;
DECL_FUNCTION_CODE (decl) = function_code;
+
+ /* Possibly apply some default attributes to this built-in function. */
+ if (attrs)
+ {
+ /* FORNOW the only supported attribute is "const". If others need
+ to be supported then see the more general solution in procedure
+ builtin_function in c-decl.c */
+ if (lookup_attribute ( "const", attrs ))
+ TREE_READONLY (decl) = 1;
+ }
+
return decl;
}