selftest-diagnostic.h 1.5 KB

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