foonathan / lexy

C++ parsing DSL
https://lexy.foonathan.net
Boost Software License 1.0
976 stars 61 forks source link

Does not compile with -Werror option, cause of some macro problem #206

Open NotZahar opened 1 month ago

NotZahar commented 1 month ago

gcc 13 gives the following:

../lexy/lexy/dsl/punctuator.hpp:15:26: error: unnecessary parentheses in declaration of ‘period’ [-Werror=parentheses]
   15 |     inline constexpr auto(Name) = _##Name {}
      |                          ^~~~~~
../lexy/lexy/dsl/punctuator.hpp:17:1: note: in expansion of macro ‘LEXY_PUNCT’
   17 | LEXY_PUNCT(period, ".");
      | ^~~~~~~~~~
../lexy/lexy/dsl/punctuator.hpp:15:26: note: remove parentheses
   15 |     inline constexpr auto(Name) = _##Name {}
      |                          ^~~~~~
../lexy/lexy/dsl/punctuator.hpp:17:1: note: in expansion of macro ‘LEXY_PUNCT’
   17 | LEXY_PUNCT(period, ".");
      | ^~~~~~~~~~
../lexy/lexy/dsl/punctuator.hpp:15:26: error: unnecessary parentheses in declaration of ‘comma’ [-Werror=parentheses]
   15 |     inline constexpr auto(Name) = _##Name {}
      |                          ^~~~~~
../lexy/lexy/dsl/punctuator.hpp:18:1: note: in expansion of macro ‘LEXY_PUNCT’
   18 | LEXY_PUNCT(comma, ",");
      | ^~~~~~~~~~
../lexy/lexy/dsl/punctuator.hpp:15:26: note: remove parentheses
   15 |     inline constexpr auto(Name) = _##Name {}
      |                          ^~~~~~
../lexy/lexy/dsl/punctuator.hpp:18:1: note: in expansion of macro ‘LEXY_PUNCT’
   18 | LEXY_PUNCT(comma, ",");
      | ^~~~~~~~~~
../lexy/lexy/dsl/punctuator.hpp:15:26: error: unnecessary parentheses in declaration of ‘colon’ [-Werror=parentheses]
   15 |     inline constexpr auto(Name) = _##Name {}
      |                          ^~~~~~
../lexy/lexy/dsl/punctuator.hpp:19:1: note: in expansion of macro ‘LEXY_PUNCT’
   19 | LEXY_PUNCT(colon, ":");
      | ^~~~~~~~~~
../lexy/lexy/dsl/punctuator.hpp:15:26: note: remove parentheses
   15 |     inline constexpr auto(Name) = _##Name {}
      |                          ^~~~~~
../lexy/lexy/dsl/punctuator.hpp:19:1: note: in expansion of macro ‘LEXY_PUNCT’
   19 | LEXY_PUNCT(colon, ":");
      | ^~~~~~~~~~
...

May be this line (from punctuator.hpp:15):

inline constexpr auto(Name) = _##Name {}

Should be replaced by:

inline constexpr auto Name = _##Name {}
foonathan commented 1 month ago

Hm, I think then I had a warning about macro arguments not being parenthesized :D Can you do a PR with the fix and see what the CI system says? Thanks.

NotZahar commented 4 weeks ago

https://github.com/foonathan/lexy/pull/207