LCOV - code coverage report
Current view: top level - /mnt/build/buildbot/bld/build-lcov/gcc/m2/gm2-compiler-boot - M2Pass.c (source / functions) Coverage Total Hit
Test: gcc.info Lines: 72.6 % 62 45
Test Date: 2026-02-28 14:20:25 Functions: 75.0 % 20 15
Legend: Lines:     hit not hit

            Line data    Source code
       1              : /* do not edit automatically generated by mc from M2Pass.  */
       2              : /* M2Pass.mod provides setting and testing of the current pass.
       3              : 
       4              : Copyright (C) 2001-2026 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 <stdbool.h>
      26              : #   if !defined (PROC_D)
      27              : #      define PROC_D
      28              :        typedef void (*PROC_t) (void);
      29              :        typedef struct { PROC_t proc; } PROC;
      30              : #   endif
      31              : 
      32              : #define _M2Pass_C
      33              : 
      34              : #include "GM2Pass.h"
      35              : #   include "GM2Error.h"
      36              : 
      37              : typedef enum {M2Pass_NoPass, M2Pass_Pass0, M2Pass_Pass1, M2Pass_Pass2, M2Pass_PassC, M2Pass_Pass3, M2Pass_CodeGeneration, M2Pass_ErrorPass, M2Pass_HiddenPass} M2Pass_Pass;
      38              : 
      39              : static M2Pass_Pass CurrentPass;
      40              : 
      41              : /*
      42              :    SetPassToNoPass - sets the pass state to no Pass.
      43              : */
      44              : 
      45              : extern "C" void M2Pass_SetPassToNoPass (void);
      46              : 
      47              : /*
      48              :    SetPassToPass0 - sets the pass state to Pass 0.
      49              : */
      50              : 
      51              : extern "C" void M2Pass_SetPassToPass0 (void);
      52              : 
      53              : /*
      54              :    SetPassToPass1 - sets the pass state to Pass 1.
      55              : */
      56              : 
      57              : extern "C" void M2Pass_SetPassToPass1 (void);
      58              : 
      59              : /*
      60              :    SetPassToPass2 - sets the pass state to Pass 2.
      61              : */
      62              : 
      63              : extern "C" void M2Pass_SetPassToPass2 (void);
      64              : 
      65              : /*
      66              :    SetPassToPassC - sets the pass state to Pass C.
      67              : */
      68              : 
      69              : extern "C" void M2Pass_SetPassToPassC (void);
      70              : 
      71              : /*
      72              :    SetPassToPass3 - sets the pass state to Pass 3.
      73              : */
      74              : 
      75              : extern "C" void M2Pass_SetPassToPass3 (void);
      76              : 
      77              : /*
      78              :    SetPassToPassHidden - sets the pass state to the hidden type pass.
      79              : */
      80              : 
      81              : extern "C" void M2Pass_SetPassToPassHidden (void);
      82              : 
      83              : /*
      84              :    SetPassToCodeGeneration - sets the pass state to CodeGeneration.
      85              : */
      86              : 
      87              : extern "C" void M2Pass_SetPassToCodeGeneration (void);
      88              : 
      89              : /*
      90              :    SetPassToErrorPass - sets the pass state to no Error Pass.
      91              : */
      92              : 
      93              : extern "C" void M2Pass_SetPassToErrorPass (void);
      94              : 
      95              : /*
      96              :    IsNoPass - returns true if currently in no Pass.
      97              : */
      98              : 
      99              : extern "C" bool M2Pass_IsNoPass (void);
     100              : 
     101              : /*
     102              :    IsPass0 - returns true if currently in Pass 0.
     103              : */
     104              : 
     105              : extern "C" bool M2Pass_IsPass0 (void);
     106              : 
     107              : /*
     108              :    IsPass1 - returns true if currently in Pass 1.
     109              : */
     110              : 
     111              : extern "C" bool M2Pass_IsPass1 (void);
     112              : 
     113              : /*
     114              :    IsPass2 - returns true if currently in Pass 2.
     115              : */
     116              : 
     117              : extern "C" bool M2Pass_IsPass2 (void);
     118              : 
     119              : /*
     120              :    IsPassC - returns true if currently in Pass C.
     121              : */
     122              : 
     123              : extern "C" bool M2Pass_IsPassC (void);
     124              : 
     125              : /*
     126              :    IsPass3 - returns true if currently in Pass 3.
     127              : */
     128              : 
     129              : extern "C" bool M2Pass_IsPass3 (void);
     130              : 
     131              : /*
     132              :    IsPassHidden - returns TRUE if currently parsing for hidden types.
     133              : */
     134              : 
     135              : extern "C" bool M2Pass_IsPassHidden (void);
     136              : 
     137              : /*
     138              :    IsPassCodeGeneration - returns true if currently in the CodeGeneration Pass.
     139              : */
     140              : 
     141              : extern "C" bool M2Pass_IsPassCodeGeneration (void);
     142              : 
     143              : /*
     144              :    IsErrorPass - returns true if currently in the Error Pass.
     145              : */
     146              : 
     147              : extern "C" bool M2Pass_IsErrorPass (void);
     148              : 
     149              : 
     150              : /*
     151              :    SetPassToNoPass - sets the pass state to no Pass.
     152              : */
     153              : 
     154       236767 : extern "C" void M2Pass_SetPassToNoPass (void)
     155              : {
     156       236767 :   CurrentPass = M2Pass_NoPass;
     157       236767 : }
     158              : 
     159              : 
     160              : /*
     161              :    SetPassToPass0 - sets the pass state to Pass 0.
     162              : */
     163              : 
     164        14952 : extern "C" void M2Pass_SetPassToPass0 (void)
     165              : {
     166        14952 :   if (CurrentPass == M2Pass_NoPass)
     167              :     {
     168        14952 :       CurrentPass = M2Pass_Pass0;
     169              :     }
     170              :   else
     171              :     {
     172            0 :       M2Error_InternalError ((const char *) "attempting to set CurrentPass to Pass1", 38);
     173              :     }
     174        14952 : }
     175              : 
     176              : 
     177              : /*
     178              :    SetPassToPass1 - sets the pass state to Pass 1.
     179              : */
     180              : 
     181        14820 : extern "C" void M2Pass_SetPassToPass1 (void)
     182              : {
     183        14820 :   if (CurrentPass == M2Pass_NoPass)
     184              :     {
     185        14820 :       CurrentPass = M2Pass_Pass1;
     186              :     }
     187              :   else
     188              :     {
     189            0 :       M2Error_InternalError ((const char *) "attempting to set CurrentPass to Pass1", 38);
     190              :     }
     191        14820 : }
     192              : 
     193              : 
     194              : /*
     195              :    SetPassToPass2 - sets the pass state to Pass 2.
     196              : */
     197              : 
     198        14790 : extern "C" void M2Pass_SetPassToPass2 (void)
     199              : {
     200        14790 :   if (CurrentPass == M2Pass_NoPass)
     201              :     {
     202        14790 :       CurrentPass = M2Pass_Pass2;
     203              :     }
     204              :   else
     205              :     {
     206            0 :       M2Error_InternalError ((const char *) "attempting to set CurrentPass to Pass2", 38);
     207              :     }
     208        14790 : }
     209              : 
     210              : 
     211              : /*
     212              :    SetPassToPassC - sets the pass state to Pass C.
     213              : */
     214              : 
     215        14688 : extern "C" void M2Pass_SetPassToPassC (void)
     216              : {
     217        14688 :   if (CurrentPass == M2Pass_NoPass)
     218              :     {
     219        14688 :       CurrentPass = M2Pass_PassC;
     220              :     }
     221              :   else
     222              :     {
     223            0 :       M2Error_InternalError ((const char *) "attempting to set CurrentPass to PassC", 38);
     224              :     }
     225        14688 : }
     226              : 
     227              : 
     228              : /*
     229              :    SetPassToPass3 - sets the pass state to Pass 3.
     230              : */
     231              : 
     232        81783 : extern "C" void M2Pass_SetPassToPass3 (void)
     233              : {
     234        81783 :   if (CurrentPass == M2Pass_NoPass)
     235              :     {
     236        81783 :       CurrentPass = M2Pass_Pass3;
     237              :     }
     238              :   else
     239              :     {
     240            0 :       M2Error_InternalError ((const char *) "attempting to set CurrentPass to Pass3", 38);
     241              :     }
     242        81783 : }
     243              : 
     244              : 
     245              : /*
     246              :    SetPassToPassHidden - sets the pass state to the hidden type pass.
     247              : */
     248              : 
     249        67206 : extern "C" void M2Pass_SetPassToPassHidden (void)
     250              : {
     251        67206 :   CurrentPass = M2Pass_HiddenPass;
     252        67206 : }
     253              : 
     254              : 
     255              : /*
     256              :    SetPassToCodeGeneration - sets the pass state to CodeGeneration.
     257              : */
     258              : 
     259        13940 : extern "C" void M2Pass_SetPassToCodeGeneration (void)
     260              : {
     261        13940 :   if (CurrentPass == M2Pass_NoPass)
     262              :     {
     263        13940 :       CurrentPass = M2Pass_CodeGeneration;
     264              :     }
     265              :   else
     266              :     {
     267            0 :       M2Error_InternalError ((const char *) "attempting to set CurrentPass to CodeGeneration", 47);
     268              :     }
     269        13940 : }
     270              : 
     271              : 
     272              : /*
     273              :    SetPassToErrorPass - sets the pass state to no Error Pass.
     274              : */
     275              : 
     276            0 : extern "C" void M2Pass_SetPassToErrorPass (void)
     277              : {
     278            0 :   CurrentPass = M2Pass_ErrorPass;
     279            0 : }
     280              : 
     281              : 
     282              : /*
     283              :    IsNoPass - returns true if currently in no Pass.
     284              : */
     285              : 
     286            0 : extern "C" bool M2Pass_IsNoPass (void)
     287              : {
     288            0 :   return CurrentPass == M2Pass_NoPass;
     289              :   /* static analysis guarentees a RETURN statement will be used before here.  */
     290              :   __builtin_unreachable ();
     291              : }
     292              : 
     293              : 
     294              : /*
     295              :    IsPass0 - returns true if currently in Pass 0.
     296              : */
     297              : 
     298     27003628 : extern "C" bool M2Pass_IsPass0 (void)
     299              : {
     300     27003628 :   return CurrentPass == M2Pass_Pass0;
     301              :   /* static analysis guarentees a RETURN statement will be used before here.  */
     302              :   __builtin_unreachable ();
     303              : }
     304              : 
     305              : 
     306              : /*
     307              :    IsPass1 - returns true if currently in Pass 1.
     308              : */
     309              : 
     310       185071 : extern "C" bool M2Pass_IsPass1 (void)
     311              : {
     312       185071 :   return CurrentPass == M2Pass_Pass1;
     313              :   /* static analysis guarentees a RETURN statement will be used before here.  */
     314              :   __builtin_unreachable ();
     315              : }
     316              : 
     317              : 
     318              : /*
     319              :    IsPass2 - returns true if currently in Pass 2.
     320              : */
     321              : 
     322       185071 : extern "C" bool M2Pass_IsPass2 (void)
     323              : {
     324       185071 :   return CurrentPass == M2Pass_Pass2;
     325              :   /* static analysis guarentees a RETURN statement will be used before here.  */
     326              :   __builtin_unreachable ();
     327              : }
     328              : 
     329              : 
     330              : /*
     331              :    IsPassC - returns true if currently in Pass C.
     332              : */
     333              : 
     334       185071 : extern "C" bool M2Pass_IsPassC (void)
     335              : {
     336       185071 :   return CurrentPass == M2Pass_PassC;
     337              :   /* static analysis guarentees a RETURN statement will be used before here.  */
     338              :   __builtin_unreachable ();
     339              : }
     340              : 
     341              : 
     342              : /*
     343              :    IsPass3 - returns true if currently in Pass 3.
     344              : */
     345              : 
     346       185071 : extern "C" bool M2Pass_IsPass3 (void)
     347              : {
     348       185071 :   return CurrentPass == M2Pass_Pass3;
     349              :   /* static analysis guarentees a RETURN statement will be used before here.  */
     350              :   __builtin_unreachable ();
     351              : }
     352              : 
     353              : 
     354              : /*
     355              :    IsPassHidden - returns TRUE if currently parsing for hidden types.
     356              : */
     357              : 
     358            0 : extern "C" bool M2Pass_IsPassHidden (void)
     359              : {
     360            0 :   return CurrentPass == M2Pass_HiddenPass;
     361              :   /* static analysis guarentees a RETURN statement will be used before here.  */
     362              :   __builtin_unreachable ();
     363              : }
     364              : 
     365              : 
     366              : /*
     367              :    IsPassCodeGeneration - returns true if currently in the CodeGeneration Pass.
     368              : */
     369              : 
     370       670172 : extern "C" bool M2Pass_IsPassCodeGeneration (void)
     371              : {
     372       670172 :   return CurrentPass == M2Pass_CodeGeneration;
     373              :   /* static analysis guarentees a RETURN statement will be used before here.  */
     374              :   __builtin_unreachable ();
     375              : }
     376              : 
     377              : 
     378              : /*
     379              :    IsErrorPass - returns true if currently in the Error Pass.
     380              : */
     381              : 
     382            0 : extern "C" bool M2Pass_IsErrorPass (void)
     383              : {
     384            0 :   return CurrentPass == M2Pass_ErrorPass;
     385              :   /* static analysis guarentees a RETURN statement will be used before here.  */
     386              :   __builtin_unreachable ();
     387              : }
     388              : 
     389        14952 : extern "C" void _M2_M2Pass_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
     390              : {
     391        14952 :   M2Pass_SetPassToNoPass ();
     392        14952 : }
     393              : 
     394            0 : extern "C" void _M2_M2Pass_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
     395              : {
     396            0 : }
        

Generated by: LCOV version 2.4-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.