[cfe-commits] r141806 - /cfe/trunk/test/Preprocessor/warning_tests.c

Ted Kremenek kremenek at apple.com
Wed Oct 12 13:06:10 PDT 2011


Author: kremenek
Date: Wed Oct 12 15:06:09 2011
New Revision: 141806

URL: http://llvm.org/viewvc/llvm-project?rev=141806&view=rev
Log:
Add test case for __has_warning.

Added:
    cfe/trunk/test/Preprocessor/warning_tests.c

Added: cfe/trunk/test/Preprocessor/warning_tests.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/warning_tests.c?rev=141806&view=auto
==============================================================================
--- cfe/trunk/test/Preprocessor/warning_tests.c (added)
+++ cfe/trunk/test/Preprocessor/warning_tests.c Wed Oct 12 15:06:09 2011
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -fsyntax-only %s -verify
+#ifndef __has_warning
+#error Should have __has_warning
+#endif
+
+#if __has_warning("not valid") // expected-warning {{__has_warning expected option name}}
+#endif
+
+#if __has_warning("-Wparentheses")
+#warning Should have -Wparentheses // expected-warning {{Should have -Wparentheses}}
+#endif
+
+#if __has_warning(-Wfoo) // expected-error {{builtin warning check macro requires a parenthesized string}}
+#endif
+
+#if __has_warning("-Wnot-a-valid-warning-flag-at-all")
+#else
+#warning Not a valid warning flag // expected-warning {{Not a valid warning flag}}
+#endif
\ No newline at end of file





More information about the cfe-commits mailing list