Description

We had some code using the CA_VALID_POINTER and CA_CHECK_RETVAL annotations which had been working fine up until the 5.3 engine release. In 5.3, we started getting the following compile errors in a /analyze (-staticanalyzer=VisualCpp) build:

 

error C2337: 'Pre': attribute not found

error C2337: 'Post': attribute not found

 

I'm assuming that CA_READ_ONLY and CA_WRITE_ONLY would have similar issues, but we aren't using those just yet. I've made our own defines to replace these for now:

 

#define CA_SK_VALID_POINTER In

#define CA_SK_CHECK_RETVAL Must_inspect_result

 

though I'm not 100% certain those are equivalent to the previous annotations. At any rate, from the documentation I was able to find, it looks like the [Pre] and [Post] stuff has been deprecated by Microsoft, so I'm assuming those existing SAL defines need to be changed.

Steps to Reproduce
  • Use CA_VALID_POINTER or CA_CHECK_RETVAL in game code
  • Compile UnrealGame Win64 Development -StaticAnalyzer=Default 
  • Notice errors

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-197962 in the post.

0
Login to Vote

Unresolved
ComponentUE - Foundation - Core
Affects Versions5.3
Target Fix5.6
CreatedOct 13, 2023
UpdatedOct 18, 2024
View Jira Issue