[PATCH] Fix compiler message generation

From: David Howells
Date: Wed Jul 02 2014 - 06:57:09 EST


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.

I suspect the correct fix from make's point of view is to issue the build
command in the build tree and use VPATH to refer to the source, but that would
likely involve making a lot of Makefiles and would involve a step equivalent
to autoconf - which is probably not what we want.

Signed-off-by: David Howells <dhowells@xxxxxxxxxx>
cc: Michal Marek <mmarek@xxxxxxx>
cc: Sam Ravnborg <sam@xxxxxxxxxxxx>
---

Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)


diff --git a/Makefile b/Makefile
index 1317563..def4a75 100644
--- a/Makefile
+++ b/Makefile
@@ -155,7 +155,7 @@ ifeq ($(KBUILD_SRC),)
else
ifeq ($(KBUILD_SRC)/,$(dir $(CURDIR)))
# building in a subdirectory of the source tree
- srctree := ..
+ srctree := $(realpath ..)
else
srctree := $(KBUILD_SRC)
endif

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/