2

Been trying to clean up warnings on a project. I've been disabling warnings for certain 3rd party include files, and I'm at the point that if I set the filter in the "Error List" to "Build Only", I'm not getting any warnings, but I still see close to 200 warnings if I set the filter to "IntelliSense Only" or "Build + Intellisense".

I'm don't quite get what the difference is, or how to disable certain warnings for both build and intellisense. For example, I'm getting warning C6263: Using _alloca in a loop: this can quickly overflow the stack." in any place that we use the T2W or A2W macro, even in a file that I'm pretty sure I've disabled the warning using this in our stdafx.h file:

#pragma warning(push)
#pragma warning(disable: 6263)
#include <atldlgs.h>
#pragma warning(pop)

I'm not sure why the warning is an IntelliSense warning and not a Build warning, (i.e. I don't see anything in the build output that reflects the warning I see in the Error List window), and I'm not sure how you can disable IntelliSense warnings via pragmas.

Note that I'm not trying to disable code analysis, or IntelliSense. I'm trying to disable SOME of the warnings that are showing up in the "Error List" window when building, which appear to come from IntelliSense.

bpeikes
  • 3,495
  • 9
  • 42
  • 80
  • 2
    Intellisense is a separate compiler that works in the IDE for squiggles and code analysis. It's goal is to produce a quick but sometimes wrong suggestion. – drescherjm Aug 31 '20 at 20:38
  • It's neither, it is a code analysis warning. How you got there isn't very obvious from the question, maybe [this](https://stackoverflow.com/questions/52649461/how-can-i-disable-live-code-analysis-in-visual-studio-2017). – Hans Passant Aug 31 '20 at 21:26

1 Answers1

-1

If you want to disable Intellisense, you could set True in Tools->Options->Text Editor->C/C++->Advanced->Disable IntelliSense.

If you want to disable specific errors, you could refer to Microsoft Docs about warning pragma.

Syntax

#pragma warning(
    warning-specifier : warning-number-list
    [; warning-specifier : warning-number-list ... ] )
#pragma warning( push [ , n ] )
#pragma warning( pop )

Also, you could refer to this link about how To disable all code analysis warnings for included third-party files.

Add the following code to your header file.

#include <codeanalysis\warnings.h>
#pragma warning( push )
#pragma warning ( disable : ALL_CODE_ANALYSIS_WARNINGS )
#include <third-party include files here>
#pragma warning( pop )
Barrnet Chou
  • 1,738
  • 1
  • 4
  • 7
  • I'm not trying to disable all warnings, or IntelliSense. What I'm trying to do is clean up what gets displayed in the "Error List" window when building. Right now, I've cleaned up most of my "Build" warnings, but the window still shows some IntelliSense warnings. I don't want to remove all of the IntelliSense warnings, just specific ones for certain files that I know we do not have to clean up because it's not our code. – bpeikes Sep 01 '20 at 04:12
  • Also, I know about using pragma warning disable. I describe how we are using it in the post. – bpeikes Sep 01 '20 at 04:15
  • I am afraid that there are not many documents about `Visual Studio build vs intellisense warnings`. So, it is difficult to give exact comparison information. – Barrnet Chou Sep 02 '20 at 07:44