Skip to content

Commit 1cf2665

Browse files
committed
issue #8838 export "something" { } wrong parsing
According to the C++ standard "C" and "C++" have to be supported and other linkage types: "Use of a string-literal other than "C" or "C++" is conditionally-supported, with implementation-defined semantics."
1 parent 5a75d92 commit 1cf2665

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/pre.l

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ WSopt [ \t\r]*
474474
BEGIN(CopyLine);
475475
}
476476
}
477-
<CopyLine,LexCopyLine>"extern"{BN}{0,80}"\"C\""*{BN}{0,80}"{" {
477+
<CopyLine,LexCopyLine>"extern"{BN}*"\""[^\"]+"\""{BN}*("{")? {
478478
QCString text=yytext;
479479
yyextra->yyLineNr+=text.contains('\n');
480480
outputArray(yyscanner,yytext,yyleng);

src/scanner.l

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ struct scannerYY_state
189189
bool odlProp = false;
190190

191191
bool lexInit = false;
192-
bool externC = false;
192+
bool externLinkage = false;
193193

194194
QCString delimiter;
195195

@@ -2347,7 +2347,7 @@ NONLopt [^\n]*
23472347
}
23482348
else
23492349
{
2350-
yyextra->externC=FALSE; // see bug759247
2350+
yyextra->externLinkage=FALSE; // see bug759247
23512351
BEGIN(FindMembers);
23522352
}
23532353
}
@@ -3471,7 +3471,7 @@ NONLopt [^\n]*
34713471
{
34723472
yyextra->current->args += yytext ;
34733473
yyextra->squareCount=1;
3474-
yyextra->externC=FALSE; // see bug759247
3474+
yyextra->externLinkage=FALSE; // see bug759247
34753475
BEGIN( Array ) ;
34763476
}
34773477
}
@@ -6325,14 +6325,14 @@ NONLopt [^\n]*
63256325
startCommentBlock(yyscanner,yyextra->current->brief.isEmpty());
63266326
BEGIN( DocLine );
63276327
}
6328-
<FindMembers>"extern"{BN}*"\"C"("++")?"\""{BN}*("{")? {
6328+
<FindMembers>"extern"{BN}*"\""[^\"]+"\""{BN}*("{")? {
63296329
lineCount(yyscanner);
6330-
yyextra->externC=TRUE;
6330+
yyextra->externLinkage=TRUE;
63316331
}
63326332
<FindMembers>"{" {
6333-
if (yyextra->externC)
6333+
if (yyextra->externLinkage)
63346334
{
6335-
yyextra->externC=FALSE;
6335+
yyextra->externLinkage=FALSE;
63366336
}
63376337
else if (yyextra->insideCS &&
63386338
!yyextra->current->name.isEmpty() &&

0 commit comments

Comments
 (0)