public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "lavr at ncbi dot nlm.nih.gov" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/60100] New: warning disappears when preprocessed source is compiled Date: Thu, 06 Feb 2014 19:32:00 -0000 [thread overview] Message-ID: <bug-60100-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60100 Bug ID: 60100 Summary: warning disappears when preprocessed source is compiled Product: gcc Version: 4.8.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: lavr at ncbi dot nlm.nih.gov Created attachment 32070 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32070&action=edit GCC specs are attached Hello, When compiling the attached C code with GCC 4.8.1, I see a warning (which is correct) that the callback signature mismatches what's expected in the argument of BUF_PeekAtCB() call. If however, the source is first preprocessed then compiled, there is no warning! Since distcc uses precompiled source, the disappearing warning is a bad thing because it hides potential (and real, such as this case) bugs. $ cat qq.h #include <stddef.h> typedef struct SBUF* BUF; extern size_t BUF_PeekAtCB (BUF buf, size_t pos, size_t (*callback)(void* cbdata, const void* buf, size_t size), void* cbdata, size_t size ); $ cat qq.c #include <stdio.h> #include "qq.h" size_t cb(void* a, void* b, size_t c, int d) { return c; } int main() { BUF b = 0; size_t n = BUF_PeekAtCB(b, 0, cb, 0, 512); printf("%u\n", (unsigned int) n); return 0; } $ gcc -Wall -c qq.c -o qq.o qq.c: In function 'main': qq.c:14:5: warning: passing argument 3 of 'BUF_PeekAtCB' from incompatible pointer type [enabled by default] size_t n = BUF_PeekAtCB(b, 0, cb, 0, 512); ^ In file included from qq.c:2:0: qq.h:7:15: note: expected 'size_t (*)(void *, const void *, size_t)' but argument is of type 'size_t (*)(void *, void *, size_t, int)' extern size_t BUF_PeekAtCB ^ $ gcc -Wall -E qq.c -o qq.e $ gcc -Wall -c qq.e -o qq.o gcc: warning: qq.e: linker input file unused because linking not done Also, I'm not sure why there is a bogus warning about linking here (and not when compiling right from the source file, above). Any insight that you may have provide will be highly appreciated. Thanks, Anton Lavrentiev
next reply other threads:[~2014-02-06 19:32 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-02-06 19:32 lavr at ncbi dot nlm.nih.gov [this message] 2014-02-06 19:34 ` [Bug c/60100] " pinskia at gcc dot gnu.org 2014-02-06 19:41 ` lavr at ncbi dot nlm.nih.gov 2014-02-06 19:50 ` lavr at ncbi dot nlm.nih.gov 2014-02-06 19:51 ` lavr at ncbi dot nlm.nih.gov 2014-03-24 10:47 ` mpolacek at gcc dot gnu.org 2014-03-24 13:44 ` schwab@linux-m68k.org 2014-03-24 15:56 ` lavr at ncbi dot nlm.nih.gov 2014-04-11 10:01 ` mpolacek at gcc dot gnu.org 2014-09-19 19:48 ` schwab@linux-m68k.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-60100-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).