LCOV - code coverage report
Current view: top level - /mnt/build/buildbot/bld/build-lcov/gcc/m2/gm2-compiler-boot - M2Emit.c (source / functions) Coverage Total Hit
Test: gcc.info Lines: 55.0 % 20 11
Test Date: 2024-12-21 13:15:12 Functions: 50.0 % 6 3
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: - 0 0

             Branch data     Line data    Source code
       1                 :             : /* do not edit automatically generated by mc from M2Emit.  */
       2                 :             : /* M2Emit.mod issue errors to the GCC error reporting substructure.
       3                 :             : 
       4                 :             : Copyright (C) 2019-2024 Free Software Foundation, Inc.
       5                 :             : Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
       6                 :             : 
       7                 :             : This file is part of GNU Modula-2.
       8                 :             : 
       9                 :             : GNU Modula-2 is free software; you can redistribute it and/or modify
      10                 :             : it under the terms of the GNU General Public License as published by
      11                 :             : the Free Software Foundation; either version 3, or (at your option)
      12                 :             : any later version.
      13                 :             : 
      14                 :             : GNU Modula-2 is distributed in the hope that it will be useful, but
      15                 :             : WITHOUT ANY WARRANTY; without even the implied warranty of
      16                 :             : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      17                 :             : General Public License for more details.
      18                 :             : 
      19                 :             : You should have received a copy of the GNU General Public License
      20                 :             : along with GNU Modula-2; see the file COPYING3.  If not see
      21                 :             : <http://www.gnu.org/licenses/>.  */
      22                 :             : 
      23                 :             : #include "config.h"
      24                 :             : #include "system.h"
      25                 :             : #include "gcc-consolidation.h"
      26                 :             : 
      27                 :             : #include <stdbool.h>
      28                 :             : #   if !defined (PROC_D)
      29                 :             : #      define PROC_D
      30                 :             :        typedef void (*PROC_t) (void);
      31                 :             :        typedef struct { PROC_t proc; } PROC;
      32                 :             : #   endif
      33                 :             : 
      34                 :             : #define _M2Emit_C
      35                 :             : 
      36                 :             : #include "GM2Emit.h"
      37                 :             : #   include "Gm2linemap.h"
      38                 :             : #   include "GM2LexBuf.h"
      39                 :             : #   include "GDynamicStrings.h"
      40                 :             : #   include "GSYSTEM.h"
      41                 :             : 
      42                 :             : 
      43                 :             : /*
      44                 :             :    EmitError - pass the error to GCC.
      45                 :             : */
      46                 :             : 
      47                 :             : extern "C" void M2Emit_EmitError (bool error, bool note, unsigned int token, DynamicStrings_String message);
      48                 :             : 
      49                 :             : /*
      50                 :             :    InternalError - issue an internal error, message.
      51                 :             : */
      52                 :             : 
      53                 :             : extern "C" void M2Emit_InternalError (const char *message_, unsigned int _message_high);
      54                 :             : 
      55                 :             : /*
      56                 :             :    UnknownLocation - return the unknown location (using GCC linemap for cc1gm2)
      57                 :             :                      and constants for gm2l and gm2m.
      58                 :             : */
      59                 :             : 
      60                 :             : extern "C" location_t M2Emit_UnknownLocation (void);
      61                 :             : 
      62                 :             : /*
      63                 :             :    BuiltinsLocation - return the builtins location (using GCC linemap for cc1gm2)
      64                 :             :                       and constants for gm2l and gm2m.
      65                 :             : */
      66                 :             : 
      67                 :             : extern "C" location_t M2Emit_BuiltinsLocation (void);
      68                 :             : 
      69                 :             : 
      70                 :             : /*
      71                 :             :    EmitError - pass the error to GCC.
      72                 :             : */
      73                 :             : 
      74                 :        3607 : extern "C" void M2Emit_EmitError (bool error, bool note, unsigned int token, DynamicStrings_String message)
      75                 :             : {
      76                 :        3607 :   if (error)
      77                 :             :     {
      78                 :        2998 :       m2linemap_ErrorAtf (M2LexBuf_TokenToLocation (token), DynamicStrings_string (message));
      79                 :             :     }
      80                 :         609 :   else if (note)
      81                 :             :     {
      82                 :             :       /* avoid dangling else.  */
      83                 :          15 :       m2linemap_NoteAtf (M2LexBuf_TokenToLocation (token), DynamicStrings_string (message));
      84                 :             :     }
      85                 :             :   else
      86                 :             :     {
      87                 :             :       /* avoid dangling else.  */
      88                 :         594 :       m2linemap_WarningAtf (M2LexBuf_TokenToLocation (token), DynamicStrings_string (message));
      89                 :             :     }
      90                 :        3607 : }
      91                 :             : 
      92                 :             : 
      93                 :             : /*
      94                 :             :    InternalError - issue an internal error, message.
      95                 :             : */
      96                 :             : 
      97                 :           0 : extern "C" void M2Emit_InternalError (const char *message_, unsigned int _message_high)
      98                 :             : {
      99                 :           0 :   char message[_message_high+1];
     100                 :             : 
     101                 :             :   /* make a local copy of each unbounded array.  */
     102                 :           0 :   memcpy (message, message_, _message_high+1);
     103                 :             : 
     104                 :           0 :   m2linemap_internal_error (const_cast<void*> (static_cast<const void*>(message)));
     105                 :           0 : }
     106                 :             : 
     107                 :             : 
     108                 :             : /*
     109                 :             :    UnknownLocation - return the unknown location (using GCC linemap for cc1gm2)
     110                 :             :                      and constants for gm2l and gm2m.
     111                 :             : */
     112                 :             : 
     113                 :     9900734 : extern "C" location_t M2Emit_UnknownLocation (void)
     114                 :             : {
     115                 :     9900734 :   return m2linemap_UnknownLocation ();
     116                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
     117                 :             :   __builtin_unreachable ();
     118                 :             : }
     119                 :             : 
     120                 :             : 
     121                 :             : /*
     122                 :             :    BuiltinsLocation - return the builtins location (using GCC linemap for cc1gm2)
     123                 :             :                       and constants for gm2l and gm2m.
     124                 :             : */
     125                 :             : 
     126                 :      289759 : extern "C" location_t M2Emit_BuiltinsLocation (void)
     127                 :             : {
     128                 :      289759 :   return m2linemap_BuiltinsLocation ();
     129                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
     130                 :             :   __builtin_unreachable ();
     131                 :             : }
     132                 :             : 
     133                 :           0 : extern "C" void _M2_M2Emit_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
     134                 :             : {
     135                 :           0 : }
     136                 :             : 
     137                 :           0 : extern "C" void _M2_M2Emit_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
     138                 :             : {
     139                 :           0 : }
        

Generated by: LCOV version 2.1-beta

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,rust,m2 --enable-host-shared. GCC test suite is run with the built compiler.