[LLVMbugs] [Bug 8974] New: dependency files absolutize paths such as -include ../path/foo.h on the command line
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Thu Jan 13 17:20:42 PST 2011
http://llvm.org/bugs/show_bug.cgi?id=8974
Summary: dependency files absolutize paths such as -include
../path/foo.h on the command line
Product: clang
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P
Component: Frontend
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: nlewycky at google.com
CC: llvmbugs at cs.uiuc.edu
In a very small difference between clang and gcc behaviour, the command:
$(CC) -M -MF hello.d -c hello.c -include emptydir/../hello.h
will produce a different hello.d for clang and for gcc. GCC always emits the
value of the -include argument verbatim, while clang emits the absolute path.
This breaks users who try to relocate their .d files.
The way this happens in clang is that InitPreprocessor.cpp's AddImplicitInclude
appends #include "..." to the file before we parse a file. Let me quote the
relevant comment (in NormalizeDashIncludePath):
// Implicit include paths should be resolved relative to the current
// working directory first, and then use the regular header search
// mechanism. The proper way to handle this is to have the
// predefines buffer located at the current working directory, but
// it has not file entry. For now, workaround this by using an
// absolute path if we find the file here, and otherwise letting
// header search handle it.
so if it's found relative to '.' then we make the path absolute and then the
FileEntry takes on that name when it's #include'd, and that's what goes out to
dependency file generation.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list