Boost logo

Boost :

Subject: [boost] Compiler Warnings Tests
From: Paul A. Bristow (pbristow_at_[hidden])
Date: 2009-11-27 13:03:36


> -----Original Message-----
> From: boost-users-bounces_at_[hidden]
[mailto:boost-users-bounces_at_[hidden]]
> On Behalf Of Robert Ramey
> Sent: Friday, November 27, 2009 5:07 PM
> To: boost-users_at_[hidden]
> Cc: boost_at_[hidden]
> Subject: Re: [Boost-users] Compiler warnings from Macs, IBM acc, Borland,
Comeau,
> Metroworks, et al - are they a Problem?
>
> I know this suggestion has been made but I want to expand a little on it.
>
> a "library" - warning policy test. This would be just like any other
> library as far as the testing system goes. It would have maybe
> 10? small compile only tests which would emit warnings or not.
> The source would describe which warning is in fact being tested.
>
> Presumably, the test matrix would permit one to look at the warning
> messages. (I'm not sure that the current one does this).
>
> In anycase, it would permit the test matrix be used to check
> the warning status for each warning on each compiler at
> a specified warning level.
>
> I see this as the only way to get a real grip on how these things
> vary among the array of compiler's we might use.
>
> I realize that it would be some work, but I would think it wouldn't
> be all that much more - if any - than that which has already been
> expended on the wiki. It would have the great advantage of
> being relatively free of "maintainence by hand". It would automate
> the whole process of determining the status of different compilers
> in this area.

OK I can see some merit in this (now I understand your proposal a bit more).

And I'm starting a new thread for Compiler Warnings Tests

The Microsoft docs examples might be a good start?

// C4244_level4.cpp
// compile with: /W4 == actually warnings = all

(warnings = errors will allow normal fail testing if it isn;t possible to check
for warnings?)

// AND MS extensions off?

int aa;
unsigned short bb;

int main() {
   int b = 0, c = 0;
   short a = b + c; // C4244

   bb += c; // C4244
   bb = bb + c; // C4244
   bb += static_cast<unsigned short>(aa); // C4244
   bb = bb + static_cast<unsigned short>(aa); // OK
}

So are you proposing a collection of these, with versions that should compile
and others that should not, for example:

int main()
{
   int b = 0, c = 0;
  short a = b + c; // C4244
}

and another with

int main()
{
   int b = 0, c = 0;
  short a = static_cast<short>(b + c); // OK - NO C4244
}

all run by a jamfile.v2.

Or am I still misunderstanding you?

Vicente has said he will think about it. I will also give it some more thought.

Paul

---
Paul A. Bristow
Prizet Farmhouse
Kendal, UK   LA8 8AB
+44 1539 561830, mobile +44 7714330204
pbristow_at_[hidden]
---
Paul A. Bristow
Prizet Farmhouse
Kendal, UK   LA8 8AB
+44 1539 561830, mobile +44 7714330204
pbristow_at_[hidden]

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk