Skip to content

Commit d4f1c1f

Browse files
committed
Fix clang-tidy issues
1 parent e5ecbd4 commit d4f1c1f

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

simplecpp.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -668,8 +668,8 @@ void simplecpp::TokenList::readfile(Stream &stream, const std::string &filename,
668668

669669
unsigned long maxline;
670670
{
671-
cstd_t cstd = getCStd(dui.std);
672-
cppstd_t cppstd = getCppStd(dui.std);
671+
const cstd_t cstd = getCStd(dui.std);
672+
const cppstd_t cppstd = getCppStd(dui.std);
673673
if ((cstd != CUnknown && cstd < C99) || (cppstd != CPPUnknown && cppstd < CPP11))
674674
maxline = 32767;
675675
else
@@ -740,10 +740,12 @@ void simplecpp::TokenList::readfile(Stream &stream, const std::string &filename,
740740
if (!ppTok || !ppTok->number)
741741
continue;
742742

743-
unsigned long line = 0;
743+
unsigned long line;
744744
try {
745745
line = std::stoul(ppTok->str());
746-
} catch (...) {}
746+
} catch (...) {
747+
line = 0;
748+
}
747749

748750
if (line == 0 || line > maxline) {
749751
if (outputList) {

test.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2859,8 +2859,6 @@ static void nullDirective3()
28592859

28602860
static void lineDirective()
28612861
{
2862-
std::vector<std::string> filenames;
2863-
28642862
for (const std::string std : {"c89", "c90", "c++03"}) {
28652863
simplecpp::DUI dui;
28662864
dui.std = std;

0 commit comments

Comments
 (0)