View Issue Details

IDProjectCategoryView StatusLast Update
0001953NoesisGUIC++ SDKpublic2021-05-03 15:17
Reportersteveh Assigned Tojsantos  
PrioritynormalSeveritytrivial 
Status resolvedResolutionfixed 
Product Version3.0.9 
Target Version3.0.12Fixed in Version3.0.12 
Summary0001953: Compile error in Error.h when running static analysis
Description

Hi 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 Reproduce
  1. 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

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
2021-05-03 15:17 jsantos Status assigned => resolved
2021-05-03 15:17 jsantos Resolution open => fixed
2021-05-03 15:17 jsantos Fixed in Version => 3.0.12