From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id AC2983951835; Thu, 20 May 2021 08:13:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AC2983951835 From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/42579] [PATCH] support for obtaining file basename Date: Thu, 20 May 2021 08:13:00 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 4.5.0 X-Bugzilla-Keywords: patch X-Bugzilla-Severity: enhancement X-Bugzilla-Who: cvs-commit at gcc dot gnu.org 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: 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 May 2021 08:13:00 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D42579 --- Comment #9 from CVS Commits --- The master branch has been updated by Christophe Lyon : https://gcc.gnu.org/g:1a9b3f04c11eb467a8dc504a37dad57a371a0d4c commit r12-938-g1a9b3f04c11eb467a8dc504a37dad57a371a0d4c Author: Christophe Lyon Date: Thu May 20 08:10:50 2021 +0000 c: Add support for __FILE_NAME__ macro (PR c/42579) The toolchain provided by ST for stm32 has had support for __FILENAME__ for a while, but clang/llvm has recently implemented support for __FILE_NAME__, so it seems better to use the same macro name in GCC. It happens that the ST patch is similar to the one proposed in PR c/42579. Given these input files: :::::::::::::: mydir/myinc.h :::::::::::::: char* mystringh_file =3D __FILE__; char* mystringh_filename =3D __FILE_NAME__; char* mystringh_base_file =3D __BASE_FILE__; :::::::::::::: mydir/mysrc.c :::::::::::::: char* mystring_file =3D __FILE__; char* mystring_filename =3D __FILE_NAME__; char* mystring_base_file =3D __BASE_FILE__; we produce: $ gcc mydir/mysrc.c -I . -E char* mystringh_file =3D "./mydir/myinc.h"; char* mystringh_filename =3D "myinc.h"; char* mystringh_base_file =3D "mydir/mysrc.c"; char* mystring_file =3D "mydir/mysrc.c"; char* mystring_filename =3D "mysrc.c"; char* mystring_base_file =3D "mydir/mysrc.c"; 2021-05-20 Christophe Lyon Torbj=C3=B6rn Svensson PR c/42579 libcpp/ * include/cpplib.h (cpp_builtin_type): Add BT_FILE_NAME entry. * init.c (builtin_array): Likewise. * macro.c (_cpp_builtin_macro_text): Add support for BT_FILE_NA= ME. gcc/ * doc/cpp.texi (Common Predefined Macros): Document __FILE_NAME= __. gcc/testsuite/ * c-c++-common/spellcheck-reserved.c: Add tests for __FILE_NAME= __. * c-c++-common/cpp/file-name-1.c: New test.=