Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tobias Hunger
qt-creator
Commits
9ccd2f15
Commit
9ccd2f15
authored
Mar 15, 2010
by
Tobias Hunger
Browse files
Report errors in Makefiles in gnumakeparser
* Report errors in Makefiles * Skip all but the first fatal error
parent
54393f7e
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/plugins/projectexplorer/gnumakeparser.cpp
View file @
9ccd2f15
...
...
@@ -41,13 +41,16 @@ namespace {
const
char
*
const
MAKE_PATTERN
(
"^(mingw(32|64)-|g)?make(
\\
[
\\
d+
\\
])?:
\\
s"
);
}
GnuMakeParser
::
GnuMakeParser
(
const
QString
&
dir
)
GnuMakeParser
::
GnuMakeParser
(
const
QString
&
dir
)
:
m_alreadyFatal
(
false
)
{
m_makeDir
.
setPattern
(
QLatin1String
(
MAKE_PATTERN
)
+
QLatin1String
(
"(
\\
w+) directory .(.+).$"
));
m_makeDir
.
setMinimal
(
true
);
m_makeLine
.
setPattern
(
QLatin1String
(
MAKE_PATTERN
)
+
QLatin1String
(
"(.*)$"
));
m_makeLine
.
setMinimal
(
true
);
m_makefileError
.
setPattern
(
QLatin1String
(
"^(.*):(
\\
d+):
\\
s
\\
*
\\
*
\\
*
\\
s(.*)$"
));
m_makefileError
.
setMinimal
(
true
);
addDirectory
(
dir
);
}
...
...
@@ -62,18 +65,34 @@ void GnuMakeParser::stdOutput(const QString &line)
addDirectory
(
m_makeDir
.
cap
(
5
));
return
;
}
// Only ever report the first fatal message:
// Everything else will be follow-up issues.
if
(
m_makeLine
.
indexIn
(
lne
)
>
-
1
)
{
QString
message
=
m_makeLine
.
cap
(
4
);
Task
task
(
Task
::
Warning
,
message
,
QString
()
/* filename */
,
-
1
,
/* line */
Constants
::
TASK_CATEGORY_BUILDSYSTEM
);
if
(
message
.
startsWith
(
QLatin1String
(
"*** "
)))
{
task
.
description
=
task
.
description
.
mid
(
4
);
task
.
type
=
Task
::
Error
;
if
(
!
m_alreadyFatal
)
{
QString
message
=
m_makeLine
.
cap
(
4
);
Task
task
(
Task
::
Warning
,
message
,
QString
()
/* filename */
,
-
1
,
/* line */
Constants
::
TASK_CATEGORY_BUILDSYSTEM
);
if
(
message
.
startsWith
(
QLatin1String
(
"*** "
)))
{
task
.
description
=
task
.
description
.
mid
(
4
);
task
.
type
=
Task
::
Error
;
m_alreadyFatal
=
true
;
}
addTask
(
task
);
}
return
;
}
if
(
m_makefileError
.
indexIn
(
lne
)
>
-
1
)
{
if
(
!
m_alreadyFatal
)
{
m_alreadyFatal
=
true
;
addTask
(
Task
(
Task
::
Error
,
m_makefileError
.
cap
(
3
),
m_makefileError
.
cap
(
1
),
m_makefileError
.
cap
(
2
).
toInt
(),
Constants
::
TASK_CATEGORY_BUILDSYSTEM
));
}
addTask
(
task
);
return
;
}
...
...
@@ -204,6 +223,32 @@ void ProjectExplorerPlugin::testGnuMakeParserParsing_data()
Constants
::
TASK_CATEGORY_BUILDSYSTEM
))
<<
QString
()
<<
QStringList
();
QTest
::
newRow
(
"multiple fatals"
)
<<
QStringList
()
<<
QString
::
fromLatin1
(
"make[3]: *** [.obj/debug-shared/gnumakeparser.o] Error 1
\n
"
"make[3]: *** Waiting for unfinished jobs....
\n
"
"make[2]: *** [sub-projectexplorer-make_default] Error 2"
)
<<
OutputParserTester
::
STDOUT
<<
QString
()
<<
QString
()
<<
(
QList
<
Task
>
()
<<
Task
(
Task
::
Error
,
QString
::
fromLatin1
(
"[.obj/debug-shared/gnumakeparser.o] Error 1"
),
QString
(),
-
1
,
Constants
::
TASK_CATEGORY_BUILDSYSTEM
))
<<
QString
()
<<
QStringList
();
QTest
::
newRow
(
"Makefile error"
)
<<
QStringList
()
<<
QString
::
fromLatin1
(
"Makefile:360: *** missing separator (did you mean TAB instead of 8 spaces?). Stop."
)
<<
OutputParserTester
::
STDOUT
<<
QString
()
<<
QString
()
<<
(
QList
<
Task
>
()
<<
Task
(
Task
::
Error
,
QString
::
fromLatin1
(
"missing separator (did you mean TAB instead of 8 spaces?). Stop."
),
QString
::
fromLatin1
(
"Makefile"
),
360
,
Constants
::
TASK_CATEGORY_BUILDSYSTEM
))
<<
QString
()
<<
QStringList
();
}
void
ProjectExplorerPlugin
::
testGnuMakeParserParsing
()
...
...
src/plugins/projectexplorer/gnumakeparser.h
View file @
9ccd2f15
...
...
@@ -57,12 +57,14 @@ private:
QRegExp
m_makeDir
;
QRegExp
m_makeLine
;
QRegExp
m_makefileError
;
QStringList
m_directories
;
#if defined WITH_TESTS
friend
class
ProjectExplorerPlugin
;
#endif
bool
m_alreadyFatal
;
};
}
// namespace ProjectExplorer
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment