@@ -3268,6 +3268,9 @@ void simplecpp::preprocess(simplecpp::TokenList &output, const simplecpp::TokenL
32683268 sizeOfType.insert (std::make_pair (" double *" , sizeof (double *)));
32693269 sizeOfType.insert (std::make_pair (" long double *" , sizeof (long double *)));
32703270
3271+ // 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
3272+ std::vector<std::string> dummy;
3273+
32713274 const bool hasInclude = (dui.std .size () == 5 && dui.std .compare (0 ,3 ," c++" ) == 0 && dui.std >= " c++17" );
32723275 MacroMap macros;
32733276 for (std::list<std::string>::const_iterator it = dui.defines .begin (); it != dui.defines .end (); ++it) {
@@ -3279,26 +3282,26 @@ void simplecpp::preprocess(simplecpp::TokenList &output, const simplecpp::TokenL
32793282 continue ;
32803283 const std::string lhs (macrostr.substr (0 ,eq));
32813284 const std::string rhs (eq==std::string::npos ? std::string (" 1" ) : macrostr.substr (eq+1 ));
3282- const Macro macro (lhs, rhs, files );
3285+ const Macro macro (lhs, rhs, dummy );
32833286 macros.insert (std::pair<TokenString,Macro>(macro.name (), macro));
32843287 }
32853288
3286- macros.insert (std::make_pair (" __FILE__" , Macro (" __FILE__" , " __FILE__" , files )));
3287- macros.insert (std::make_pair (" __LINE__" , Macro (" __LINE__" , " __LINE__" , files )));
3288- macros.insert (std::make_pair (" __COUNTER__" , Macro (" __COUNTER__" , " __COUNTER__" , files )));
3289+ macros.insert (std::make_pair (" __FILE__" , Macro (" __FILE__" , " __FILE__" , dummy )));
3290+ macros.insert (std::make_pair (" __LINE__" , Macro (" __LINE__" , " __LINE__" , dummy )));
3291+ macros.insert (std::make_pair (" __COUNTER__" , Macro (" __COUNTER__" , " __COUNTER__" , dummy )));
32893292 struct tm ltime = {};
32903293 getLocaltime (ltime);
3291- macros.insert (std::make_pair (" __DATE__" , Macro (" __DATE__" , getDateDefine (<ime), files )));
3292- macros.insert (std::make_pair (" __TIME__" , Macro (" __TIME__" , getTimeDefine (<ime), files )));
3294+ macros.insert (std::make_pair (" __DATE__" , Macro (" __DATE__" , getDateDefine (<ime), dummy )));
3295+ macros.insert (std::make_pair (" __TIME__" , Macro (" __TIME__" , getTimeDefine (<ime), dummy )));
32933296
32943297 if (!dui.std .empty ()) {
32953298 std::string std_def = simplecpp::getCStdString (dui.std );
32963299 if (!std_def.empty ()) {
3297- macros.insert (std::make_pair (" __STDC_VERSION__" , Macro (" __STDC_VERSION__" , std_def, files )));
3300+ macros.insert (std::make_pair (" __STDC_VERSION__" , Macro (" __STDC_VERSION__" , std_def, dummy )));
32983301 } else {
32993302 std_def = simplecpp::getCppStdString (dui.std );
33003303 if (!std_def.empty ())
3301- macros.insert (std::make_pair (" __cplusplus" , Macro (" __cplusplus" , std_def, files )));
3304+ macros.insert (std::make_pair (" __cplusplus" , Macro (" __cplusplus" , std_def, dummy )));
33023305 }
33033306 }
33043307
0 commit comments