aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/cpp
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2012-10-04 17:33:11 +0200
committerFlorian Weimer <fw@gcc.gnu.org>2012-10-04 17:33:11 +0200
commitf591bd8f507db985a2d194b3b58b5d8b128dce0a (patch)
tree3992b4ad76993de282e9b81bbe8d85f5c7834619 /gcc/testsuite/c-c++-common/cpp
parentc62b924434c30cc417df9c1f0bac770e653f0241 (diff)
downloadgcc-f591bd8f507db985a2d194b3b58b5d8b128dce0a.zip
gcc-f591bd8f507db985a2d194b3b58b5d8b128dce0a.tar.gz
gcc-f591bd8f507db985a2d194b3b58b5d8b128dce0a.tar.bz2
Implement #pragma GCC warning/error
2012-10-04 Florian Weimer <fweimer@redhat.com> * doc/cpp.texi (Pragmas): Document #pragma GCC warning, #pragma GCC error. 2012-10-04 Florian Weimer <fweimer@redhat.com> * c-c++-common/cpp/diagnostic-pragma-1.c: New testcase. 2012-10-04 Florian Weimer <fweimer@redhat.com> * directives.c (do_pragma_warning_or_error): New. (do_pragma_warning): New. (do_pragma_error): New. (_cpp_init_internal_pragmas): Register new pragmas. From-SVN: r192084
Diffstat (limited to 'gcc/testsuite/c-c++-common/cpp')
-rw-r--r--gcc/testsuite/c-c++-common/cpp/diagnostic-pragma-1.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/testsuite/c-c++-common/cpp/diagnostic-pragma-1.c b/gcc/testsuite/c-c++-common/cpp/diagnostic-pragma-1.c
new file mode 100644
index 0000000..9867c94
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/cpp/diagnostic-pragma-1.c
@@ -0,0 +1,11 @@
+// { dg-do compile }
+
+#pragma GCC warning "warn-a" // { dg-warning warn-a }
+#pragma GCC error "err-b" // { dg-error err-b }
+
+#define CONST1 _Pragma("GCC warning \"warn-c\"") 1
+#define CONST2 _Pragma("GCC error \"err-d\"") 2
+
+char a[CONST1]; // { dg-warning warn-c }
+char b[CONST2]; // { dg-error err-d }
+