Skip to content

Commit

Permalink
Fix bad parsing in extract_used_header_warnings
Browse files Browse the repository at this point in the history
- This makes it more robust to changes in formatting in the compiler
  log output between different nvrtc versions.
  • Loading branch information
benbarsdell committed Nov 21, 2023
1 parent ed2331e commit e1334e5
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions jitify2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7211,14 +7211,12 @@ inline bool extract_used_header_warnings(
start = (size_t)-1;
}
++start;
// Each full warning message is 4 lines.
for (int i = 0; i < 4; ++i) {
size_t new_end = compile_log->find_first_of('\n', end + 1);
if (new_end == std::string::npos) break; // End of log
end = new_end;
}
++end;
std::string tail = compile_log->substr(end);
std::string tail;
// Log messages are separated by a blank line.
end = compile_log->find("\n\n", end + 1);
if (end != std::string::npos) {
tail = compile_log->substr(end + 2);
}
compile_log->resize(start);
*compile_log += tail;
}
Expand All @@ -7233,14 +7231,11 @@ inline bool extract_used_header_warnings(
start = (size_t)-1;
}
++start;
size_t end =
compile_log->find_first_of('\n', pos + std::strlen("-diag-suppress"));
assert(end != std::string::npos);
end = compile_log->find_first_of('\n', end + 1);
std::string tail;
size_t end =
compile_log->find("\n\n", pos + std::strlen("-diag-suppress"));
if (end != std::string::npos) {
++end;
tail = compile_log->substr(end);
tail = compile_log->substr(end + 2);
}
compile_log->resize(start);
*compile_log += tail;
Expand Down

0 comments on commit e1334e5

Please sign in to comment.