Skip to content

Commit 455abf7

Browse files
committed
Handling of #pragma once
After review
1 parent e11dbdb commit 455abf7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/pre.l

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ struct preYY_state
306306
DefineMap localDefines; // macros defined in this file
307307
DefineList macroDefinitions;
308308
LinkedMap<PreIncludeInfo> includeRelations;
309-
StringVector pragmaList;
309+
StringUnorderedSet pragmaSet;
310310

311311
int lastContext = 0;
312312
bool lexRulesPart = false;
@@ -1065,14 +1065,14 @@ WSopt [ \t\r]*
10651065
}
10661066
<Command>"pragma"{B}+"once" {
10671067
yyextra->expectGuard = FALSE;
1068-
if (std::find(yyextra->pragmaList.begin(), yyextra->pragmaList.end(), yyextra->fileName.data()) != yyextra->pragmaList.end())
1068+
if (yyextra->pragmaSet.find(yyextra->fileName.str())!=yyextra->pragmaSet.end())
10691069
{
10701070
outputChar(yyscanner,'\n');
10711071
BEGIN(PragmaOnce);
10721072
}
10731073
else
10741074
{
1075-
yyextra->pragmaList.push_back(yyextra->fileName.data());
1075+
yyextra->pragmaSet.insert(yyextra->fileName.data());
10761076
}
10771077
}
10781078
<PragmaOnce>. {}
@@ -4032,7 +4032,7 @@ void Preprocessor::processFile(const QCString &fileName,const std::string &input
40324032
state->includeStack.clear();
40334033
state->expandedDict.clear();
40344034
state->contextDefines.clear();
4035-
state->pragmaList.clear();
4035+
state->pragmaSet.clear();
40364036
while (!state->condStack.empty()) state->condStack.pop();
40374037

40384038
setFileName(yyscanner,fileName);

0 commit comments

Comments
 (0)