diff --git a/.clang-tidy b/.clang-tidy index c1710a2a1a..3c4757dfef 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -150,7 +150,6 @@ Checks: '*, -readability-convert-member-functions-to-static, -readability-make-member-function-const, -bugprone-implicit-widening-of-multiplication-result, - -bugprone-macro-parentheses, -bugprone-multi-level-implicit-pointer-conversion, -bugprone-signed-char-misuse, -cppcoreguidelines-avoid-non-const-global-variables, diff --git a/platforms/common/uORB/uORB_tests/uORBTest_UnitTest.cpp b/platforms/common/uORB/uORB_tests/uORBTest_UnitTest.cpp index d96fc0e983..1ad23b581d 100644 --- a/platforms/common/uORB/uORB_tests/uORBTest_UnitTest.cpp +++ b/platforms/common/uORB/uORB_tests/uORBTest_UnitTest.cpp @@ -645,7 +645,7 @@ int uORBTest::UnitTest::test_wrap_around() } #define CHECK_COPY(i_got, i_correct) \ orb_copy(ORB_ID(orb_test_medium_wrap_around), sfd, &u); \ - if (i_got != i_correct) { \ + if ((i_got) != (i_correct)) { \ return test_fail("got wrong element from the queue (got %i, should be %i)", i_got, i_correct); \ } @@ -875,7 +875,7 @@ int uORBTest::UnitTest::test_queue() } #define CHECK_COPY(i_got, i_correct) \ orb_copy(ORB_ID(orb_test_medium_queue), sfd, &u); \ - if (i_got != i_correct) { \ + if ((i_got) != (i_correct)) { \ return test_fail("got wrong element from the queue (got %i, should be %i)", i_got, i_correct); \ } diff --git a/src/drivers/camera_trigger/camera_trigger.cpp b/src/drivers/camera_trigger/camera_trigger.cpp index 2a1fbfc443..484fd2fe92 100644 --- a/src/drivers/camera_trigger/camera_trigger.cpp +++ b/src/drivers/camera_trigger/camera_trigger.cpp @@ -88,7 +88,7 @@ typedef enum : int32_t { TRIGGER_MODE_DISTANCE_ON_CMD } trigger_mode_t; -#define commandParamToInt(n) static_cast(n >= 0 ? n + 0.5f : n - 0.5f) +#define commandParamToInt(n) static_cast((n) >= 0 ? (n) + 0.5f : (n) - 0.5f) class CameraTrigger final : public px4::ScheduledWorkItem { diff --git a/src/lib/tinybson/tinybson.cpp b/src/lib/tinybson/tinybson.cpp index 131901ecc8..e62b2e7b87 100644 --- a/src/lib/tinybson/tinybson.cpp +++ b/src/lib/tinybson/tinybson.cpp @@ -51,8 +51,8 @@ # define debug(fmt, args...) do { } while(0) #endif -#define CODER_CHECK(_c) do { if (_c->dead) { PX4_ERR("coder dead"); return -1; }} while(0) -#define CODER_KILL(_c, _reason) do { PX4_ERR("killed: %s", _reason); _c->dead = true; return -1; } while(0) +#define CODER_CHECK(_c) do { if ((_c)->dead) { PX4_ERR("coder dead"); return -1; }} while(0) +#define CODER_KILL(_c, _reason) do { PX4_ERR("killed: %s", _reason); (_c)->dead = true; return -1; } while(0) static int read_x(bson_decoder_t decoder, void *p, size_t s) diff --git a/src/lib/tunes/tunes.cpp b/src/lib/tunes/tunes.cpp index 02a5b16055..1516a93f35 100644 --- a/src/lib/tunes/tunes.cpp +++ b/src/lib/tunes/tunes.cpp @@ -46,7 +46,7 @@ #include #define BEAT_TIME_CONVERSION_MS (60 * 1000 * 4) -#define BEAT_TIME_CONVERSION_US BEAT_TIME_CONVERSION_MS * 1000 +#define BEAT_TIME_CONVERSION_US (BEAT_TIME_CONVERSION_MS * 1000) #define BEAT_TIME_CONVERSION BEAT_TIME_CONVERSION_US // semitone offsets from C for the characters 'A'-'G'