eranpeer / FakeIt

C++ mocking made easy. A simple yet very expressive, headers only library for c++ mocking.
MIT License
1.22k stars 169 forks source link

Catch2 warning suppression macros changed 10/27/2019 #197

Closed codusnocturnus closed 3 years ago

codusnocturnus commented 4 years ago

Catch2 changed their approach to warning suppression macros such that the "UNSUPPRESS" macros are no longer defined, which breaks compilation for single_header/catch/fakeit.hpp at line 1225.

Read the commit message here for details: https://github.com/catchorg/Catch2/commit/849f2848bdf625a7b6248e4e62ba0e39ee609634#diff-a010dcdfe8ba1736a2dc3acde52c3e89

Compilation succeeds if I change CatchAdapter::Fail() to:

void fail(
        std::string vetificationType,
        Catch::SourceLineInfo sourceLineInfo,
        std::string failingExpression,
        std::string fomattedMessage,
        Catch::ResultWas::OfType resultWas = Catch::ResultWas::OfType::ExpressionFailed ){
    Catch::AssertionHandler catchAssertionHandler( vetificationType, sourceLineInfo, failingExpression, Catch::ResultDisposition::Normal );
    INTERNAL_CATCH_TRY { \
        CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \         // added line
        CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \
        catchAssertionHandler.handleMessage(resultWas, fomattedMessage); \
        CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \         // changed line
    } INTERNAL_CATCH_CATCH(catchAssertionHandler) { \
        INTERNAL_CATCH_REACT(catchAssertionHandler) \
    }
}
codusnocturnus commented 4 years ago

Covered by PR #195

shrgabor commented 4 years ago

Dear @eranpeer Can you please have a look on one of these PR's? #201 and #195 . They are trying to solve the same problem. And they are opened for quite a long time. I think it would worth a new release. Anyhow, thank you for your fantastic framework. I really love it.

pgorgon-hem commented 4 years ago

I fixed PR #195, please merge it, there are some people who need it.

Robbie-Palmer commented 4 years ago

I'm using Catch v2.12.1 and received the error error: ‘CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS’ was not declared in this scope on compilation The referenced changes fixed it for me

sdaly2107 commented 3 years ago

Are there any plans to release this fix?

pharapeti commented 3 years ago

I'm using Catch v2.12.1 and received the error error: ‘CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS’ was not declared in this scope on compilation The referenced changes fixed it for me

Same here

zfields commented 3 years ago

I'm on Catch v2.13.4 and I can confirm this is still an issue. Just chiming in to increase visibility.

I hand ported #201 and it fixes the issue. FWIW, it looks like a quick and easy PR to fix the issue. It's a 6 line change that will help a lot of people use FakeIt. Cheers!

FranckRJ commented 3 years ago

Fixed in 2.0.6.