Summary: | make implicit pointer conversions an error when sizeof(int) != sizeof(void *) | ||
---|---|---|---|
Product: | gcc | Reporter: | dann frazier <dannf> |
Component: | c | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | RESOLVED WONTFIX | ||
Severity: | enhancement | CC: | gcc-bugs, msebor |
Priority: | P3 | Keywords: | diagnostic |
Version: | 4.3.4 | ||
Target Milestone: | --- | ||
Host: | Target: | ||
Build: | Known to work: | ||
Known to fail: | Last reconfirmed: | 2017-02-07 00:00:00 |
Description
dann frazier
2009-08-21 16:49:48 UTC
-Werror=int-to-pointer-cast will make one class of warnings into errors, but I don't think there's a switch to handle the other cases your script detects. There has been no update on this request in over 7 years. Is it still relevant (especially in light of comment #1)? If so, can you provide more details? I.e., what warnings specifically would you like to treat as errors that -Werror=warning-name doesn't let you do? Like so: $ cat t.c && /build/gcc-git/gcc/xgcc -B /build/gcc-git/gcc -O0 -S -Wall -Werror=int-conversion t.c int f (void*); void* g (void) { char *s = f (0); f (123); s = 345; return 456; } t.c: In function ‘g’: t.c:4:13: error: initialization makes pointer from integer without a cast [-Werror=int-conversion] char *s = f (0); ^ t.c:5:6: error: passing argument 1 of ‘f’ makes pointer from integer without a cast [-Werror=int-conversion] f (123); ^~~ t.c:1:5: note: expected ‘void *’ but argument is of type ‘int’ int f (void*); ^ t.c:6:5: error: assignment makes pointer from integer without a cast [-Werror=int-conversion] s = 345; ^ t.c:7:10: error: return makes pointer from integer without a cast [-Werror=int-conversion] return 456; ^~~ t.c:4:9: warning: variable ‘s’ set but not used [-Wunused-but-set-variable] char *s = f (0); ^ cc1: some warnings being treated as errors Closing due to no feedback. |