1 /**************************************************************************
3 ** This file is part of Qt Creator
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
7 ** Contact: Nokia Corporation (info@qt.nokia.com)
10 ** GNU Lesser General Public License Usage
12 ** This file may be used under the terms of the GNU Lesser General Public
13 ** License version 2.1 as published by the Free Software Foundation and
14 ** appearing in the file LICENSE.LGPL included in the packaging of this file.
15 ** Please review the following information to ensure the GNU Lesser General
16 ** Public License version 2.1 requirements will be met:
17 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
19 ** In addition, as a special exception, Nokia gives you certain additional
20 ** rights. These rights are described in the Nokia Qt LGPL Exception
21 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
25 ** Alternatively, this file may be used in accordance with the terms and
26 ** conditions contained in a signed written agreement between you and Nokia.
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
31 **************************************************************************/
33 #include "gccparser.h"
35 #include "taskwindow.h"
36 #include "projectexplorerconstants.h"
38 #include <QtCore/QDir>
40 using namespace ProjectExplorer;
43 // opt. drive letter + filename: (2 brackets)
44 const char * const FILE_PATTERN = "(<command line>|([A-Za-z]:)?[^:]+\\.[^:]+):";
45 const char * const COMMAND_PATTERN = "^(.*[\\\\/])?([a-z0-9]+-[a-z0-9]+-[a-z0-9]+-)?(gcc|g\\+\\+)(-[0-9\\.]+)?(\\.exe)?: ";
48 GccParser::GccParser()
50 setObjectName(QLatin1String("GCCParser"));
51 m_regExp.setPattern(QString(QChar('^')) + QString::fromLatin1(FILE_PATTERN) + QLatin1String("(\\d+):(\\d+:)?\\s((fatal |#)?(warning|error|note):?\\s)(.+)$"));
52 m_regExp.setMinimal(true);
54 m_regExpIncluded.setPattern(QString::fromLatin1("^.*from\\s") + QString::fromLatin1(FILE_PATTERN) + QLatin1String("(\\d+)[,:]?$"));
55 m_regExpIncluded.setMinimal(true);
57 // optional path with trailing slash
58 // optional arm-linux-none-thingy
60 // optional trailing version number
61 // optional .exe postfix
62 m_regExpGccNames.setPattern(COMMAND_PATTERN);
63 m_regExpGccNames.setMinimal(true);
65 appendOutputParser(new LdParser);
68 void GccParser::stdError(const QString &line)
70 QString lne = line.trimmed();
72 // Blacklist some lines to not handle them:
73 if (lne.startsWith(QLatin1String("TeamBuilder ")) ||
74 lne.startsWith(QLatin1String("distcc["))) {
75 IOutputParser::stdError(line);
79 // Handle misc issues:
80 if (lne.startsWith(QLatin1String("ERROR:")) ||
81 lne == QLatin1String("* cpp failed")) {
82 emit addTask(Task(Task::Error,
83 lne /* description */,
84 QString() /* filename */,
86 Constants::TASK_CATEGORY_COMPILE));
88 } else if (m_regExpGccNames.indexIn(lne) > -1) {
89 QString description = lne.mid(m_regExpGccNames.matchedLength());
90 Task task(Task::Error,
92 QString(), /* filename */
94 Constants::TASK_CATEGORY_COMPILE);
95 if (description.startsWith(QLatin1String("warning: "))) {
96 task.type = Task::Warning;
97 task.description = description.mid(9);
98 } else if (description.startsWith(QLatin1String("fatal: "))) {
99 task.description = description.mid(7);
103 } else if (m_regExp.indexIn(lne) > -1) {
104 QString filename = m_regExp.cap(1);
105 int lineno = m_regExp.cap(3).toInt();
106 Task task(Task::Unknown,
107 m_regExp.cap(8) /* description */,
108 QDir::fromNativeSeparators(filename), lineno,
109 Constants::TASK_CATEGORY_COMPILE);
110 if (m_regExp.cap(7) == QLatin1String("warning"))
111 task.type = Task::Warning;
112 else if (m_regExp.cap(7) == QLatin1String("error") ||
113 task.description.startsWith(QLatin1String("undefined reference to")))
114 task.type = Task::Error;
116 // Prepend "#warning" or "#error" if that triggered the match on (warning|error)
117 // We want those to show how the warning was triggered
118 if (m_regExp.cap(5).startsWith(QChar('#')))
119 task.description = m_regExp.cap(5) + task.description;
123 } else if (m_regExpIncluded.indexIn(lne) > -1) {
124 emit addTask(Task(Task::Unknown,
125 lne /* description */,
126 QDir::fromNativeSeparators(m_regExpIncluded.cap(1)) /* filename */,
127 m_regExpIncluded.cap(3).toInt() /* linenumber */,
128 Constants::TASK_CATEGORY_COMPILE));
131 IOutputParser::stdError(line);
139 # include "projectexplorer.h"
140 # include "metatypedeclarations.h"
141 # include "outputparser_test.h"
143 void ProjectExplorerPlugin::testGccOutputParsers_data()
145 QTest::addColumn<QString>("input");
146 QTest::addColumn<OutputParserTester::Channel>("inputChannel");
147 QTest::addColumn<QString>("childStdOutLines");
148 QTest::addColumn<QString>("childStdErrLines");
149 QTest::addColumn<QList<ProjectExplorer::Task> >("tasks");
150 QTest::addColumn<QString>("outputLines");
153 QTest::newRow("pass-through stdout")
154 << QString::fromLatin1("Sometext") << OutputParserTester::STDOUT
155 << QString::fromLatin1("Sometext") << QString()
156 << QList<ProjectExplorer::Task>()
158 QTest::newRow("pass-through stderr")
159 << QString::fromLatin1("Sometext") << OutputParserTester::STDERR
160 << QString() << QString::fromLatin1("Sometext")
161 << QList<ProjectExplorer::Task>()
164 QTest::newRow("GCCE error")
165 << QString::fromLatin1("/temp/test/untitled8/main.cpp: In function `int main(int, char**)':\n"
166 "/temp/test/untitled8/main.cpp:9: error: `sfasdf' undeclared (first use this function)\n"
167 "/temp/test/untitled8/main.cpp:9: error: (Each undeclared identifier is reported only once for each function it appears in.)")
168 << OutputParserTester::STDERR
169 << QString() << QString()
170 << (QList<ProjectExplorer::Task>()
171 << Task(Task::Unknown,
172 QLatin1String("In function `int main(int, char**)':"),
173 QLatin1String("/temp/test/untitled8/main.cpp"), -1,
174 Constants::TASK_CATEGORY_COMPILE)
176 QLatin1String("`sfasdf' undeclared (first use this function)"),
177 QLatin1String("/temp/test/untitled8/main.cpp"), 9,
178 Constants::TASK_CATEGORY_COMPILE)
180 QLatin1String("(Each undeclared identifier is reported only once for each function it appears in.)"),
181 QLatin1String("/temp/test/untitled8/main.cpp"), 9,
182 Constants::TASK_CATEGORY_COMPILE)
185 QTest::newRow("GCCE warning")
186 << QString::fromLatin1("/src/corelib/global/qglobal.h:1635: warning: inline function `QDebug qDebug()' used but never defined")
187 << OutputParserTester::STDERR
188 << QString() << QString()
189 << (QList<ProjectExplorer::Task>()
190 << Task(Task::Warning,
191 QLatin1String("inline function `QDebug qDebug()' used but never defined"),
192 QLatin1String("/src/corelib/global/qglobal.h"), 1635,
193 Constants::TASK_CATEGORY_COMPILE))
195 QTest::newRow("warning")
196 << QString::fromLatin1("main.cpp:7:2: warning: Some warning")
197 << OutputParserTester::STDERR
198 << QString() << QString()
199 << (QList<ProjectExplorer::Task>() << Task(Task::Warning,
200 QLatin1String("Some warning"),
201 QLatin1String("main.cpp"), 7,
202 Constants::TASK_CATEGORY_COMPILE))
204 QTest::newRow("GCCE #error")
205 << QString::fromLatin1("C:\\temp\\test\\untitled8\\main.cpp:7: #error Symbian error")
206 << OutputParserTester::STDERR
207 << QString() << QString()
208 << (QList<ProjectExplorer::Task>() << Task(Task::Error,
209 QLatin1String("#error Symbian error"),
210 QLatin1String("C:/temp/test/untitled8/main.cpp"), 7,
211 Constants::TASK_CATEGORY_COMPILE))
213 // Symbian reports #warning(s) twice (using different syntax).
214 QTest::newRow("GCCE #warning1")
215 << QString::fromLatin1("C:\\temp\\test\\untitled8\\main.cpp:8: warning: #warning Symbian warning")
216 << OutputParserTester::STDERR
217 << QString() << QString()
218 << (QList<ProjectExplorer::Task>() << Task(Task::Warning,
219 QLatin1String("#warning Symbian warning"),
220 QLatin1String("C:/temp/test/untitled8/main.cpp"), 8,
221 Constants::TASK_CATEGORY_COMPILE))
223 QTest::newRow("GCCE #warning2")
224 << QString::fromLatin1("/temp/test/untitled8/main.cpp:8:2: warning: #warning Symbian warning")
225 << OutputParserTester::STDERR
226 << QString() << QString()
227 << (QList<ProjectExplorer::Task>() << Task(Task::Warning,
228 QLatin1String("#warning Symbian warning"),
229 QLatin1String("/temp/test/untitled8/main.cpp"), 8,
230 Constants::TASK_CATEGORY_COMPILE))
232 QTest::newRow("Undefined reference (debug)")
233 << QString::fromLatin1("main.o: In function `main':\n"
234 "C:\\temp\\test\\untitled8/main.cpp:8: undefined reference to `MainWindow::doSomething()'\n"
235 "collect2: ld returned 1 exit status")
236 << OutputParserTester::STDERR
237 << QString() << QString()
238 << (QList<ProjectExplorer::Task>()
239 << Task(Task::Unknown,
240 QLatin1String("In function `main':"),
241 QLatin1String("main.o"), -1,
242 Constants::TASK_CATEGORY_COMPILE)
244 QLatin1String("undefined reference to `MainWindow::doSomething()'"),
245 QLatin1String("C:/temp/test/untitled8/main.cpp"), 8,
246 Constants::TASK_CATEGORY_COMPILE)
248 QLatin1String("collect2: ld returned 1 exit status"),
250 Constants::TASK_CATEGORY_COMPILE)
253 QTest::newRow("Undefined reference (release)")
254 << QString::fromLatin1("main.o: In function `main':\n"
255 "C:\\temp\\test\\untitled8/main.cpp:(.text+0x40): undefined reference to `MainWindow::doSomething()'\n"
256 "collect2: ld returned 1 exit status")
257 << OutputParserTester::STDERR
258 << QString() << QString()
259 << (QList<ProjectExplorer::Task>()
260 << Task(Task::Unknown,
261 QLatin1String("In function `main':"),
262 QLatin1String("main.o"), -1,
263 Constants::TASK_CATEGORY_COMPILE)
265 QLatin1String("undefined reference to `MainWindow::doSomething()'"),
266 QLatin1String("C:/temp/test/untitled8/main.cpp"), -1,
267 Constants::TASK_CATEGORY_COMPILE)
269 QLatin1String("collect2: ld returned 1 exit status"),
271 Constants::TASK_CATEGORY_COMPILE)
274 QTest::newRow("linker: dll format not recognized")
275 << QString::fromLatin1("c:\\Qt\\4.6\\lib/QtGuid4.dll: file not recognized: File format not recognized")
276 << OutputParserTester::STDERR
277 << QString() << QString()
278 << (QList<ProjectExplorer::Task>()
280 QLatin1String("file not recognized: File format not recognized"),
281 QLatin1String("c:/Qt/4.6/lib/QtGuid4.dll"), -1,
282 Constants::TASK_CATEGORY_COMPILE))
284 QTest::newRow("Invalid rpath")
285 << QString::fromLatin1("g++: /usr/local/lib: No such file or directory")
286 << OutputParserTester::STDERR
287 << QString() << QString()
288 << (QList<ProjectExplorer::Task>()
290 QLatin1String("/usr/local/lib: No such file or directory"),
292 Constants::TASK_CATEGORY_COMPILE))
295 QTest::newRow("Invalid rpath")
296 << QString::fromLatin1("../../../../master/src/plugins/debugger/gdb/gdbengine.cpp: In member function 'void Debugger::Internal::GdbEngine::handleBreakInsert2(const Debugger::Internal::GdbResponse&)':\n"
297 "../../../../master/src/plugins/debugger/gdb/gdbengine.cpp:2114: warning: unused variable 'index'\n"
298 "../../../../master/src/plugins/debugger/gdb/gdbengine.cpp:2115: warning: unused variable 'handler'")
299 << OutputParserTester::STDERR
300 << QString() << QString()
301 << (QList<ProjectExplorer::Task>()
302 << Task(Task::Unknown,
303 QLatin1String("In member function 'void Debugger::Internal::GdbEngine::handleBreakInsert2(const Debugger::Internal::GdbResponse&)':"),
304 QLatin1String("../../../../master/src/plugins/debugger/gdb/gdbengine.cpp"), -1,
305 Constants::TASK_CATEGORY_COMPILE)
306 << Task(Task::Warning,
307 QLatin1String("unused variable 'index'"),
308 QLatin1String("../../../../master/src/plugins/debugger/gdb/gdbengine.cpp"), 2114,
309 Constants::TASK_CATEGORY_COMPILE)
310 << Task(Task::Warning,
311 QLatin1String("unused variable 'handler'"),
312 QLatin1String("../../../../master/src/plugins/debugger/gdb/gdbengine.cpp"), 2115,
313 Constants::TASK_CATEGORY_COMPILE))
315 QTest::newRow("gnumakeparser.cpp errors")
316 << QString::fromLatin1("/home/code/src/creator/src/plugins/projectexplorer/gnumakeparser.cpp: In member function 'void ProjectExplorer::ProjectExplorerPlugin::testGnuMakeParserTaskMangling_data()':\n"
317 "/home/code/src/creator/src/plugins/projectexplorer/gnumakeparser.cpp:264: error: expected primary-expression before ':' token\n"
318 "/home/code/src/creator/src/plugins/projectexplorer/gnumakeparser.cpp:264: error: expected ';' before ':' token")
319 << OutputParserTester::STDERR
320 << QString() << QString()
321 << (QList<ProjectExplorer::Task>()
322 << Task(Task::Unknown,
323 QLatin1String("In member function 'void ProjectExplorer::ProjectExplorerPlugin::testGnuMakeParserTaskMangling_data()':"),
324 QLatin1String("/home/code/src/creator/src/plugins/projectexplorer/gnumakeparser.cpp"), -1,
325 Constants::TASK_CATEGORY_COMPILE)
327 QLatin1String("expected primary-expression before ':' token"),
328 QLatin1String("/home/code/src/creator/src/plugins/projectexplorer/gnumakeparser.cpp"), 264,
329 Constants::TASK_CATEGORY_COMPILE)
331 QLatin1String("expected ';' before ':' token"),
332 QLatin1String("/home/code/src/creator/src/plugins/projectexplorer/gnumakeparser.cpp"), 264,
333 Constants::TASK_CATEGORY_COMPILE))
335 QTest::newRow("distcc error(QTCREATORBUG-904)")
336 << QString::fromLatin1("distcc[73168] (dcc_get_hostlist) Warning: no hostlist is set; can't distribute work\n"
337 "distcc[73168] (dcc_build_somewhere) Warning: failed to distribute, running locally instead")
338 << OutputParserTester::STDERR
339 << QString() << QString::fromLatin1("distcc[73168] (dcc_get_hostlist) Warning: no hostlist is set; can't distribute work\n"
340 "distcc[73168] (dcc_build_somewhere) Warning: failed to distribute, running locally instead")
341 << QList<ProjectExplorer::Task>()
343 QTest::newRow("ld warning (QTCREATORBUG-905)")
344 << QString::fromLatin1("ld: warning: Core::IEditor* QVariant::value<Core::IEditor*>() const has different visibility (hidden) in .obj/debug-shared/openeditorsview.o and (default) in .obj/debug-shared/editormanager.o")
345 << OutputParserTester::STDERR
346 << QString() << QString()
347 << ( QList<ProjectExplorer::Task>()
348 << Task(Task::Warning,
349 QLatin1String("Core::IEditor* QVariant::value<Core::IEditor*>() const has different visibility (hidden) in .obj/debug-shared/openeditorsview.o and (default) in .obj/debug-shared/editormanager.o"),
351 Constants::TASK_CATEGORY_COMPILE))
353 QTest::newRow("ld fatal")
354 << QString::fromLatin1("ld: fatal: Symbol referencing errors. No output written to testproject")
355 << OutputParserTester::STDERR
356 << QString() << QString()
357 << ( QList<ProjectExplorer::Task>()
359 QLatin1String("Symbol referencing errors. No output written to testproject"),
361 Constants::TASK_CATEGORY_COMPILE))
363 QTest::newRow("Teambuilder issues")
364 << QString::fromLatin1("TeamBuilder Client:: error: could not find Scheduler, running Job locally...")
365 << OutputParserTester::STDERR
366 << QString() << QString::fromLatin1("TeamBuilder Client:: error: could not find Scheduler, running Job locally...")
367 << QList<ProjectExplorer::Task>()
369 QTest::newRow("note")
370 << QString::fromLatin1("/home/dev/creator/share/qtcreator/gdbmacros/gdbmacros.cpp:1079: note: initialized from here")
371 << OutputParserTester::STDERR
372 << QString() << QString()
373 << ( QList<ProjectExplorer::Task>()
374 << Task(Task::Unknown,
375 QLatin1String("initialized from here"),
376 QString::fromLatin1("/home/dev/creator/share/qtcreator/gdbmacros/gdbmacros.cpp"), 1079,
377 Constants::TASK_CATEGORY_COMPILE))
379 QTest::newRow("static member function")
380 << QString::fromLatin1("/Qt/4.6.2-Symbian/s60sdk/epoc32/include/stdapis/stlport/stl/_tree.c: In static member function 'static std::_Rb_tree_node_base* std::_Rb_global<_Dummy>::_Rebalance_for_erase(std::_Rb_tree_node_base*, std::_Rb_tree_node_base*&, std::_Rb_tree_node_base*&, std::_Rb_tree_node_base*&)':\n"
381 "/Qt/4.6.2-Symbian/s60sdk/epoc32/include/stdapis/stlport/stl/_tree.c:194: warning: suggest explicit braces to avoid ambiguous 'else'")
382 << OutputParserTester::STDERR
383 << QString() << QString()
384 << ( QList<ProjectExplorer::Task>()
385 << Task(Task::Unknown,
386 QLatin1String("In static member function 'static std::_Rb_tree_node_base* std::_Rb_global<_Dummy>::_Rebalance_for_erase(std::_Rb_tree_node_base*, std::_Rb_tree_node_base*&, std::_Rb_tree_node_base*&, std::_Rb_tree_node_base*&)':"),
387 QString::fromLatin1("/Qt/4.6.2-Symbian/s60sdk/epoc32/include/stdapis/stlport/stl/_tree.c"), -1,
388 Constants::TASK_CATEGORY_COMPILE)
389 << Task(Task::Warning,
390 QLatin1String("suggest explicit braces to avoid ambiguous 'else'"),
391 QString::fromLatin1("/Qt/4.6.2-Symbian/s60sdk/epoc32/include/stdapis/stlport/stl/_tree.c"), 194,
392 Constants::TASK_CATEGORY_COMPILE))
394 QTest::newRow("rm false positive")
395 << QString::fromLatin1("rm: cannot remove `release/moc_mainwindow.cpp': No such file or directory")
396 << OutputParserTester::STDERR
397 << QString() << QString("rm: cannot remove `release/moc_mainwindow.cpp': No such file or directory")
398 << QList<ProjectExplorer::Task>()
400 QTest::newRow("ranlib false positive")
401 << QString::fromLatin1("ranlib: file: libSupport.a(HashTable.o) has no symbols")
402 << OutputParserTester::STDERR
403 << QString() << QString("ranlib: file: libSupport.a(HashTable.o) has no symbols")
404 << QList<ProjectExplorer::Task>()
406 QTest::newRow("ld: missing library")
407 << QString::fromLatin1("/usr/bin/ld: cannot find -ldoesnotexist")
408 << OutputParserTester::STDERR
409 << QString() << QString()
410 << ( QList<ProjectExplorer::Task>()
412 QLatin1String("cannot find -ldoesnotexist"),
414 Constants::TASK_CATEGORY_COMPILE))
416 QTest::newRow("In function")
417 << QString::fromLatin1("../../scriptbug/main.cpp: In function void foo(i) [with i = double]:\n"
418 "../../scriptbug/main.cpp:22: instantiated from here\n"
419 "../../scriptbug/main.cpp:8: warning: unused variable c")
420 << OutputParserTester::STDERR
421 << QString() << QString()
422 << ( QList<ProjectExplorer::Task>()
423 << Task(Task::Unknown,
424 QLatin1String("In function void foo(i) [with i = double]:"),
425 QLatin1String("../../scriptbug/main.cpp"), -1,
426 Constants::TASK_CATEGORY_COMPILE)
427 << Task(Task::Unknown,
428 QLatin1String("instantiated from here"),
429 QLatin1String("../../scriptbug/main.cpp"), 22,
430 Constants::TASK_CATEGORY_COMPILE)
431 << Task(Task::Warning,
432 QLatin1String("unused variable c"),
433 QLatin1String("../../scriptbug/main.cpp"), 8,
434 Constants::TASK_CATEGORY_COMPILE))
436 QTest::newRow("instanciated from here")
437 << QString::fromLatin1("main.cpp:10: instantiated from here ")
438 << OutputParserTester::STDERR
439 << QString() << QString()
440 << ( QList<ProjectExplorer::Task>()
441 << Task(Task::Unknown,
442 QLatin1String("instantiated from here"),
443 QLatin1String("main.cpp"), 10,
444 Constants::TASK_CATEGORY_COMPILE))
446 QTest::newRow("In constructor")
447 << QString::fromLatin1("/dev/creator/src/plugins/find/basetextfind.h: In constructor 'Find::BaseTextFind::BaseTextFind(QTextEdit*)':")
448 << OutputParserTester::STDERR
449 << QString() << QString()
450 << ( QList<ProjectExplorer::Task>()
451 << Task(Task::Unknown,
452 QLatin1String("In constructor 'Find::BaseTextFind::BaseTextFind(QTextEdit*)':"),
453 QLatin1String("/dev/creator/src/plugins/find/basetextfind.h"), -1,
454 Constants::TASK_CATEGORY_COMPILE))
457 QTest::newRow("At global scope")
458 << QString::fromLatin1("../../scriptbug/main.cpp: At global scope:\n"
459 "../../scriptbug/main.cpp: In instantiation of void bar(i) [with i = double]:\n"
460 "../../scriptbug/main.cpp:8: instantiated from void foo(i) [with i = double]\n"
461 "../../scriptbug/main.cpp:22: instantiated from here\n"
462 "../../scriptbug/main.cpp:5: warning: unused parameter v")
463 << OutputParserTester::STDERR
464 << QString() << QString()
465 << ( QList<ProjectExplorer::Task>()
466 << Task(Task::Unknown,
467 QLatin1String("At global scope:"),
468 QLatin1String("../../scriptbug/main.cpp"), -1,
469 Constants::TASK_CATEGORY_COMPILE)
470 << Task(Task::Unknown,
471 QLatin1String("In instantiation of void bar(i) [with i = double]:"),
472 QLatin1String("../../scriptbug/main.cpp"), -1,
473 Constants::TASK_CATEGORY_COMPILE)
474 << Task(Task::Unknown,
475 QLatin1String("instantiated from void foo(i) [with i = double]"),
476 QLatin1String("../../scriptbug/main.cpp"), 8,
477 Constants::TASK_CATEGORY_COMPILE)
478 << Task(Task::Unknown,
479 QLatin1String("instantiated from here"),
480 QLatin1String("../../scriptbug/main.cpp"), 22,
481 Constants::TASK_CATEGORY_COMPILE)
482 << Task(Task::Warning,
483 QLatin1String("unused parameter v"),
484 QLatin1String("../../scriptbug/main.cpp"), 5,
485 Constants::TASK_CATEGORY_COMPILE))
488 QTest::newRow("gcc 4.5 fatal error")
489 << QString::fromLatin1("/home/code/test.cpp:54:38: fatal error: test.moc: No such file or directory")
490 << OutputParserTester::STDERR
491 << QString() << QString()
492 << ( QList<ProjectExplorer::Task>()
494 QLatin1String("test.moc: No such file or directory"),
495 QLatin1String("/home/code/test.cpp"), 54,
496 Constants::TASK_CATEGORY_COMPILE))
499 QTest::newRow("QTCREATORBUG-597")
500 << QString::fromLatin1("debug/qplotaxis.o: In function `QPlotAxis':\n"
501 "M:\\Development\\x64\\QtPlot/qplotaxis.cpp:26: undefined reference to `vtable for QPlotAxis'\n"
502 "M:\\Development\\x64\\QtPlot/qplotaxis.cpp:26: undefined reference to `vtable for QPlotAxis'\n"
503 "collect2: ld returned 1 exit status")
504 << OutputParserTester::STDERR
505 << QString() << QString()
506 << ( QList<ProjectExplorer::Task>()
507 << Task(Task::Unknown,
508 QLatin1String("In function `QPlotAxis':"),
509 QLatin1String("debug/qplotaxis.o"), -1,
510 Constants::TASK_CATEGORY_COMPILE)
512 QLatin1String("undefined reference to `vtable for QPlotAxis'"),
513 QLatin1String("M:/Development/x64/QtPlot/qplotaxis.cpp"), 26,
514 Constants::TASK_CATEGORY_COMPILE)
516 QLatin1String("undefined reference to `vtable for QPlotAxis'"),
517 QLatin1String("M:/Development/x64/QtPlot/qplotaxis.cpp"), 26,
518 Constants::TASK_CATEGORY_COMPILE)
520 QLatin1String("collect2: ld returned 1 exit status"),
522 Constants::TASK_CATEGORY_COMPILE))
525 QTest::newRow("instantiated from here should not be an error")
526 << QString::fromLatin1("../stl/main.cpp: In member function typename _Vector_base<_Tp, _Alloc>::_Tp_alloc_type::const_reference Vector<_Tp, _Alloc>::at(int) [with _Tp = Point, _Alloc = Allocator<Point>]:\n"
527 "../stl/main.cpp:38: instantiated from here\n"
528 "../stl/main.cpp:31: warning: returning reference to temporary\n"
529 "../stl/main.cpp: At global scope:\n"
530 "../stl/main.cpp:31: warning: unused parameter index")
531 << OutputParserTester::STDERR
532 << QString() << QString()
533 << ( QList<ProjectExplorer::Task>()
534 << Task(Task::Unknown,
535 QLatin1String("In member function typename _Vector_base<_Tp, _Alloc>::_Tp_alloc_type::const_reference Vector<_Tp, _Alloc>::at(int) [with _Tp = Point, _Alloc = Allocator<Point>]:"),
536 QLatin1String("../stl/main.cpp"), -1,
537 Constants::TASK_CATEGORY_COMPILE)
538 << Task(Task::Unknown,
539 QLatin1String("instantiated from here"),
540 QLatin1String("../stl/main.cpp"), 38,
541 Constants::TASK_CATEGORY_COMPILE)
542 << Task(Task::Warning,
543 QLatin1String("returning reference to temporary"),
544 QLatin1String("../stl/main.cpp"), 31,
545 Constants::TASK_CATEGORY_COMPILE)
546 << Task(Task::Unknown,
547 QLatin1String("At global scope:"),
548 QLatin1String("../stl/main.cpp"), -1,
549 Constants::TASK_CATEGORY_COMPILE)
550 << Task(Task::Warning,
551 QLatin1String("unused parameter index"),
552 QLatin1String("../stl/main.cpp"), 31,
553 Constants::TASK_CATEGORY_COMPILE))
556 QTest::newRow("GCCE from lines")
557 << QString::fromLatin1("In file included from C:/Symbian_SDK/epoc32/include/e32cmn.h:6792,\n"
558 " from C:/Symbian_SDK/epoc32/include/e32std.h:25,\n"
559 "C:/Symbian_SDK/epoc32/include/e32cmn.inl: In member function 'SSecureId::operator const TSecureId&() const':\n"
560 "C:/Symbian_SDK/epoc32/include/e32cmn.inl:7094: warning: returning reference to temporary")
561 << OutputParserTester::STDERR
562 << QString() << QString()
563 << ( QList<ProjectExplorer::Task>()
564 << Task(Task::Unknown,
565 QLatin1String("In file included from C:/Symbian_SDK/epoc32/include/e32cmn.h:6792,"),
566 QLatin1String("C:/Symbian_SDK/epoc32/include/e32cmn.h"), 6792,
567 Constants::TASK_CATEGORY_COMPILE)
568 << Task(Task::Unknown,
569 QLatin1String("from C:/Symbian_SDK/epoc32/include/e32std.h:25,"),
570 QLatin1String("C:/Symbian_SDK/epoc32/include/e32std.h"), 25,
571 Constants::TASK_CATEGORY_COMPILE)
572 << Task(Task::Unknown,
573 QLatin1String("In member function 'SSecureId::operator const TSecureId&() const':"),
574 QLatin1String("C:/Symbian_SDK/epoc32/include/e32cmn.inl"), -1,
575 Constants::TASK_CATEGORY_COMPILE)
576 << Task(Task::Warning,
577 QLatin1String("returning reference to temporary"),
578 QLatin1String("C:/Symbian_SDK/epoc32/include/e32cmn.inl"), 7094,
579 Constants::TASK_CATEGORY_COMPILE))
582 QTest::newRow("QTCREATORBUG-2206")
583 << QString::fromLatin1("../../../src/XmlUg/targetdelete.c: At top level:")
584 << OutputParserTester::STDERR
585 << QString() << QString()
586 << ( QList<ProjectExplorer::Task>()
587 << Task(Task::Unknown,
588 QLatin1String("At top level:"),
589 QLatin1String("../../../src/XmlUg/targetdelete.c"), -1,
590 Constants::TASK_CATEGORY_COMPILE))
593 QTest::newRow("GCCE 4: commandline, includes")
594 << QString::fromLatin1("In file included from /Symbian/SDK/EPOC32/INCLUDE/GCCE/GCCE.h:15,\n"
595 " from <command line>:26:\n"
596 "/Symbian/SDK/epoc32/include/variant/Symbian_OS.hrh:1134:26: warning: no newline at end of file")
597 << OutputParserTester::STDERR
598 << QString() << QString()
599 << ( QList<ProjectExplorer::Task>()
600 << Task(Task::Unknown,
601 QLatin1String("In file included from /Symbian/SDK/EPOC32/INCLUDE/GCCE/GCCE.h:15,"),
602 QLatin1String("/Symbian/SDK/EPOC32/INCLUDE/GCCE/GCCE.h"), 15,
603 Constants::TASK_CATEGORY_COMPILE)
604 << Task(Task::Unknown,
605 QLatin1String("from <command line>:26:"),
606 QLatin1String("<command line>"), 26,
607 Constants::TASK_CATEGORY_COMPILE)
608 << Task(Task::Warning,
609 QLatin1String("no newline at end of file"),
610 QLatin1String("/Symbian/SDK/epoc32/include/variant/Symbian_OS.hrh"), 1134,
611 Constants::TASK_CATEGORY_COMPILE))
614 QTest::newRow("Linker fail (release build)")
615 << QString::fromLatin1("release/main.o:main.cpp:(.text+0x42): undefined reference to `MainWindow::doSomething()'")
616 << OutputParserTester::STDERR
617 << QString() << QString()
618 << ( QList<ProjectExplorer::Task>()
620 QLatin1String("undefined reference to `MainWindow::doSomething()'"),
621 QLatin1String("main.cpp"), -1,
622 Constants::TASK_CATEGORY_COMPILE))
627 void ProjectExplorerPlugin::testGccOutputParsers()
629 OutputParserTester testbench;
630 testbench.appendOutputParser(new GccParser);
631 QFETCH(QString, input);
632 QFETCH(OutputParserTester::Channel, inputChannel);
633 QFETCH(QList<Task>, tasks);
634 QFETCH(QString, childStdOutLines);
635 QFETCH(QString, childStdErrLines);
636 QFETCH(QString, outputLines);
638 testbench.testParsing(input, inputChannel,
639 tasks, childStdOutLines, childStdErrLines,