Our website uses cookies to enhance your browsing experience.
Accept
to the top
>
>
PVS-Studio prints the error "Some …

PVS-Studio prints the error "Some diagnostic messages may contain incorrect line number for file ..." (continuation)

Nov 10 2009

We have already written about the causes of the warning "Some diagnostic messages may contain incorrect line number for file ...". Let me remind you that multi-line #define directives are processed incorrectly due to the preprocessor error in Visual C++ 2005 (without SP1). This leads to the PVS-Studio positioning error. If you get this warning I recommend that you read this note to understand the reason for that and how to deal with it.

Unfortunately, there is one more case when the warning "Some diagnostic messages may contain incorrect line number for file ..." is generated and a fault in positioning diagnostic warnings occurs. We speak about multi-line #pragma directives of a special kind. Here is an example of correct code:

#pragma warning(push) 
void test()
{
  int a = 0;
  size_t b = a; // PVS-Studio informs about the error here
}

But if you write #pragma directive in two lines PVS-Studio analyzer informs about the error in the wrong place (one-line fault):

#pragma \
  warning(push) 
void test()
{
  int a = 0;     // PVS-Studio informs about the error here,
  size_t b = a;  // but actually it is here.
}

Although in another case with a multi-line #pragma directive there is no error:

#pragma warning \
  (push) 
void test()
{
  int a = 0;
  size_t b = a; // PVS-Studio informs about the error in this line
}

Like in the previous note about the warning "Some diagnostic messages may contain incorrect line number for file ...", this error is related to using the Visual C++ preprocessor.

However, this error is not fixed by installing Service Pack 1 on Visual Studio 2005 or moving to Visual Studio 2008. The only recommendation is to either refuse to use multi-line #pragma directives or still use them but in the way they are correctly processed.

Popular related articles


Comments (0)

Next comments next comments
close comment form
close form

Fill out the form in 2 simple steps below:

Your contact information:

Step 1
Congratulations! This is your promo code!

Desired license type:

Step 2
Team license
Enterprise license
** By clicking this button you agree to our Privacy Policy statement
close form
Request our prices
New License
License Renewal
--Select currency--
USD
EUR
* By clicking this button you agree to our Privacy Policy statement

close form
Free PVS‑Studio license for Microsoft MVP specialists
* By clicking this button you agree to our Privacy Policy statement

close form
To get the licence for your open-source project, please fill out this form
* By clicking this button you agree to our Privacy Policy statement

close form
I am interested to try it on the platforms:
* By clicking this button you agree to our Privacy Policy statement

close form
check circle
Message submitted.

Your message has been sent. We will email you at


If you do not see the email in your inbox, please check if it is filtered to one of the following folders:

  • Promotion
  • Updates
  • Spam