summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorklarlund <klarlund@gmail.com>2008-05-28 02:32:59 +0000
committerklarlund <klarlund@gmail.com>2008-05-28 02:32:59 +0000
commit0e4ab5ab4eb66388bb6803ebe2e493a33dac7884 (patch)
treeaec5d06733a1f22de8216e9135ed2beb93caa02a
parent61e564d9d7896cd22286c0f06f50fc6153a4b684 (diff)
downloaddistcc-git-0e4ab5ab4eb66388bb6803ebe2e493a33dac7884.tar.gz
Remove spurious warning messages about absolute filepaths.
During compilation of the Linux kernel messages like: absolute filepath blabla.h was IGNORED (correctness of build may be affected) are issued. They are wrong. The problem is that -include or -imacro or even source file names with absolute filepaths trigger a complaint from the caching mechanism usually used for relative file names. We correct this problem. We also substitute fp_map for includepath_map, which is the now preferred term. REVIEWER: csilvers@google.com TESTS: make pump-maintainer-check make include-server-maintainer-check
-rwxr-xr-xinclude_server/cache_basics.py13
-rwxr-xr-xinclude_server/parse_command.py16
2 files changed, 20 insertions, 9 deletions
diff --git a/include_server/cache_basics.py b/include_server/cache_basics.py
index c7142ed..d7c98c2 100755
--- a/include_server/cache_basics.py
+++ b/include_server/cache_basics.py
@@ -504,12 +504,19 @@ class RelpathMapToIndex(MapToIndex):
(below) to bail out.
"""
- def Index(self, relpath):
+ def Index(self, relpath, ignore_absolute_path_warning=False):
"""Return index d > 0 of relative path.
- Argument:
+ Args:
directory: a string not starting with /.
+ ignore_absolute_path_warning: a Boolean
+
+ The variable ignore_absolute_path_warning is set to True in order to
+ override the requirement that filepaths are relative. This is useful for the
+ compilation unit filepath and filepaths of -include's: they are permitted to
+ be absolute because the command line can still be rewritten on the server.
+ The server tweaks their location to become relative to the server root.
"""
- if os.path.isabs(relpath):
+ if os.path.isabs(relpath) and not ignore_absolute_path_warning:
if basics.opt_unsafe_absolute_includes:
Debug(DEBUG_WARNING,
"absolute filepath '%s' was IGNORED"
diff --git a/include_server/parse_command.py b/include_server/parse_command.py
index c38728d..6b3faa0 100755
--- a/include_server/parse_command.py
+++ b/include_server/parse_command.py
@@ -314,14 +314,14 @@ TRANSLATION_UNIT_FILEPATH_RE = (
for ext in basics.TRANSLATION_UNIT_MAP.keys()])))
-def ParseCommandArgs(args, current_dir, fp_map, dir_map, realpath_map,
+def ParseCommandArgs(args, current_dir, includepath_map, dir_map, realpath_map,
systemdir_prefix_cache, compiler_defaults, timer=None):
"""Parse arguments like -I to make include directory lists.
Arguments:
args: list of arguments (strings)
current_dir: string
- fp_map: a MapToIndex object
+ includepath_map: a MapToIndex object
dir_map: a DirectoryMapToIndex object
realpath_map: a CanonicalMapToIndex cache
systemdir_prefix_cache: a SystemdirPrefixCache
@@ -332,7 +332,7 @@ def ParseCommandArgs(args, current_dir, fp_map, dir_map, realpath_map,
where:
quote_dirs: a list of dir_map-indexed directories
angle_dirs: a list of dir_map-indexed directories
- files: a list of fp_map-indexed files
+ files: a list of includepath_map-indexed files
source_file_prefix: the source file name with extension stripped
dopts: a list of items as returned by _SplitMacroArg
send_systemdirs: a boolean, true only in exceptional cases
@@ -349,7 +349,7 @@ def ParseCommandArgs(args, current_dir, fp_map, dir_map, realpath_map,
if __debug__: Debug(DEBUG_TRACE, "ParseCommand %s" % args)
assert isinstance(dir_map, cache_basics.DirectoryMapToIndex)
- assert isinstance(fp_map, cache_basics.MapToIndex)
+ assert isinstance(includepath_map, cache_basics.MapToIndex)
assert isinstance(realpath_map, cache_basics.CanonicalMapToIndex)
parse_state = ParseState()
@@ -481,8 +481,12 @@ def ParseCommandArgs(args, current_dir, fp_map, dir_map, realpath_map,
quote_dirs.extend(angle_dirs)
angle_dirs = tuple(angle_dirs)
quote_dirs = tuple(quote_dirs)
- include_files = tuple([fp_map.Index(basics.SafeNormPath(f))
- for f in parse_state.include_files])
+ # Include files are meant to be sent to the server. They do not pose the
+ # danger of absolute includes, which includepath_map is designed to avoid.
+ include_files = tuple(
+ [includepath_map.Index(basics.SafeNormPath(f),
+ ignore_absolute_path_warning=True)
+ for f in parse_state.include_files])
# Send default system dirs?
for isystem_dir in parse_state.before_system_dirs: