diff options
author | steven <steven@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-10-12 22:09:29 +0000 |
---|---|---|
committer | steven <steven@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-10-12 22:09:29 +0000 |
commit | ce8710535a1f5fb3233402fa6c9d6a71653702a9 (patch) | |
tree | d8508ce937bd1981385a02639c802f8107997f26 /gcc/cp | |
parent | b91522ff0eee271bef59f9e73ea5c1a4ef5c59c7 (diff) | |
download | gcc-ce8710535a1f5fb3233402fa6c9d6a71653702a9.tar.gz |
gcc/
* c-common.c (c_common_truthvalue_conversion): Warn if the
address of a non-weak function is used as a truth value.
cp/
* cvt.c (ocp_convert): Move warning to C common code.
testsuite/
* gcc.dg/weak/weak-3.c: Fix for new warning.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@72409 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/cvt.c | 16 |
2 files changed, 6 insertions, 14 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index da318cfc9a2..9a0735bcca7 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,7 @@ +2003-10-12 Steven Bosscher <steven@gcc.gnu.org> + + * cvt.c (ocp_convert): Move warning to C common code. + 2003-10-09 Jason Merrill <jason@redhat.com> PR c++/6392 diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c index 32d0d794cef..1479fbd69eb 100644 --- a/gcc/cp/cvt.c +++ b/gcc/cp/cvt.c @@ -694,20 +694,8 @@ ocp_convert (tree type, tree expr, int convtype, int flags) return error_mark_node; } if (code == BOOLEAN_TYPE) - { - tree fn = NULL_TREE; - - /* Common Ada/Pascal programmer's mistake. We always warn - about this since it is so bad. */ - if (TREE_CODE (expr) == FUNCTION_DECL) - fn = expr; - else if (TREE_CODE (expr) == ADDR_EXPR - && TREE_CODE (TREE_OPERAND (expr, 0)) == FUNCTION_DECL) - fn = TREE_OPERAND (expr, 0); - if (fn && !DECL_WEAK (fn)) - warning ("the address of `%D', will always be `true'", fn); - return cp_truthvalue_conversion (e); - } + return cp_truthvalue_conversion (e); + return fold (convert_to_integer (type, e)); } if (POINTER_TYPE_P (type) || TYPE_PTR_TO_MEMBER_P (type)) |