@@ -148,11 +148,11 @@ static std::string readfile(const char code[], std::size_t size, simplecpp::Outp
148148 return makeTokenList (code,size,files,std::string (),outputList).stringify ();
149149}
150150
151- static std::string preprocess (const char code[], const simplecpp::DUI &dui, simplecpp::OutputList *outputList)
151+ static std::string preprocess (const char code[], const simplecpp::DUI &dui, simplecpp::OutputList *outputList, const std::string &file = std::string() )
152152{
153153 std::vector<std::string> files;
154154 std::map<std::string, simplecpp::TokenList*> filedata;
155- simplecpp::TokenList tokens = makeTokenList (code,files);
155+ simplecpp::TokenList tokens = makeTokenList (code,files,file );
156156 tokens.removeComments ();
157157 simplecpp::TokenList tokens2 (files);
158158 simplecpp::preprocess (tokens2, tokens, files, filedata, dui, outputList);
@@ -164,6 +164,11 @@ static std::string preprocess(const char code[])
164164 return preprocess (code, simplecpp::DUI (), nullptr );
165165}
166166
167+ static std::string preprocess (const char code[], const std::string &file)
168+ {
169+ return preprocess (code, simplecpp::DUI (), nullptr , file);
170+ }
171+
167172static std::string preprocess (const char code[], const simplecpp::DUI &dui)
168173{
169174 return preprocess (code, dui, nullptr );
@@ -230,7 +235,7 @@ static void backslash()
230235
231236static void builtin ()
232237{
233- ASSERT_EQUALS (" \"\" 1 0" , preprocess (" __FILE__ __LINE__ __COUNTER__" ));
238+ ASSERT_EQUALS (" \" test.c \" 1 0" , preprocess (" __FILE__ __LINE__ __COUNTER__" , " test.c " ));
234239 ASSERT_EQUALS (" \n\n 3" , preprocess (" \n\n __LINE__" ));
235240 ASSERT_EQUALS (" \n\n 0" , preprocess (" \n\n __COUNTER__" ));
236241 ASSERT_EQUALS (" \n\n 0 1" , preprocess (" \n\n __COUNTER__ __COUNTER__" ));
0 commit comments