Skip to content

Commit

Permalink
Fix C++ compiler warning (#989)
Browse files Browse the repository at this point in the history
Remove parentheses around `(name)` because gcc8-c++ complains that they're unnecessary.

Unfortunately, after removal clang-tidy complains that we're not putting parentheses around a macro argument. I choose to silence clang-tidy because it's easier to silence an optional tool than figure out how to silence a whole family of compilers.
  • Loading branch information
graebm authored Mar 8, 2023
1 parent 983abad commit 35a8c65
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion include/aws/common/string.h
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,10 @@ int aws_array_list_comparator_string(const void *a, const void *b);
const size_t len; \
const uint8_t bytes[sizeof(literal)]; \
} name##_s = {NULL, sizeof(literal) - 1, literal}; \
static const struct aws_string *(name) = (struct aws_string *)(&name##_s)
static const struct aws_string *name = (struct aws_string *)(&name##_s) /* NOLINT(bugprone-macro-parentheses) */

/* NOLINT above is because clang-tidy complains that (name) isn't in parentheses,
* but gcc8-c++ complains that the parentheses are unnecessary */

/*
* A related macro that declares the string pointer without static, allowing it to be externed as a global constant
Expand Down

0 comments on commit 35a8c65

Please sign in to comment.