Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove NOLINT pragmas from ErrorCode macro. #629

Open
davidlion opened this issue Dec 9, 2024 · 0 comments
Open

Remove NOLINT pragmas from ErrorCode macro. #629

davidlion opened this issue Dec 9, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@davidlion
Copy link
Member

Request

In error_handling/ErrorCode.hpp there is the following macro that we use NOLINT to avoid clang-tidy issues.

// NOLINTBEGIN(bugprone-macro-parentheses, cppcoreguidelines-macro-usage)
#define CLP_ERROR_HANDLING_MARK_AS_ERROR_CODE_ENUM(T) \
    template <> \
    struct std::is_error_code_enum<clp::error_handling::ErrorCode<T>> : std::true_type { \
        static_assert(std::is_enum_v<T>); \
    };
// NOLINTEND(bugprone-macro-parentheses, cppcoreguidelines-macro-usage)

After skimming the clang-tidy documentation for the two issues [1, 2] it seems possible to satisfy these checks, but more investigation is needed.

refs:

  1. https://clang.llvm.org/extra/clang-tidy/checks/bugprone/macro-parentheses.html
  2. https://clang.llvm.org/extra/clang-tidy/checks/cppcoreguidelines/macro-usage.html

Possible implementation

For cppcoreguidelines-macro-usage:

  1. Investigate whether there is another construct to use
  2. Use the AllowedRegexp option to allow the macro

For bugprone-macro-parentheses:

  1. Add parentheses as necessary to satisfy
@davidlion davidlion added the enhancement New feature or request label Dec 9, 2024
@davidlion davidlion self-assigned this Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant