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
Marco Bubke
flatpak-qt-creator
Commits
55d0e4f8
Commit
55d0e4f8
authored
Mar 03, 2009
by
Roberto Raggi
Browse files
Improved the way we expand function-like macros when we can't collect all the arguments.
parent
656d70fa
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/libs/cplusplus/pp-engine.cpp
View file @
55d0e4f8
...
...
@@ -810,9 +810,8 @@ void Preprocessor::preprocess(const QByteArray &fileName, const QByteArray &sour
++
_dot
;
}
if
(
_dot
->
isNot
(
T_RPAREN
))
{
// ### warning expected T_RPAREN
}
if
(
_dot
->
isNot
(
T_RPAREN
))
_result
->
append
(
spell
);
else
expandFunctionLikeMacro
(
identifierToken
,
m
);
...
...
tests/auto/cplusplus/preprocessor/tst_preprocessor.cpp
View file @
55d0e4f8
#include
<QtTest>
#include
<pp.h>
CPLUSPLUS_USE_NAMESPACE
using
namespace
CPlusPlus
;
class
tst_Preprocessor
:
public
QObject
{
...
...
@@ -9,21 +9,35 @@ Q_OBJECT
private
Q_SLOTS
:
void
pp_with_no_client
();
void
unfinished_function_like_macro_call
();
};
void
tst_Preprocessor
::
pp_with_no_client
()
{
using
namespace
CPlusPlus
;
Client
*
client
=
0
;
// no client.
Environment
env
;
Preprocessor
preprocess
(
client
,
&
env
);
QByteArray
preprocessed
=
preprocess
(
"<stdin>"
,
"#define foo(a,b) a + b
\n
foo(1, 2)
\n
"
);
"
\n
#define foo(a,b) a + b"
"
\n
foo(1, 2)
\n
"
);
QByteArray
expected
=
"1 + 2"
;
QCOMPARE
(
preprocessed
.
trimmed
(),
expected
);
}
void
tst_Preprocessor
::
unfinished_function_like_macro_call
()
{
Client
*
client
=
0
;
// no client.
Environment
env
;
Preprocessor
preprocess
(
client
,
&
env
);
QByteArray
preprocessed
=
preprocess
(
"<stdin>"
,
"
\n
#define foo(a,b) a + b"
"
\n
foo(1, 2
\n
"
);
QByteArray
expected
=
"foo"
;
QCOMPARE
(
preprocessed
.
trimmed
(),
expected
);
}
QTEST_APPLESS_MAIN
(
tst_Preprocessor
)
#include
"tst_preprocessor.moc"
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