serge-sans-paille / frozen

a header-only, constexpr alternative to gperf for C++14 users
Apache License 2.0
1.27k stars 103 forks source link

Fixing "'macro' is not defined" warning, when using clang-tidy #173

Closed Sackzement closed 1 month ago

Sackzement commented 1 month ago

Using clang-tidy with frozen, shows following warning:

/path/to/frozen-git/include/frozen/bits/defines.h:62:5: warning: '__cpp_lib_constexpr_string' is not defined, evaluates to 0 [clang-diagnostic-undef]
   62 | #if __cpp_lib_constexpr_string >= 201907L
      |     ^

This commit checks if the macro __cpp_lib_constexpr_string is defined before it compares the value. The same is done with the macro __cpp_deduction_guides.

Compilers: gcc 14.1.1 20240522 clang 17.0.6

serge-sans-paille commented 1 month ago

thanks!