decl.c (259660) | 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 Free Software Foundation, Inc. 4 Contributed by Michael Tiemann (tiemann@cygnus.com) 5 6This file is part of GCC. 7 8GCC is free software; you can redistribute it and/or modify --- 218 unchanged lines hidden (view full) --- 227 (Zero if we are at namespace scope, one inside the body of a 228 function, two inside the body of a function in a local class, etc.) */ 229int function_depth; 230 231/* States indicating how grokdeclarator() should handle declspecs marked 232 with __attribute__((deprecated)). An object declared as 233 __attribute__((deprecated)) suppresses warnings of uses of other 234 deprecated items. */ | 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 Free Software Foundation, Inc. 4 Contributed by Michael Tiemann (tiemann@cygnus.com) 5 6This file is part of GCC. 7 8GCC is free software; you can redistribute it and/or modify --- 218 unchanged lines hidden (view full) --- 227 (Zero if we are at namespace scope, one inside the body of a 228 function, two inside the body of a function in a local class, etc.) */ 229int function_depth; 230 231/* States indicating how grokdeclarator() should handle declspecs marked 232 with __attribute__((deprecated)). An object declared as 233 __attribute__((deprecated)) suppresses warnings of uses of other 234 deprecated items. */ |
235/* APPLE LOCAL begin "unavailable" attribute (radar 2809697) */ 236/* An object declared as __attribute__((unavailable)) suppresses 237 any reports of being declared with unavailable or deprecated 238 items. */ 239/* APPLE LOCAL end "unavailable" attribute (radar 2809697) */ |
|
235 236enum deprecated_states { 237 DEPRECATED_NORMAL, 238 DEPRECATED_SUPPRESS | 240 241enum deprecated_states { 242 DEPRECATED_NORMAL, 243 DEPRECATED_SUPPRESS |
244 /* APPLE LOCAL "unavailable" attribute (radar 2809697) */ 245 , DEPRECATED_UNAVAILABLE_SUPPRESS |
|
239}; 240 241static enum deprecated_states deprecated_state = DEPRECATED_NORMAL; 242 243 244/* A TREE_LIST of VAR_DECLs. The TREE_PURPOSE is a RECORD_TYPE or 245 UNION_TYPE; the TREE_VALUE is a VAR_DECL with that type. At the 246 time the VAR_DECL was declared, the type was incomplete. */ --- 3584 unchanged lines hidden (view full) --- 3831 int initialized, 3832 tree attributes, 3833 tree prefix_attributes, 3834 tree *pushed_scope_p) 3835{ 3836 tree decl; 3837 tree type, tem; 3838 tree context; | 246}; 247 248static enum deprecated_states deprecated_state = DEPRECATED_NORMAL; 249 250 251/* A TREE_LIST of VAR_DECLs. The TREE_PURPOSE is a RECORD_TYPE or 252 UNION_TYPE; the TREE_VALUE is a VAR_DECL with that type. At the 253 time the VAR_DECL was declared, the type was incomplete. */ --- 3584 unchanged lines hidden (view full) --- 3838 int initialized, 3839 tree attributes, 3840 tree prefix_attributes, 3841 tree *pushed_scope_p) 3842{ 3843 tree decl; 3844 tree type, tem; 3845 tree context; |
3846 /* APPLE LOCAL "unavailable" attribute (radar 2809697) */ 3847 tree a; |
|
3839 bool was_public; 3840 3841 *pushed_scope_p = NULL_TREE; 3842 | 3848 bool was_public; 3849 3850 *pushed_scope_p = NULL_TREE; 3851 |
3843 /* An object declared as __attribute__((deprecated)) suppresses 3844 warnings of uses of other deprecated items. */ | 3852 /* APPLE LOCAL begin "unavailable" attribute (radar 2809697) */ 3853 /* An object declared as __attribute__((unavailable)) suppresses 3854 any reports of being declared with unavailable or deprecated 3855 items. An object declared as __attribute__((deprecated)) 3856 suppresses warnings of uses of other deprecated items. */ 3857#ifdef A_LESS_INEFFICENT_WAY /* which I really don't want to do! */ |
3845 if (lookup_attribute ("deprecated", attributes)) 3846 deprecated_state = DEPRECATED_SUPPRESS; | 3858 if (lookup_attribute ("deprecated", attributes)) 3859 deprecated_state = DEPRECATED_SUPPRESS; |
3860 else if (lookup_attribute ("unavailable", attributes)) 3861 deprecated_state = DEPRECATED_UNAVAILABLE_SUPPRESS; 3862#else /* a more efficient way doing what lookup_attribute would do */ 3863 for (a = attributes; a; a = TREE_CHAIN (a)) 3864 { 3865 tree name = TREE_PURPOSE (a); 3866 if (TREE_CODE (name) == IDENTIFIER_NODE) 3867 if (is_attribute_p ("deprecated", name)) 3868 { 3869 deprecated_state = DEPRECATED_SUPPRESS; 3870 break; 3871 } 3872 if (is_attribute_p ("unavailable", name)) 3873 { 3874 deprecated_state = DEPRECATED_UNAVAILABLE_SUPPRESS; 3875 break; 3876 } 3877 } 3878#endif 3879 /* APPLE LOCAL end "unavailable" attribute (radar 2809697) */ |
|
3847 3848 attributes = chainon (attributes, prefix_attributes); 3849 3850 decl = grokdeclarator (declarator, declspecs, NORMAL, initialized, 3851 &attributes); 3852 3853 deprecated_state = DEPRECATED_NORMAL; 3854 --- 3414 unchanged lines hidden (view full) --- 7269 7270 /* Extract the basic type from the decl-specifier-seq. */ 7271 type = declspecs->type; 7272 if (type == error_mark_node) 7273 { 7274 type = NULL_TREE; 7275 type_was_error_mark_node = true; 7276 } | 3880 3881 attributes = chainon (attributes, prefix_attributes); 3882 3883 decl = grokdeclarator (declarator, declspecs, NORMAL, initialized, 3884 &attributes); 3885 3886 deprecated_state = DEPRECATED_NORMAL; 3887 --- 3414 unchanged lines hidden (view full) --- 7302 7303 /* Extract the basic type from the decl-specifier-seq. */ 7304 type = declspecs->type; 7305 if (type == error_mark_node) 7306 { 7307 type = NULL_TREE; 7308 type_was_error_mark_node = true; 7309 } |
7310 7311 /* APPLE LOCAL begin unavailable attribute (radar 2809697) --bowdidge */ 7312 /* If the entire declaration is itself tagged as unavailable then 7313 suppress reports of unavailable/deprecated items. If the 7314 entire declaration is tagged as only deprecated we still 7315 report unavailable uses. */ 7316 if (type && TREE_DEPRECATED (type) && TREE_UNAVAILABLE (type)) 7317 { 7318 if (deprecated_state != DEPRECATED_UNAVAILABLE_SUPPRESS) 7319 warn_deprecated_use (type); 7320 } 7321 else 7322 /* APPLE LOCAL end unavailable attribute (radar 2809697) --bowdidge */ |
|
7277 /* If the entire declaration is itself tagged as deprecated then 7278 suppress reports of deprecated items. */ 7279 if (type && TREE_DEPRECATED (type) 7280 && deprecated_state != DEPRECATED_SUPPRESS) 7281 warn_deprecated_use (type); 7282 if (type && TREE_CODE (type) == TYPE_DECL) 7283 { 7284 typedef_decl = type; --- 4514 unchanged lines hidden --- | 7323 /* If the entire declaration is itself tagged as deprecated then 7324 suppress reports of deprecated items. */ 7325 if (type && TREE_DEPRECATED (type) 7326 && deprecated_state != DEPRECATED_SUPPRESS) 7327 warn_deprecated_use (type); 7328 if (type && TREE_CODE (type) == TYPE_DECL) 7329 { 7330 typedef_decl = type; --- 4514 unchanged lines hidden --- |