diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-04-28 20:23:54 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-04-28 20:24:03 +0300 |
commit | 5e04e4eb0d66d3862f3cc0ca77803171c0fc587f (patch) | |
tree | 76801db1bac4d479a050dec9ab386b399c8701e6 | |
parent | 074c5f0d26b20fbb69e558af3e9a6f4183a2ad29 (diff) | |
parent | 9ebd737df38e3d5ce5c9c584586c4bf29c50f424 (diff) |
Merge branch 'master' into blender2.8
-rw-r--r-- | intern/cycles/util/util_logging.cpp | 4 | ||||
-rw-r--r-- | intern/cycles/util/util_path.cpp | 31 | ||||
-rw-r--r-- | intern/libmv/intern/logging.cc | 4 |
3 files changed, 28 insertions, 11 deletions
diff --git a/intern/cycles/util/util_logging.cpp b/intern/cycles/util/util_logging.cpp index a5a3bd34fff..f38683bf7de 100644 --- a/intern/cycles/util/util_logging.cpp +++ b/intern/cycles/util/util_logging.cpp @@ -30,10 +30,10 @@ void util_logging_init(const char *argv0) #ifdef WITH_CYCLES_LOGGING using CYCLES_GFLAGS_NAMESPACE::SetCommandLineOption; - /* Make it so FATAL messages are always print into console. */ + /* Make it so ERROR messages are always print into console. */ char severity_fatal[32]; snprintf(severity_fatal, sizeof(severity_fatal), "%d", - google::GLOG_FATAL); + google::GLOG_ERROR); google::InitGoogleLogging(argv0); SetCommandLineOption("logtostderr", "1"); diff --git a/intern/cycles/util/util_path.cpp b/intern/cycles/util/util_path.cpp index cd3067f7650..08624cfc739 100644 --- a/intern/cycles/util/util_path.cpp +++ b/intern/cycles/util/util_path.cpp @@ -768,9 +768,17 @@ bool path_remove(const string& path) return remove(path.c_str()) == 0; } -static string line_directive(const string& path, int line) +static string line_directive(const string& base, const string& path, int line) { string escaped_path = path; + /* First we make path relative. */ + if(string_startswith(escaped_path, base.c_str())) { + const string base_file = path_filename(base); + const size_t base_len = base.length(); + escaped_path = base_file + escaped_path.substr(base_len, + escaped_path.length() - base_len); + } + /* Second, we replace all unsafe characters. */ string_replace(escaped_path, "\"", "\\\""); string_replace(escaped_path, "\'", "\\\'"); string_replace(escaped_path, "\?", "\\\?"); @@ -779,12 +787,14 @@ static string line_directive(const string& path, int line) } -string path_source_replace_includes(const string& source, - const string& path, - const string& source_filename) +static string path_source_replace_includes_recursive( + const string& base, + const string& source, + const string& path, + const string& source_filename) { /* Our own little c preprocessor that replaces #includes with the file - * contents, to work around issue of opencl drivers not supporting + * contents, to work around issue of OpenCL drivers not supporting * include paths with spaces in them. */ @@ -813,9 +823,9 @@ string path_source_replace_includes(const string& source, text, path_dirname(filepath), filename); text = path_source_replace_includes(text, path, filename); /* Use line directives for better error messages. */ - line = line_directive(filepath, 1) + line = line_directive(base, filepath, 1) + token.replace(0, n_end + 1, "\n" + text + "\n") - + line_directive(path_join(path, source_filename), i + 1); + + line_directive(base, path_join(path, source_filename), i + 1); } } } @@ -826,6 +836,13 @@ string path_source_replace_includes(const string& source, return result; } +string path_source_replace_includes(const string& source, + const string& path, + const string& source_filename) +{ + return path_source_replace_includes_recursive(path, source, path, source_filename); +} + FILE *path_fopen(const string& path, const string& mode) { #ifdef _WIN32 diff --git a/intern/libmv/intern/logging.cc b/intern/libmv/intern/logging.cc index 9b8adf09a97..863832cb72b 100644 --- a/intern/libmv/intern/logging.cc +++ b/intern/libmv/intern/logging.cc @@ -30,10 +30,10 @@ void libmv_initLogging(const char* argv0) { using LIBMV_GFLAGS_NAMESPACE::SetCommandLineOption; - // Make it so FATAL messages are always print into console. + // Make it so ERROR messages are always print into console. char severity_fatal[32]; snprintf(severity_fatal, sizeof(severity_fatal), "%d", - google::GLOG_FATAL); + google::GLOG_ERROR); google::InitGoogleLogging(argv0); SetCommandLineOption("logtostderr", "1"); SetCommandLineOption("v", "0"); |