
Paul A. Bristow wrote:
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?
You've got it. The only difference would be that the warning shouldn't be associated with a particular compiler. Look at boost/libs/config tests for inspiriation. Tests would be something like: boost/libs/warnings/ test_data_truncation // this would correspond to C4244 for ms and ? for other ones // this test would be "compile-pass" // and it would contain a number of tests cases test_unused_argument test_argument_name_shadowing test_virtual_dtor_missing test_cant_create_default_construtor test_cant_create_default_assignment ... On the boost testing matrix, the first row describes the environment. To make this useful, this test should be run with the first row - environment description including the warning level. Note that I use my library_test.sh to run tests for one specific library. This creates an html test matrix on your local machine which shows all the warning emitted. The beauty of this system is that it's very easy to run the tests and create the test matrix on your local machine for just one library. Robert Ramey