Commit f00d7c4b authored by Houtan Bastani's avatar Houtan Bastani

macro processor: fix bug where command line arguments that began with an...

macro processor: fix bug where command line arguments that began with an integer were being treated as integers even if they weren't (e.g. dates)
parent e4bdc022
Pipeline #2899 passed with stages
in 2 minutes and 28 seconds
......@@ -35,8 +35,12 @@ Driver::parse(const string &file_arg, const string &basename_arg, istream &modfi
for (const auto & [var, val] : defines)
try
{
stoi(val);
command_line_defines_with_endl << "@#define " << var << " = " << val << endl;
string::size_type pos;
stod(val, &pos);
if (pos == val.size())
command_line_defines_with_endl << "@#define " << var << " = " << val << endl;
else
command_line_defines_with_endl << "@#define " << var << R"( = ")" << val << R"(")" << endl;
}
catch (const invalid_argument &)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment