This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix gfortran -Wall on arm (PR target/33947)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 22 Nov 2007 17:09:01 -0500
- Subject: [PATCH] Fix gfortran -Wall on arm (PR target/33947)
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
__const__ and __nothrow__ attributes are both C/C++/ObjC/ObjC++ specific
attributes handled in c-common.c, so in Fortran and other languages they
won't do anything and with -Wall emit annoying
f951: warning: 'const' attribute directive ignored
f951: warning: 'nothrow' attribute directive ignored
messages. The attached patch fixes it by setting the flags on the builtin
fndecl directly, the same way as all other backends do it in these cases.
I have verified that in C __builtin_thread_pointer () keeps the const
and nothrow properties by inspection of -fdump-tree-eh and
-fdump-tree-optimized dumps for
void bar (void *x);
long foo (void)
{
int z __attribute__((cleanup (bar)));
extern void *__builtin_thread_pointer (void);
char *i = __builtin_thread_pointer ();
char *j = __builtin_thread_pointer ();
return i - j;
}
Committed as obvious on the trunk.
2007-11-22 Jakub Jelinek <jakub@redhat.com>
PR target/33947
* config/arm/arm.c (arm_init_tls_builtins): Set TREE_NOTHROW
and TREE_READONLY on the fn decl rather than passing a chain
of attributes.
--- gcc/config/arm/arm.c.jj 2007-11-06 09:15:15.000000000 +0100
+++ gcc/config/arm/arm.c 2007-11-22 22:30:56.000000000 +0100
@@ -14488,14 +14488,14 @@ arm_init_iwmmxt_builtins (void)
static void
arm_init_tls_builtins (void)
{
- tree ftype;
- tree nothrow = tree_cons (get_identifier ("nothrow"), NULL, NULL);
- tree const_nothrow = tree_cons (get_identifier ("const"), NULL, nothrow);
+ tree ftype, decl;
ftype = build_function_type (ptr_type_node, void_list_node);
- add_builtin_function ("__builtin_thread_pointer", ftype,
- ARM_BUILTIN_THREAD_POINTER, BUILT_IN_MD,
- NULL, const_nothrow);
+ decl = add_builtin_function ("__builtin_thread_pointer", ftype,
+ ARM_BUILTIN_THREAD_POINTER, BUILT_IN_MD,
+ NULL, NULL_TREE);
+ TREE_NOTHROW (decl) = 1;
+ TREE_READONLY (decl) = 1;
}
typedef enum {
Jakub