@@ -3360,12 +3360,14 @@ void simplecpp::preprocess(simplecpp::TokenList &output, const simplecpp::TokenL
33603360 macros.insert (std::make_pair (" __TIME__" , Macro (" __TIME__" , getTimeDefine (<ime), dummy)));
33613361
33623362 if (!dui.std .empty ()) {
3363- std::string std_def = simplecpp::getCStdString (dui.std );
3364- if (!std_def.empty ()) {
3365- macros.insert (std::make_pair (" __STDC_VERSION__" , Macro (" __STDC_VERSION__" , std_def, dummy)));
3363+ const cstd_t c_std = simplecpp::getCStd (dui.std );
3364+ if (c_std != CUnknown) {
3365+ const std::string std_def = simplecpp::getCStdString (c_std);
3366+ if (!std_def.empty ())
3367+ macros.insert (std::make_pair (" __STDC_VERSION__" , Macro (" __STDC_VERSION__" , std_def, dummy)));
33663368 } else {
3367- std_def = simplecpp::getCppStdString (dui.std );
3368- if (std_def. empty () ) {
3369+ const cppstd_t cpp_std = simplecpp::getCppStd (dui.std );
3370+ if (cpp_std == CPPUnknown ) {
33693371 if (outputList) {
33703372 simplecpp::Output err (files);
33713373 err.type = Output::DUI_ERROR;
@@ -3375,7 +3377,9 @@ void simplecpp::preprocess(simplecpp::TokenList &output, const simplecpp::TokenL
33753377 output.clear ();
33763378 return ;
33773379 }
3378- macros.insert (std::make_pair (" __cplusplus" , Macro (" __cplusplus" , std_def, dummy)));
3380+ const std::string std_def = simplecpp::getCppStdString (cpp_std);
3381+ if (!std_def.empty ())
3382+ macros.insert (std::make_pair (" __cplusplus" , Macro (" __cplusplus" , std_def, dummy)));
33793383 }
33803384 }
33813385
0 commit comments