Re: [PATCH] Fix compiler message generation

From: Michal Marek
Date: Wed Jul 02 2014 - 08:40:26 EST


On Wed, Jul 02, 2014 at 11:56:46AM +0100, David Howells wrote:
> The following commit:
>
> commit 9da0763bdd82572be243fcf5161734f11568960f
> Author: Michal Marek <mmarek@xxxxxxx>
> Date: Fri Apr 25 23:25:18 2014 +0200
> Subject: kbuild: Use relative path when building in a subdir of the source tree
>
> makes compiler messages relative to the *build* tree if the build tree is a
> subdirectory at the root of the source tree.
>
> This is the wrong thing to do since the make command is issued in the *source*
> tree and so any editor or IDE that issues the make command will likely expect
> paths in warnings and errors to be relative either to the current directory at
> the time the make was issued or to the directory in which make was run.
>
> Certainly, this is something I'm seeing with emacs. I do:
>
> LANG=C nice -19 make O=build -C /data/fs/linux-2.6-fscache -j4
>
> And then I get error messages that look like:
>
> ../fs/namei.c: In function 'SYSC_linkat':
> ../fs/namei.c:4836:57: error: expected declaration specifiers before 'x'
> int, newdfd, const char __user *, newname, int, flags)x
>
> which emacs can't find the source for because it doesn't relate to anything
> emacs knows about.
>
> As a temporary measure, fix this by substituting the full path of the source
> as make knows it.

Boaz Harrosh hit the same problem with kdevelop and posted a patch that
adds a variable to turn off relative paths:
https://lkml.org/lkml/2014/6/19/295. This has the downside that one has
to remember to set the variable.

However, VPATH builds are not that uncommon, so I guess the editors and
IDEs can actually handle them if make prints the "Entering directory
`blah/blah'" messages. We disable this in kbuild to not pollute the log,
but how about the following patch? I tried it with vim and it worked: