diff options
author | mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-09-06 17:48:53 +0000 |
---|---|---|
committer | mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-09-06 17:48:53 +0000 |
commit | 5ba33bf48d95679d6b160b02a2c913e184d6e817 (patch) | |
tree | 8d764bed307ee0730b51e4687fd0373d0bbc7c5d /gcc/c-typeck.c | |
parent | 9176ae584afb34cfaad8181e2e43057229fa0050 (diff) | |
download | gcc-5ba33bf48d95679d6b160b02a2c913e184d6e817.tar.gz |
* c-common.h (do_warn_double_promotion): Declare.
* c-common.c (do_warn_double_promotion): Define.
* c-typeck.c (do_warn_double_promotion): Remove.
* doc/invoke.texi (-Wdouble-promotion): Note available for C++ and
Objective-C++ too.
* typeck.c (cp_build_binary_op): Call do_warn_double_promotion.
* call.c (build_conditional_expr): Likewise.
(convert_arg_to_ellipsis): Likewise.
* g++.dg/warn/Wdouble-promotion.C: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@163925 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-typeck.c')
-rw-r--r-- | gcc/c-typeck.c | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index 87c51104038..08a3825a436 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -4036,40 +4036,6 @@ ep_convert_and_check (tree type, tree expr, tree semantic_type) return convert (type, expr); } -/* RESULT_TYPE is the result of converting TYPE1 and TYPE2 to a common - type via c_common_type. If -Wdouble-promotion is in use, and the - conditions for warning have been met, issue a warning. GMSGID is - the warning message. It must have two %T specifiers for the type - that was converted (generally "float") and the type to which it was - converted (generally "double), respectively. LOC is the location - to which the awrning should refer. */ - -static void -do_warn_double_promotion (tree result_type, tree type1, tree type2, - const char *gmsgid, location_t loc) -{ - tree source_type; - - if (!warn_double_promotion) - return; - /* If the conversion will not occur at run-time, there is no need to - warn about it. */ - if (c_inhibit_evaluation_warnings) - return; - if (TYPE_MAIN_VARIANT (result_type) != double_type_node - && TYPE_MAIN_VARIANT (result_type) != complex_double_type_node) - return; - if (TYPE_MAIN_VARIANT (type1) == float_type_node - || TYPE_MAIN_VARIANT (type1) == complex_float_type_node) - source_type = type1; - else if (TYPE_MAIN_VARIANT (type2) == float_type_node - || TYPE_MAIN_VARIANT (type2) == complex_float_type_node) - source_type = type2; - else - return; - warning_at (loc, OPT_Wdouble_promotion, gmsgid, source_type, result_type); -} - /* Build and return a conditional expression IFEXP ? OP1 : OP2. If IFEXP_BCP then the condition is a call to __builtin_constant_p, and if folded to an integer constant then the unselected half may |