Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2019-01-03 Thread Joerg Sonnenberger via cfe-commits
On Thu, Jan 03, 2019 at 05:01:00PM +, Ximin Luo via cfe-commits wrote: > My patch that Roman quoted in the email below was an additional > mechanism to set -fmacro-prefix-map and -fdebug-prefix-map via an > environment variable. This was not accepted into GCC because they are > (in summary) all

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2019-01-03 Thread Ximin Luo via cfe-commits
Hi all, more strict interpretations of reproducible builds want build paths to not appear in the final output *regardless of the build location* and so /tmp/build would not be appropriate. Rough justification is that we want different people building under different starting conditions to be abl

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2019-01-03 Thread Nolan O'Brien via cfe-commits
I believe reproducible build projects simply move their source to `/tmp/build` or something else that’s consistent to deal with `__FILE__` currently. They’d probably appreciate this to avoid file copying during `make` builds Nolan O'Brien Sent from my iPhone > On Jan 3, 2019, at 7:47 AM, Roman

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2019-01-03 Thread Roman Lebedev via cfe-commits
No, that is the opposite of the solution, actually, i think. https://tests.reproducible-builds.org/debian/issues/unstable/gcc_captures_build_path_issue.html And: https://gcc.gnu.org/ml/gcc-patches/2017-04/msg00513.html ^ i suspect clang should be compatible with whatever approach is suggested ther

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2019-01-03 Thread Roman Lebedev via cfe-commits
Just a thought: reproducible builds will surely be interested in this. Did gcc already solve this problem? And if yes, it would be best to be compatible. On Thu, Jan 3, 2019 at 6:41 PM Nolan O'Brien via Phabricator via cfe-commits wrote: > > NSProgrammer added a comment. > > To throw in my 2 cent

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-09-06 Thread Weiming Zhao via cfe-commits
weimingz added a comment. ping? https://reviews.llvm.org/D17741 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-04-22 Thread Weiming Zhao via cfe-commits
weimingz added a comment. Ping ? http://reviews.llvm.org/D17741 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-04-08 Thread Weiming Zhao via cfe-commits
weimingz updated this revision to Diff 53105. weimingz added a comment. per Alex's suggestion, split into 2 flags: -ffile-macro-prefix-to-remove=xxx : remove matched prefix -ffile-macro-basename-only : remove the whole dir part http://reviews.llvm.org/D17741 Files: include/clang/Driver/Optio

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-04-08 Thread Weiming Zhao via cfe-commits
weimingz added a subscriber: weimingz. weimingz added a comment. Sounds good. Will do. Thanks for reviewing http://reviews.llvm.org/D17741 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-co

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-04-08 Thread Zhao, Weiming via cfe-commits
Sounds good. Will do. Thanks for reviewing On 4/8/2016 11:46 AM, Alex Rosenberg wrote: alexr added a subscriber: alexr. alexr added a comment. There are multiple features in this patch that should be considered separately. Please split the patch. That said, I don't think we want to add a fun

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-04-08 Thread Alex Rosenberg via cfe-commits
alexr added a subscriber: alexr. alexr added a comment. There are multiple features in this patch that should be considered separately. Please split the patch. That said, I don't think we want to add a fundamental new preprocessor feature like __FILE_BASENAME__ without at least getting some ear

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-03-21 Thread Weiming Zhao via cfe-commits
weimingz added a comment. In http://reviews.llvm.org/D17741#374725, @weimingz wrote: > In http://reviews.llvm.org/D17741#372098, @weimingz wrote: > > > rebased > > > ping~ HI, Any comments/suggestions? http://reviews.llvm.org/D17741 ___ cfe-comm

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-03-14 Thread Weiming Zhao via cfe-commits
weimingz added a comment. In http://reviews.llvm.org/D17741#372098, @weimingz wrote: > rebased ping~ http://reviews.llvm.org/D17741 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-03-10 Thread Weiming Zhao via cfe-commits
weimingz updated this revision to Diff 50300. weimingz added a comment. rebased http://reviews.llvm.org/D17741 Files: include/clang/Driver/Options.td include/clang/Lex/Preprocessor.h include/clang/Lex/PreprocessorOptions.h lib/Driver/Tools.cpp lib/Frontend/CompilerInvocation.cpp lib

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-03-04 Thread Craig, Ben via cfe-commits
On 3/4/2016 6:23 AM, Joerg Sonnenberger via cfe-commits wrote: On Thu, Mar 03, 2016 at 04:50:11PM -0800, Nico Weber via cfe-commits wrote: On Thu, Mar 3, 2016 at 4:28 PM, Joerg Sonnenberger via cfe-commits < cfe-commits@lists.llvm.org> wrote: On Thu, Mar 03, 2016 at 02:09:17PM -0800, Nico Webe

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-03-04 Thread Joerg Sonnenberger via cfe-commits
On Thu, Mar 03, 2016 at 04:50:11PM -0800, Nico Weber via cfe-commits wrote: > On Thu, Mar 3, 2016 at 4:28 PM, Joerg Sonnenberger via cfe-commits < > cfe-commits@lists.llvm.org> wrote: > > > On Thu, Mar 03, 2016 at 02:09:17PM -0800, Nico Weber via cfe-commits wrote: > > > On Thu, Mar 3, 2016 at 1:5

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-03-03 Thread Nico Weber via cfe-commits
On Thu, Mar 3, 2016 at 4:28 PM, Joerg Sonnenberger via cfe-commits < cfe-commits@lists.llvm.org> wrote: > On Thu, Mar 03, 2016 at 02:09:17PM -0800, Nico Weber via cfe-commits wrote: > > On Thu, Mar 3, 2016 at 1:50 PM, Joerg Sonnenberger via cfe-commits < > > cfe-commits@lists.llvm.org> wrote: > >

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-03-03 Thread Joerg Sonnenberger via cfe-commits
On Thu, Mar 03, 2016 at 02:09:17PM -0800, Nico Weber via cfe-commits wrote: > On Thu, Mar 3, 2016 at 1:50 PM, Joerg Sonnenberger via cfe-commits < > cfe-commits@lists.llvm.org> wrote: > > > On Thu, Mar 03, 2016 at 07:39:04PM +, Weiming Zhao via cfe-commits > > wrote: > > > Change the option na

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-03-03 Thread Nico Weber via cfe-commits
On Thu, Mar 3, 2016 at 1:50 PM, Joerg Sonnenberger via cfe-commits < cfe-commits@lists.llvm.org> wrote: > On Thu, Mar 03, 2016 at 07:39:04PM +, Weiming Zhao via cfe-commits > wrote: > > Change the option name to -ffile-macro-prefix-to-remove > > This still sounds to me like a solution for a ve

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-03-03 Thread Joerg Sonnenberger via cfe-commits
On Thu, Mar 03, 2016 at 07:39:04PM +, Weiming Zhao via cfe-commits wrote: > Change the option name to -ffile-macro-prefix-to-remove This still sounds to me like a solution for a very restricted part of a much more generic problem... Joerg ___ cfe-co

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-03-03 Thread Weiming Zhao via cfe-commits
weimingz updated the summary for this revision. weimingz updated this revision to Diff 49762. weimingz added a comment. Change the option name to -ffile-macro-prefix-to-remove http://reviews.llvm.org/D17741 Files: include/clang/Driver/Options.td include/clang/Lex/Preprocessor.h include/cl

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-03-03 Thread Hal Finkel via cfe-commits
hfinkel added a subscriber: hfinkel. hfinkel added a comment. In http://reviews.llvm.org/D17741#367113, @weimingz wrote: > Add "-f__FILE__-prefix-to-remove" flag to support the trim of the prefix. > Passing special value __ALL_DIR__ to remove all dir parts. > > For example FILE is /a/b/c > -f_

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-03-03 Thread Weiming Zhao via cfe-commits
weimingz updated this revision to Diff 49713. weimingz added a comment. Add "-f__FILE__-prefix-to-remove" flag to support the trim of the prefix. Passing special value __ALL_DIR__ to remove all dir parts. For example FILE is /a/b/c -f__FILE__-prefix-to-remove=/a/ will cause FILE be expanded to b

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-03-01 Thread Ben Craig via cfe-commits
bcraig added a comment. In http://reviews.llvm.org/D17741#365457, @thakis wrote: > > I think we can do this separately. A "basename" macro is easier for > > programmers to use and no build system change needed. > > > Hm, I would think that adding a flag to your CFLAGS is easier than getting > a

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-03-01 Thread Sean Silva via cfe-commits
On Tue, Mar 1, 2016 at 10:54 AM, Nico Weber via cfe-commits < cfe-commits@lists.llvm.org> wrote: > thakis added a comment. > > > I think we can do this separately. A "basename" macro is easier for > programmers to use and no build system change needed. > > > Hm, I would think that adding a flag to

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-03-01 Thread Nico Weber via cfe-commits
thakis added a comment. > I think we can do this separately. A "basename" macro is easier for > programmers to use and no build system change needed. Hm, I would think that adding a flag to your CFLAGS is easier than getting all your dependencies to use a clang-only new macro… http://reviews

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-03-01 Thread Ben Craig via cfe-commits
bcraig added a comment. LGTM. You should probably wait for someone else to approve it though. http://reviews.llvm.org/D17741 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-03-01 Thread Weiming Zhao via cfe-commits
weimingz added a comment. In http://reviews.llvm.org/D17741#364954, @thakis wrote: > In http://reviews.llvm.org/D17741#364931, @weimingz wrote: > > > In http://reviews.llvm.org/D17741#364756, @thakis wrote: > > > > > Instead of doing this, would it make sense to have a flag like > > > -ffile-bas

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-02-29 Thread Nico Weber via cfe-commits
thakis added a comment. In http://reviews.llvm.org/D17741#364931, @weimingz wrote: > In http://reviews.llvm.org/D17741#364756, @thakis wrote: > > > Instead of doing this, would it make sense to have a flag like > > -ffile-basename that changes what __FILE__ expands to? > > > > I had wished I'd b

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-02-29 Thread Weiming Zhao via cfe-commits
weimingz updated this revision to Diff 49445. weimingz added a comment. rename the macro to CLANG_FILE_BASENAME per Ben's comments. http://reviews.llvm.org/D17741 Files: include/clang/Lex/Preprocessor.h lib/Lex/PPMacroExpansion.cpp test/Lexer/file_basename.c Index: test/Lexer/file_basena

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-02-29 Thread Weiming Zhao via cfe-commits
weimingz added a comment. In http://reviews.llvm.org/D17741#364756, @thakis wrote: > Instead of doing this, would it make sense to have a flag like > -ffile-basename that changes what __FILE__ expands to? > > I had wished I'd be able to have some control over __FILE__ (I'd like to say > "make a

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-02-29 Thread Weiming Zhao via cfe-commits
weimingz added a comment. In http://reviews.llvm.org/D17741#364742, @bcraig wrote: > Note: this doesn't count as an official "LGTM". > > The code change seems fine to me. I think this has been implemented in gcc > as well, but I don't recall for certain. If this has been implemented in > gcc,

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-02-29 Thread Joerg Sonnenberger via cfe-commits
joerg added a subscriber: joerg. joerg added a comment. I've added functionality like that to NetBSD's GCC a long time ago. That functionality is useful for a variety of situations, cutting down file space or canonicalization are two uses.

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-02-29 Thread Nico Weber via cfe-commits
thakis added a subscriber: thakis. thakis added a comment. Instead of doing this, would it make sense to have a flag like -ffile-basename that changes what __FILE__ expands to? I had wished I'd be able to have some control over __FILE__ (I'd like to say "make all __FILE__s relative to this give

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-02-29 Thread Ben Craig via cfe-commits
bcraig added a subscriber: bcraig. bcraig added a comment. Note: this doesn't count as an official "LGTM". The code change seems fine to me. I think this has been implemented in gcc as well, but I don't recall for certain. If this has been implemented in gcc, then I would expect the semantics