LCOV - code coverage report
Current view: top level - /mnt/build/buildbot/bld/build-lcov/gcc/m2/gm2-compiler-boot - M2Comp.c (source / functions) Coverage Total Hit
Test: gcc.info Lines: 58.4 % 613 358
Test Date: 2026-02-28 14:20:25 Functions: 60.5 % 38 23
Legend: Lines:     hit not hit

            Line data    Source code
       1              : /* do not edit automatically generated by mc from M2Comp.  */
       2              : /* M2Comp.mod continually calls the compiler for every source file.
       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 "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              : #   if !defined (TRUE)
      35              : #      define TRUE (1==1)
      36              : #   endif
      37              : 
      38              : #   if !defined (FALSE)
      39              : #      define FALSE (1==0)
      40              : #   endif
      41              : 
      42              : #   include "Gmcrts.h"
      43              : #if defined(__cplusplus)
      44              : #   undef NULL
      45              : #   define NULL 0
      46              : #endif
      47              : #define _M2Comp_C
      48              : 
      49              : #include "GM2Comp.h"
      50              : #   include "GM2Pass.h"
      51              : #   include "GM2Reserved.h"
      52              : #   include "GM2Search.h"
      53              : #   include "GM2Code.h"
      54              : #   include "GM2LexBuf.h"
      55              : #   include "GM2FileName.h"
      56              : #   include "GM2Preprocess.h"
      57              : #   include "Glibc.h"
      58              : #   include "GM2Error.h"
      59              : #   include "GM2MetaError.h"
      60              : #   include "GFormatStrings.h"
      61              : #   include "GP0SymBuild.h"
      62              : #   include "GM2Debug.h"
      63              : #   include "Gm2flex.h"
      64              : #   include "Gm2block.h"
      65              : #   include "GP0SyntaxCheck.h"
      66              : #   include "GP1Build.h"
      67              : #   include "GP2Build.h"
      68              : #   include "GPCBuild.h"
      69              : #   include "GP3Build.h"
      70              : #   include "GPHBuild.h"
      71              : #   include "GPCSymBuild.h"
      72              : #   include "GDynamicStrings.h"
      73              : #   include "GM2Diagnostic.h"
      74              : #   include "GM2Batch.h"
      75              : #   include "GSymbolTable.h"
      76              : #   include "GFIO.h"
      77              : #   include "GSFIO.h"
      78              : #   include "GNameKey.h"
      79              : #   include "GM2Printf.h"
      80              : #   include "GM2Quiet.h"
      81              : #   include "GM2Options.h"
      82              : #   include "GPathName.h"
      83              : #   include "GLists.h"
      84              : #   include "GIndexing.h"
      85              : 
      86              : #   define Debugging false
      87              : static enum {M2Comp_None, M2Comp_Definition, M2Comp_Implementation, M2Comp_Program} ModuleType;
      88              : static Indexing_Index DepContent;
      89              : static DynamicStrings_String DepOutput;
      90              : 
      91              : /*
      92              :    compile - compile the filename.
      93              : */
      94              : 
      95              : extern "C" void M2Comp_compile (void * filename);
      96              : 
      97              : /*
      98              :    CompilingDefinitionModule - returns true if the current module being
      99              :                                compiled is a definition module.
     100              : */
     101              : 
     102              : extern "C" bool M2Comp_CompilingDefinitionModule (void);
     103              : 
     104              : /*
     105              :    CompilingImplementationModule - returns true if the current module being
     106              :                                    compiled is an implementation module.
     107              : */
     108              : 
     109              : extern "C" bool M2Comp_CompilingImplementationModule (void);
     110              : 
     111              : /*
     112              :    CompilingProgramModule - returns true if the current module being
     113              :                             compiled is a program module.
     114              : */
     115              : 
     116              : extern "C" bool M2Comp_CompilingProgramModule (void);
     117              : 
     118              : /*
     119              :    NeedToParseImplementation -
     120              : */
     121              : 
     122              : static bool NeedToParseImplementation (unsigned int sym);
     123              : 
     124              : /*
     125              :    GenerateDefDependency - generate a single dependency for the definition module
     126              :                            providing that it can be found and is not blocked by -MM.
     127              : */
     128              : 
     129              : static void GenerateDefDependency (unsigned int module);
     130              : 
     131              : /*
     132              :    GenerateDependenciesFromImport - lookup the module associated with the import
     133              :                                     and call GenerateDefDependency.
     134              : */
     135              : 
     136              : static void GenerateDependenciesFromImport (unsigned int import);
     137              : 
     138              : /*
     139              :    GenerateDependenciesFromList - iterative over the import lists and for
     140              :                                   each module issue a dependency.
     141              : */
     142              : 
     143              : static void GenerateDependenciesFromList (Lists_List dep);
     144              : 
     145              : /*
     146              :    GenerateDependencies - generate a list of dependencies for the main module where
     147              :                           the source code is found in sourcefile.
     148              : */
     149              : 
     150              : static void GenerateDependencies (void);
     151              : 
     152              : /*
     153              :    Compile - compile file, s, using a 5 pass technique.
     154              : */
     155              : 
     156              : static void Compile (DynamicStrings_String s);
     157              : 
     158              : /*
     159              :    PopulateResource -
     160              : */
     161              : 
     162              : static void PopulateResource (void);
     163              : 
     164              : /*
     165              :    ExamineHeader - examines up until the ';', '[' or eof and determines if the source file
     166              :                    is a program, implementation/definition module.
     167              : */
     168              : 
     169              : static void ExamineHeader (void * *name, bool *isdefimp, bool *module);
     170              : 
     171              : /*
     172              :    ExamineCompilationUnit - opens the source file to obtain the module name and kind of module.
     173              : */
     174              : 
     175              : static unsigned int ExamineCompilationUnit (void);
     176              : 
     177              : /*
     178              :    PeepInto - peeps into source, s, and initializes a definition/implementation or
     179              :               program module accordingly.
     180              : */
     181              : 
     182              : static void PeepInto (DynamicStrings_String s);
     183              : 
     184              : /*
     185              :    qprintLibName - print the libname.
     186              : */
     187              : 
     188              : static void qprintLibName (DynamicStrings_String LibName);
     189              : 
     190              : /*
     191              :    CreateFileStem - create a stem using the template LibName_ModuleName.
     192              : */
     193              : 
     194              : static DynamicStrings_String CreateFileStem (DynamicStrings_String SymName, DynamicStrings_String LibName);
     195              : static DynamicStrings_String BaseName (DynamicStrings_String Path, bool CutExt);
     196              : 
     197              : /*
     198              :    IsLibrary - return TRUE if line contains a library module.
     199              : */
     200              : 
     201              : static bool IsLibrary (DynamicStrings_String line);
     202              : 
     203              : /*
     204              :    IsUnique - return TRUE if line is unique in array content.
     205              : */
     206              : 
     207              : static bool IsUnique (Indexing_Index content, DynamicStrings_String line);
     208              : 
     209              : /*
     210              :    Append - append line to array content.
     211              : */
     212              : 
     213              : static void Append (Indexing_Index content, DynamicStrings_String line);
     214              : 
     215              : /*
     216              :    MergeDep - if line is unique in array content then append.
     217              :               Check to see (and ignore) if line is a library module and -MM
     218              :               is present.
     219              : */
     220              : 
     221              : static void MergeDep (Indexing_Index content, DynamicStrings_String line);
     222              : 
     223              : /*
     224              :    splitLine - split a line into words separated by spaces
     225              :                and call MergeDep on each word.
     226              : */
     227              : 
     228              : static void splitLine (Indexing_Index content, DynamicStrings_String line);
     229              : 
     230              : /*
     231              :    MergeDeps - foreach dependency in ChildDep do
     232              :                   add dependency to ChildDep if not already present.
     233              :                ignore all ChildDep if -MM and libname # "".
     234              : */
     235              : 
     236              : static void MergeDeps (Indexing_Index content, DynamicStrings_String ChildDep, DynamicStrings_String LibName);
     237              : 
     238              : /*
     239              :    GetRuleTarget - return the rule target which is derived from the -MT arg
     240              :                    or -o arg or filename.mod.
     241              : */
     242              : 
     243              : static DynamicStrings_String GetRuleTarget (DynamicStrings_String filename);
     244              : 
     245              : /*
     246              :    ReadDepContents - reads the contents of file dep into a dynamic array
     247              :                      and return the array.  The file will be split into words
     248              :                      and each word stored as an entry in the array.
     249              : */
     250              : 
     251              : static Indexing_Index ReadDepContents (DynamicStrings_String filename, DynamicStrings_String dep);
     252              : 
     253              : /*
     254              :    WriteDep - write the dependencies and target to file out.
     255              : */
     256              : 
     257              : static void WriteDep (Indexing_Index contents, FIO_File out);
     258              : 
     259              : /*
     260              :    WritePhonyDep - write the dependencies and target to file out.
     261              : */
     262              : 
     263              : static void WritePhonyDep (Indexing_Index contents, FIO_File out);
     264              : 
     265              : /*
     266              :    WriteDepContents - write the dynamic array to filename dep (or StdOut) if
     267              :                       the GetMF file is NIL.
     268              : */
     269              : 
     270              : static void WriteDepContents (DynamicStrings_String dep, Indexing_Index contents);
     271              : 
     272              : /*
     273              :    CreateDepFilename - return a dependency filename associated with filename or use GetMF.
     274              : */
     275              : 
     276              : static DynamicStrings_String CreateDepFilename (DynamicStrings_String filename);
     277              : 
     278              : /*
     279              :    Pass0CheckDef -
     280              : */
     281              : 
     282              : static bool Pass0CheckDef (unsigned int sym);
     283              : 
     284              : /*
     285              :    Pass0CheckMod -
     286              : */
     287              : 
     288              : static bool Pass0CheckMod (unsigned int sym, DynamicStrings_String PPSource);
     289              : 
     290              : /*
     291              :    DoPass0 -
     292              : */
     293              : 
     294              : static void DoPass0 (DynamicStrings_String filename);
     295              : 
     296              : /*
     297              :    DoPass1 - parses the sources of all modules necessary to compile
     298              :              the required module, Main.
     299              : */
     300              : 
     301              : static void DoPass1 (void);
     302              : 
     303              : /*
     304              :    DoPass2 - parses the sources of all modules necessary to compile
     305              :              the required module, Main.
     306              : */
     307              : 
     308              : static void DoPass2 (void);
     309              : 
     310              : /*
     311              :    DoPassC - parses the sources of all modules necessary to compile
     312              :              the required module, Main.
     313              : */
     314              : 
     315              : static void DoPassC (void);
     316              : 
     317              : /*
     318              :    DoPass3 - parses the sources of all modules necessary to compile
     319              :              the required module, Main.
     320              : */
     321              : 
     322              : static void DoPass3 (void);
     323              : 
     324              : 
     325              : /*
     326              :    NeedToParseImplementation -
     327              : */
     328              : 
     329       159015 : static bool NeedToParseImplementation (unsigned int sym)
     330              : {
     331       159015 :   return ((((SymbolTable_IsDefImp (sym)) && (SymbolTable_IsHiddenTypeDeclared (sym))) && M2Options_ExtendedOpaque) || ((SymbolTable_IsDefImp (sym)) && (SymbolTable_IsBuiltinInModule (sym)))) || (M2Options_WholeProgram && (! (SymbolTable_IsDefinitionForC (sym))));
     332              :   /* static analysis guarentees a RETURN statement will be used before here.  */
     333              :   __builtin_unreachable ();
     334              : }
     335              : 
     336              : 
     337              : /*
     338              :    GenerateDefDependency - generate a single dependency for the definition module
     339              :                            providing that it can be found and is not blocked by -MM.
     340              : */
     341              : 
     342            0 : static void GenerateDefDependency (unsigned int module)
     343              : {
     344            0 :   DynamicStrings_String stem;
     345            0 :   DynamicStrings_String fullpath;
     346            0 :   DynamicStrings_String named;
     347              : 
     348            0 :   stem = DynamicStrings_InitStringCharStar (NameKey_KeyToCharStar (SymbolTable_GetSymName (module)));
     349            0 :   named = static_cast<DynamicStrings_String> (NULL);
     350            0 :   if (M2Search_FindSourceDefFile (stem, &fullpath, &named))
     351              :     {
     352              :       /* avoid gcc warning by using compound statement even if not strictly necessary.  */
     353            0 :       if ((DynamicStrings_EqualArray (named, (const char *) "", 0)) || (! (M2Options_GetMM ())))
     354              :         {
     355            0 :           MergeDep (DepContent, fullpath);
     356              :         }
     357              :       else
     358              :         {
     359            0 :           fullpath = DynamicStrings_KillString (fullpath);
     360              :         }
     361              :     }
     362            0 :   stem = DynamicStrings_KillString (stem);
     363            0 :   named = DynamicStrings_KillString (named);
     364            0 : }
     365              : 
     366              : 
     367              : /*
     368              :    GenerateDependenciesFromImport - lookup the module associated with the import
     369              :                                     and call GenerateDefDependency.
     370              : */
     371              : 
     372            0 : static void GenerateDependenciesFromImport (unsigned int import)
     373              : {
     374            0 :   unsigned int module;
     375              : 
     376            0 :   M2Debug_Assert (SymbolTable_IsImport (import));
     377            0 :   module = SymbolTable_GetImportModule (import);
     378            0 :   GenerateDefDependency (module);
     379            0 : }
     380              : 
     381              : 
     382              : /*
     383              :    GenerateDependenciesFromList - iterative over the import lists and for
     384              :                                   each module issue a dependency.
     385              : */
     386              : 
     387            0 : static void GenerateDependenciesFromList (Lists_List dep)
     388              : {
     389            0 :   Lists_List importList;
     390            0 :   unsigned int import;
     391            0 :   unsigned int i;
     392            0 :   unsigned int n;
     393            0 :   unsigned int j;
     394            0 :   unsigned int m;
     395              : 
     396            0 :   n = Lists_NoOfItemsInList (dep);
     397            0 :   i = 1;
     398            0 :   while (i <= n)
     399              :     {
     400            0 :       import = static_cast<unsigned int> (Lists_GetItemFromList (dep, i));
     401            0 :       if (SymbolTable_IsImportStatement (import))
     402              :         {
     403            0 :           importList = SymbolTable_GetImportStatementList (import);
     404            0 :           j = 1;
     405            0 :           m = Lists_NoOfItemsInList (importList);
     406            0 :           while (j <= m)
     407              :             {
     408            0 :               import = static_cast<unsigned int> (Lists_GetItemFromList (importList, j));
     409            0 :               GenerateDependenciesFromImport (import);
     410            0 :               j += 1;
     411              :             }
     412              :         }
     413              :       else
     414              :         {
     415            0 :           GenerateDependenciesFromImport (import);
     416              :         }
     417            0 :       i += 1;
     418              :     }
     419            0 : }
     420              : 
     421              : 
     422              : /*
     423              :    GenerateDependencies - generate a list of dependencies for the main module where
     424              :                           the source code is found in sourcefile.
     425              : */
     426              : 
     427            0 : static void GenerateDependencies (void)
     428              : {
     429            0 :   if (SymbolTable_IsDefImp (SymbolTable_GetMainModule ()))
     430              :     {
     431            0 :       GenerateDependenciesFromList (SymbolTable_GetModuleDefImportStatementList (SymbolTable_GetMainModule ()));
     432            0 :       GenerateDefDependency (SymbolTable_GetMainModule ());
     433              :     }
     434            0 :   GenerateDependenciesFromList (SymbolTable_GetModuleModImportStatementList (SymbolTable_GetMainModule ()));
     435            0 :   WriteDepContents (DepOutput, DepContent);
     436            0 : }
     437              : 
     438              : 
     439              : /*
     440              :    Compile - compile file, s, using a 5 pass technique.
     441              : */
     442              : 
     443        14952 : static void Compile (DynamicStrings_String s)
     444              : {
     445        14952 :   DoPass0 (s);
     446        14910 :   M2Error_FlushWarnings ();
     447        14910 :   M2Error_FlushErrors ();
     448        14820 :   M2LexBuf_ResetForNewPass ();
     449        14820 :   M2Error_ResetErrorScope ();
     450        14820 :   M2Quiet_qprintf0 ((const char *) "Pass 1: scopes, enumerated types, imports and exports\\n", 55);
     451        14820 :   DoPass1 ();
     452        14814 :   M2Error_FlushWarnings ();
     453        14814 :   M2Error_FlushErrors ();
     454        14790 :   if ((M2Options_GetM ()) || (M2Options_GetMM ()))
     455              :     {
     456            0 :       GenerateDependencies ();
     457              :     }
     458        14790 :   if (! M2Options_PPonly)
     459              :     {
     460        14790 :       M2Quiet_qprintf0 ((const char *) "Pass 2: constants and types\\n", 29);
     461        14790 :       M2LexBuf_ResetForNewPass ();
     462        14790 :       M2Error_ResetErrorScope ();
     463        14790 :       DoPass2 ();
     464        14772 :       M2Error_FlushWarnings ();
     465        14772 :       M2Error_FlushErrors ();
     466        14688 :       M2Quiet_qprintf0 ((const char *) "Pass C: aggregate constants\\n", 29);
     467        14688 :       M2LexBuf_ResetForNewPass ();
     468        14688 :       M2Error_ResetErrorScope ();
     469        14688 :       DoPassC ();
     470        14658 :       M2Error_FlushWarnings ();
     471        14658 :       M2Error_FlushErrors ();
     472        14577 :       M2Quiet_qprintf0 ((const char *) "Pass 3: quadruple generation\\n", 30);
     473        14577 :       M2LexBuf_ResetForNewPass ();
     474        14577 :       M2Error_ResetErrorScope ();
     475        14577 :       DoPass3 ();
     476        14363 :       M2Error_FlushWarnings ();
     477        14363 :       M2Error_FlushErrors ();
     478        13940 :       M2Quiet_qprintf0 ((const char *) "Pass 4: gcc tree generation\\n", 29);
     479        13940 :       M2Code_Code ();
     480        13652 :       M2Error_FlushWarnings ();
     481        13652 :       M2Error_FlushErrors ();
     482              :     }
     483        13418 : }
     484              : 
     485              : 
     486              : /*
     487              :    PopulateResource -
     488              : */
     489              : 
     490        13418 : static void PopulateResource (void)
     491              : {
     492        13418 :   M2Diagnostic_Diagnostic StatsMemDiag;
     493              : 
     494        13418 :   if (M2Options_MemReport)
     495              :     {
     496            0 :       StatsMemDiag = M2Diagnostic_InitMemDiagnostic ((const char *) "M2Comp:statistics", 17, (const char *) "total source lines {1d} total constants {2d} total types {3d}", 61);
     497            0 :       M2Diagnostic_MemSet (StatsMemDiag, 1, m2flex_GetTotalLines ());
     498            0 :       M2Diagnostic_MemSet (StatsMemDiag, 2, m2block_GetTotalConstants ());
     499            0 :       M2Diagnostic_MemSet (StatsMemDiag, 3, m2block_GetGlobalTypes ());
     500              :     }
     501        13418 : }
     502              : 
     503              : 
     504              : /*
     505              :    ExamineHeader - examines up until the ';', '[' or eof and determines if the source file
     506              :                    is a program, implementation/definition module.
     507              : */
     508              : 
     509        14951 : static void ExamineHeader (void * *name, bool *isdefimp, bool *module)
     510              : {
     511              :   /* Stop if we see one of eof ';' '['.  */
     512        29896 :   while (((M2LexBuf_currenttoken != M2Reserved_eoftok) && (M2LexBuf_currenttoken != M2Reserved_semicolontok)) && (M2LexBuf_currenttoken != M2Reserved_lsbratok))
     513              :     {
     514        14945 :       if ((*name) == NULL)
     515              :         {
     516        14945 :           if ((M2LexBuf_currenttoken == M2Reserved_implementationtok) || (M2LexBuf_currenttoken == M2Reserved_definitiontok))
     517              :             {
     518         3079 :               (*isdefimp) = true;
     519         3079 :               M2LexBuf_GetToken ();
     520              :             }
     521        14945 :           if (M2LexBuf_currenttoken == M2Reserved_moduletok)
     522              :             {
     523        14945 :               (*module) = true;
     524        14945 :               M2LexBuf_GetToken ();
     525        14945 :               if (M2LexBuf_currenttoken == M2Reserved_identtok)
     526              :                 {
     527        14945 :                   (*name) = M2LexBuf_currentstring;
     528              :                 }
     529              :             }
     530              :         }
     531        14945 :       M2LexBuf_GetToken ();
     532              :     }
     533        14951 : }
     534              : 
     535              : 
     536              : /*
     537              :    ExamineCompilationUnit - opens the source file to obtain the module name and kind of module.
     538              : */
     539              : 
     540        14951 : static unsigned int ExamineCompilationUnit (void)
     541              : {
     542        14951 :   DynamicStrings_String Message;
     543        14951 :   void * name;
     544        14951 :   bool module;
     545        14951 :   bool isdefimp;
     546              : 
     547        14951 :   name = NULL;
     548        14951 :   isdefimp = false;  /* default to program module  */
     549        14951 :   module = false;  /* Seen module keyword?  */
     550        14951 :   ExamineHeader (&name, &isdefimp, &module);  /* Seen module keyword?  */
     551        14951 :   if (name == NULL)
     552              :     {
     553            6 :       if (module)
     554              :         {
     555            0 :           Message = M2MetaError_MetaString0 (DynamicStrings_InitString ((const char *) "no {%kMODULE} keyword seen", 26));
     556              :         }
     557              :       else
     558              :         {
     559            6 :           Message = M2MetaError_MetaString0 (DynamicStrings_InitString ((const char *) "no module ident seen", 20));
     560              :         }
     561            6 :       m2flex_M2Error (DynamicStrings_string (Message));
     562            6 :       libc_exit (1);
     563              :     }
     564              :   else
     565              :     {
     566              :       /* The token used is will be overwritten when P0 is underway.
     567              :          At this point we are determining the module kind and the tokens
     568              :          read will be discarded (see ReInitialize below).  */
     569        14945 :       if (isdefimp)
     570              :         {
     571         3079 :           return M2Batch_MakeImplementationSource (M2LexBuf_BuiltinTokenNo, NameKey_makekey (name));
     572              :         }
     573              :       else
     574              :         {
     575        11866 :           return M2Batch_MakeProgramSource (M2LexBuf_BuiltinTokenNo, NameKey_makekey (name));
     576              :         }
     577              :     }
     578              :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/M2Comp.def", 20, 1);
     579              :   __builtin_unreachable ();
     580              : }
     581              : 
     582              : 
     583              : /*
     584              :    PeepInto - peeps into source, s, and initializes a definition/implementation or
     585              :               program module accordingly.
     586              : */
     587              : 
     588        14952 : static void PeepInto (DynamicStrings_String s)
     589              : {
     590        14952 :   unsigned int mainModule;
     591              : 
     592        14952 :   if (M2LexBuf_OpenSource (s))
     593              :     {
     594        14951 :       mainModule = ExamineCompilationUnit ();
     595        14945 :       if (mainModule != SymbolTable_NulSym)
     596              :         {
     597        14945 :           SymbolTable_SetMainModule (mainModule);
     598              :         }
     599        14945 :       M2LexBuf_CloseSource ();
     600        14945 :       M2LexBuf_ReInitialize ();
     601              :     }
     602              :   else
     603              :     {
     604            1 :       M2Printf_fprintf1 (FIO_StdErr, (const char *) "failed to open %s\\n", 19, (const unsigned char *) &s, (sizeof (s)-1));
     605            1 :       libc_exit (1);
     606              :     }
     607        14945 : }
     608              : 
     609              : 
     610              : /*
     611              :    qprintLibName - print the libname.
     612              : */
     613              : 
     614       244843 : static void qprintLibName (DynamicStrings_String LibName)
     615              : {
     616       244843 :   if ((LibName != NULL) && (! (DynamicStrings_EqualArray (LibName, (const char *) "", 0))))
     617              :     {
     618       226287 :       M2Quiet_qprintf1 ((const char *) " [%s]", 5, (const unsigned char *) &LibName, (sizeof (LibName)-1));
     619              :     }
     620       244843 : }
     621              : 
     622              : 
     623              : /*
     624              :    CreateFileStem - create a stem using the template LibName_ModuleName.
     625              : */
     626              : 
     627       229968 : static DynamicStrings_String CreateFileStem (DynamicStrings_String SymName, DynamicStrings_String LibName)
     628              : {
     629       229968 :   if ((DynamicStrings_Length (LibName)) > 0)
     630              :     {
     631       225663 :       return DynamicStrings_ConCat (DynamicStrings_Dup (LibName), DynamicStrings_ConCat (DynamicStrings_InitStringChar ('_'), SymName));
     632              :     }
     633              :   else
     634              :     {
     635              :       return SymName;
     636              :     }
     637              :   /* static analysis guarentees a RETURN statement will be used before here.  */
     638              :   __builtin_unreachable ();
     639              : }
     640              : 
     641            0 : static DynamicStrings_String BaseName (DynamicStrings_String Path, bool CutExt)
     642              : {
     643            0 :   int ext;
     644            0 :   int basename;
     645              : 
     646              :   /* 
     647              :    Return basename of path.  CutExt determines whether the .extension
     648              :    should be removed.
     649              :   */
     650            0 :   basename = DynamicStrings_RIndex (Path, '/', 0);
     651            0 :   if (basename == -1)
     652              :     {
     653              :       basename = 0;
     654              :     }
     655              :   else
     656              :     {
     657            0 :       basename = basename+1;
     658              :     }
     659            0 :   if (CutExt)
     660              :     {
     661              :       /* avoid dangling else.  */
     662            0 :       ext = DynamicStrings_RIndex (Path, '.', 0);
     663            0 :       if (ext == -1)
     664              :         {
     665            0 :           ext = 0;
     666              :         }
     667              :     }
     668              :   else
     669              :     {
     670              :       ext = 0;
     671              :     }
     672            0 :   return DynamicStrings_Slice (Path, basename, ext);
     673              :   /* static analysis guarentees a RETURN statement will be used before here.  */
     674              :   __builtin_unreachable ();
     675              : }
     676              : 
     677              : 
     678              : /*
     679              :    IsLibrary - return TRUE if line contains a library module.
     680              : */
     681              : 
     682            0 : static bool IsLibrary (DynamicStrings_String line)
     683              : {
     684            0 :   DynamicStrings_String moduleName;
     685            0 :   DynamicStrings_String libname;
     686            0 :   DynamicStrings_String filename;
     687            0 :   bool result;
     688              : 
     689            0 :   result = false;
     690            0 :   moduleName = BaseName (line, true);
     691            0 :   filename = static_cast<DynamicStrings_String> (NULL);
     692            0 :   libname = static_cast<DynamicStrings_String> (NULL);
     693            0 :   if (M2Search_FindSourceDefFile (moduleName, &filename, &libname))
     694              :     {
     695            0 :       moduleName = DynamicStrings_KillString (moduleName);
     696            0 :       if ((DynamicStrings_Length (libname)) > 0)
     697              :         {
     698            0 :           moduleName = BaseName (line, false);
     699            0 :           line = BaseName (line, false);
     700            0 :           result = DynamicStrings_Equal (line, moduleName);
     701            0 :           line = DynamicStrings_KillString (line);
     702              :         }
     703              :     }
     704            0 :   libname = DynamicStrings_KillString (libname);
     705            0 :   filename = DynamicStrings_KillString (filename);
     706            0 :   moduleName = DynamicStrings_KillString (moduleName);
     707            0 :   return result;
     708              :   /* static analysis guarentees a RETURN statement will be used before here.  */
     709              :   __builtin_unreachable ();
     710              : }
     711              : 
     712              : 
     713              : /*
     714              :    IsUnique - return TRUE if line is unique in array content.
     715              : */
     716              : 
     717            0 : static bool IsUnique (Indexing_Index content, DynamicStrings_String line)
     718              : {
     719            0 :   unsigned int high;
     720            0 :   unsigned int i;
     721              : 
     722            0 :   high = Indexing_HighIndice (content);
     723            0 :   i = 1;
     724            0 :   while (i <= high)
     725              :     {
     726            0 :       if (DynamicStrings_Equal (line, static_cast<DynamicStrings_String> (Indexing_GetIndice (content, i))))
     727              :         {
     728              :           return false;
     729              :         }
     730            0 :       i += 1;
     731              :     }
     732              :   return true;
     733              :   /* static analysis guarentees a RETURN statement will be used before here.  */
     734              :   __builtin_unreachable ();
     735              : }
     736              : 
     737              : 
     738              : /*
     739              :    Append - append line to array content.
     740              : */
     741              : 
     742            0 : static void Append (Indexing_Index content, DynamicStrings_String line)
     743              : {
     744            0 :   unsigned int high;
     745              : 
     746            0 :   high = Indexing_HighIndice (content);
     747            0 :   Indexing_PutIndice (content, high+1, reinterpret_cast <void *> (line));
     748            0 : }
     749              : 
     750              : 
     751              : /*
     752              :    MergeDep - if line is unique in array content then append.
     753              :               Check to see (and ignore) if line is a library module and -MM
     754              :               is present.
     755              : */
     756              : 
     757            0 : static void MergeDep (Indexing_Index content, DynamicStrings_String line)
     758              : {
     759            0 :   line = DynamicStrings_RemoveWhitePrefix (line);
     760            0 :   if ((! (DynamicStrings_EqualArray (line, (const char *) "\\", 1))) && ((DynamicStrings_Length (line)) > 0))
     761              :     {
     762              :       /* Ignore if -MM and is a library module.  */
     763            0 :       if (! ((M2Options_GetMM ()) && (IsLibrary (line))))
     764              :         {
     765            0 :           if (IsUnique (content, line))
     766              :             {
     767            0 :               Append (content, line);
     768              :             }
     769              :         }
     770              :     }
     771            0 : }
     772              : 
     773              : 
     774              : /*
     775              :    splitLine - split a line into words separated by spaces
     776              :                and call MergeDep on each word.
     777              : */
     778              : 
     779            0 : static void splitLine (Indexing_Index content, DynamicStrings_String line)
     780              : {
     781            0 :   DynamicStrings_String word;
     782            0 :   int space;
     783              : 
     784            0 :   do {
     785            0 :     line = DynamicStrings_RemoveWhitePrefix (line);
     786            0 :     space = DynamicStrings_Index (line, ' ', 0);
     787            0 :     if (space > 0)
     788              :       {
     789            0 :         word = DynamicStrings_Slice (line, 0, space);
     790            0 :         word = DynamicStrings_RemoveWhitePrefix (word);
     791            0 :         if ((DynamicStrings_Length (word)) > 0)
     792              :           {
     793            0 :             MergeDep (content, word);
     794              :           }
     795            0 :         line = DynamicStrings_Slice (line, space, 0);
     796              :       }
     797            0 :     else if (space < 0)
     798              :       {
     799              :         /* avoid dangling else.  */
     800            0 :         MergeDep (content, line);
     801              :       }
     802            0 :   } while (! (space <= 0));
     803            0 : }
     804              : 
     805              : 
     806              : /*
     807              :    MergeDeps - foreach dependency in ChildDep do
     808              :                   add dependency to ChildDep if not already present.
     809              :                ignore all ChildDep if -MM and libname # "".
     810              : */
     811              : 
     812       229962 : static void MergeDeps (Indexing_Index content, DynamicStrings_String ChildDep, DynamicStrings_String LibName)
     813              : {
     814       229962 :   DynamicStrings_String line;
     815       229962 :   FIO_File in;
     816              : 
     817       229962 :   if ((content != NULL) && (! ((M2Options_GetMM ()) && ((DynamicStrings_Length (LibName)) > 0))))
     818              :     {
     819            0 :       in = SFIO_OpenToRead (ChildDep);
     820            0 :       if (FIO_IsNoError (in))
     821              :         {
     822            0 :           line = SFIO_ReadS (in);  /* Skip over first line containing the module object.  */
     823            0 :           while (! (FIO_EOF (in)))  /* Skip over first line containing the module object.  */
     824              :             {
     825            0 :               line = SFIO_ReadS (in);
     826            0 :               splitLine (content, line);
     827              :             }
     828              :         }
     829            0 :       FIO_Close (in);
     830              :     }
     831       229962 : }
     832              : 
     833              : 
     834              : /*
     835              :    GetRuleTarget - return the rule target which is derived from the -MT arg
     836              :                    or -o arg or filename.mod.
     837              : */
     838              : 
     839            0 : static DynamicStrings_String GetRuleTarget (DynamicStrings_String filename)
     840              : {
     841            0 :   if ((M2Options_GetDepTarget ()) != NULL)
     842              :     {
     843            0 :       return DynamicStrings_InitStringCharStar (M2Options_GetDepTarget ());
     844              :     }
     845            0 :   else if ((M2Options_GetMF ()) != NULL)
     846              :     {
     847              :       /* avoid dangling else.  */
     848            0 :       return DynamicStrings_InitStringCharStar (M2Options_GetMF ());
     849              :     }
     850              :   else
     851              :     {
     852              :       /* avoid dangling else.  */
     853            0 :       return DynamicStrings_ConCat (BaseName (filename, true), DynamicStrings_InitString ((const char *) ".o", 2));
     854              :     }
     855              :   /* static analysis guarentees a RETURN statement will be used before here.  */
     856              :   __builtin_unreachable ();
     857              : }
     858              : 
     859              : 
     860              : /*
     861              :    ReadDepContents - reads the contents of file dep into a dynamic array
     862              :                      and return the array.  The file will be split into words
     863              :                      and each word stored as an entry in the array.
     864              : */
     865              : 
     866        14952 : static Indexing_Index ReadDepContents (DynamicStrings_String filename, DynamicStrings_String dep)
     867              : {
     868        14952 :   Indexing_Index content;
     869        14952 :   DynamicStrings_String line;
     870        14952 :   FIO_File in;
     871              : 
     872        14952 :   content = static_cast<Indexing_Index> (NULL);
     873        14952 :   if ((M2Options_GetM ()) || (M2Options_GetMM ()))
     874              :     {
     875            0 :       in = SFIO_OpenToRead (dep);
     876              :       /* The file might not be created (if -MD or -MMD is used as these options
     877              :          operate without preprocessing) in which case we create an dynamic
     878              :          array with the source filename and target.  */
     879            0 :       content = Indexing_InitIndex (1);
     880            0 :       if (((M2Options_GetMD ()) || (M2Options_GetMMD ())) || (! (FIO_IsNoError (in))))
     881              :         {
     882              :           /* No preprocessing done therefore create first two lines using
     883              :             target and source.  */
     884            0 :           Indexing_PutIndice (content, 1, reinterpret_cast <void *> (DynamicStrings_ConCatChar (GetRuleTarget (filename), ':')));
     885            0 :           Indexing_PutIndice (content, 2, reinterpret_cast <void *> (DynamicStrings_Dup (filename)));
     886              :         }
     887              :       else
     888              :         {
     889              :           /* Preprocessing (using cc1) has created one for us, so we read it.  */
     890            0 :           while (! (FIO_EOF (in)))
     891              :             {
     892            0 :               line = SFIO_ReadS (in);
     893            0 :               splitLine (content, line);
     894              :             }
     895              :         }
     896            0 :       FIO_Close (in);
     897              :     }
     898        14952 :   return content;
     899              :   /* static analysis guarentees a RETURN statement will be used before here.  */
     900              :   __builtin_unreachable ();
     901              : }
     902              : 
     903              : 
     904              : /*
     905              :    WriteDep - write the dependencies and target to file out.
     906              : */
     907              : 
     908            0 : static void WriteDep (Indexing_Index contents, FIO_File out)
     909              : {
     910            0 :   unsigned int i;
     911            0 :   unsigned int h;
     912            0 :   DynamicStrings_String line;
     913              : 
     914            0 :   i = 1;
     915            0 :   h = Indexing_HighIndice (contents);
     916            0 :   while (i <= h)
     917              :     {
     918            0 :       line = static_cast<DynamicStrings_String> (Indexing_GetIndice (contents, i));
     919            0 :       line = DynamicStrings_RemoveWhitePrefix (line);
     920            0 :       if ((DynamicStrings_Length (line)) > 0)
     921              :         {
     922            0 :           if (i == 1)
     923              :             {
     924              :               /* avoid dangling else.  */
     925              :               /* First line is always the target.  */
     926            0 :               if ((M2Options_GetDepTarget ()) != NULL)
     927              :                 {
     928            0 :                   line = DynamicStrings_ConCatChar (DynamicStrings_InitStringCharStar (M2Options_GetDepTarget ()), ':');
     929              :                 }
     930              :             }
     931            0 :           else if (i > 1)
     932              :             {
     933              :               /* avoid dangling else.  */
     934            0 :               FIO_WriteChar (out, ' ');
     935              :             }
     936            0 :           line = SFIO_WriteS (out, line);
     937            0 :           if (i < h)
     938              :             {
     939            0 :               FIO_WriteChar (out, ' ');
     940            0 :               FIO_WriteChar (out, '\\');
     941              :             }
     942            0 :           FIO_WriteLine (out);
     943              :         }
     944            0 :       i += 1;
     945              :     }
     946            0 : }
     947              : 
     948              : 
     949              : /*
     950              :    WritePhonyDep - write the dependencies and target to file out.
     951              : */
     952              : 
     953            0 : static void WritePhonyDep (Indexing_Index contents, FIO_File out)
     954              : {
     955            0 :   unsigned int i;
     956            0 :   unsigned int h;
     957            0 :   DynamicStrings_String line;
     958              : 
     959              :   /* The first line is always the target and the second line is always
     960              :       the top level source file.  */
     961            0 :   i = 3;
     962            0 :   h = Indexing_HighIndice (contents);
     963            0 :   while (i <= h)
     964              :     {
     965            0 :       line = static_cast<DynamicStrings_String> (Indexing_GetIndice (contents, i));
     966            0 :       line = DynamicStrings_RemoveWhitePrefix (line);
     967            0 :       if ((DynamicStrings_Length (line)) > 0)
     968              :         {
     969            0 :           line = SFIO_WriteS (out, line);
     970            0 :           FIO_WriteChar (out, ':');
     971            0 :           FIO_WriteLine (out);
     972              :         }
     973            0 :       i += 1;
     974              :     }
     975            0 : }
     976              : 
     977              : 
     978              : /*
     979              :    WriteDepContents - write the dynamic array to filename dep (or StdOut) if
     980              :                       the GetMF file is NIL.
     981              : */
     982              : 
     983            0 : static void WriteDepContents (DynamicStrings_String dep, Indexing_Index contents)
     984              : {
     985            0 :   FIO_File out;
     986              : 
     987            0 :   if ((contents != NULL) && ((M2Options_GetM ()) || (M2Options_GetMM ())))
     988              :     {
     989            0 :       if ((M2Options_GetMF ()) == NULL)
     990              :         {
     991            0 :           out = FIO_StdOut;
     992            0 :           dep = M2Preprocess_OnExitDelete (dep);
     993              :         }
     994              :       else
     995              :         {
     996            0 :           out = SFIO_OpenToWrite (dep);
     997              :         }
     998            0 :       if (FIO_IsNoError (out))
     999              :         {
    1000            0 :           WriteDep (contents, out);
    1001            0 :           if (M2Options_GetMP ())
    1002              :             {
    1003            0 :               WritePhonyDep (contents, out);
    1004              :             }
    1005              :         }
    1006            0 :       if ((M2Options_GetMF ()) == NULL)
    1007              :         {
    1008            0 :           FIO_FlushOutErr ();
    1009              :         }
    1010              :       else
    1011              :         {
    1012            0 :           FIO_Close (out);
    1013              :         }
    1014            0 :       contents = Indexing_KillIndex (contents);
    1015              :     }
    1016            0 : }
    1017              : 
    1018              : 
    1019              : /*
    1020              :    CreateDepFilename - return a dependency filename associated with filename or use GetMF.
    1021              : */
    1022              : 
    1023        14952 : static DynamicStrings_String CreateDepFilename (DynamicStrings_String filename)
    1024              : {
    1025        14952 :   DynamicStrings_String depfile;
    1026              : 
    1027        14952 :   if ((M2Options_GetMF ()) == NULL)
    1028              :     {
    1029        14952 :       depfile = M2Preprocess_MakeSaveTempsFileNameExt (filename, DynamicStrings_InitString ((const char *) ".d", 2));
    1030        14952 :       return M2Preprocess_OnExitDelete (depfile);
    1031              :     }
    1032              :   else
    1033              :     {
    1034            0 :       return DynamicStrings_InitStringCharStar (M2Options_GetMF ());
    1035              :     }
    1036              :   /* static analysis guarentees a RETURN statement will be used before here.  */
    1037              :   __builtin_unreachable ();
    1038              : }
    1039              : 
    1040              : 
    1041              : /*
    1042              :    Pass0CheckDef -
    1043              : */
    1044              : 
    1045       173985 : static bool Pass0CheckDef (unsigned int sym)
    1046              : {
    1047       173985 :   DynamicStrings_String ChildDep;
    1048       173985 :   DynamicStrings_String SymName;
    1049       173985 :   DynamicStrings_String FileName;
    1050       173985 :   DynamicStrings_String LibName;
    1051              : 
    1052       173985 :   LibName = static_cast<DynamicStrings_String> (NULL);
    1053       173985 :   FileName = static_cast<DynamicStrings_String> (NULL);
    1054       173985 :   SymName = DynamicStrings_InitStringCharStar (NameKey_KeyToCharStar (SymbolTable_GetSymName (sym)));
    1055       173985 :   if (SymbolTable_IsDefImp (sym))
    1056              :     {
    1057       162119 :       if (M2Search_FindSourceDefFile (SymName, &FileName, &LibName))
    1058              :         {
    1059       162096 :           ModuleType = M2Comp_Definition;
    1060       162096 :           ChildDep = M2Preprocess_MakeSaveTempsFileNameExt (CreateFileStem (SymName, LibName), DynamicStrings_InitString ((const char *) ".def.d", 6));
    1061       162096 :           if (M2LexBuf_OpenSource (M2Batch_AssociateDefinition (M2Preprocess_PreprocessModule (FileName, false, true, ChildDep), sym)))
    1062              :             {
    1063       162096 :               if (! (P0SyntaxCheck_CompilationUnit ()))
    1064              :                 {
    1065            6 :                   M2Error_WriteFormat0 ((const char *) "compilation failed", 18);
    1066            6 :                   M2LexBuf_CloseSource ();
    1067            6 :                   SymName = DynamicStrings_KillString (SymName);
    1068            6 :                   FileName = DynamicStrings_KillString (FileName);
    1069            6 :                   LibName = DynamicStrings_KillString (LibName);
    1070            6 :                   return false;
    1071              :                 }
    1072       162090 :               M2Quiet_qprintf2 ((const char *) "   Module %-20s : %s", 20, (const unsigned char *) &SymName, (sizeof (SymName)-1), (const unsigned char *) &FileName, (sizeof (FileName)-1));
    1073       162090 :               qprintLibName (LibName);
    1074       162090 :               SymbolTable_PutLibName (sym, NameKey_makekey (DynamicStrings_string (LibName)));
    1075       162090 :               if (SymbolTable_IsDefinitionForC (sym))
    1076              :                 {
    1077        13106 :                   M2Quiet_qprintf0 ((const char *) " (for C)", 8);
    1078              :                 }
    1079       162090 :               if (SymbolTable_IsDefLink (sym))
    1080              :                 {
    1081        81170 :                   M2Quiet_qprintf0 ((const char *) " (linking)", 10);
    1082              :                 }
    1083       162090 :               M2Quiet_qprintf0 ((const char *) "\\n", 2);
    1084       162090 :               M2LexBuf_CloseSource ();
    1085       162090 :               MergeDeps (DepContent, ChildDep, LibName);
    1086              :             }
    1087              :           else
    1088              :             {
    1089              :               /* Unrecoverable error.  */
    1090            0 :               M2MetaError_MetaErrorString1 (FormatStrings_Sprintf1 (DynamicStrings_InitString ((const char *) "file {%%1EUAF%s} containing module {%%1a} cannot be found {%%1&Ds}", 66), (const unsigned char *) &FileName, (sizeof (FileName)-1)), sym);
    1091              :             }
    1092              :         }
    1093              :       else
    1094              :         {
    1095           23 :           M2MetaError_MetaError1 ((const char *) "the file containing the definition module {%1EMAa} cannot be found {%1&Ds}", 74, sym);
    1096              :         }
    1097       162090 :       ModuleType = M2Comp_Implementation;
    1098              :     }
    1099              :   else
    1100              :     {
    1101        11866 :       ModuleType = M2Comp_Program;
    1102              :     }
    1103       173956 :   SymName = DynamicStrings_KillString (SymName);
    1104       173956 :   FileName = DynamicStrings_KillString (FileName);
    1105       173956 :   LibName = DynamicStrings_KillString (LibName);
    1106       173956 :   return true;
    1107              :   /* static analysis guarentees a RETURN statement will be used before here.  */
    1108              :   __builtin_unreachable ();
    1109              : }
    1110              : 
    1111              : 
    1112              : /*
    1113              :    Pass0CheckMod -
    1114              : */
    1115              : 
    1116       173956 : static bool Pass0CheckMod (unsigned int sym, DynamicStrings_String PPSource)
    1117              : {
    1118       173956 :   unsigned int Main;
    1119       173956 :   DynamicStrings_String ChildDep;
    1120       173956 :   DynamicStrings_String SymName;
    1121       173956 :   DynamicStrings_String FileName;
    1122       173956 :   DynamicStrings_String LibName;
    1123              : 
    1124       173956 :   SymName = DynamicStrings_InitStringCharStar (NameKey_KeyToCharStar (SymbolTable_GetSymName (sym)));
    1125       173956 :   FileName = static_cast<DynamicStrings_String> (NULL);
    1126       173956 :   LibName = static_cast<DynamicStrings_String> (NULL);
    1127       173956 :   Main = SymbolTable_GetMainModule ();
    1128       173956 :   if ((Main == sym) || (NeedToParseImplementation (sym)))
    1129              :     {
    1130              :       /* avoid dangling else.  */
    1131              :       /* Only need to read implementation module if hidden types are
    1132              :          declared or it is the main module.  */
    1133        20023 :       if (Main == sym)
    1134              :         {
    1135        14941 :           FileName = DynamicStrings_Dup (PPSource);
    1136        14941 :           LibName = DynamicStrings_InitStringCharStar (M2Options_GetM2Prefix ());
    1137        14941 :           SymbolTable_PutLibName (sym, NameKey_makekey (DynamicStrings_string (LibName)));
    1138              :         }
    1139              :       else
    1140              :         {
    1141         5082 :           if (M2Search_FindSourceModFile (SymName, &FileName, &LibName))
    1142              :             {
    1143         4914 :               ChildDep = M2Preprocess_MakeSaveTempsFileNameExt (CreateFileStem (SymName, LibName), DynamicStrings_InitString ((const char *) ".mod.d", 6));
    1144         4914 :               FileName = M2Preprocess_PreprocessModule (FileName, false, true, ChildDep);
    1145         4914 :               SymbolTable_PutLibName (sym, NameKey_makekey (DynamicStrings_string (LibName)));
    1146         4914 :               MergeDeps (DepContent, ChildDep, LibName);
    1147              :             }
    1148              :           else
    1149              :             {
    1150          168 :               M2Quiet_qprintf1 ((const char *) "   Module %-20s : implementation source file not found\\n", 56, (const unsigned char *) &SymName, (sizeof (SymName)-1));
    1151              :             }
    1152              :         }
    1153        20023 :       if (FileName != NULL)
    1154              :         {
    1155              :           /* avoid gcc warning by using compound statement even if not strictly necessary.  */
    1156        19855 :           if (M2LexBuf_OpenSource (M2Batch_AssociateModule (DynamicStrings_Dup (FileName), sym)))
    1157              :             {
    1158        19855 :               if (! (P0SyntaxCheck_CompilationUnit ()))
    1159              :                 {
    1160           48 :                   M2Error_WriteFormat0 ((const char *) "compilation failed", 18);
    1161           48 :                   M2LexBuf_CloseSource ();
    1162           48 :                   SymName = DynamicStrings_KillString (SymName);
    1163           48 :                   FileName = DynamicStrings_KillString (FileName);
    1164           48 :                   LibName = DynamicStrings_KillString (LibName);
    1165           48 :                   return false;
    1166              :                 }
    1167        19795 :               M2Quiet_qprintf2 ((const char *) "   Module %-20s : %s", 20, (const unsigned char *) &SymName, (sizeof (SymName)-1), (const unsigned char *) &FileName, (sizeof (FileName)-1));
    1168        19795 :               qprintLibName (LibName);
    1169        19795 :               if (SymbolTable_IsModLink (sym))
    1170              :                 {
    1171         2696 :                   M2Quiet_qprintf0 ((const char *) " (linking)", 10);
    1172              :                 }
    1173        19795 :               M2Quiet_qprintf0 ((const char *) "\\n", 2);
    1174        19795 :               M2LexBuf_CloseSource ();
    1175              :             }
    1176              :           else
    1177              :             {
    1178              :               /* It is legitimate to implement a module in C (and pretend it was a M2
    1179              :                implementation) providing that it is not the main program module and the
    1180              :                definition module does not declare a hidden type when -fextended-opaque
    1181              :                is used.  */
    1182            0 :               if ((! M2Options_WholeProgram || (sym == Main)) || (SymbolTable_IsHiddenTypeDeclared (sym)))
    1183              :                 {
    1184              :                   /* Unrecoverable error.  */
    1185            0 :                   M2MetaError_MetaErrorString1 (FormatStrings_Sprintf1 (DynamicStrings_InitString ((const char *) "file {%%1EUAF%s} containing module {%%1a} cannot be found {%%1&Ds}", 66), (const unsigned char *) &FileName, (sizeof (FileName)-1)), sym);
    1186              :                 }
    1187              :             }
    1188              :         }
    1189              :     }
    1190       153933 :   else if (M2Options_GenModuleList)
    1191              :     {
    1192              :       /* avoid dangling else.  */
    1193        91388 :       if ((SymbolTable_IsDefImp (sym)) && (! (SymbolTable_IsDefinitionForC (sym))))
    1194              :         {
    1195              :           /* The implementation module is only useful if -fgen-module-list= is
    1196              :             used (to gather all dependencies).  Note that we do not insist
    1197              :             upon finding the implementation module.  */
    1198        82082 :           LibName = static_cast<DynamicStrings_String> (NULL);
    1199        82082 :           if (M2Search_FindSourceModFile (SymName, &FileName, &LibName))
    1200              :             {
    1201        62958 :               SymbolTable_PutLibName (sym, NameKey_makekey (DynamicStrings_string (LibName)));
    1202        62958 :               M2Quiet_qprintf2 ((const char *) "   Module %-20s : %s", 20, (const unsigned char *) &SymName, (sizeof (SymName)-1), (const unsigned char *) &FileName, (sizeof (FileName)-1));
    1203        62958 :               qprintLibName (LibName);
    1204        62958 :               M2Quiet_qprintf0 ((const char *) " (linking)\\n", 12);
    1205        62958 :               ChildDep = M2Preprocess_MakeSaveTempsFileNameExt (CreateFileStem (SymName, LibName), DynamicStrings_InitString ((const char *) ".mod.d", 6));
    1206        62958 :               if (M2LexBuf_OpenSource (M2Batch_AssociateModule (M2Preprocess_PreprocessModule (FileName, false, true, ChildDep), sym)))
    1207              :                 {
    1208        62958 :                   SymbolTable_PutModLink (sym, true);  /* This source is only used to determine link time info.  */
    1209        62958 :                   if (! (P0SyntaxCheck_CompilationUnit ()))  /* This source is only used to determine link time info.  */
    1210              :                     {
    1211            0 :                       M2Error_WriteFormat0 ((const char *) "compilation failed", 18);
    1212            0 :                       M2LexBuf_CloseSource ();
    1213            0 :                       SymName = DynamicStrings_KillString (SymName);
    1214            0 :                       FileName = DynamicStrings_KillString (FileName);
    1215            0 :                       LibName = DynamicStrings_KillString (LibName);
    1216            0 :                       return false;
    1217              :                     }
    1218        62958 :                   M2LexBuf_CloseSource ();
    1219        62958 :                   MergeDeps (DepContent, ChildDep, LibName);
    1220              :                 }
    1221              :             }
    1222              :         }
    1223              :     }
    1224       173896 :   SymName = DynamicStrings_KillString (SymName);
    1225       173896 :   FileName = DynamicStrings_KillString (FileName);
    1226       173896 :   LibName = DynamicStrings_KillString (LibName);
    1227       173896 :   return true;
    1228              :   /* static analysis guarentees a RETURN statement will be used before here.  */
    1229              :   __builtin_unreachable ();
    1230              : }
    1231              : 
    1232              : 
    1233              : /*
    1234              :    DoPass0 -
    1235              : */
    1236              : 
    1237        14952 : static void DoPass0 (DynamicStrings_String filename)
    1238              : {
    1239        14952 :   unsigned int sym;
    1240        14952 :   unsigned int i;
    1241        14952 :   DynamicStrings_String PPSource;
    1242              : 
    1243        14952 :   P0SymBuild_P0Init ();
    1244        14952 :   M2Pass_SetPassToPass0 ();
    1245              :   /* Maybe preprocess the main file.  */
    1246        14952 :   DepOutput = CreateDepFilename (filename);
    1247        14952 :   PPSource = M2Preprocess_PreprocessModule (filename, true, false, DepOutput);
    1248        14952 :   DepContent = ReadDepContents (filename, DepOutput);
    1249        14952 :   PeepInto (PPSource);
    1250        14945 :   i = 1;
    1251        14945 :   sym = M2Batch_GetModuleNo (i);
    1252        14945 :   M2Quiet_qprintf1 ((const char *) "Compiling: %s\\n", 15, (const unsigned char *) &PPSource, (sizeof (PPSource)-1));
    1253        14945 :   if (Debugging)
    1254              :     {
    1255              :       PathName_DumpPathName ((const char *) "DoPass0", 7);
    1256              :     }
    1257        14945 :   if (M2Options_Verbose)
    1258              :     {
    1259            0 :       M2Printf_fprintf1 (FIO_StdOut, (const char *) "Compiling: %s\\n", 15, (const unsigned char *) &PPSource, (sizeof (PPSource)-1));
    1260              :     }
    1261        14945 :   M2Quiet_qprintf0 ((const char *) "Pass 0: lexical analysis, parsing, modules and associated filenames\\n", 69);
    1262       203786 :   while (sym != SymbolTable_NulSym)
    1263              :     {
    1264       173985 :       if (! (Pass0CheckDef (sym)))
    1265              :         {
    1266           54 :           return;
    1267              :         }
    1268       173956 :       if (! (Pass0CheckMod (sym, PPSource)))
    1269              :         {
    1270              :           return;
    1271              :         }
    1272       173896 :       i += 1;
    1273       173896 :       sym = M2Batch_GetModuleNo (i);
    1274              :     }
    1275        14856 :   M2Pass_SetPassToNoPass ();
    1276              : }
    1277              : 
    1278              : 
    1279              : /*
    1280              :    DoPass1 - parses the sources of all modules necessary to compile
    1281              :              the required module, Main.
    1282              : */
    1283              : 
    1284        14820 : static void DoPass1 (void)
    1285              : {
    1286        14820 :   NameKey_Name name;
    1287        14820 :   unsigned int Sym;
    1288        14820 :   unsigned int i;
    1289        14820 :   DynamicStrings_String FileName;
    1290              : 
    1291        14820 :   P0SymBuild_P1Init ();
    1292        14820 :   M2Pass_SetPassToPass1 ();
    1293        14820 :   i = 1;
    1294        14820 :   Sym = M2Batch_GetModuleNo (i);
    1295       202847 :   while (Sym != SymbolTable_NulSym)
    1296              :     {
    1297       173213 :       FileName = M2Batch_GetDefinitionModuleFile (Sym);
    1298       173213 :       if (FileName != NULL)
    1299              :         {
    1300       161456 :           if (Debugging)
    1301              :             {
    1302              :               name = SymbolTable_GetSymName (Sym);
    1303              :               M2Quiet_qprintf1 ((const char *) "   Module %a\\n", 14, (const unsigned char *) &name, (sizeof (name)-1));
    1304              :             }
    1305       161456 :           if (M2LexBuf_OpenSource (FileName))
    1306              :             {
    1307       161456 :               ModuleType = M2Comp_Definition;
    1308       161456 :               if (! (P1Build_CompilationUnit ()))
    1309              :                 {
    1310            0 :                   M2MetaError_MetaError0 ((const char *) "compilation failed", 18);
    1311            0 :                   M2LexBuf_CloseSource ();
    1312            0 :                   return;
    1313              :                 }
    1314       161456 :               M2LexBuf_CloseSource ();
    1315              :             }
    1316              :           else
    1317              :             {
    1318            0 :               M2Printf_fprintf1 (FIO_StdErr, (const char *) "failed to open %s\\n", 19, (const unsigned char *) &FileName, (sizeof (FileName)-1));
    1319            0 :               libc_exit (1);
    1320              :             }
    1321       161456 :           ModuleType = M2Comp_Implementation;
    1322              :         }
    1323              :       else
    1324              :         {
    1325        11757 :           ModuleType = M2Comp_Program;
    1326              :         }
    1327       173213 :       FileName = M2Batch_GetModuleFile (Sym);
    1328       173213 :       if (FileName != NULL)
    1329              :         {
    1330        82626 :           if (Debugging)
    1331              :             {
    1332              :               name = SymbolTable_GetSymName (Sym);
    1333              :               M2Quiet_qprintf1 ((const char *) "   Module %a\\n", 14, (const unsigned char *) &name, (sizeof (name)-1));
    1334              :             }
    1335        82626 :           if (M2LexBuf_OpenSource (FileName))
    1336              :             {
    1337        82626 :               if (! (P1Build_CompilationUnit ()))
    1338              :                 {
    1339            0 :                   M2MetaError_MetaError0 ((const char *) "compilation failed", 18);
    1340            0 :                   M2LexBuf_CloseSource ();
    1341            0 :                   return;
    1342              :                 }
    1343        82620 :               M2LexBuf_CloseSource ();
    1344              :             }
    1345              :           else
    1346              :             {
    1347            0 :               M2Printf_fprintf1 (FIO_StdErr, (const char *) "failed to open %s\\n", 19, (const unsigned char *) &FileName, (sizeof (FileName)-1));
    1348            0 :               libc_exit (1);
    1349              :             }
    1350              :         }
    1351       173207 :       i += 1;
    1352       173207 :       Sym = M2Batch_GetModuleNo (i);
    1353              :     }
    1354        14814 :   M2Pass_SetPassToNoPass ();
    1355              : }
    1356              : 
    1357              : 
    1358              : /*
    1359              :    DoPass2 - parses the sources of all modules necessary to compile
    1360              :              the required module, Main.
    1361              : */
    1362              : 
    1363        14790 : static void DoPass2 (void)
    1364              : {
    1365        14790 :   NameKey_Name name;
    1366        14790 :   unsigned int Sym;
    1367        14790 :   unsigned int i;
    1368        14790 :   DynamicStrings_String FileName;
    1369              : 
    1370        14790 :   M2Pass_SetPassToPass2 ();
    1371        14790 :   i = 1;
    1372        14790 :   Sym = M2Batch_GetModuleNo (i);
    1373       202559 :   while (Sym != SymbolTable_NulSym)
    1374              :     {
    1375       172997 :       FileName = M2Batch_GetDefinitionModuleFile (Sym);
    1376       172997 :       if (FileName != NULL)
    1377              :         {
    1378       161264 :           if (Debugging)
    1379              :             {
    1380              :               name = SymbolTable_GetSymName (Sym);
    1381              :               M2Quiet_qprintf1 ((const char *) "   Module %a\\n", 14, (const unsigned char *) &name, (sizeof (name)-1));
    1382              :             }
    1383       161264 :           if (M2LexBuf_OpenSource (FileName))
    1384              :             {
    1385       161264 :               ModuleType = M2Comp_Definition;
    1386       161264 :               if (! (P2Build_CompilationUnit ()))
    1387              :                 {
    1388            0 :                   M2MetaError_MetaError0 ((const char *) "compilation failed", 18);
    1389            0 :                   M2LexBuf_CloseSource ();
    1390            0 :                   return;
    1391              :                 }
    1392       161264 :               M2LexBuf_CloseSource ();
    1393              :             }
    1394              :           else
    1395              :             {
    1396            0 :               M2Printf_fprintf1 (FIO_StdErr, (const char *) "failed to open %s\\n", 19, (const unsigned char *) &FileName, (sizeof (FileName)-1));
    1397            0 :               libc_exit (1);
    1398              :             }
    1399       161264 :           ModuleType = M2Comp_Implementation;
    1400              :         }
    1401              :       else
    1402              :         {
    1403        11733 :           ModuleType = M2Comp_Program;
    1404              :         }
    1405       172997 :       FileName = M2Batch_GetModuleFile (Sym);
    1406       172997 :       if (FileName != NULL)
    1407              :         {
    1408        82524 :           if (Debugging)
    1409              :             {
    1410              :               name = SymbolTable_GetSymName (Sym);
    1411              :               M2Quiet_qprintf1 ((const char *) "   Module %a\\n", 14, (const unsigned char *) &name, (sizeof (name)-1));
    1412              :             }
    1413        82524 :           if (M2LexBuf_OpenSource (FileName))
    1414              :             {
    1415        82524 :               if (! (P2Build_CompilationUnit ()))
    1416              :                 {
    1417            0 :                   M2MetaError_MetaError0 ((const char *) "compilation failed", 18);
    1418            0 :                   M2LexBuf_CloseSource ();
    1419            0 :                   return;
    1420              :                 }
    1421        82506 :               M2LexBuf_CloseSource ();
    1422              :             }
    1423              :           else
    1424              :             {
    1425            0 :               M2Printf_fprintf1 (FIO_StdErr, (const char *) "failed to open %s\\n", 19, (const unsigned char *) &FileName, (sizeof (FileName)-1));
    1426            0 :               libc_exit (1);
    1427              :             }
    1428              :         }
    1429       172979 :       i += 1;
    1430       172979 :       Sym = M2Batch_GetModuleNo (i);
    1431              :     }
    1432        14772 :   M2Pass_SetPassToNoPass ();
    1433              : }
    1434              : 
    1435              : 
    1436              : /*
    1437              :    DoPassC - parses the sources of all modules necessary to compile
    1438              :              the required module, Main.
    1439              : */
    1440              : 
    1441        14688 : static void DoPassC (void)
    1442              : {
    1443        14688 :   NameKey_Name name;
    1444        14688 :   unsigned int Sym;
    1445        14688 :   unsigned int i;
    1446        14688 :   DynamicStrings_String FileName;
    1447              : 
    1448        14688 :   M2Pass_SetPassToPassC ();
    1449        14688 :   i = 1;
    1450        14688 :   Sym = M2Batch_GetModuleNo (i);
    1451       201815 :   while (Sym != SymbolTable_NulSym)
    1452              :     {
    1453       172463 :       FileName = M2Batch_GetDefinitionModuleFile (Sym);
    1454       172463 :       if (FileName != NULL)
    1455              :         {
    1456       160778 :           if (Debugging)
    1457              :             {
    1458              :               name = SymbolTable_GetSymName (Sym);
    1459              :               M2Quiet_qprintf1 ((const char *) "   Module %a\\n", 14, (const unsigned char *) &name, (sizeof (name)-1));
    1460              :             }
    1461       160778 :           if (M2LexBuf_OpenSource (FileName))
    1462              :             {
    1463       160778 :               ModuleType = M2Comp_Definition;
    1464       160778 :               if (! (PCBuild_CompilationUnit ()))
    1465              :                 {
    1466            0 :                   M2MetaError_MetaError0 ((const char *) "compilation failed", 18);
    1467            0 :                   M2LexBuf_CloseSource ();
    1468            0 :                   return;
    1469              :                 }
    1470       160778 :               M2LexBuf_CloseSource ();
    1471              :             }
    1472              :           else
    1473              :             {
    1474            0 :               M2Printf_fprintf1 (FIO_StdErr, (const char *) "failed to open %s\\n", 19, (const unsigned char *) &FileName, (sizeof (FileName)-1));
    1475            0 :               libc_exit (1);
    1476              :             }
    1477       160778 :           ModuleType = M2Comp_Implementation;
    1478              :         }
    1479              :       else
    1480              :         {
    1481        11685 :           ModuleType = M2Comp_Program;
    1482              :         }
    1483       172463 :       FileName = M2Batch_GetModuleFile (Sym);
    1484       172463 :       if (FileName != NULL)
    1485              :         {
    1486        82422 :           if (Debugging)
    1487              :             {
    1488              :               name = SymbolTable_GetSymName (Sym);
    1489              :               M2Quiet_qprintf1 ((const char *) "   Module %a\\n", 14, (const unsigned char *) &name, (sizeof (name)-1));
    1490              :             }
    1491        82422 :           if (M2LexBuf_OpenSource (FileName))
    1492              :             {
    1493        82422 :               if (! (PCBuild_CompilationUnit ()))
    1494              :                 {
    1495            0 :                   M2MetaError_MetaError0 ((const char *) "compilation failed", 18);
    1496            0 :                   M2LexBuf_CloseSource ();
    1497            0 :                   return;
    1498              :                 }
    1499        82398 :               M2LexBuf_CloseSource ();
    1500              :             }
    1501              :           else
    1502              :             {
    1503            0 :               M2Printf_fprintf1 (FIO_StdErr, (const char *) "failed to open %s\\n", 19, (const unsigned char *) &FileName, (sizeof (FileName)-1));
    1504            0 :               libc_exit (1);
    1505              :             }
    1506              :         }
    1507       172439 :       i += 1;
    1508       172439 :       Sym = M2Batch_GetModuleNo (i);
    1509              :     }
    1510        14664 :   PCSymBuild_ResolveConstTypes ();
    1511        14664 :   SymbolTable_ResolveConstructorTypes ();
    1512        14658 :   SymbolTable_SanityCheckConstants ();
    1513        14658 :   M2Pass_SetPassToNoPass ();
    1514              : }
    1515              : 
    1516              : 
    1517              : /*
    1518              :    DoPass3 - parses the sources of all modules necessary to compile
    1519              :              the required module, Main.
    1520              : */
    1521              : 
    1522        14577 : static void DoPass3 (void)
    1523              : {
    1524        14577 :   unsigned int Main;
    1525        14577 :   unsigned int Sym;
    1526        14577 :   unsigned int i;
    1527        14577 :   DynamicStrings_String FileName;
    1528              : 
    1529        14577 :   M2Pass_SetPassToPass3 ();
    1530        14577 :   Main = SymbolTable_GetMainModule ();
    1531        14577 :   i = 1;
    1532        14577 :   Sym = M2Batch_GetModuleNo (i);
    1533       200708 :   while (Sym != SymbolTable_NulSym)
    1534              :     {
    1535       171768 :       FileName = M2Batch_GetDefinitionModuleFile (Sym);
    1536       171768 :       if (FileName != NULL)
    1537              :         {
    1538       160176 :           if (M2LexBuf_OpenSource (FileName))
    1539              :             {
    1540       160176 :               ModuleType = M2Comp_Definition;
    1541       160176 :               if (! (P3Build_CompilationUnit ()))
    1542              :                 {
    1543            0 :                   M2MetaError_MetaError0 ((const char *) "compilation failed", 18);
    1544            0 :                   M2LexBuf_CloseSource ();
    1545            0 :                   return;
    1546              :                 }
    1547       160176 :               M2LexBuf_CloseSource ();
    1548              :             }
    1549              :           else
    1550              :             {
    1551            0 :               M2Printf_fprintf1 (FIO_StdErr, (const char *) "failed to open %s\\n", 19, (const unsigned char *) &FileName, (sizeof (FileName)-1));
    1552            0 :               libc_exit (1);
    1553              :             }
    1554       160176 :           ModuleType = M2Comp_Implementation;
    1555              :         }
    1556              :       else
    1557              :         {
    1558        11592 :           ModuleType = M2Comp_Program;
    1559              :         }
    1560       171768 :       FileName = M2Batch_GetModuleFile (Sym);
    1561       171768 :       if (FileName != NULL)
    1562              :         {
    1563              :           /* avoid gcc warning by using compound statement even if not strictly necessary.  */
    1564        82311 :           if (M2LexBuf_OpenSource (FileName))
    1565              :             {
    1566        82311 :               if ((Main == Sym) || M2Options_WholeProgram)
    1567              :                 {
    1568              :                   /* avoid dangling else.  */
    1569        15105 :                   if (! (P3Build_CompilationUnit ()))
    1570              :                     {
    1571            0 :                       M2MetaError_MetaError0 ((const char *) "compilation failed", 18);
    1572            0 :                       M2LexBuf_CloseSource ();
    1573            0 :                       return;
    1574              :                     }
    1575              :                 }
    1576              :               else
    1577              :                 {
    1578              :                   /* 
    1579              :                   not the main module .mod therefore must be implementing
    1580              :                   a hidden type - we dont want to generate any
    1581              :                   StatementSequence quadrupes but we do want to build TYPEs
    1582              :                   and ConstExpressions.
    1583              :   */
    1584        67206 :                   M2Pass_SetPassToNoPass ();
    1585        67206 :                   M2Pass_SetPassToPassHidden ();
    1586        67206 :                   if (! (PHBuild_CompilationUnit ()))
    1587              :                     {
    1588            0 :                       M2MetaError_MetaError0 ((const char *) "compilation failed", 18);
    1589            0 :                       M2LexBuf_CloseSource ();
    1590            0 :                       return;
    1591              :                     }
    1592        67206 :                   M2Pass_SetPassToNoPass ();
    1593        67206 :                   M2Pass_SetPassToPass3 ();
    1594              :                 }
    1595        82097 :               M2LexBuf_CloseSource ();
    1596              :             }
    1597              :           else
    1598              :             {
    1599            0 :               M2Printf_fprintf1 (FIO_StdErr, (const char *) "failed to open %s\\n", 19, (const unsigned char *) &FileName, (sizeof (FileName)-1));
    1600            0 :               libc_exit (1);
    1601              :             }
    1602              :         }
    1603       171554 :       i += 1;
    1604       171554 :       Sym = M2Batch_GetModuleNo (i);
    1605              :     }
    1606        14363 :   M2Pass_SetPassToNoPass ();
    1607              : }
    1608              : 
    1609              : 
    1610              : /*
    1611              :    compile - compile the filename.
    1612              : */
    1613              : 
    1614        14952 : extern "C" void M2Comp_compile (void * filename)
    1615              : {
    1616        14952 :   DynamicStrings_String f;
    1617        14952 :   DynamicStrings_String s;
    1618              : 
    1619        14952 :   M2Diagnostic_Configure (M2Options_TimeReport, M2Options_MemReport);
    1620        14952 :   f = DynamicStrings_InitStringCharStar (filename);
    1621        14952 :   Compile (f);
    1622        13418 :   f = DynamicStrings_KillString (f);
    1623        13418 :   PopulateResource ();
    1624        13418 :   if (M2Options_TimeReport || M2Options_MemReport)
    1625              :     {
    1626            0 :       s = SFIO_WriteS (FIO_StdOut, M2Diagnostic_Generate (false));
    1627            0 :       FIO_FlushOutErr ();
    1628            0 :       s = DynamicStrings_KillString (s);
    1629              :     }
    1630        13418 : }
    1631              : 
    1632              : 
    1633              : /*
    1634              :    CompilingDefinitionModule - returns true if the current module being
    1635              :                                compiled is a definition module.
    1636              : */
    1637              : 
    1638    145948644 : extern "C" bool M2Comp_CompilingDefinitionModule (void)
    1639              : {
    1640    145948644 :   return ModuleType == M2Comp_Definition;
    1641              :   /* static analysis guarentees a RETURN statement will be used before here.  */
    1642              :   __builtin_unreachable ();
    1643              : }
    1644              : 
    1645              : 
    1646              : /*
    1647              :    CompilingImplementationModule - returns true if the current module being
    1648              :                                    compiled is an implementation module.
    1649              : */
    1650              : 
    1651      9886792 : extern "C" bool M2Comp_CompilingImplementationModule (void)
    1652              : {
    1653      9886792 :   return ModuleType == M2Comp_Implementation;
    1654              :   /* static analysis guarentees a RETURN statement will be used before here.  */
    1655              :   __builtin_unreachable ();
    1656              : }
    1657              : 
    1658              : 
    1659              : /*
    1660              :    CompilingProgramModule - returns true if the current module being
    1661              :                             compiled is a program module.
    1662              : */
    1663              : 
    1664        93308 : extern "C" bool M2Comp_CompilingProgramModule (void)
    1665              : {
    1666        93308 :   return ModuleType == M2Comp_Program;
    1667              :   /* static analysis guarentees a RETURN statement will be used before here.  */
    1668              :   __builtin_unreachable ();
    1669              : }
    1670              : 
    1671        14952 : extern "C" void _M2_M2Comp_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
    1672              : {
    1673        14952 :   ModuleType = M2Comp_None;
    1674        14952 :   DepContent = static_cast<Indexing_Index> (NULL);
    1675        14952 :   DepOutput = static_cast<DynamicStrings_String> (NULL);
    1676        14952 : }
    1677              : 
    1678            0 : extern "C" void _M2_M2Comp_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
    1679              : {
    1680            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.