[prev in list] [next in list] [prev in thread] [next in thread]
List: gcc-fortran
Subject: Re: [PATCH, fortran] Add gfc_define_builtin_with_spec
From: Thomas Schwinge <thomas () codesourcery ! com>
Date: 2015-04-21 18:28:20
Message-ID: 87wq151gl7.fsf () kepler ! schwinge ! homeip ! net
[Download RAW message or body]
Hi!
On Fri, 9 Jan 2015 16:37:00 +0100, Tom de Vries <Tom_deVries@mentor.com> wrote:
> For the oacc kernels patch series I need a fortran builtin with fn spec
> attribute (as mentioned here: https://gcc.gnu.org/ml/gcc/2014-12/msg00001.html ).
>
> Attached patch adds a function gfc_define_builtin_with_spec that allows me to
> define such a builtin.
>
> At this point there's no user yet in trunk, so I've declared it unused.
>
> Bootstrapped and reg-tested on x86_64.
>
> OK for stage 3 trunk?
Committed to gomp-4_0-branch in r222275:
commit ee0a44a49648f1addce78a6765bcbf6a14f237c2
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Tue Apr 21 18:24:48 2015 +0000
Add gfc_define_builtin_with_spec
gcc/fortran/
* f95-lang.c (gfc_define_builtin_with_spec): New function.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@222275 \
138bc75d-0d04-0410-961f-82ee72b054a4
---
gcc/fortran/ChangeLog.gomp | 4 ++++
gcc/fortran/f95-lang.c | 21 +++++++++++++++++++++
2 files changed, 25 insertions(+)
diff --git gcc/fortran/ChangeLog.gomp gcc/fortran/ChangeLog.gomp
index 02a1aeb..8c23900 100644
--- gcc/fortran/ChangeLog.gomp
+++ gcc/fortran/ChangeLog.gomp
@@ -1,3 +1,7 @@
+2015-04-21 Tom de Vries <tom@codesourcery.com>
+
+ * f95-lang.c (gfc_define_builtin_with_spec): New function.
+
2015-01-13 Thomas Schwinge <thomas@codesourcery.com>
* trans-openmp.c (gfc_omp_finish_clause, gfc_trans_omp_clauses):
diff --git gcc/fortran/f95-lang.c gcc/fortran/f95-lang.c
index de9c813..1a14860 100644
--- gcc/fortran/f95-lang.c
+++ gcc/fortran/f95-lang.c
@@ -39,6 +39,7 @@ along with GCC; see the file COPYING3. If not see
#include "wide-int.h"
#include "inchash.h"
#include "tree.h"
+#include "stringpool.h"
#include "flags.h"
#include "langhooks.h"
#include "langhooks-def.h"
@@ -600,6 +601,26 @@ gfc_define_builtin (const char *name, tree type, enum \
built_in_function code, set_builtin_decl (code, decl, true);
}
+/* Like gfc_define_builtin, but with fn spec attribute FNSPEC. */
+
+static void ATTRIBUTE_UNUSED
+gfc_define_builtin_with_spec (const char *name, tree fntype,
+ enum built_in_function code,
+ const char *library_name, int attr,
+ const char *fnspec)
+{
+ if (fnspec)
+ {
+ /* Code copied from build_library_function_decl_1. */
+ tree attr_args = build_tree_list (NULL_TREE,
+ build_string (strlen (fnspec), fnspec));
+ tree attrs = tree_cons (get_identifier ("fn spec"),
+ attr_args, TYPE_ATTRIBUTES (fntype));
+ fntype = build_type_attribute_variant (fntype, attrs);
+ }
+
+ gfc_define_builtin (name, fntype, code, library_name, attr);
+}
#define DO_DEFINE_MATH_BUILTIN(code, name, argtype, tbase) \
gfc_define_builtin ("__builtin_" name "l", tbase##longdouble[argtype], \
Grüße,
Thomas
["signature.asc" (application/pgp-signature)]
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic