LCOV - code coverage report
Current view: top level - gcc - selftest-diagnostic.c (source / functions) Hit Total Coverage
Test: gcc.info Lines: 15 15 100.0 %
Date: 2020-03-28 11:57:23 Functions: 3 3 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* Selftest support for diagnostics.
       2                 :            :    Copyright (C) 2016-2020 Free Software Foundation, Inc.
       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                 :            : #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                 :            : 
      32                 :            : namespace selftest {
      33                 :            : 
      34                 :            : /* Implementation of class selftest::test_diagnostic_context.  */
      35                 :            : 
      36                 :      74926 : test_diagnostic_context::test_diagnostic_context ()
      37                 :            : {
      38                 :      74926 :   diagnostic_initialize (this, 0);
      39                 :      74926 :   show_caret = true;
      40                 :      74926 :   show_labels_p = true;
      41                 :      74926 :   show_column = true;
      42                 :      74926 :   start_span = start_span_cb;
      43                 :      74926 :   min_margin_width = 6;
      44                 :      74926 : }
      45                 :            : 
      46                 :     149852 : test_diagnostic_context::~test_diagnostic_context ()
      47                 :            : {
      48                 :      74926 :   diagnostic_finish (this);
      49                 :      74926 : }
      50                 :            : 
      51                 :            : /* Implementation of diagnostic_start_span_fn, hiding the
      52                 :            :    real filename (to avoid printing the names of tempfiles).  */
      53                 :            : 
      54                 :            : void
      55                 :        112 : test_diagnostic_context::start_span_cb (diagnostic_context *context,
      56                 :            :                                         expanded_location exploc)
      57                 :            : {
      58                 :        112 :   exploc.file = "FILENAME";
      59                 :        112 :   default_diagnostic_start_span_fn (context, exploc);
      60                 :        112 : }
      61                 :            : 
      62                 :            : } // namespace selftest
      63                 :            : 
      64                 :            : #endif /* #if CHECKING_P */

Generated by: LCOV version 1.0

LCOV profile is generated on x86_64 machine using following configure options: configure --disable-bootstrap --enable-coverage=opt --enable-languages=c,c++,fortran,go,jit,lto --enable-host-shared. GCC test suite is run with the built compiler.