LCOV - code coverage report
Current view: top level - /mnt/build/buildbot/bld/build-lcov/gcc/m2/gm2-compiler-boot - FifoQueue.c (source / functions) Coverage Total Hit
Test: gcc.info Lines: 76.0 % 50 38
Test Date: 2025-11-22 14:42:49 Functions: 66.7 % 15 10
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 FifoQueue.  */
       2                 :             : /* FifoQueue.mod provides a simple fifo queue.
       3                 :             : 
       4                 :             : Copyright (C) 2001-2025 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 _FifoQueue_C
      33                 :             : 
      34                 :             : #include "GFifoQueue.h"
      35                 :             : #   include "GLists.h"
      36                 :             : 
      37                 :             : typedef struct FifoQueue_Fifo_r FifoQueue_Fifo;
      38                 :             : 
      39                 :             : struct FifoQueue_Fifo_r {
      40                 :             :                           Lists_List Queue;
      41                 :             :                           unsigned int Out;
      42                 :             :                         };
      43                 :             : 
      44                 :             : static FifoQueue_Fifo const_;
      45                 :             : static FifoQueue_Fifo set;
      46                 :             : static FifoQueue_Fifo subrange;
      47                 :             : static FifoQueue_Fifo enumeration;
      48                 :             : static FifoQueue_Fifo constructor;
      49                 :             : 
      50                 :             : /*
      51                 :             :    PutSetIntoFifoQueue - places a set symbol
      52                 :             :                          into a fifo queue.
      53                 :             : */
      54                 :             : 
      55                 :             : extern "C" void FifoQueue_PutSetIntoFifoQueue (unsigned int c);
      56                 :             : 
      57                 :             : /*
      58                 :             :    GetSetFromFifoQueue - retrieves a set symbol
      59                 :             :                          from a fifo queue.
      60                 :             : */
      61                 :             : 
      62                 :             : extern "C" void FifoQueue_GetSetFromFifoQueue (unsigned int *c);
      63                 :             : 
      64                 :             : /*
      65                 :             :    PutEnumerationIntoFifoQueue - places an enumeration symbol, c,
      66                 :             :                                  into a fifo queue.
      67                 :             : */
      68                 :             : 
      69                 :             : extern "C" void FifoQueue_PutEnumerationIntoFifoQueue (unsigned int c);
      70                 :             : 
      71                 :             : /*
      72                 :             :    GetEnumerationFromFifoQueue - retrieves an enumeration symbol,
      73                 :             :                                  c, from a fifo queue.
      74                 :             : */
      75                 :             : 
      76                 :             : extern "C" void FifoQueue_GetEnumerationFromFifoQueue (unsigned int *c);
      77                 :             : 
      78                 :             : /*
      79                 :             :    PutSubrangeIntoFifoQueue - places a subrange symbol into a fifo
      80                 :             :                               queue.
      81                 :             : */
      82                 :             : 
      83                 :             : extern "C" void FifoQueue_PutSubrangeIntoFifoQueue (unsigned int c);
      84                 :             : 
      85                 :             : /*
      86                 :             :    GetSubrangeFromFifoQueue - retrieves a subrange symbol from a
      87                 :             :                               fifo queue.
      88                 :             : */
      89                 :             : 
      90                 :             : extern "C" void FifoQueue_GetSubrangeFromFifoQueue (unsigned int *c);
      91                 :             : 
      92                 :             : /*
      93                 :             :    PutConstIntoFifoQueue - places a constant symbol
      94                 :             :                            into a fifo queue.
      95                 :             : */
      96                 :             : 
      97                 :             : extern "C" void FifoQueue_PutConstIntoFifoQueue (unsigned int c);
      98                 :             : 
      99                 :             : /*
     100                 :             :    GetConstFromFifoQueue - retrieves a const symbol
     101                 :             :                            from a fifo queue.
     102                 :             : */
     103                 :             : 
     104                 :             : extern "C" void FifoQueue_GetConstFromFifoQueue (unsigned int *c);
     105                 :             : 
     106                 :             : /*
     107                 :             :    PutConstructorIntoFifoQueue - places a constructor symbol
     108                 :             :                                  into a fifo queue.
     109                 :             : */
     110                 :             : 
     111                 :             : extern "C" void FifoQueue_PutConstructorIntoFifoQueue (unsigned int c);
     112                 :             : 
     113                 :             : /*
     114                 :             :    GetConstructorFromFifoQueue - retrieves a constructor symbol
     115                 :             :                                  from a fifo queue.
     116                 :             : */
     117                 :             : 
     118                 :             : extern "C" void FifoQueue_GetConstructorFromFifoQueue (unsigned int *c);
     119                 :             : 
     120                 :             : /*
     121                 :             :    PutInto - places a CARDINAL number, c, into a fifo queue.
     122                 :             : */
     123                 :             : 
     124                 :             : static void PutInto (FifoQueue_Fifo *f, unsigned int c);
     125                 :             : 
     126                 :             : /*
     127                 :             :    GetFrom - retrieves a CARDINAL number, c, from a fifo queue.
     128                 :             : */
     129                 :             : 
     130                 :             : static void GetFrom (FifoQueue_Fifo *f, unsigned int *c);
     131                 :             : 
     132                 :             : /*
     133                 :             :    Init - initialize the fifo queue.
     134                 :             : */
     135                 :             : 
     136                 :             : static void Init (FifoQueue_Fifo *f);
     137                 :             : 
     138                 :             : 
     139                 :             : /*
     140                 :             :    PutInto - places a CARDINAL number, c, into a fifo queue.
     141                 :             : */
     142                 :             : 
     143                 :      274362 : static void PutInto (FifoQueue_Fifo *f, unsigned int c)
     144                 :             : {
     145                 :           0 :   Lists_PutItemIntoList ((*f).Queue, c);
     146                 :           0 : }
     147                 :             : 
     148                 :             : 
     149                 :             : /*
     150                 :             :    GetFrom - retrieves a CARDINAL number, c, from a fifo queue.
     151                 :             : */
     152                 :             : 
     153                 :      274320 : static void GetFrom (FifoQueue_Fifo *f, unsigned int *c)
     154                 :             : {
     155                 :      274320 :   (*f).Out += 1;
     156                 :      274320 :   (*c) = static_cast<unsigned int> (Lists_GetItemFromList ((*f).Queue, (*f).Out));
     157                 :      274320 : }
     158                 :             : 
     159                 :             : 
     160                 :             : /*
     161                 :             :    Init - initialize the fifo queue.
     162                 :             : */
     163                 :             : 
     164                 :       76145 : static void Init (FifoQueue_Fifo *f)
     165                 :             : {
     166                 :           0 :   Lists_InitList (&(*f).Queue);
     167                 :       76145 :   (*f).Out = 0;
     168                 :           0 : }
     169                 :             : 
     170                 :             : 
     171                 :             : /*
     172                 :             :    PutSetIntoFifoQueue - places a set symbol
     173                 :             :                          into a fifo queue.
     174                 :             : */
     175                 :             : 
     176                 :           0 : extern "C" void FifoQueue_PutSetIntoFifoQueue (unsigned int c)
     177                 :             : {
     178                 :           0 :   PutInto (&set, c);
     179                 :           0 : }
     180                 :             : 
     181                 :             : 
     182                 :             : /*
     183                 :             :    GetSetFromFifoQueue - retrieves a set symbol
     184                 :             :                          from a fifo queue.
     185                 :             : */
     186                 :             : 
     187                 :           0 : extern "C" void FifoQueue_GetSetFromFifoQueue (unsigned int *c)
     188                 :             : {
     189                 :           0 :   GetFrom (&set, c);
     190                 :           0 : }
     191                 :             : 
     192                 :             : 
     193                 :             : /*
     194                 :             :    PutEnumerationIntoFifoQueue - places an enumeration symbol, c,
     195                 :             :                                  into a fifo queue.
     196                 :             : */
     197                 :             : 
     198                 :       34138 : extern "C" void FifoQueue_PutEnumerationIntoFifoQueue (unsigned int c)
     199                 :             : {
     200                 :       34138 :   PutInto (&enumeration, c);
     201                 :       34138 : }
     202                 :             : 
     203                 :             : 
     204                 :             : /*
     205                 :             :    GetEnumerationFromFifoQueue - retrieves an enumeration symbol,
     206                 :             :                                  c, from a fifo queue.
     207                 :             : */
     208                 :             : 
     209                 :       34114 : extern "C" void FifoQueue_GetEnumerationFromFifoQueue (unsigned int *c)
     210                 :             : {
     211                 :       34114 :   GetFrom (&enumeration, c);
     212                 :       34114 : }
     213                 :             : 
     214                 :             : 
     215                 :             : /*
     216                 :             :    PutSubrangeIntoFifoQueue - places a subrange symbol into a fifo
     217                 :             :                               queue.
     218                 :             : */
     219                 :             : 
     220                 :      203646 : extern "C" void FifoQueue_PutSubrangeIntoFifoQueue (unsigned int c)
     221                 :             : {
     222                 :      203646 :   PutInto (&subrange, c);
     223                 :      203646 : }
     224                 :             : 
     225                 :             : 
     226                 :             : /*
     227                 :             :    GetSubrangeFromFifoQueue - retrieves a subrange symbol from a
     228                 :             :                               fifo queue.
     229                 :             : */
     230                 :             : 
     231                 :      203634 : extern "C" void FifoQueue_GetSubrangeFromFifoQueue (unsigned int *c)
     232                 :             : {
     233                 :      203634 :   GetFrom (&subrange, c);
     234                 :      203634 : }
     235                 :             : 
     236                 :             : 
     237                 :             : /*
     238                 :             :    PutConstIntoFifoQueue - places a constant symbol
     239                 :             :                            into a fifo queue.
     240                 :             : */
     241                 :             : 
     242                 :         120 : extern "C" void FifoQueue_PutConstIntoFifoQueue (unsigned int c)
     243                 :             : {
     244                 :         120 :   PutInto (&const_, c);
     245                 :         120 : }
     246                 :             : 
     247                 :             : 
     248                 :             : /*
     249                 :             :    GetConstFromFifoQueue - retrieves a const symbol
     250                 :             :                            from a fifo queue.
     251                 :             : */
     252                 :             : 
     253                 :         120 : extern "C" void FifoQueue_GetConstFromFifoQueue (unsigned int *c)
     254                 :             : {
     255                 :         120 :   GetFrom (&const_, c);
     256                 :         120 : }
     257                 :             : 
     258                 :             : 
     259                 :             : /*
     260                 :             :    PutConstructorIntoFifoQueue - places a constructor symbol
     261                 :             :                                  into a fifo queue.
     262                 :             : */
     263                 :             : 
     264                 :       36458 : extern "C" void FifoQueue_PutConstructorIntoFifoQueue (unsigned int c)
     265                 :             : {
     266                 :       36458 :   PutInto (&constructor, c);
     267                 :       36458 : }
     268                 :             : 
     269                 :             : 
     270                 :             : /*
     271                 :             :    GetConstructorFromFifoQueue - retrieves a constructor symbol
     272                 :             :                                  from a fifo queue.
     273                 :             : */
     274                 :             : 
     275                 :       36452 : extern "C" void FifoQueue_GetConstructorFromFifoQueue (unsigned int *c)
     276                 :             : {
     277                 :       36452 :   GetFrom (&constructor, c);
     278                 :       36452 : }
     279                 :             : 
     280                 :       15229 : extern "C" void _M2_FifoQueue_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
     281                 :             : {
     282                 :       15229 :   Init (&const_);
     283                 :       15229 :   Init (&set);
     284                 :       15229 :   Init (&enumeration);
     285                 :       15229 :   Init (&subrange);
     286                 :       15229 :   Init (&constructor);
     287                 :       15229 : }
     288                 :             : 
     289                 :           0 : extern "C" void _M2_FifoQueue_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
     290                 :             : {
     291                 :           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.