diff options
author | Manuel López-Ibáñez <manu@gcc.gnu.org> | 2008-08-27 23:51:13 +0000 |
---|---|---|
committer | Manuel López-Ibáñez <manu@gcc.gnu.org> | 2008-08-27 23:51:13 +0000 |
commit | 4ccd12e5aae640a352129fd387657da8e4d0f95b (patch) | |
tree | 76b1a1a6fe70921dc6bb953b9e8d85784d7945a1 /gcc | |
parent | 9a424841dba421bb636d758a432a14b9e7754f7b (diff) | |
download | gcc-4ccd12e5aae640a352129fd387657da8e4d0f95b.zip gcc-4ccd12e5aae640a352129fd387657da8e4d0f95b.tar.gz gcc-4ccd12e5aae640a352129fd387657da8e4d0f95b.tar.bz2 |
re PR c/37186 (-Wno-error=pointer-sign does not work)
2008-08-27 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
PR c/37186
* c-typeck.c (WARN_FOR_ASSIGNMENT): Add OPT parameter.
(convert_for_assignment): Pass corrent OPT_W* parameter to
WARN_FOR_ASSIGNMENT.
testsuite/
* gcc.dg/pr37186.c: New.
From-SVN: r139680
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/c-typeck.c | 28 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr37186.c | 9 |
4 files changed, 35 insertions, 14 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4b237af..d091380 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2008-08-27 Manuel Lopez-Ibanez <manu@gcc.gnu.org> + + PR c/37186 + * c-typeck.c (WARN_FOR_ASSIGNMENT): Add OPT parameter. + (convert_for_assignment): Pass corrent OPT_W* parameter to + WARN_FOR_ASSIGNMENT. + 2008-08-27 Paolo Carlini <paolo.carlini@oracle.com> PR c++/35321 diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index da5717a..db4718c 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -3952,24 +3952,24 @@ convert_for_assignment (tree type, tree rhs, enum impl_conv errtype, /* This macro is used to emit diagnostics to ensure that all format strings are complete sentences, visible to gettext and checked at compile time. */ -#define WARN_FOR_ASSIGNMENT(LOCATION, AR, AS, IN, RE) \ +#define WARN_FOR_ASSIGNMENT(LOCATION, OPT, AR, AS, IN, RE) \ do { \ switch (errtype) \ { \ case ic_argpass: \ - pedwarn (LOCATION, 0, AR, parmnum, rname); \ + pedwarn (LOCATION, OPT, AR, parmnum, rname); \ break; \ case ic_argpass_nonproto: \ - warning (0, AR, parmnum, rname); \ + warning (OPT, AR, parmnum, rname); \ break; \ case ic_assign: \ - pedwarn (LOCATION, 0, AS); \ + pedwarn (LOCATION, OPT, AS); \ break; \ case ic_init: \ - pedwarn (LOCATION, 0, IN); \ + pedwarn (LOCATION, OPT, IN); \ break; \ case ic_return: \ - pedwarn (LOCATION, 0, RE); \ + pedwarn (LOCATION, OPT, RE); \ break; \ default: \ gcc_unreachable (); \ @@ -4151,7 +4151,7 @@ convert_for_assignment (tree type, tree rhs, enum impl_conv errtype, function where an ordinary one is wanted, but not vice-versa. */ if (TYPE_QUALS (ttl) & ~TYPE_QUALS (ttr)) - WARN_FOR_ASSIGNMENT (input_location, + WARN_FOR_ASSIGNMENT (input_location, 0, G_("passing argument %d of %qE " "makes qualified function " "pointer from unqualified"), @@ -4165,7 +4165,7 @@ convert_for_assignment (tree type, tree rhs, enum impl_conv errtype, "pointer from unqualified")); } else if (TYPE_QUALS (ttr) & ~TYPE_QUALS (ttl)) - WARN_FOR_ASSIGNMENT (input_location, + WARN_FOR_ASSIGNMENT (input_location, 0, G_("passing argument %d of %qE discards " "qualifiers from pointer target type"), G_("assignment discards qualifiers " @@ -4265,7 +4265,7 @@ convert_for_assignment (tree type, tree rhs, enum impl_conv errtype, (VOID_TYPE_P (ttr) && !null_pointer_constant_p (rhs) && TREE_CODE (ttl) == FUNCTION_TYPE))) - WARN_FOR_ASSIGNMENT (input_location, + WARN_FOR_ASSIGNMENT (input_location, OPT_pedantic, G_("ISO C forbids passing argument %d of " "%qE between function pointer " "and %<void *%>"), @@ -4303,7 +4303,7 @@ convert_for_assignment (tree type, tree rhs, enum impl_conv errtype, ; /* If there is a mismatch, do warn. */ else if (warn_pointer_sign) - WARN_FOR_ASSIGNMENT (input_location, + WARN_FOR_ASSIGNMENT (input_location, OPT_Wpointer_sign, G_("pointer targets in passing argument " "%d of %qE differ in signedness"), G_("pointer targets in assignment " @@ -4321,7 +4321,7 @@ convert_for_assignment (tree type, tree rhs, enum impl_conv errtype, it is okay to use a const or volatile function where an ordinary one is wanted, but not vice-versa. */ if (TYPE_QUALS (ttl) & ~TYPE_QUALS (ttr)) - WARN_FOR_ASSIGNMENT (input_location, + WARN_FOR_ASSIGNMENT (input_location, 0, G_("passing argument %d of %qE makes " "qualified function pointer " "from unqualified"), @@ -4336,7 +4336,7 @@ convert_for_assignment (tree type, tree rhs, enum impl_conv errtype, else /* Avoid warning about the volatile ObjC EH puts on decls. */ if (!objc_ok) - WARN_FOR_ASSIGNMENT (input_location, + WARN_FOR_ASSIGNMENT (input_location, 0, G_("passing argument %d of %qE from " "incompatible pointer type"), G_("assignment from incompatible pointer type"), @@ -4359,7 +4359,7 @@ convert_for_assignment (tree type, tree rhs, enum impl_conv errtype, or one that results from arithmetic, even including a cast to integer type. */ if (!null_pointer_constant_p (rhs)) - WARN_FOR_ASSIGNMENT (input_location, + WARN_FOR_ASSIGNMENT (input_location, 0, G_("passing argument %d of %qE makes " "pointer from integer without a cast"), G_("assignment makes pointer from integer " @@ -4373,7 +4373,7 @@ convert_for_assignment (tree type, tree rhs, enum impl_conv errtype, } else if (codel == INTEGER_TYPE && coder == POINTER_TYPE) { - WARN_FOR_ASSIGNMENT (input_location, + WARN_FOR_ASSIGNMENT (input_location, 0, G_("passing argument %d of %qE makes integer " "from pointer without a cast"), G_("assignment makes integer from pointer " diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e1ead09..9fad734 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-08-27 Manuel Lopez-Ibanez <manu@gcc.gnu.org> + + PR c/37186 + * gcc.dg/pr37186.c: New. + 2008-08-27 Janis Johnson <janis187@us.ibm.com> * gcc.dg/torture/type-generic-1.c: Revert previous change. diff --git a/gcc/testsuite/gcc.dg/pr37186.c b/gcc/testsuite/gcc.dg/pr37186.c new file mode 100644 index 0000000..7fa52ff --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr37186.c @@ -0,0 +1,9 @@ +/* PR 37186 */ +/* { dg-do compile } */ +/* { dg-options "-Wall -Werror -Wno-error=pointer-sign" } */ + +int foo(signed char *); +int bar(unsigned char *p) +{ + return foo(p); /* { dg-warning "pointer targets in passing argument 1 of 'foo' differ in signedness" } */ +} |