Consistently handle negative shifted macro args (#2014)

Negative macro arguments count from the end, i.e. `\<-1>`
is equivalent to `\<_NARG>`, even after `shift`ing them.

Negative arguments cannot be used to access shifted values.
This commit is contained in:
Rangi
2026-07-07 02:19:37 -04:00
committed by GitHub
parent f82b0838a1
commit 21682e8814
5 changed files with 72 additions and 10 deletions
+1 -1
View File
@@ -13,7 +13,7 @@ struct MacroArgs {
std::vector<std::shared_ptr<std::string>> args;
uint32_t nbArgs() const { return args.size() - shift; }
std::shared_ptr<std::string> getArg(int32_t i) const;
std::shared_ptr<std::string> getArg(int32_t num) const;
std::shared_ptr<std::string> getAllArgs() const;
void appendArg(std::shared_ptr<std::string> arg);