@@ -135,11 +135,11 @@ static std::string readfile(const char code[], std::size_t size, simplecpp::Outp
135135 return makeTokenList (code,size,files,std::string (),outputList).stringify ();
136136}
137137
138- static std::string preprocess (const char code[], const simplecpp::DUI &dui, simplecpp::OutputList *outputList)
138+ static std::string preprocess (const char code[], const simplecpp::DUI &dui, simplecpp::OutputList *outputList, const std::string &file = std::string() )
139139{
140140 std::vector<std::string> files;
141141 std::map<std::string, simplecpp::TokenList*> filedata;
142- simplecpp::TokenList tokens = makeTokenList (code,files);
142+ simplecpp::TokenList tokens = makeTokenList (code,files,file );
143143 tokens.removeComments ();
144144 simplecpp::TokenList tokens2 (files);
145145 simplecpp::preprocess (tokens2, tokens, files, filedata, dui, outputList);
@@ -151,6 +151,11 @@ static std::string preprocess(const char code[])
151151 return preprocess (code, simplecpp::DUI (), nullptr );
152152}
153153
154+ static std::string preprocess (const char code[], const std::string &file)
155+ {
156+ return preprocess (code, simplecpp::DUI (), nullptr , file);
157+ }
158+
154159static std::string preprocess (const char code[], const simplecpp::DUI &dui)
155160{
156161 return preprocess (code, dui, nullptr );
@@ -221,7 +226,7 @@ static void backslash()
221226
222227static void builtin ()
223228{
224- ASSERT_EQUALS (" \"\" 1 0" , preprocess (" __FILE__ __LINE__ __COUNTER__" ));
229+ ASSERT_EQUALS (" \" test.c \" 1 0" , preprocess (" __FILE__ __LINE__ __COUNTER__" , " test.c " ));
225230 ASSERT_EQUALS (" \n\n 3" , preprocess (" \n\n __LINE__" ));
226231 ASSERT_EQUALS (" \n\n 0" , preprocess (" \n\n __COUNTER__" ));
227232 ASSERT_EQUALS (" \n\n 0 1" , preprocess (" \n\n __COUNTER__ __COUNTER__" ));
0 commit comments