View Issue Details

IDProjectCategoryView StatusLast Update
0001953NoesisGUIC++ SDKpublic2021-03-29 18:33
ReporterstevehAssigned Tojsantos 
PrioritynormalSeveritytrivialReproducibilityalways
Status assignedResolutionopen 
Product Version3.0.9 
Target Version3.0.12Fixed in Version 
Summary0001953: Compile error in Error.h when running static analysis
DescriptionHi guys, just a simple typo caused by some compiler options when running static analysis:

#ifndef NS_CHECK
    #ifdef _PREFAST_
        #define NS_CHECK(expr, ...) __analysis_assume(!!(expr)
    #elif defined(__clang_analyzer__)
        #include <assert.h>
        #define NS_CHECK(expr, ...) assert(expr)
    #elif defined(NS_PROFILE)
        #define NS_CHECK(expr, ...) \
            NS_MACRO_BEGIN \
                if (NS_UNLIKELY(!(expr))) \
                { \
                    Noesis::InvokeErrorHandler(__FILE__, __LINE__, false, __VA_ARGS__); \
                } \
            NS_MACRO_END
    #else
        #define NS_CHECK(...) NS_UNUSED(__VA_ARGS__)
    #endif
#endif




Specifically this bit here:

#define NS_CHECK(expr, ...) __analysis_assume(!!(expr)

It's missing a closing parenthesis. This will only cause an error if _PREFAST_ is defined which is only defined during static analysis. Adding the missing closing parenthesis fixed the compile error.
Steps To Reproduce1. Run static analysis
2. You should get a compile error here about unexpected EOF

inline BaseRefCounted::~BaseRefCounted()
{
    // Note that 1 is valid when the object lives is the stack or is being manually destroyed
    NS_CHECK(mRefCount == 1 || mRefCount == 0, "Unexpected RefCount(%d) deleting object at %p",
        (int32_t)mRefCount, this);
}

Cheers,

-Steven
TagsNo tags attached.
PlatformAny

Activities

jsantos

jsantos

2021-03-29 18:33

manager   ~0007114

Thanks for reporting this Steve.

Issue History

Date Modified Username Field Change
2021-03-26 19:33 steveh New Issue
2021-03-29 10:56 sfernandez Assigned To => jsantos
2021-03-29 10:56 sfernandez Status new => assigned
2021-03-29 10:56 sfernandez Target Version => 3.0.12
2021-03-29 18:33 jsantos Note Added: 0007114