Browse Source

Expand cases generating warnings to cover more compilers

[SVN r29342]
Beman Dawes 21 years ago
parent
commit
e51c00e6f6
2 changed files with 13 additions and 6 deletions
  1. 5 2
      tools/regression/test/run-note-warn.cpp
  2. 8 4
      tools/regression/test/run-pass-warn.cpp

+ 5 - 2
tools/regression/test/run-note-warn.cpp

@@ -12,6 +12,9 @@ int main()
 
   // provoke a compiler warning to make sure <note> takes priority over
   // a warning, but neither is lost from status reporting links HTML.
-  char x = 0xffffffff;
-  return x ? 0 : 0; // use x to eliminate other warnings
+  short s;
+  unsigned long ul;
+  s = s & ul; // warning from many compilers
+  if ( s == ul ) {} // warning from GCC
+  return 0;
 }

+ 8 - 4
tools/regression/test/run-pass-warn.cpp

@@ -2,9 +2,13 @@
 //  Software License, Version 1.0. (See accompanying file
 //  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 
-int main()
+// provoke one or more compiler warnings
+
+int main(int argc, char * argv[] )
 {
-  // provoke a compiler warning
-  char x = 0xffffffff;
-  return x ? 0 : 0; // use x to eliminate other warnings
+  short s;
+  unsigned long ul;
+  s = s & ul; // warning from many compilers
+  if ( s == ul ) {} // warning from GCC
+  return 0;
 }

粤ICP备19079148号