Skip to content
Snippets Groups Projects
Verified Commit 86b66863 authored by Houtan Bastani's avatar Houtan Bastani
Browse files

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)

(cherry picked from commit f00d7c4b)
parent 1d31e00b
No related branches found
No related tags found
No related merge requests found
...@@ -35,8 +35,12 @@ Driver::parse(const string &file_arg, const string &basename_arg, istream &modfi ...@@ -35,8 +35,12 @@ Driver::parse(const string &file_arg, const string &basename_arg, istream &modfi
for (const auto & [var, val] : defines) for (const auto & [var, val] : defines)
try try
{ {
stoi(val); string::size_type pos;
stod(val, &pos);
if (pos == val.size())
command_line_defines_with_endl << "@#define " << var << " = " << val << endl; 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 &) catch (const invalid_argument &)
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment