X-Git-Url: http://git.sourceforge.jp/view?a=blobdiff_plain;f=gcc%2Fattribs.c;h=7377c57691dfe0b4d91b17965f7201587debe184;hb=baab3ea2c32aaac44a3f03bc51988ef4f07a659d;hp=fd11a96700f773d484f1688b8ae76baa8b488c4a;hpb=1c0a6d1e195099395b9f06dd82021f3fec7924fd;p=pf3gnuchains%2Fgcc-fork.git diff --git a/gcc/attribs.c b/gcc/attribs.c index fd11a96700f..7377c57691d 100644 --- a/gcc/attribs.c +++ b/gcc/attribs.c @@ -1,6 +1,6 @@ /* Functions dealing with attribute handling, used by most front ends. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, - 2002, 2003, 2004 Free Software Foundation, Inc. + 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of GCC. @@ -16,8 +16,8 @@ for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ +Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301, USA. */ #include "config.h" #include "system.h" @@ -77,21 +77,21 @@ init_attributes (void) /* The name must not begin and end with __. */ const char *name = attribute_tables[i][j].name; int len = strlen (name); - + gcc_assert (!(name[0] == '_' && name[1] == '_' && name[len - 1] == '_' && name[len - 2] == '_')); - + /* The minimum and maximum lengths must be consistent. */ gcc_assert (attribute_tables[i][j].min_length >= 0); - + gcc_assert (attribute_tables[i][j].max_length == -1 || (attribute_tables[i][j].max_length >= attribute_tables[i][j].min_length)); - + /* An attribute cannot require both a DECL and a TYPE. */ gcc_assert (!attribute_tables[i][j].decl_required || !attribute_tables[i][j].type_required); - + /* If an attribute requires a function type, in particular it requires a type. */ gcc_assert (!attribute_tables[i][j].function_type_required @@ -172,7 +172,7 @@ decl_attributes (tree *node, tree attributes, int flags) if (spec == NULL) { - warning ("%qs attribute directive ignored", + warning (OPT_Wattributes, "%qs attribute directive ignored", IDENTIFIER_POINTER (name)); continue; } @@ -197,7 +197,7 @@ decl_attributes (tree *node, tree attributes, int flags) } else { - warning ("%qs attribute does not apply to types", + warning (OPT_Wattributes, "%qs attribute does not apply to types", IDENTIFIER_POINTER (name)); continue; } @@ -227,8 +227,8 @@ decl_attributes (tree *node, tree attributes, int flags) pull out the target type now, frob it as appropriate, and rebuild the pointer type later. - This would all be simpler if attributes were part of the - declarator, grumble grumble. */ + This would all be simpler if attributes were part of the + declarator, grumble grumble. */ fn_ptr_tmp = TREE_TYPE (*anode); anode = &fn_ptr_tmp; flags &= ~(int) ATTR_FLAG_TYPE_IN_PLACE; @@ -243,12 +243,21 @@ decl_attributes (tree *node, tree attributes, int flags) if (TREE_CODE (*anode) != FUNCTION_TYPE && TREE_CODE (*anode) != METHOD_TYPE) { - warning ("%qs attribute only applies to function types", + warning (OPT_Wattributes, + "%qs attribute only applies to function types", IDENTIFIER_POINTER (name)); continue; } } + if (TYPE_P (*anode) + && (flags & (int) ATTR_FLAG_TYPE_IN_PLACE) + && TYPE_SIZE (*anode) != NULL_TREE) + { + warning (OPT_Wattributes, "type attributes ignored after type is already defined"); + continue; + } + if (spec->handler != NULL) returned_attrs = chainon ((*spec->handler) (anode, name, args, flags, &no_add_attrs),