@@ -140,11 +140,11 @@ static std::string readfile(const char code[], std::size_t size, simplecpp::Outp
140
140
return makeTokenList (code,size,files,std::string (),outputList).stringify ();
141
141
}
142
142
143
- static std::string preprocess (const char code[], const simplecpp::DUI &dui, simplecpp::OutputList *outputList)
143
+ static std::string preprocess (const char code[], const simplecpp::DUI &dui, simplecpp::OutputList *outputList, const std::string &file = std::string() )
144
144
{
145
145
std::vector<std::string> files;
146
146
std::map<std::string, simplecpp::TokenList*> filedata;
147
- simplecpp::TokenList tokens = makeTokenList (code,files);
147
+ simplecpp::TokenList tokens = makeTokenList (code,files,file );
148
148
tokens.removeComments ();
149
149
simplecpp::TokenList tokens2 (files);
150
150
simplecpp::preprocess (tokens2, tokens, files, filedata, dui, outputList);
@@ -156,6 +156,11 @@ static std::string preprocess(const char code[])
156
156
return preprocess (code, simplecpp::DUI (), nullptr );
157
157
}
158
158
159
+ static std::string preprocess (const char code[], const std::string &file)
160
+ {
161
+ return preprocess (code, simplecpp::DUI (), nullptr , file);
162
+ }
163
+
159
164
static std::string preprocess (const char code[], const simplecpp::DUI &dui)
160
165
{
161
166
return preprocess (code, dui, nullptr );
@@ -222,7 +227,7 @@ static void backslash()
222
227
223
228
static void builtin ()
224
229
{
225
- ASSERT_EQUALS (" \"\" 1 0" , preprocess (" __FILE__ __LINE__ __COUNTER__" ));
230
+ ASSERT_EQUALS (" \" test.c \" 1 0" , preprocess (" __FILE__ __LINE__ __COUNTER__" , " test.c " ));
226
231
ASSERT_EQUALS (" \n\n 3" , preprocess (" \n\n __LINE__" ));
227
232
ASSERT_EQUALS (" \n\n 0" , preprocess (" \n\n __COUNTER__" ));
228
233
ASSERT_EQUALS (" \n\n 0 1" , preprocess (" \n\n __COUNTER__ __COUNTER__" ));
0 commit comments