Bug 108978

Summary: Add __builtin_FILE_NAME() which behaves like the __FILE_NAME__ macro
Product: gcc Reporter: Fangrui Song <i>
Component: cAssignee: Not yet assigned to anyone <unassigned>
Status: NEW ---    
Severity: enhancement    
Priority: P3    
Version: unknown   
Target Milestone: ---   
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed: 2023-03-01 00:00:00
Attachments: quick patch

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.