c-common.c (259666) | c-common.c (260014) |
---|---|
1/* Subroutines shared by all languages that are variants of C. 2 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 3 2001, 2002, 2003, 2004, 2005 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 --- 527 unchanged lines hidden (view full) --- 536static tree handle_malloc_attribute (tree *, tree, tree, int, bool *); 537static tree handle_returns_twice_attribute (tree *, tree, tree, int, bool *); 538static tree handle_no_limit_stack_attribute (tree *, tree, tree, int, 539 bool *); 540static tree handle_pure_attribute (tree *, tree, tree, int, bool *); 541static tree handle_novops_attribute (tree *, tree, tree, int, bool *); 542static tree handle_deprecated_attribute (tree *, tree, tree, int, 543 bool *); | 1/* Subroutines shared by all languages that are variants of C. 2 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 3 2001, 2002, 2003, 2004, 2005 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 --- 527 unchanged lines hidden (view full) --- 536static tree handle_malloc_attribute (tree *, tree, tree, int, bool *); 537static tree handle_returns_twice_attribute (tree *, tree, tree, int, bool *); 538static tree handle_no_limit_stack_attribute (tree *, tree, tree, int, 539 bool *); 540static tree handle_pure_attribute (tree *, tree, tree, int, bool *); 541static tree handle_novops_attribute (tree *, tree, tree, int, bool *); 542static tree handle_deprecated_attribute (tree *, tree, tree, int, 543 bool *); |
544/* APPLE LOCAL begin "unavailable" attribute (Radar 2809697) --ilr */ 545static tree handle_unavailable_attribute (tree *, tree, tree, int, bool *); 546/* APPLE LOCAL end "unavailable" attribute --ilr */ |
|
544static tree handle_vector_size_attribute (tree *, tree, tree, int, 545 bool *); 546static tree handle_nonnull_attribute (tree *, tree, tree, int, bool *); 547static tree handle_nothrow_attribute (tree *, tree, tree, int, bool *); 548static tree handle_cleanup_attribute (tree *, tree, tree, int, bool *); 549static tree handle_warn_unused_result_attribute (tree *, tree, tree, int, 550 bool *); 551static tree handle_sentinel_attribute (tree *, tree, tree, int, bool *); --- 69 unchanged lines hidden (view full) --- 621 { "pure", 0, 0, true, false, false, 622 handle_pure_attribute }, 623 /* For internal use (marking of builtins) only. The name contains space 624 to prevent its usage in source code. */ 625 { "no vops", 0, 0, true, false, false, 626 handle_novops_attribute }, 627 { "deprecated", 0, 0, false, false, false, 628 handle_deprecated_attribute }, | 547static tree handle_vector_size_attribute (tree *, tree, tree, int, 548 bool *); 549static tree handle_nonnull_attribute (tree *, tree, tree, int, bool *); 550static tree handle_nothrow_attribute (tree *, tree, tree, int, bool *); 551static tree handle_cleanup_attribute (tree *, tree, tree, int, bool *); 552static tree handle_warn_unused_result_attribute (tree *, tree, tree, int, 553 bool *); 554static tree handle_sentinel_attribute (tree *, tree, tree, int, bool *); --- 69 unchanged lines hidden (view full) --- 624 { "pure", 0, 0, true, false, false, 625 handle_pure_attribute }, 626 /* For internal use (marking of builtins) only. The name contains space 627 to prevent its usage in source code. */ 628 { "no vops", 0, 0, true, false, false, 629 handle_novops_attribute }, 630 { "deprecated", 0, 0, false, false, false, 631 handle_deprecated_attribute }, |
632 /* APPLE LOCAL begin "unavailable" attribute (Radar 2809697) --ilr */ 633 { "unavailable", 0, 0, false, false, false, 634 handle_unavailable_attribute }, 635 /* APPLE LOCAL end "unavailable" attribute --ilr */ |
|
629 { "vector_size", 1, 1, false, true, false, 630 handle_vector_size_attribute }, 631 { "visibility", 1, 1, false, false, false, 632 handle_visibility_attribute }, 633 { "tls_model", 1, 1, true, false, false, 634 handle_tls_model_attribute }, 635 { "nonnull", 0, -1, false, true, true, 636 handle_nonnull_attribute }, --- 3752 unchanged lines hidden (view full) --- 4389{ 4390 if (DECL_P (*node)) 4391 { 4392 tree decl = *node; 4393 4394 if (TREE_CODE (decl) == PARM_DECL 4395 || TREE_CODE (decl) == VAR_DECL 4396 || TREE_CODE (decl) == FUNCTION_DECL | 636 { "vector_size", 1, 1, false, true, false, 637 handle_vector_size_attribute }, 638 { "visibility", 1, 1, false, false, false, 639 handle_visibility_attribute }, 640 { "tls_model", 1, 1, true, false, false, 641 handle_tls_model_attribute }, 642 { "nonnull", 0, -1, false, true, true, 643 handle_nonnull_attribute }, --- 3752 unchanged lines hidden (view full) --- 4396{ 4397 if (DECL_P (*node)) 4398 { 4399 tree decl = *node; 4400 4401 if (TREE_CODE (decl) == PARM_DECL 4402 || TREE_CODE (decl) == VAR_DECL 4403 || TREE_CODE (decl) == FUNCTION_DECL |
4397 || TREE_CODE (decl) == LABEL_DECL | 4404/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ 4405 || (TREE_CODE (decl) == LABEL_DECL 4406 && ! DECL_ARTIFICIAL (decl)) 4407/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ |
4398 || TREE_CODE (decl) == TYPE_DECL) 4399 TREE_USED (decl) = 1; 4400 else 4401 { 4402 warning (OPT_Wattributes, "%qE attribute ignored", name); 4403 *no_add_attrs = true; 4404 } 4405 } --- 431 unchanged lines hidden (view full) --- 4837 } 4838 else if (!(flags & (int) ATTR_FLAG_TYPE_IN_PLACE)) 4839 *type = build_variant_type_copy (*type); 4840 4841 TYPE_ALIGN (*type) = (1 << i) * BITS_PER_UNIT; 4842 TYPE_USER_ALIGN (*type) = 1; 4843 } 4844 else if (! VAR_OR_FUNCTION_DECL_P (decl) | 4408 || TREE_CODE (decl) == TYPE_DECL) 4409 TREE_USED (decl) = 1; 4410 else 4411 { 4412 warning (OPT_Wattributes, "%qE attribute ignored", name); 4413 *no_add_attrs = true; 4414 } 4415 } --- 431 unchanged lines hidden (view full) --- 4847 } 4848 else if (!(flags & (int) ATTR_FLAG_TYPE_IN_PLACE)) 4849 *type = build_variant_type_copy (*type); 4850 4851 TYPE_ALIGN (*type) = (1 << i) * BITS_PER_UNIT; 4852 TYPE_USER_ALIGN (*type) = 1; 4853 } 4854 else if (! VAR_OR_FUNCTION_DECL_P (decl) |
4845 && TREE_CODE (decl) != FIELD_DECL) | 4855/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ 4856 && TREE_CODE (decl) != FIELD_DECL 4857 && TREE_CODE (decl) != LABEL_DECL) 4858/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ |
4846 { 4847 error ("alignment may not be specified for %q+D", decl); 4848 *no_add_attrs = true; 4849 } 4850 else if (TREE_CODE (decl) == FUNCTION_DECL 4851 && DECL_ALIGN (decl) > (1 << i) * BITS_PER_UNIT) 4852 { 4853 if (DECL_USER_ALIGN (decl)) --- 486 unchanged lines hidden (view full) --- 5340 warning (OPT_Wattributes, "%qE attribute ignored for %qE", name, what); 5341 else 5342 warning (OPT_Wattributes, "%qE attribute ignored", name); 5343 } 5344 5345 return NULL_TREE; 5346} 5347 | 4859 { 4860 error ("alignment may not be specified for %q+D", decl); 4861 *no_add_attrs = true; 4862 } 4863 else if (TREE_CODE (decl) == FUNCTION_DECL 4864 && DECL_ALIGN (decl) > (1 << i) * BITS_PER_UNIT) 4865 { 4866 if (DECL_USER_ALIGN (decl)) --- 486 unchanged lines hidden (view full) --- 5353 warning (OPT_Wattributes, "%qE attribute ignored for %qE", name, what); 5354 else 5355 warning (OPT_Wattributes, "%qE attribute ignored", name); 5356 } 5357 5358 return NULL_TREE; 5359} 5360 |
5361/* APPLE LOCAL begin "unavailable" attribute (Radar 2809697) --ilr */ 5362/* Handle a "unavailable" attribute; arguments as in 5363 struct attribute_spec.handler. */ 5364 5365static tree 5366handle_unavailable_attribute (tree *node, tree name, 5367 tree args ATTRIBUTE_UNUSED, 5368 int flags ATTRIBUTE_UNUSED, 5369 bool *no_add_attrs) 5370{ 5371 tree type = NULL_TREE; 5372 int warn = 0; 5373 const char *what = NULL; 5374 5375 if (DECL_P (*node)) 5376 { 5377 tree decl = *node; 5378 type = TREE_TYPE (decl); 5379 5380 if (TREE_CODE (decl) == TYPE_DECL 5381 || TREE_CODE (decl) == PARM_DECL 5382 || TREE_CODE (decl) == VAR_DECL 5383 || TREE_CODE (decl) == FUNCTION_DECL) 5384 { 5385 TREE_UNAVAILABLE (decl) = 1; 5386 } 5387 else 5388 warn = 1; 5389 } 5390 else if (TYPE_P (*node)) 5391 { 5392 if (!(flags & (int) ATTR_FLAG_TYPE_IN_PLACE)) 5393 *node = build_variant_type_copy (*node); 5394 TREE_UNAVAILABLE (*node) = 1; 5395 type = *node; 5396 } 5397 else 5398 warn = 1; 5399 5400 if (warn) 5401 { 5402 *no_add_attrs = true; 5403 if (type && TYPE_NAME (type)) 5404 { 5405 if (TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE) 5406 what = IDENTIFIER_POINTER (TYPE_NAME (*node)); 5407 else if (TREE_CODE (TYPE_NAME (type)) == TYPE_DECL 5408 && DECL_NAME (TYPE_NAME (type))) 5409 what = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))); 5410 } 5411 if (what) 5412 warning (0, "`%s' attribute ignored for `%s'", 5413 IDENTIFIER_POINTER (name), what); 5414 else 5415 warning (0, "`%s' attribute ignored", IDENTIFIER_POINTER (name)); 5416 } 5417 5418 return NULL_TREE; 5419} 5420/* APPLE LOCAL end "unavailable" attribute --ilr */ 5421 |
|
5348/* Handle a "vector_size" attribute; arguments as in 5349 struct attribute_spec.handler. */ 5350 5351static tree 5352handle_vector_size_attribute (tree *node, tree name, tree args, 5353 int ARG_UNUSED (flags), 5354 bool *no_add_attrs) 5355{ --- 1298 unchanged lines hidden --- | 5422/* Handle a "vector_size" attribute; arguments as in 5423 struct attribute_spec.handler. */ 5424 5425static tree 5426handle_vector_size_attribute (tree *node, tree name, tree args, 5427 int ARG_UNUSED (flags), 5428 bool *no_add_attrs) 5429{ --- 1298 unchanged lines hidden --- |