Skip to content

[Bug]: GTEST_FATAL_FAILURE_ and GTEST_SKIP_ return void expression #4625

Open
@hurzelchen

Description

@hurzelchen

Describe the issue

The internal macros GTEST_FATAL_FAILURE_ and GTEST_SKIP_ return the void expression GTEST_MESSAGE_.

I would expect them to call GTEST_MESSAGE_ and then return.

Steps to reproduce the problem

Run clazy static code analyzer on simple TestCase that uses one of the ASSERT_ macros.

It will e.g. report

main.cpp:39:5: warning: Returning a void expression [-Wclazy-returning-void-expression]
    ASSERT_TRUE(true);
    ^
/usr/src/googletest/googletest/include/gtest/gtest.h:1990:32: note: expanded from macro 'ASSERT_TRUE'
#define ASSERT_TRUE(condition) GTEST_ASSERT_TRUE(condition)
                               ^
/usr/src/googletest/googletest/include/gtest/gtest.h:1973:23: note: expanded from macro 'GTEST_ASSERT_TRUE'
                      GTEST_FATAL_FAILURE_)

What version of GoogleTest are you using?

1.11.0

What operating system and version are you using?

Ubuntu 22.04.5

What compiler and version are you using?

clang 14.0 with clazy 1.11 plugin

What build system are you using?

cmake 3.24.4

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions