Deleted Added
full compact
c-decl.c (258748) c-decl.c (260014)
1/* Process declarations and variables for C compiler.
2 Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
3 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify it under
8the terms of the GNU General Public License as published by the Free

--- 5 unchanged lines hidden (view full) ---

14FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15for more details.
16
17You should have received a copy of the GNU General Public License
18along with GCC; see the file COPYING. If not, write to the Free
19Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
2002110-1301, USA. */
21
1/* Process declarations and variables for C compiler.
2 Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
3 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify it under
8the terms of the GNU General Public License as published by the Free

--- 5 unchanged lines hidden (view full) ---

14FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15for more details.
16
17You should have received a copy of the GNU General Public License
18along with GCC; see the file COPYING. If not, write to the Free
19Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
2002110-1301, USA. */
21
22/* $FreeBSD: head/contrib/gcc/c-decl.c 258748 2013-11-29 18:46:02Z pfg $ */
22/* $FreeBSD: head/contrib/gcc/c-decl.c 260014 2013-12-28 20:30:31Z pfg $ */
23/* Merged C99 inline changes from gcc trunk 122565 2007-03-05 */
24/* Fixed problems with compiling inline-25.c and inline-26.c */
25/* XXX still fails inline-29.c, inline-31.c, and inline-32.c */
26
27/* Process declarations and symbol lookup for C front end.
28 Also constructs types; the standard scalar types at initialization,
29 and structure, union, array and enum types when they are declared. */
30

--- 417 unchanged lines hidden (view full) ---

448
449 return t;
450}
451
452/* States indicating how grokdeclarator() should handle declspecs marked
453 with __attribute__((deprecated)). An object declared as
454 __attribute__((deprecated)) suppresses warnings of uses of other
455 deprecated items. */
23/* Merged C99 inline changes from gcc trunk 122565 2007-03-05 */
24/* Fixed problems with compiling inline-25.c and inline-26.c */
25/* XXX still fails inline-29.c, inline-31.c, and inline-32.c */
26
27/* Process declarations and symbol lookup for C front end.
28 Also constructs types; the standard scalar types at initialization,
29 and structure, union, array and enum types when they are declared. */
30

--- 417 unchanged lines hidden (view full) ---

