| 58 | #else |
| 59 | #include <cstdint> |
| 60 | struct SourceLocation { |
| 61 | #if CPPCHECK_HAS_SOURCE_LOCATION_INTRINSICS |
| 62 | static SourceLocation current(std::uint_least32_t line = __builtin_LINE(), |
| 63 | std::uint_least32_t column = __builtin_COLUMN(), |
| 64 | const char* file_name = __builtin_FILE(), |
| 65 | const char* function_name = __builtin_FUNCTION()) |
| 66 | { |
| 67 | SourceLocation result{}; |
| 68 | result.m_line = line; |
| 69 | result.m_column = column; |
| 70 | result.m_file_name = file_name; |
| 71 | result.m_function_name = function_name; |
| 72 | return result; |
| 73 | } |
| 74 | #else |
| 75 | static SourceLocation current() { |
| 76 | return SourceLocation(); |
| 77 | } |
| 78 | #endif |
| 79 | std::uint_least32_t m_line = 0; |
| 80 | std::uint_least32_t m_column = 0; |
| 81 | const char* m_file_name = ""; |
| 82 | const char* m_function_name = ""; |
| 83 | std::uint_least32_t line() const { |
| 84 | return m_line; |
| 85 | } |
| 86 | std::uint_least32_t column() const { |
| 87 | return m_column; |
| 88 | } |
| 89 | const char* file_name() const { |
| 90 | return m_file_name; |
| 91 | } |
| 92 | const char* function_name() const { |
| 93 | return m_function_name; |
| 94 | } |
| 95 | }; |
| 96 | #endif |
| 97 | |
| 98 | #endif |