summaryrefslogtreecommitdiffstats
path: root/src/tools/moc
diff options
context:
space:
mode:
authorRolland Dudemaine <rolland@ghs.com>2011-02-22 15:28:10 (GMT)
committerHarald Fernengel <harald.fernengel@nokia.com>2011-02-22 15:28:10 (GMT)
commitc03fa07e0b52b28732bb86a34ed8ac58b1fa5397 (patch)
tree88b0471a24fac3abb63041a9fe02d3c708934761 /src/tools/moc
parent575b2cc66b8d603b297604f83108d229e17c8d0d (diff)
downloadQt-c03fa07e0b52b28732bb86a34ed8ac58b1fa5397.zip
Qt-c03fa07e0b52b28732bb86a34ed8ac58b1fa5397.tar.gz
Qt-c03fa07e0b52b28732bb86a34ed8ac58b1fa5397.tar.bz2
Add a "-nn" option to moc
Demote "No relevant classes found" warnings to "notes". "-nn" can be used to silence notes in order to reduce noise on embedded builds Merge-request: 1101 Reviewed-by: Harald Fernengel <harald.fernengel@nokia.com>
Diffstat (limited to 'src/tools/moc')
-rw-r--r--src/tools/moc/main.cpp10
-rw-r--r--src/tools/moc/parser.cpp6
-rw-r--r--src/tools/moc/parser.h4
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);
};