448
449 return t;
450}
451
452/* States indicating how grokdeclarator() should handle declspecs marked
453 with __attribute__((deprecated)). An object declared as
454 __attribute__((deprecated)) suppresses warnings of uses of other
455 deprecated items. */
456/* APPLE LOCAL begin "unavailable" attribute (radar 2809697) */
457/* Also add an __attribute__((unavailable)). An object declared as
458 __attribute__((unavailable)) suppresses any reports of being
459 declared with unavailable or deprecated items. */
460/* APPLE LOCAL end "unavailable" attribute (radar 2809697) */
456
457enum deprecated_states {
458 DEPRECATED_NORMAL,
459 DEPRECATED_SUPPRESS
461
462enum deprecated_states {
463 DEPRECATED_NORMAL,
464 DEPRECATED_SUPPRESS
465 /* APPLE LOCAL "unavailable" attribute (radar 2809697) */
466 , DEPRECATED_UNAVAILABLE_SUPPRESS
460};
461
462static enum deprecated_states deprecated_state = DEPRECATED_NORMAL;
463
464void
465c_print_identifier (FILE *file, tree node, int indent)
466{
467 print_node (file, "symbol", I_SYMBOL_DECL (node), indent + 4);

--- 1236 unchanged lines hidden (view full) ---

1704
1705 if (TREE_THIS_VOLATILE (newdecl))
1706 TREE_THIS_VOLATILE (olddecl) = 1;
1707
1708 /* Merge deprecatedness. */
1709 if (TREE_DEPRECATED (newdecl))
1710 TREE_DEPRECATED (olddecl) = 1;
1711
467};
468
469static enum deprecated_states deprecated_state = DEPRECATED_NORMAL;
470
471void
472c_print_identifier (FILE *file, tree node, int indent)
473{
474 print_node (file, "symbol", I_SYMBOL_DECL (node), indent + 4);

--- 1236 unchanged lines hidden (view full) ---

1711
1712 if (TREE_THIS_VOLATILE (newdecl))
1713 TREE_THIS_VOLATILE (olddecl) = 1;
1714
1715 /* Merge deprecatedness. */
1716 if (TREE_DEPRECATED (newdecl))
1717 TREE_DEPRECATED (olddecl) = 1;
1718
1719 /* APPLE LOCAL begin "unavailable" attribute (radar 2809697) */
1720 /* Merge unavailableness. */
1721 if (TREE_UNAVAILABLE (newdecl))
1722 TREE_UNAVAILABLE (olddecl) = 1;
1723 /* APPLE LOCAL end "unavailable" attribute (radar 2809697) */
1724
1712 /* Keep source location of definition rather than declaration and of
1713 prototype rather than non-prototype unless that prototype is
1714 built-in. */
1715 if ((DECL_INITIAL (newdecl) == 0 && DECL_INITIAL (olddecl) != 0)
1716 || (old_is_prototype && !new_is_prototype
1717 && !C_DECL_BUILTIN_PROTOTYPE (olddecl)))
1718 DECL_SOURCE_LOCATION (newdecl) = DECL_SOURCE_LOCATION (olddecl);
1719

--- 1497 unchanged lines hidden (view full) ---

3217start_decl (struct c_declarator *declarator, struct c_declspecs *declspecs,
3218 bool initialized, tree attributes)
3219{
3220 tree decl;
3221 tree tem;
3222
3223 /* An object declared as __attribute__((deprecated)) suppresses
3224 warnings of uses of other deprecated items. */
1725 /* Keep source location of definition rather than declaration and of
1726 prototype rather than non-prototype unless that prototype is
1727 built-in. */
1728 if ((DECL_INITIAL (newdecl) == 0 && DECL_INITIAL (olddecl) != 0)
1729 || (old_is_prototype && !new_is_prototype
1730 && !C_DECL_BUILTIN_PROTOTYPE (olddecl)))
1731 DECL_SOURCE_LOCATION (newdecl) = DECL_SOURCE_LOCATION (olddecl);
1732

--- 1497 unchanged lines hidden (view full) ---

3230start_decl (struct c_declarator *declarator, struct c_declspecs *declspecs,
3231 bool initialized, tree attributes)
3232{
3233 tree decl;
3234 tree tem;
3235
3236 /* An object declared as __attribute__((deprecated)) suppresses
3237 warnings of uses of other deprecated items. */
3238 /* APPLE LOCAL begin "unavailable" attribute (radar 2809697) */
3239 /* An object declared as __attribute__((unavailable)) suppresses
3240 any reports of being declared with unavailable or deprecated
3241 items. An object declared as __attribute__((deprecated))
3242 suppresses warnings of uses of other deprecated items. */
3243#ifdef A_LESS_INEFFICENT_WAY /* which I really don't want to do! */
3225 if (lookup_attribute ("deprecated", attributes))
3226 deprecated_state = DEPRECATED_SUPPRESS;
3244 if (lookup_attribute ("deprecated", attributes))
3245 deprecated_state = DEPRECATED_SUPPRESS;
3246 else if (lookup_attribute ("unavailable", attributes))
3247 deprecated_state = DEPRECATED_UNAVAILABLE_SUPPRESS;
3248#else /* a more efficient way doing what lookup_attribute would do */
3249 tree a;
3227
3250
3251 for (a = attributes; a; a = TREE_CHAIN (a))
3252 {
3253 tree name = TREE_PURPOSE (a);
3254 if (TREE_CODE (name) == IDENTIFIER_NODE)
3255 if (is_attribute_p ("deprecated", name))
3256 {
3257 deprecated_state = DEPRECATED_SUPPRESS;
3258 break;
3259 }
3260 if (is_attribute_p ("unavailable", name))
3261 {
3262 deprecated_state = DEPRECATED_UNAVAILABLE_SUPPRESS;
3263 break;
3264 }
3265 }
3266#endif
3267 /* APPLE LOCAL end "unavailable" attribute (radar 2809697) */
3268
3228 decl = grokdeclarator (declarator, declspecs,
3229 NORMAL, initialized, NULL);
3230 if (!decl)
3231 return 0;
3232
3233 deprecated_state = DEPRECATED_NORMAL;
3234
3235 if (warn_main > 0 && TREE_CODE (decl) != FUNCTION_DECL

--- 846 unchanged lines hidden (view full) ---

4082 a function declarator. */
4083
4084 if (funcdef_flag && !funcdef_syntax)
4085 return 0;
4086
4087 /* If this looks like a function definition, make it one,
4088 even if it occurs where parms are expected.
4089 Then store_parm_decls will reject it and not use it as a parm. */
3269 decl = grokdeclarator (declarator, declspecs,
3270 NORMAL, initialized, NULL);
3271 if (!decl)
3272 return 0;
3273
3274 deprecated_state = DEPRECATED_NORMAL;
3275
3276 if (warn_main > 0 && TREE_CODE (decl) != FUNCTION_DECL

--- 846 unchanged lines hidden (view full) ---

4123 a function declarator. */
4124
4125 if (funcdef_flag && !funcdef_syntax)
4126 return 0;
4127
4128 /* If this looks like a function definition, make it one,
4129 even if it occurs where parms are expected.
4130 Then store_parm_decls will reject it and not use it as a parm. */
4131 /* APPLE LOCAL begin "unavailable" attribute (radar 2809697) */
4132 if (declspecs->unavailable_p)
4133 error_unavailable_use (declspecs->type);
4134 else
4135 /* APPLE LOCAL end "unavailable" attribute (radar 2809697) */
4090 if (decl_context == NORMAL && !funcdef_flag && current_scope->parm_flag)
4091 decl_context = PARM;
4092
4093 if (declspecs->deprecated_p && deprecated_state != DEPRECATED_SUPPRESS)
4094 warn_deprecated_use (declspecs->type);
4095
4096 if ((decl_context == NORMAL || decl_context == FIELD)
4097 && current_scope == file_scope

--- 3164 unchanged lines hidden (view full) ---

7262 ret->storage_class = csc_none;
7263 ret->declspecs_seen_p = false;
7264 ret->type_seen_p = false;
7265 ret->non_sc_seen_p = false;
7266 ret->typedef_p = false;
7267 ret->tag_defined_p = false;
7268 ret->explicit_signed_p = false;
7269 ret->deprecated_p = false;
4136 if (decl_context == NORMAL && !funcdef_flag && current_scope->parm_flag)
4137 decl_context = PARM;
4138
4139 if (declspecs->deprecated_p && deprecated_state != DEPRECATED_SUPPRESS)
4140 warn_deprecated_use (declspecs->type);
4141
4142 if ((decl_context == NORMAL || decl_context == FIELD)
4143 && current_scope == file_scope

--- 3164 unchanged lines hidden (view full) ---

7308 ret->storage_class = csc_none;
7309 ret->declspecs_seen_p = false;
7310 ret->type_seen_p = false;
7311 ret->non_sc_seen_p = false;
7312 ret->typedef_p = false;
7313 ret->tag_defined_p = false;
7314 ret->explicit_signed_p = false;
7315 ret->deprecated_p = false;
7316 /* APPLE LOCAL "unavailable" attribute (radar 2809697) */
7317 ret->unavailable_p = false;
7270 ret->default_int_p = false;
7271 ret->long_p = false;
7272 ret->long_long_p = false;
7273 ret->short_p = false;
7274 ret->signed_p = false;
7275 ret->unsigned_p = false;
7276 ret->complex_p = false;
7277 ret->inline_p = false;

--- 47 unchanged lines hidden (view full) ---

7325{
7326 tree type = spec.spec;
7327 specs->non_sc_seen_p = true;
7328 specs->declspecs_seen_p = true;
7329 specs->type_seen_p = true;
7330 if (TREE_DEPRECATED (type))
7331 specs->deprecated_p = true;
7332
7318 ret->default_int_p = false;
7319 ret->long_p = false;
7320 ret->long_long_p = false;
7321 ret->short_p = false;
7322 ret->signed_p = false;
7323 ret->unsigned_p = false;
7324 ret->complex_p = false;
7325 ret->inline_p = false;

--- 47 unchanged lines hidden (view full) ---

7373{
7374 tree type = spec.spec;
7375 specs->non_sc_seen_p = true;
7376 specs->declspecs_seen_p = true;
7377 specs->type_seen_p = true;
7378 if (TREE_DEPRECATED (type))
7379 specs->deprecated_p = true;
7380
7381 /* APPLE LOCAL begin "unavailable" attribute (radar 2809697) */
7382 if (TREE_UNAVAILABLE (type))
7383 specs->unavailable_p = true;
7384 /* APPLE LOCAL end "unavailable" attribute (radar 2809697) */
7385
7333 /* Handle type specifier keywords. */
7334 if (TREE_CODE (type) == IDENTIFIER_NODE && C_IS_RESERVED_WORD (type))
7335 {
7336 enum rid i = C_RID_CODE (type);
7337 if (specs->type)
7338 {
7339 error ("two or more data types in declaration specifiers");
7340 return specs;

--- 741 unchanged lines hidden ---
7386 /* Handle type specifier keywords. */
7387 if (TREE_CODE (type) == IDENTIFIER_NODE && C_IS_RESERVED_WORD (type))
7388 {
7389 enum rid i = C_RID_CODE (type);
7390 if (specs->type)
7391 {
7392 error ("two or more data types in declaration specifiers");
7393 return specs;

--- 741 unchanged lines hidden ---