]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/selftest-diagnostic.c
* config/microblaze/microblaze.c (microblaze_expand_block_move): Treat
[thirdparty/gcc.git] / gcc / selftest-diagnostic.c
CommitLineData
db7ff53d 1/* Selftest support for diagnostics.
fbd26352 2 Copyright (C) 2016-2019 Free Software Foundation, Inc.
db7ff53d 3
4This file is part of GCC.
5
6GCC is free software; you can redistribute it and/or modify it under
7the terms of the GNU General Public License as published by the Free
8Software Foundation; either version 3, or (at your option) any later
9version.
10
11GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12WARRANTY; without even the implied warranty of MERCHANTABILITY or
13FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14for more details.
15
16You should have received a copy of the GNU General Public License
17along with GCC; see the file COPYING3. If not see
18<http://www.gnu.org/licenses/>. */
19
20#include "config.h"
21#include "system.h"
22#include "coretypes.h"
23#include "diagnostic.h"
24#include "selftest.h"
25#include "selftest-diagnostic.h"
26
27/* The selftest code should entirely disappear in a production
28 configuration, hence we guard all of it with #if CHECKING_P. */
29
30#if CHECKING_P
31
32namespace selftest {
33
34/* Implementation of class selftest::test_diagnostic_context. */
35
36test_diagnostic_context::test_diagnostic_context ()
37{
38 diagnostic_initialize (this, 0);
39 show_caret = true;
b7bb5264 40 show_labels_p = true;
db7ff53d 41 show_column = true;
42 start_span = start_span_cb;
31087b7e 43 min_margin_width = 6;
db7ff53d 44}
45
46test_diagnostic_context::~test_diagnostic_context ()
47{
48 diagnostic_finish (this);
49}
50
51/* Implementation of diagnostic_start_span_fn, hiding the
52 real filename (to avoid printing the names of tempfiles). */
53
54void
55test_diagnostic_context::start_span_cb (diagnostic_context *context,
56 expanded_location exploc)
57{
58 exploc.file = "FILENAME";
59 default_diagnostic_start_span_fn (context, exploc);
60}
61
62} // namespace selftest
63
64#endif /* #if CHECKING_P */