diff options
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/moc/main.cpp | 10 | ||||
-rw-r--r-- | src/tools/moc/parser.cpp | 6 | ||||
-rw-r--r-- | src/tools/moc/parser.h | 4 |
3 files changed, 16 insertions, 4 deletions
diff --git a/src/tools/moc/main.cpp b/src/tools/moc/main.cpp index 1ecb7e5..ecff105 100644 --- a/src/tools/moc/main.cpp +++ b/src/tools/moc/main.cpp @@ -111,6 +111,7 @@ void error(const char *msg = "Invalid argument") " -i do not generate an #include statement\n" " -p<path> path prefix for included file\n" " -f[<file>] force #include, optional file name\n" + " -nn do not display notes\n" " -nw do not display warnings\n" " @<file> read additional options from file\n" " -v display version of moc\n"); @@ -333,9 +334,12 @@ int runMoc(int _argc, char **_argv) case 'n': // don't display warnings if (ignoreConflictingOptions) break; - if (opt != "nw") + if (opt == "nw") + moc.displayWarnings = moc.displayNotes = false; + else if (opt == "nn") + moc.displayNotes = false; + else error(); - moc.displayWarnings = false; break; case 'h': // help if (more && opt != "help") @@ -425,7 +429,7 @@ int runMoc(int _argc, char **_argv) fprintf(out, "%s\n", composePreprocessorOutput(moc.symbols).constData()); } else { if (moc.classList.isEmpty()) - moc.warning("No relevant classes found. No output generated."); + moc.note("No relevant classes found. No output generated."); else moc.generate(out); } diff --git a/src/tools/moc/parser.cpp b/src/tools/moc/parser.cpp index 1fa1401..b6f0837 100644 --- a/src/tools/moc/parser.cpp +++ b/src/tools/moc/parser.cpp @@ -78,4 +78,10 @@ void Parser::warning(const char *msg) { currentFilenames.top().constData(), qMax(0, index > 0 ? symbol().lineNum : 0), msg); } +void Parser::note(const char *msg) { + if (displayNotes && msg) + fprintf(stderr, ErrorFormatString "Note: %s\n", + currentFilenames.top().constData(), qMax(0, index > 0 ? symbol().lineNum : 0), msg); +} + QT_END_NAMESPACE diff --git a/src/tools/moc/parser.h b/src/tools/moc/parser.h index 8356449..a874248 100644 --- a/src/tools/moc/parser.h +++ b/src/tools/moc/parser.h @@ -50,10 +50,11 @@ QT_BEGIN_NAMESPACE class Parser { public: - Parser():index(0), displayWarnings(true){} + Parser():index(0), displayWarnings(true), displayNotes(true) {} Symbols symbols; int index; bool displayWarnings; + bool displayNotes; QStack<QByteArray> currentFilenames; @@ -73,6 +74,7 @@ public: void error(int rollback); void error(const char *msg = 0); void warning(const char * = 0); + void note(const char * = 0); }; |