-
Notifications
You must be signed in to change notification settings - Fork 4
Restrictions and WIP Items
Min-Yih Hsu edited this page Jun 10, 2020
·
2 revisions
- Every braces inside a nacro rule must be paired. That is, you can not write something like:
#pragma nacro rule incorrect
(a:$expr) -> {
case a: puts("haha"); break;
default: return;
} // ERROR: dangling right brace!
}
- We don't know how does it interact with Module Macro in Clang / modern C++.
- Source location infos are totally mess up in some of the nacro features and it's nearly impossible to fix without changing Clang's code base. Which will make diagnostic messages (i.e. error, warning messages) impossible to read.
- Add an option that allows users to opt-out enclosing braces for
$block
generated type. Currently if the generated type is$block
, a pair of braces will always be inserted around:
#pragma nacro rule foo
(a:$expr) -> $block {
std::vector<int> v;
v.push_back(a);
}
void user(int value) {
foo(94)
// foo will be expanded to:
// {
// std::vector<int> v;
// v.push_back(94);
// }
v.push_back(87); // ERROR: 'v' was not declared in this scope!
}
If user has an option to opt-out the surrounded braces:
#pragma nacro rule foo no-new-scope
(a:$expr) -> $block {
std::vector<int> v;
v.push_back(a);
}
void user(int value) {
foo(94)
// foo will be expanded to:
// std::vector<int> v;
// v.push_back(94);
v.push_back(87); // CORRECT!
}