Bug 108978 - Add __builtin_FILE_NAME() which behaves like the __FILE_NAME__ macro
Summary: Add __builtin_FILE_NAME() which behaves like the __FILE_NAME__ macro
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: unknown
: P3 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-03-01 02:18 UTC by Fangrui Song
Modified: 2023-03-01 02:37 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2023-03-01 00:00:00


Attachments
quick patch (909 bytes, patch)
2023-03-01 02:36 UTC, Andrew Pinski
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Fangrui Song 2023-03-01 02:18:22 UTC
PR c/42579 added __FILE_NAME__. On the Clang side someone is proposing __builtin_FILE_NAME (https://reviews.llvm.org/D144878) a la __builtin_FILE .
Comment 1 Andrew Pinski 2023-03-01 02:31:07 UTC
Hmm, I don't know but maybe __builtin_BASE_FILE should also be added too.
Comment 2 Andrew Pinski 2023-03-01 02:36:59 UTC
Created attachment 54561 [details]
quick patch

This is a quick hacked patch which adds this. I didn't even test it or add testcases. It might not even compile because of the use of lbasename. But someone else should be able to take it and finish it up.