From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 727B13858C56; Sat, 27 Jan 2024 18:23:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 727B13858C56 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1706379814; bh=BMG7OlIXnT00c3Bq9E2CBW4wRrmgYgeBub2rfwZe5UI=; h=From:To:Subject:Date:From; b=QOkEPsfL+r9OAE2RO5xr2gYNFQ9y0YMOWZn+pEJKRKlIzv/steZKZDRVkG2+TVDv9 /0xAxkceZvkKwQ9EO15GsZpAu5Jk1eHHMl9LZzIiZCkLCRySdZo8jtrv/vvGU4yHwH ySn4Ip3ctor8ibfCXd60o465gcHVDOPlWXFnpip4= From: "nightstrike at gmail dot com" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: unknown X-Bugzilla-Keywords: diagnostic, testsuite-fail X-Bugzilla-Severity: normal X-Bugzilla-Who: nightstrike at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status keywords bug_severity priority component assigned_to reporter cc target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D113631 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 f= or the case in the PR for a subset of systems with certain standard header fil= es.=20 The original testcase was: a #include #include #include 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: :1:2: error: expected ';' before 'typedef' 1 | a | ^ | ; Notably, it works differently with C++: :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 con= fuse 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 '= =3D', ',', ';', '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 pr= agma 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 '=3D', ',', ';', 'asm' or '__attribute__' before '#pragma' 1 | #pragma message "foo" | ^~~~~~~ a.h:1:9: note: '#pragma message: foo'=