xref: /netbsd-src/external/gpl3/gcc.old/dist/gcc/selftest-diagnostic.h (revision 4c3eb207d36f67d31994830c0a694161fc1ca39b)
1cef8759bSmrg /* Selftest support for diagnostics.
2*4c3eb207Smrg    Copyright (C) 2016-2020 Free Software Foundation, Inc.
3cef8759bSmrg 
4cef8759bSmrg This file is part of GCC.
5cef8759bSmrg 
6cef8759bSmrg GCC is free software; you can redistribute it and/or modify it under
7cef8759bSmrg the terms of the GNU General Public License as published by the Free
8cef8759bSmrg Software Foundation; either version 3, or (at your option) any later
9cef8759bSmrg version.
10cef8759bSmrg 
11cef8759bSmrg GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12cef8759bSmrg WARRANTY; without even the implied warranty of MERCHANTABILITY or
13cef8759bSmrg FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14cef8759bSmrg for more details.
15cef8759bSmrg 
16cef8759bSmrg You should have received a copy of the GNU General Public License
17cef8759bSmrg along with GCC; see the file COPYING3.  If not see
18cef8759bSmrg <http://www.gnu.org/licenses/>.  */
19cef8759bSmrg 
20cef8759bSmrg #ifndef GCC_SELFTEST_DIAGNOSTIC_H
21cef8759bSmrg #define GCC_SELFTEST_DIAGNOSTIC_H
22cef8759bSmrg 
23cef8759bSmrg /* The selftest code should entirely disappear in a production
24cef8759bSmrg    configuration, hence we guard all of it with #if CHECKING_P.  */
25cef8759bSmrg 
26cef8759bSmrg #if CHECKING_P
27cef8759bSmrg 
28cef8759bSmrg namespace selftest {
29cef8759bSmrg 
30cef8759bSmrg /* Convenience subclass of diagnostic_context for testing
31cef8759bSmrg    the diagnostic subsystem.  */
32cef8759bSmrg 
33cef8759bSmrg class test_diagnostic_context : public diagnostic_context
34cef8759bSmrg {
35cef8759bSmrg  public:
36cef8759bSmrg   test_diagnostic_context ();
37cef8759bSmrg   ~test_diagnostic_context ();
38cef8759bSmrg 
39cef8759bSmrg   /* Implementation of diagnostic_start_span_fn, hiding the
40cef8759bSmrg      real filename (to avoid printing the names of tempfiles).  */
41cef8759bSmrg   static void
42cef8759bSmrg   start_span_cb (diagnostic_context *context, expanded_location exploc);
43cef8759bSmrg };
44cef8759bSmrg 
45cef8759bSmrg } // namespace selftest
46cef8759bSmrg 
47cef8759bSmrg #endif /* #if CHECKING_P */
48cef8759bSmrg 
49cef8759bSmrg #endif /* GCC_SELFTEST_DIAGNOSTIC_H */
50