Macro-processor: when a variable is defined without a value, set it to “true”

Previously it was set to 1.

Also do the same change for variable defined on the command-line, for
consistency.

Closes: #43
master
Sébastien Villemot 2022-06-16 16:44:01 +02:00
parent 2a68f5a3af
commit 41b1e89756
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
2 changed files with 2 additions and 5 deletions

View File

@ -290,7 +290,7 @@ main(int argc, char **argv)
equal_index != string::npos)
defines.emplace_back(s.substr(2, equal_index-2), s.substr(equal_index+1));
else
defines.emplace_back(s.substr(2), "1");
defines.emplace_back(s.substr(2), "true");
}
else if (s.substr(0, 2) == "-I")
{

View File

@ -135,10 +135,7 @@ directive_one_line : INCLUDE expr
| INCLUDEPATH expr
{ $$ = make_shared<IncludePath>($2, @$); }
| DEFINE symbol
{
auto tmp = make_shared<Real>("1", @$);
$$ = make_shared<Define>($2, tmp, @$);
}
{ $$ = make_shared<Define>($2, make_shared<Bool>(true, @$), @$); }
| DEFINE symbol EQUAL expr
{ $$ = make_shared<Define>($2, $4, @$); }
| DEFINE function EQUAL expr