public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "nightstrike at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/113631] New: FAIL: gcc.dg/pr7356.c, fix still fails with #pragma Date: Sat, 27 Jan 2024 18:23:33 +0000 [thread overview] Message-ID: <bug-113631-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113631 Bug ID: 113631 Summary: FAIL: gcc.dg/pr7356.c, fix still fails with #pragma Product: gcc Version: unknown Status: UNCONFIRMED Keywords: diagnostic, testsuite-fail Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: nightstrike at gmail dot com CC: dmalcolm at gcc dot gnu.org Target Milestone: --- The original PR7356 highlighted a problem where a diagnostic for a problem in a source file would point to something in an included file. This was fixed for the case in the PR for a subset of systems with certain standard header files. The original testcase was: a #include <stdlib.h> #include <stdio.h> #include <string.h> int main(int argc, char** argv) { return 0; } The expectation is that GCC warns on the 'a', not somewhere inside stdlib.h. This now works as indicated in that PR: <source>:1:2: error: expected ';' before 'typedef' 1 | a | ^ | ; Notably, it works differently with C++: <source>:1:1: error: 'a' does not name a type 1 | a | ^ ...but at least it marks 'a' as the issue (should that be a separate PR?) However, on mingw, we have certain constructs in our headers that still confuse the parser, resulting in this: In file included from /tmp/rt/mingw14/x86_64-w64-mingw32/include/_mingw.h:282,^M from /tmp/rt/mingw14/x86_64-w64-mingw32/include/corecrt.h:10,^M from /tmp/rt/mingw14/x86_64-w64-mingw32/include/stdlib.h:9,^M from /tmp/gcc/testsuite/gcc.dg/pr7356.c:4:^M /tmp/rt/mingw14/x86_64-w64-mingw32/include/vadefs.h:14:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '#pragma'^M #pragma pack(push,_CRT_PACKING)^M ^~~~^M It turns out that the problem is target-agnostic and is really just due to pragmas, so I've reduced it and reproduced the problem on GNU/Linux (the pragma is meant to be a no-op, that was a close approximation. GCC diagnostic push also works): a.c: a #include "a.h" int main() {} a.h: #pragma message "foo" $ gcc -c a.c a.h:1:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '#pragma' 1 | #pragma message "foo" | ^~~~~~~ a.h:1:9: note: '#pragma message: foo'
next reply other threads:[~2024-01-27 18:23 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-01-27 18:23 nightstrike at gmail dot com [this message] 2024-01-29 8:22 ` [Bug c/113631] " rguenth at gcc dot gnu.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-113631-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).