diff options
author | Richard Guenther <rguenther@suse.de> | 2009-03-03 13:05:53 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2009-03-03 13:05:53 +0000 |
commit | 9bd9f73827bfddb9485bcc9a8a2c80d4ed5c9cd8 (patch) | |
tree | adb9abf659e3d9d8949be2fad8b9306ded1d415d /gcc/tree.c | |
parent | f07049c8f1741e8a56f8e6dc3702216a652a532d (diff) | |
download | gcc-9bd9f73827bfddb9485bcc9a8a2c80d4ed5c9cd8.zip gcc-9bd9f73827bfddb9485bcc9a8a2c80d4ed5c9cd8.tar.gz gcc-9bd9f73827bfddb9485bcc9a8a2c80d4ed5c9cd8.tar.bz2 |
re PR tree-optimization/39272 (-D_FORTIFY_SOURCE=2 no longer warns with new glibc headers)
2009-03-03 Richard Guenther <rguenther@suse.de>
PR middle-end/39272
* tree.c (tree_nonartificial_location): New function.
* tree.h (tree_nonartificial_location): Declare.
* builtins.c (expand_builtin_memory_chk): Provide location
of the call location for artificial function pieces.
(maybe_emit_chk_warning): Likewise.
(maybe_emit_sprintf_chk_warning): Likewise.
(maybe_emit_free_warning): Likewise.
* expr.c (expand_expr_real_1): Likewise.
From-SVN: r144573
Diffstat (limited to 'gcc/tree.c')
-rw-r--r-- | gcc/tree.c | 36 |
1 files changed, 36 insertions, 0 deletions
@@ -9071,6 +9071,42 @@ block_nonartificial_location (tree block) return ret; } + +/* If EXP is inlined from an __attribute__((__artificial__)) + function, return the location of the original call expression. */ + +location_t +tree_nonartificial_location (tree exp) +{ + tree block = TREE_BLOCK (exp); + + while (block + && TREE_CODE (block) == BLOCK + && BLOCK_ABSTRACT_ORIGIN (block)) + { + tree ao = BLOCK_ABSTRACT_ORIGIN (block); + + do + { + if (TREE_CODE (ao) == FUNCTION_DECL + && DECL_DECLARED_INLINE_P (ao) + && lookup_attribute ("artificial", DECL_ATTRIBUTES (ao))) + return BLOCK_SOURCE_LOCATION (block); + else if (TREE_CODE (ao) == BLOCK + && BLOCK_SUPERCONTEXT (ao) != ao) + ao = BLOCK_SUPERCONTEXT (ao); + else + break; + } + while (ao); + + block = BLOCK_SUPERCONTEXT (block); + } + + return EXPR_LOCATION (exp); +} + + /* These are the hash table functions for the hash table of OPTIMIZATION_NODEq nodes. */ |