Draft: clang-tidy: Add check cppcoreguidelines-macro-usage
Add and apply clang-tidy check cppcoreguidelines-macro-usage.
This check enforces the rule of declaring constants and macros with the constexpr specifier instead of #define, allowing better type safety.
NOTE: The first commits of this MR are, or will be, cherry-picked to different MRs. They serve as pre-requisites and contain more significant changes that need to be analyzed separately.
TO DO
-
Check whether all clang-tidy guards are still necessary. Ideally, there should be as few guards as possible. -
Merge dependent MRs.
Future Work Ideas
Future work might include addressing the following topics:
- Convert logging macros to variadic templates [see ES.34 and this snippet example].
- Use the std::source_location C++20 library to replace
NS_LOG()macros with template functions. - Use
#ifdef,if constexprorstd::enable_ifto merge enabled and disabled logging into one unified function, instead of two files.
- Use the std::source_location C++20 library to replace
Edited by Eduardo Almeida