diff options
author | Fabian Kosmale <[email protected]> | 2025-03-03 17:28:31 +0100 |
---|---|---|
committer | Fabian Kosmale <[email protected]> | 2025-03-05 22:41:05 +0100 |
commit | c0f9e99611237601dc1a8367883a0699e3fe2da2 (patch) | |
tree | f051fa2639a495b49c632fad7cbfe51540faa56f | |
parent | fd88f44c15e969da3228ab2b0a302e78e2ccc8de (diff) |
moc: Add an error overload taking a Symbol and a message
This allows deferring warnigs about a certain error until later, by
storing the symbol (while still allowing to print a custom message).
Change-Id: Id434eec9b344b1f8b18c504dfda8fed90167cf12
Reviewed-by: Ivan Solovev <[email protected]>
-rw-r--r-- | src/tools/moc/parser.cpp | 6 | ||||
-rw-r--r-- | src/tools/moc/parser.h | 1 |
2 files changed, 7 insertions, 0 deletions
diff --git a/src/tools/moc/parser.cpp b/src/tools/moc/parser.cpp index 1cfb8ce4868..5f4ff3f143f 100644 --- a/src/tools/moc/parser.cpp +++ b/src/tools/moc/parser.cpp @@ -69,6 +69,12 @@ void Parser::error(const char *msg) exit(EXIT_FAILURE); } +void Parser::error(const Symbol& symbol, const char *msg) +{ + printMsg("error: %s\n", msg, symbol); + exit(EXIT_FAILURE); +} + void Parser::warning(const Symbol &sym, QByteArrayView msg) { if (displayWarnings) diff --git a/src/tools/moc/parser.h b/src/tools/moc/parser.h index 5c84a98990a..526364d7d96 100644 --- a/src/tools/moc/parser.h +++ b/src/tools/moc/parser.h @@ -48,6 +48,7 @@ public: Q_NORETURN void error(const Symbol &symbol); Q_NORETURN void error(const char *msg = nullptr); + Q_NORETURN void error(const Symbol &symbol, const char *msg); void warning(const char * = nullptr); void warning(const Symbol &sym, QByteArrayView msg); void note(const char * = nullptr); |