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