diff options
author | msebor <msebor@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-05-03 21:15:28 +0000 |
---|---|---|
committer | msebor <msebor@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-05-03 21:15:28 +0000 |
commit | c388a0cf8d1facc88351350d9dc3274192526239 (patch) | |
tree | 0909668e48da930feebd5b9147810cbe08e38f6c /gcc/gimplify.c | |
parent | 2e063ded5483a92525ee58cac98bbefc996336af (diff) | |
download | gcc-c388a0cf8d1facc88351350d9dc3274192526239.tar.gz |
PR c++/66561 - __builtin_LINE at al. should yield constant expressions
PR c++/66639 - declare __func__, __FUNCTION__ & __PRETTY_FUNCTION__ constexpr
gcc/testsuite/ChangeLog:
2016-05-03 Martin Sebor <msebor@redhat.com>
PR c++/66561
* c-c++-common/builtin_location.c: New test.
* g++.dg/cpp1y/builtin_location.C: New test.
gcc/cp/ChangeLog:
2016-05-03 Martin Sebor <msebor@redhat.com>
PR c++/66561
* tree.c (builtin_valid_in_constant_expr_p): Treat BUILT_IN_FILE,
BUILT_IN_FUNCTION, and BUILT_IN_LINE as constant expressions.
gcc/ChangeLog:
2016-05-03 Martin Sebor <msebor@redhat.com>
PR c++/66561
* builtins.c (fold_builtin_FILE): New function.
(fold_builtin_FUNCTION, fold_builtin_LINE): New functions.
(fold_builtin_0): Call them.
* gimplify.c (gimplify_call_expr): Remove the handling of
BUILT_IN_FILE, BUILT_IN_FUNCTION, and BUILT_IN_LINE.
PR c++/66561
* doc/extend.texi (Other Builtins): Update __builtin_FILE,
__builtin_FUNCTION, and __builtin_LINE to reflect they yield
constants.
PR c++/66639
* doc/extend.texi (Function Names as Strings): Update __func__,
__FUNCTION__, __PRETTY_FUNCTION__ to reflect they evaluate to
constants.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@235845 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r-- | gcc/gimplify.c | 20 |
1 files changed, 1 insertions, 19 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 9fe9bd5ed89..f13980d80be 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -2437,25 +2437,7 @@ gimplify_call_expr (tree *expr_p, gimple_seq *pre_p, bool want_value) } break; } - case BUILT_IN_LINE: - { - *expr_p = build_int_cst (TREE_TYPE (*expr_p), - LOCATION_LINE (EXPR_LOCATION (*expr_p))); - return GS_OK; - } - case BUILT_IN_FILE: - { - const char *locfile = LOCATION_FILE (EXPR_LOCATION (*expr_p)); - *expr_p = build_string_literal (strlen (locfile) + 1, locfile); - return GS_OK; - } - case BUILT_IN_FUNCTION: - { - const char *function; - function = IDENTIFIER_POINTER (DECL_NAME (current_function_decl)); - *expr_p = build_string_literal (strlen (function) + 1, function); - return GS_OK; - } + default: ; } |