From: manu Date: Fri, 11 Jun 2010 09:43:53 +0000 (+0000) Subject: 2010-06-11 Manuel López-Ibáñez X-Git-Tag: upstream/4.9.2~28820 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=80373d81743bf073adc43299fb4679b8f03c8f0f;p=platform%2Fupstream%2Flinaro-gcc.git 2010-06-11 Manuel López-Ibáñez * c-typeck.c (handle_warn_cast_qual): Add loc parameter. Improve warning message. (build_c_cast): Pass location to handle_warn_cast_qual. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@160601 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 561b0ee..742950c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2010-06-11 Manuel López-Ibáñez + + * c-typeck.c (handle_warn_cast_qual): Add loc + parameter. Improve warning message. + (build_c_cast): Pass location to handle_warn_cast_qual. + 2010-06-11 Uros Bizjak * config/i386/i386.md (pro_epilogue_adjust_stack_1) : Assert diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index b2d3986..f8bfb51 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -4413,12 +4413,13 @@ build_compound_expr (location_t loc, tree expr1, tree expr2) /* Issue -Wcast-qual warnings when appropriate. TYPE is the type to which we are casting. OTYPE is the type of the expression being - cast. Both TYPE and OTYPE are pointer types. -Wcast-qual appeared - on the command line. Named address space qualifiers are not handled - here, because they result in different warnings. */ + cast. Both TYPE and OTYPE are pointer types. LOC is the location + of the cast. -Wcast-qual appeared on the command line. Named + address space qualifiers are not handled here, because they result + in different warnings. */ static void -handle_warn_cast_qual (tree type, tree otype) +handle_warn_cast_qual (location_t loc, tree type, tree otype) { tree in_type = type; tree in_otype = otype; @@ -4451,15 +4452,15 @@ handle_warn_cast_qual (tree type, tree otype) && TREE_CODE (in_otype) == POINTER_TYPE); if (added) - warning (OPT_Wcast_qual, "cast adds %q#v qualifier to function type", - added); + warning_at (loc, OPT_Wcast_qual, + "cast adds %q#v qualifier to function type", added); if (discarded) /* There are qualifiers present in IN_OTYPE that are not present in IN_TYPE. */ - warning (OPT_Wcast_qual, - "cast discards %q#v qualifier from pointer target type", - discarded); + warning_at (loc, OPT_Wcast_qual, + "cast discards %q#v qualifier from pointer target type", + discarded); if (added || discarded) return; @@ -4492,10 +4493,10 @@ handle_warn_cast_qual (tree type, tree otype) if ((TYPE_QUALS (in_type) &~ TYPE_QUALS (in_otype)) != 0 && !is_const) { - int added = TYPE_QUALS (in_type) &~ TYPE_QUALS (in_otype); - warning (OPT_Wcast_qual, - ("new %qv qualifier in middle of multi-level non-const cast " - "is unsafe"), added); + warning_at (loc, OPT_Wcast_qual, + "to be safe all intermediate pointers in cast from " + "%qT to %qT must be % qualified", + otype, type); break; } if (is_const) @@ -4599,7 +4600,7 @@ build_c_cast (location_t loc, tree type, tree expr) if (warn_cast_qual && TREE_CODE (type) == POINTER_TYPE && TREE_CODE (otype) == POINTER_TYPE) - handle_warn_cast_qual (type, otype); + handle_warn_cast_qual (loc, type, otype); /* Warn about conversions between pointers to disjoint address spaces. */