@@ -3268,6 +3268,9 @@ void simplecpp::preprocess(simplecpp::TokenList &output, const simplecpp::TokenL
3268
3268
sizeOfType.insert (std::make_pair (" double *" , sizeof (double *)));
3269
3269
sizeOfType.insert (std::make_pair (" long double *" , sizeof (long double *)));
3270
3270
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
+
3271
3274
const bool hasInclude = (dui.std .size () == 5 && dui.std .compare (0 ,3 ," c++" ) == 0 && dui.std >= " c++17" );
3272
3275
MacroMap macros;
3273
3276
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
3279
3282
continue ;
3280
3283
const std::string lhs (macrostr.substr (0 ,eq));
3281
3284
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 );
3283
3286
macros.insert (std::pair<TokenString,Macro>(macro.name (), macro));
3284
3287
}
3285
3288
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 )));
3289
3292
struct tm ltime = {};
3290
3293
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 )));
3293
3296
3294
3297
if (!dui.std .empty ()) {
3295
3298
std::string std_def = simplecpp::getCStdString (dui.std );
3296
3299
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 )));
3298
3301
} else {
3299
3302
std_def = simplecpp::getCppStdString (dui.std );
3300
3303
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 )));
3302
3305
}
3303
3306
}
3304
3307
0 commit comments