@@ -3274,6 +3274,9 @@ void simplecpp::preprocess(simplecpp::TokenList &output, const simplecpp::TokenL
32743274 sizeOfType.insert (std::make_pair (" double *" , sizeof (double *)));
32753275 sizeOfType.insert (std::make_pair (" long double *" , sizeof (long double *)));
32763276
3277+ // use a dummy vector for the macros because as this is not part of the file and would add an empty entry - e.g. /usr/include/poll.h
3278+ std::vector<std::string> dummy;
3279+
32773280 const bool hasInclude = (dui.std .size () == 5 && dui.std .compare (0 ,3 ," c++" ) == 0 && dui.std >= " c++17" );
32783281 MacroMap macros;
32793282 for (std::list<std::string>::const_iterator it = dui.defines .begin (); it != dui.defines .end (); ++it) {
@@ -3285,26 +3288,26 @@ void simplecpp::preprocess(simplecpp::TokenList &output, const simplecpp::TokenL
32853288 continue ;
32863289 const std::string lhs (macrostr.substr (0 ,eq));
32873290 const std::string rhs (eq==std::string::npos ? std::string (" 1" ) : macrostr.substr (eq+1 ));
3288- const Macro macro (lhs, rhs, files );
3291+ const Macro macro (lhs, rhs, dummy );
32893292 macros.insert (std::pair<TokenString,Macro>(macro.name (), macro));
32903293 }
32913294
3292- macros.insert (std::make_pair (" __FILE__" , Macro (" __FILE__" , " __FILE__" , files )));
3293- macros.insert (std::make_pair (" __LINE__" , Macro (" __LINE__" , " __LINE__" , files )));
3294- macros.insert (std::make_pair (" __COUNTER__" , Macro (" __COUNTER__" , " __COUNTER__" , files )));
3295+ macros.insert (std::make_pair (" __FILE__" , Macro (" __FILE__" , " __FILE__" , dummy )));
3296+ macros.insert (std::make_pair (" __LINE__" , Macro (" __LINE__" , " __LINE__" , dummy )));
3297+ macros.insert (std::make_pair (" __COUNTER__" , Macro (" __COUNTER__" , " __COUNTER__" , dummy )));
32953298 struct tm ltime = {};
32963299 getLocaltime (ltime);
3297- macros.insert (std::make_pair (" __DATE__" , Macro (" __DATE__" , getDateDefine (<ime), files )));
3298- macros.insert (std::make_pair (" __TIME__" , Macro (" __TIME__" , getTimeDefine (<ime), files )));
3300+ macros.insert (std::make_pair (" __DATE__" , Macro (" __DATE__" , getDateDefine (<ime), dummy )));
3301+ macros.insert (std::make_pair (" __TIME__" , Macro (" __TIME__" , getTimeDefine (<ime), dummy )));
32993302
33003303 if (!dui.std .empty ()) {
33013304 std::string std_def = simplecpp::getCStdString (dui.std );
33023305 if (!std_def.empty ()) {
3303- macros.insert (std::make_pair (" __STDC_VERSION__" , Macro (" __STDC_VERSION__" , std_def, files )));
3306+ macros.insert (std::make_pair (" __STDC_VERSION__" , Macro (" __STDC_VERSION__" , std_def, dummy )));
33043307 } else {
33053308 std_def = simplecpp::getCppStdString (dui.std );
33063309 if (!std_def.empty ())
3307- macros.insert (std::make_pair (" __cplusplus" , Macro (" __cplusplus" , std_def, files )));
3310+ macros.insert (std::make_pair (" __cplusplus" , Macro (" __cplusplus" , std_def, dummy )));
33083311 }
33093312 }
33103313
0 commit comments