Skip to content

Commit ddf359b

Browse files
committed
fixed misc-const-correctness clang-tidy warnings
s fixed `misc-const-correctness` clang-tidy warnings
1 parent edbf78c commit ddf359b

3 files changed

Lines changed: 16 additions & 16 deletions

File tree

main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ static bool isDir(const std::string& path)
2424
return (file_stat.st_mode & S_IFMT) == S_IFDIR;
2525
}
2626

27-
int main(int argc, char **argv)
27+
int main(int argc, char *argv[])
2828
{
2929
bool error = false;
3030
const char *filename = nullptr;

simplecpp.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -150,12 +150,12 @@ static bool endsWith(const std::string &s, const std::string &e)
150150
return (s.size() >= e.size()) && std::equal(e.rbegin(), e.rend(), s.rbegin());
151151
}
152152

153-
static bool sameline(const simplecpp::Token *tok1, const simplecpp::Token *tok2)
153+
static bool sameline(const simplecpp::Token * const tok1, const simplecpp::Token * const tok2)
154154
{
155155
return tok1 && tok2 && tok1->location.sameline(tok2->location);
156156
}
157157

158-
static bool isAlternativeBinaryOp(const simplecpp::Token *tok, const std::string &alt)
158+
static bool isAlternativeBinaryOp(const simplecpp::Token * const tok, const std::string &alt)
159159
{
160160
return (tok->name &&
161161
tok->str() == alt &&
@@ -165,7 +165,7 @@ static bool isAlternativeBinaryOp(const simplecpp::Token *tok, const std::string
165165
(tok->next->number || tok->next->name || tok->next->op == '('));
166166
}
167167

168-
static bool isAlternativeUnaryOp(const simplecpp::Token *tok, const std::string &alt)
168+
static bool isAlternativeUnaryOp(const simplecpp::Token * const tok, const std::string &alt)
169169
{
170170
return ((tok->name && tok->str() == alt) &&
171171
(!tok->previous || tok->previous->op == '(') &&
@@ -998,7 +998,7 @@ void simplecpp::TokenList::constFold()
998998
}
999999
}
10001000

1001-
static bool isFloatSuffix(const simplecpp::Token *tok)
1001+
static bool isFloatSuffix(const simplecpp::Token * const tok)
10021002
{
10031003
if (!tok || tok->str().size() != 1U)
10041004
return false;
@@ -1009,7 +1009,7 @@ static bool isFloatSuffix(const simplecpp::Token *tok)
10091009
static const std::string AND("and");
10101010
static const std::string BITAND("bitand");
10111011
static const std::string BITOR("bitor");
1012-
static bool isAlternativeAndBitandBitor(const simplecpp::Token* tok)
1012+
static bool isAlternativeAndBitandBitor(const simplecpp::Token * const tok)
10131013
{
10141014
return isAlternativeBinaryOp(tok, AND) || isAlternativeBinaryOp(tok, BITAND) || isAlternativeBinaryOp(tok, BITOR);
10151015
}
@@ -3305,14 +3305,14 @@ static void getLocaltime(struct tm &ltime)
33053305
#endif
33063306
}
33073307

3308-
static std::string getDateDefine(const struct tm *timep)
3308+
static std::string getDateDefine(const struct tm * const timep)
33093309
{
33103310
char buf[] = "??? ?? ????";
33113311
strftime(buf, sizeof(buf), "%b %d %Y", timep);
33123312
return std::string("\"").append(buf).append("\"");
33133313
}
33143314

3315-
static std::string getTimeDefine(const struct tm *timep)
3315+
static std::string getTimeDefine(const struct tm * const timep)
33163316
{
33173317
char buf[] = "??:??:??";
33183318
strftime(buf, sizeof(buf), "%H:%M:%S", timep);

test.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ static void assertThrowFailed(int line)
6565
std::cerr << "exception not thrown" << std::endl;
6666
}
6767

68-
static void testcase(const std::string &name, void (*f)(), int argc, char * const *argv)
68+
static void testcase(const std::string &name, void (*const f)(), int argc, char *argv[])
6969
{
7070
if (argc == 1) {
7171
f();
@@ -80,30 +80,30 @@ static void testcase(const std::string &name, void (*f)(), int argc, char * cons
8080

8181
#define TEST_CASE(F) (testcase(#F, F, argc, argv))
8282

83-
static simplecpp::TokenList makeTokenList(const char code[], std::size_t size, std::vector<std::string> &filenames, const std::string &filename=std::string(), simplecpp::OutputList *outputList=nullptr)
83+
static simplecpp::TokenList makeTokenList(const char code[], std::size_t size, std::vector<std::string> &filenames, const std::string &filename=std::string(), simplecpp::OutputList * const outputList=nullptr)
8484
{
8585
std::istringstream istr(std::string(code, size));
8686
return {istr,filenames,filename,outputList};
8787
}
8888

89-
static simplecpp::TokenList makeTokenList(const char code[], std::vector<std::string> &filenames, const std::string &filename=std::string(), simplecpp::OutputList *outputList=nullptr)
89+
static simplecpp::TokenList makeTokenList(const char code[], std::vector<std::string> &filenames, const std::string &filename=std::string(), simplecpp::OutputList * const outputList=nullptr)
9090
{
9191
return makeTokenList(code, strlen(code), filenames, filename, outputList);
9292
}
9393

94-
static std::string readfile(const char code[], simplecpp::OutputList *outputList=nullptr)
94+
static std::string readfile(const char code[], simplecpp::OutputList * const outputList=nullptr)
9595
{
9696
std::vector<std::string> files;
9797
return makeTokenList(code,files,std::string(),outputList).stringify();
9898
}
9999

100-
static std::string readfile(const char code[], std::size_t size, simplecpp::OutputList *outputList=nullptr)
100+
static std::string readfile(const char code[], std::size_t size, simplecpp::OutputList * const outputList=nullptr)
101101
{
102102
std::vector<std::string> files;
103103
return makeTokenList(code,size,files,std::string(),outputList).stringify();
104104
}
105105

106-
static std::string preprocess(const char code[], const simplecpp::DUI &dui, simplecpp::OutputList *outputList, const std::string &file = std::string())
106+
static std::string preprocess(const char code[], const simplecpp::DUI &dui, simplecpp::OutputList * const outputList, const std::string &file = std::string())
107107
{
108108
std::vector<std::string> files;
109109
simplecpp::FileDataCache cache;
@@ -131,7 +131,7 @@ static std::string preprocess(const char code[], const simplecpp::DUI &dui)
131131
return preprocess(code, dui, nullptr);
132132
}
133133

134-
static std::string preprocess(const char code[], simplecpp::OutputList *outputList)
134+
static std::string preprocess(const char code[], simplecpp::OutputList * const outputList)
135135
{
136136
return preprocess(code, simplecpp::DUI(), outputList);
137137
}
@@ -3525,7 +3525,7 @@ static void leak()
35253525
}
35263526
}
35273527

3528-
int main(int argc, char **argv)
3528+
int main(int argc, char *argv[])
35293529
{
35303530
TEST_CASE(backslash);
35313531

0 commit comments

Comments
 (0)