From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5163F3858435; Tue, 14 Nov 2023 22:55:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5163F3858435 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1700002514; bh=RVvDkxxER8mZjVhOjvYmnb+5dNxNbQfdj0vUOnoyRp8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=SgGBCGX0nG0XkQG5PqkVNHMtnICAB/xu4LOs7hj5g2749Klz6DGlpQRhvG0LAyoVH BstVhUIVl1ApnRSqbemuKtMCEUGXZwBY1aUPDKmO+0t8gBbfKvgWdtvm8tDgjuberc /bGupGmA3lvussdRm1ZOjI/31diMA9vVxenf6pR4= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug pch/47857] Pragma once warning when compiling PCH Date: Tue, 14 Nov 2023 22:55:12 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: pch X-Bugzilla-Version: 4.4.5 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: minor X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: NEW 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: Message-ID: In-Reply-To: References: 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=3D47857 --- Comment #10 from CVS Commits --- The master branch has been updated by Lewis Hyatt : https://gcc.gnu.org/g:9938645fcf914ec2a3fa8137cf1456ad4af5f77c commit r14-5471-g9938645fcf914ec2a3fa8137cf1456ad4af5f77c Author: Lewis Hyatt Date: Fri Nov 10 11:10:18 2023 -0500 c-family: Let libcpp know when the compilation is for a PCH [PR9471] libcpp will generate diagnostics when it encounters things in the main = file that only belong in a header file, such as `#pragma once' or `#pragma G= CC system_header'. But sometimes the main file is a header file that is ju= st being compiled separately, e.g. to produce a C++ module or a PCH, in wh= ich case such diagnostics should be suppressed. libcpp already has an inter= face to request that, so make use of it in the C frontends to prevent libcpp from issuing unwanted diagnostics when compiling a PCH. gcc/c-family/ChangeLog: PR pch/9471 PR pch/47857 * c-opts.cc (c_common_post_options): Set cpp_opts->main_search so libcpp knows it is compiling a header file separately. gcc/testsuite/ChangeLog: PR pch/9471 PR pch/47857 * g++.dg/pch/main-file-warnings.C: New test. * g++.dg/pch/main-file-warnings.Hs: New test. * gcc.dg/pch/main-file-warnings.c: New test. * gcc.dg/pch/main-file-warnings.hs: New test.=