| 70 | } |
| 71 | |
| 72 | void displayMessage(MessageType t, std::ostringstream& msg) |
| 73 | { |
| 74 | // Add a note about warning suppression. |
| 75 | if (t == MessageType::AUTHOR_WARNING) { |
| 76 | msg << "This warning is for project developers. Use -Wno-dev to suppress " |
| 77 | "it."; |
| 78 | } else if (t == MessageType::AUTHOR_ERROR) { |
| 79 | msg << "This error is for project developers. Use -Wno-error=dev to " |
| 80 | "suppress it."; |
| 81 | } |
| 82 | |
| 83 | // Add a terminating blank line. |
| 84 | msg << '\n'; |
| 85 | |
| 86 | #if !defined(CMAKE_BOOTSTRAP) |
| 87 | // Add a C++ stack trace to internal errors. |
| 88 | if (t == MessageType::INTERNAL_ERROR) { |
| 89 | std::string stack = cmsys::SystemInformation::GetProgramStack(0, 0); |
| 90 | if (!stack.empty()) { |
| 91 | if (cmHasLiteralPrefix(stack, "WARNING:")) { |
| 92 | stack = "Note:" + stack.substr(8); |
| 93 | } |
| 94 | msg << stack << '\n'; |
| 95 | } |
| 96 | } |
| 97 | #endif |
| 98 | |
| 99 | // Output the message. |
| 100 | cmMessageMetadata md; |
| 101 | md.attrs = getMessageColor(t); |
| 102 | if (t == MessageType::FATAL_ERROR || t == MessageType::INTERNAL_ERROR || |
| 103 | t == MessageType::DEPRECATION_ERROR || t == MessageType::AUTHOR_ERROR) { |
| 104 | cmSystemTools::SetErrorOccurred(); |
| 105 | md.title = "Error"; |
| 106 | } else { |
| 107 | md.title = "Warning"; |
| 108 | } |
| 109 | cmSystemTools::Message(msg.str(), md); |
| 110 | } |
| 111 | |
| 112 | void PrintCallStack(std::ostream& out, cmListFileBacktrace bt, |
| 113 | cm::optional<std::string> const& topSource) |
no test coverage detected
searching dependent graphs…