[cfe-commits] r158854 - /cfe/trunk/test/SemaCXX/switch-implicit-fallthrough.cpp
Alexander Kornienko
alexfh at google.com
Wed Jun 20 14:12:23 PDT 2012
Author: alexfh
Date: Wed Jun 20 16:12:23 2012
New Revision: 158854
URL: http://llvm.org/viewvc/llvm-project?rev=158854&view=rev
Log:
Added test with sizeof conditions (relies on to-be-implemented functionality of CFG, discussion: http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20120507/057370.html)
Modified:
cfe/trunk/test/SemaCXX/switch-implicit-fallthrough.cpp
Modified: cfe/trunk/test/SemaCXX/switch-implicit-fallthrough.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/switch-implicit-fallthrough.cpp?rev=158854&r1=158853&r2=158854&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/switch-implicit-fallthrough.cpp (original)
+++ cfe/trunk/test/SemaCXX/switch-implicit-fallthrough.cpp Wed Jun 20 16:12:23 2012
@@ -156,6 +156,24 @@
case 223: // expected-warning{{unannotated fall-through between switch labels}} expected-note{{insert '[[clang::fallthrough]];' to silence this warning}} expected-note{{insert 'break;' to avoid fall-through}}
[[clang::fallthrough]]; // expected-warning{{fallthrough annotation does not directly precede switch label}}
}
+
+ // TODO: uncomment this test after CFG gets more options to deal with
+ // unreachable code:
+ // http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20120507/057370.html
+#if 0
+ long p = static_cast<long>(n) * n;
+ switch (sizeof(p)) {
+ case 9: // this test will not work on compilers with 72-bit long
+ n += static_cast<int>(p >> 32);
+ [[clang::fallthrough]]; // no warning here
+ case 5: // it is not intended to work on compilers with 40-bit long as well
+ n += static_cast<int>(p);
+ break;
+ default:
+ break;
+ }
+#endif
+
return n;
}
More information about the cfe-commits
mailing list