LCOV - code coverage report
Current view: top level - gcc/m2/gm2-gcc - m2configure.cc (source / functions) Coverage Total Hit
Test: gcc.info Lines: 50.0 % 30 15
Test Date: 2026-02-28 14:20:25 Functions: 66.7 % 3 2
Legend: Lines:     hit not hit

            Line data    Source code
       1              : /* m2configure.cc provides an interface to some configuration values.
       2              : 
       3              : Copyright (C) 2022-2026 Free Software Foundation, Inc.
       4              : Contributed by Gaius Mulley <gaius@glam.ac.uk>.
       5              : 
       6              : This file is part of GNU Modula-2.
       7              : 
       8              : GNU Modula-2 is free software; you can redistribute it and/or modify
       9              : it under the terms of the GNU General Public License as published by
      10              : the Free Software Foundation; either version 3, or (at your option)
      11              : any later version.
      12              : 
      13              : GNU Modula-2 is distributed in the hope that it will be useful, but
      14              : WITHOUT ANY WARRANTY; without even the implied warranty of
      15              : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      16              : General Public License for more details.
      17              : 
      18              : You should have received a copy of the GNU General Public License
      19              : along with GNU Modula-2; see the file COPYING3.  If not see
      20              : <http://www.gnu.org/licenses/>.  */
      21              : 
      22              : #include "config.h"
      23              : #include "system.h"
      24              : #include "libiberty.h"
      25              : 
      26              : #include "gcc-consolidation.h"
      27              : 
      28              : #include "../gm2-lang.h"
      29              : #include "../m2-tree.h"
      30              : #include "m2convert.h"
      31              : 
      32              : /* Prototypes.  */
      33              : 
      34              : #define m2configure_c
      35              : 
      36              : #include "m2assert.h"
      37              : #include "m2builtins.h"
      38              : #include "m2convert.h"
      39              : #include "m2decl.h"
      40              : #include "m2expr.h"
      41              : #include "m2options.h"
      42              : #include "m2configure.h"
      43              : 
      44              : #include "m2/gm2version.h"
      45              : #include "m2/gm2config.h"
      46              : 
      47              : #define CPPPROGRAM  "cc1"
      48              : 
      49              : 
      50              : /* gen_gm2_libexec returns a string containing libexec /
      51              :    DEFAULT_TARGET_MACHINE string / DEFAULT_TARGET_MACHINE.  */
      52              : 
      53              : static char *
      54            0 : gen_gm2_libexec (const char *libexec)
      55              : {
      56            0 :   int l = strlen (libexec) + 1 + strlen (DEFAULT_TARGET_MACHINE) + 1
      57            0 :           + strlen (DEFAULT_TARGET_VERSION) + 1;
      58            0 :   char *s = (char *)xmalloc (l);
      59            0 :   char dir_sep[2];
      60              : 
      61            0 :   dir_sep[0] = DIR_SEPARATOR;
      62            0 :   dir_sep[1] = (char)0;
      63              : 
      64            0 :   strcpy (s, libexec);
      65            0 :   strcat (s, dir_sep);
      66            0 :   strcat (s, DEFAULT_TARGET_MACHINE);
      67            0 :   strcat (s, dir_sep);
      68            0 :   strcat (s, DEFAULT_TARGET_VERSION);
      69            0 :   return s;
      70              : }
      71              : 
      72              : /* FullPathCPP returns the fullpath and program name to cpp.  */
      73              : 
      74              : char *
      75         2868 : m2configure_FullPathCPP (void)
      76              : {
      77         2868 :   if (M2Options_GetCpp ())
      78              :     {
      79         2868 :       char *path = (char *) M2Options_GetB ();
      80              : 
      81         2868 :       if (path == NULL)
      82            0 :         path = gen_gm2_libexec (STANDARD_LIBEXEC_PREFIX);
      83              : 
      84         2868 :       if (strcmp (path, "") == 0)
      85            0 :         return xstrdup (CPPPROGRAM);
      86              : 
      87         2868 :       char *full = (char *)xmalloc (strlen (path) + 1 + strlen (CPPPROGRAM) + 1);
      88         2868 :       strcpy (full, path);
      89         2868 :       char *sep = (char *)alloca (2);
      90         2868 :       sep[0] = DIR_SEPARATOR;
      91         2868 :       sep[1] = (char)0;
      92         2868 :       strcat (full, sep);
      93         2868 :       strcat (full, CPPPROGRAM);
      94         2868 :       return full;
      95              :     }
      96              :   return NULL;
      97              : }
      98              : 
      99              : /* Return the value of TARGET_IEEEQUAD_DEFAULT.  If it is undefined
     100              :    -1 is returned.  A value of 0 indicates the default target long
     101              :    double uses the IBM 128 representation.  A value of 1 indicates
     102              :    the default target long double (LONGREAL) is __float128.  */
     103              : 
     104              : int
     105        14952 : m2configure_TargetIEEEQuadDefault (void)
     106              : {
     107              : #ifdef TARGET_IEEEQUAD_DEFAULT
     108              :   return TARGET_IEEEQUAD_DEFAULT;
     109              : #else
     110        14952 :   return -1;
     111              : #endif
     112              : }
        

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.