Skip to content
GitLab
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
a797b1f9
Commit
a797b1f9
authored
Mar 03, 2010
by
Tobias Hunger
Browse files
Fix unit tests for gcc parser
parent
c2303b3c
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/plugins/projectexplorer/gccparser.cpp
View file @
a797b1f9
...
...
@@ -33,42 +33,56 @@
using
namespace
ProjectExplorer
;
namespace
{
const
char
*
const
FILE_PATTERN
(
"^(([a-zA-Z]:)?[^:]*
\\
.[^:]+):"
);
}
GccParser
::
GccParser
()
{
m_regExp
.
setPattern
(
"^([^
\\
(
\\
)]+[^
\\
d]):(
\\
d+):(
\\
d+:)*(
\\
s(warning|error):)?
\\
s(.+)$"
);
// e.g.
//
m_regExp
.
setPattern
(
QString
::
fromLatin1
(
FILE_PATTERN
)
+
"(
\\
d+):(
\\
d+:)*(
\\
s#?(warning|error):?)?
\\
s(.+)$"
);
m_regExp
.
setMinimal
(
true
);
m_regExpIncluded
.
setPattern
(
"^.*from
\\
s([^:]+):(
\\
d+)(,|:)$"
);
m_regExpIncluded
.
setMinimal
(
true
);
m_regExpLinker
.
setPattern
(
"^(
\\
S*)
\\
(
\\
S+
\\
):
\\
s(.+)$"
);
// e.g.:
// c:\Qt\4.6\lib/QtGuid4.dll: file not recognized: File format not recognized
m_regExpLinker
.
setPattern
(
QString
::
fromLatin1
(
FILE_PATTERN
)
+
"((
\\
d+|[^:]*):)?
\\
s(.+)$"
);
m_regExpLinker
.
setMinimal
(
true
);
}
void
GccParser
::
stdError
(
const
QString
&
line
)
{
QString
lne
=
line
.
trimmed
();
if
(
m_regExpLinker
.
indexIn
(
lne
)
>
-
1
)
{
QString
description
=
m_regExpLinker
.
cap
(
2
);
emit
addTask
(
TaskWindow
::
Task
(
TaskWindow
::
Error
,
description
,
m_regExpLinker
.
cap
(
1
)
/* filename */
,
-
1
/* linenumber */
,
Constants
::
TASK_CATEGORY_COMPILE
));
return
;
}
else
if
(
m_regExp
.
indexIn
(
lne
)
>
-
1
)
{
if
(
m_regExp
.
indexIn
(
lne
)
>
-
1
)
{
TaskWindow
::
Task
task
(
TaskWindow
::
Unknown
,
m_regExp
.
cap
(
6
)
/* description */
,
m_regExp
.
cap
(
7
)
/* description */
,
m_regExp
.
cap
(
1
)
/* filename */
,
m_regExp
.
cap
(
2
).
toInt
()
/* line number */
,
m_regExp
.
cap
(
3
).
toInt
()
/* line number */
,
Constants
::
TASK_CATEGORY_COMPILE
);
if
(
m_regExp
.
cap
(
5
)
==
"warning"
)
if
(
m_regExp
.
cap
(
5
)
==
QLatin1String
(
"warning"
)
)
task
.
type
=
TaskWindow
::
Warning
;
else
if
(
m_regExp
.
cap
(
5
)
==
"error"
)
else
if
(
m_regExp
.
cap
(
5
)
==
QLatin1String
(
"error"
))
task
.
type
=
TaskWindow
::
Error
;
else
if
(
task
.
description
.
startsWith
(
QLatin1String
(
"undefined reference to"
)))
task
.
type
=
TaskWindow
::
Error
;
emit
addTask
(
task
);
return
;
}
else
if
(
m_regExpLinker
.
indexIn
(
lne
)
>
-
1
)
{
bool
ok
;
int
lineno
=
m_regExpLinker
.
cap
(
4
).
toInt
(
&
ok
);
if
(
!
ok
)
lineno
=
-
1
;
QString
description
=
m_regExpLinker
.
cap
(
5
);
emit
addTask
(
TaskWindow
::
Task
(
TaskWindow
::
Error
,
description
,
m_regExpLinker
.
cap
(
1
)
/* filename */
,
lineno
,
Constants
::
TASK_CATEGORY_COMPILE
));
return
;
}
else
if
(
m_regExpIncluded
.
indexIn
(
lne
)
>
-
1
)
{
emit
addTask
(
TaskWindow
::
Task
(
TaskWindow
::
Unknown
,
lne
/* description */
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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