From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 95C553858C54; Sat, 5 Nov 2022 14:31:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 95C553858C54 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1667658712; bh=xqVGsn84Pqjg5twn77vZY4dBcaPO1cleZcyzoF9AbP4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=hPY0aUT7TRg0wUfegSHjnIN2/9vfZFrxi28aKvMMCdDB4vH2WEbzUPrG57tZRxSR9 GWr0CKgHoB2w2XWCbrwsct2rpbqGVSs4dHutGmT8MU+JJTEt45YC8bpAvFQo/FLRng t2OcB3xskD5LsA327lU/D6MbxelqdImU7bQHo1kg= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug preprocessor/55971] Preprocessor macros with C++11 raw string literals fail to compile Date: Sat, 05 Nov 2022 14:31:51 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: preprocessor X-Bugzilla-Version: 4.7.2 X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal 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=3D55971 --- Comment #9 from CVS Commits --- The master branch has been updated by Lewis Hyatt : https://gcc.gnu.org/g:3ad2167bbac8ae83b1e91305b105ab5287bdac55 commit r13-3697-g3ad2167bbac8ae83b1e91305b105ab5287bdac55 Author: Lewis Hyatt Date: Wed Jun 15 18:06:53 2022 -0400 c++: libcpp: Support raw strings with newlines in directives [PR55971] It's not currently possible to use a C++11 raw string containing a newl= ine as part of the definition of a macro, or in any other preprocessing direct= ive, such as: #define X R"(two lines)" #error R"(this error has two lines)" Add support for that by relaxing the conditions under which _cpp_get_fresh_line() refuses to get a new line. For the case of lexing= a raw string, it's OK to do so as long as there is another line within the current buffer. The code in cpp_get_fresh_line() was refactored into a new func= tion get_fresh_line_impl(), so that the new logic is applied only when processing a raw string and not any other times. libcpp/ChangeLog: PR preprocessor/55971 * lex.cc (get_fresh_line_impl): New function refactoring the co= de from... (_cpp_get_fresh_line): ...here. (lex_raw_string): Use the new version of get_fresh_line_impl() = to support raw strings containing new lines when processing a directive. gcc/testsuite/ChangeLog: PR preprocessor/55971 * c-c++-common/raw-string-directive-1.c: New test. * c-c++-common/raw-string-directive-2.c: New test. gcc/c-family/ChangeLog: PR preprocessor/55971 * c-ppoutput.cc (adjust_for_newlines): Update comment.=