Intellisense errors in Unreal C++ project: "Cannot resolve symbol '__builtin_expect'"

Hi, at some point while working in Unreal 5.3 I started to see red underlines on all `check()`, `checkf()`, `verify()`, etc. The problem seems to be that Rider isn't recognizing some compiler intrinsic.

The project still compiles fine, but it's very distracting when coding.

This is in Rider 2024.1.2

0
3 comments

Hello, 

Thank you for contacting Rider support. 
We are sorry to hear that you encountered such a problem. Regrettably, I was not able to reproduce the issue. 

Would you mind sharing additional information as described below? 

  • a full-screen screenshot that demonstrates the issue;
  • Did it start happening after updating to 2024.1.2 or earlier?
  • Is UE5.3 installed from launcher or built from sources?

Have a nice day!

0

As far as I remember it just started happening one day. I updated Rider to 2024.1.2 to see if it would go away, but it didn't.

I'm building UE5.3 from source, no changes to the source code.

0

Hello,


Thank you for the details shared.
I was able to reproduce this by adding PublicDefinitions.Add("__clang_analyzer__=1"); to the Project.Build.cs file.
There are my findings at the moment:

  • (__builtin_expect(!bool(false), 0) ? CA_AssumeNoReturn() : (void)0); is an expansion of the CA_ASSUME macro;
  • CA_ASSUME is defined as #define CA_ASSUME( Expr )  (__builtin_expect(!bool(Expr), 0) ? CA_AssumeNoReturn() : (void)0) in:
    • Source/Runtime/Core/Public/Clang/ClangPlatformCodeAnalysis.h under condition 
      #if defined( __clang_analyzer__ )
          #define USING_CODE_ANALYSIS 1
      #if USING_CODE_ANALYSIS;
    • Source/Runtime/Core/Public/Windows/WindowsPlatformCodeAnalysis.h under condition 
      #else // defined(__clang_analyzer__)
  • __builtin_expect is non-standard. It's a GCC extension, so it's not guaranteed to be available on all compilers.
  • As I can judge, it is not a part of MSVC;
  • Which means:
    • you either have __clang_analyzer__ defined while using MSVC compiler, so that the __builtin_expect is not defined;
    • you use clang to compile UE <WindowsPlatform><Compiler>Clang</Compiler></WindowsPlatform> option in BuildConfiguration.xml.
      However, in with such a setup, I couldn't reproduce the issue.

To move on, I would appreciate it if you could share additional information as described below:

  • Your LiMonster.Build.cs file;
  • If you ever customized the BuildConfiguration.xml or have per-project BuildConfiguration.xml file (in your project folder) please share its content;
  • Is issue reproducible with a newly created project?

Meanwhile, I reported the case I found to our tracker: RSCPP-35769 __builtin_expect is not resolved in checkf() macro. UE5. You might want to have a look at this issue. It might be your case, if you have `__clang_analyzer__` defined. If so, you can disable this flag to workaround the issue.

Have a nice day!

0

Please sign in to leave a comment.