Unicorn with delicious cookie
Nous utilisons des cookies pour améliorer votre expérience de navigation. En savoir plus
Accepter
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)

10 Nov 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

S'abonner

Comments (0)

close comment form
close form

Remplissez le formulaire ci‑dessous en 2 étapes simples :

Vos coordonnées :

Étape 1
Félicitations ! Voici votre code promo !

Type de licence souhaité :

Étape 2
Team license
Enterprise licence
** En cliquant sur ce bouton, vous déclarez accepter notre politique de confidentialité
close form
Demandez des tarifs
Nouvelle licence
Renouvellement de licence
--Sélectionnez la devise--
USD
EUR
* En cliquant sur ce bouton, vous déclarez accepter notre politique de confidentialité

close form
La licence PVS‑Studio gratuit pour les spécialistes Microsoft MVP
close form
Pour obtenir la licence de votre projet open source, s’il vous plait rempliez ce formulaire
* En cliquant sur ce bouton, vous déclarez accepter notre politique de confidentialité

close form
I want to join the test
* En cliquant sur ce bouton, vous déclarez accepter notre politique de confidentialité

close form
check circle
Votre message a été envoyé.

Nous vous répondrons à


Si l'e-mail n'apparaît pas dans votre boîte de réception, recherchez-le dans l'un des dossiers suivants:

  • Promotion
  • Notifications
  • Spam