Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix parentheses removal for
XLS_ASSIGN_OR_RETURN()
macro.
`XLS_ASSIGN_OR_RETURN((std::tuple<int, int> some_tuple), SomeFunction())` needs the wrappinng parentheses around `some_tuple` because it contains a comma, which would otherwise be interpreted as multiple macro arguments. Internally, the macro checks if the first argument is wrapped in parentheses and removes them if present. Unfortunately, the macro that checks for wrapping parentheses fails to correctly identify parentheses under gcc, which then results in compilation failures because a declaration is wrapped in parentheses, e.g. `(std::tuple<int, int> a_tuple) = some_value`. This change switches to using `__VA_OPT__(,)` instead of relying on token-pasting behavior, which evidently does not match between gcc and clang. This change also re-enables tests on gcc now that they pass. Tested against gcc Debian 12.2.0-10. PiperOrigin-RevId: 600930055
- Loading branch information