diff options
Diffstat (limited to 'gcc/m2/gm2-compiler/M2Comp.mod')
-rw-r--r-- | gcc/m2/gm2-compiler/M2Comp.mod | 64 |
1 files changed, 49 insertions, 15 deletions
diff --git a/gcc/m2/gm2-compiler/M2Comp.mod b/gcc/m2/gm2-compiler/M2Comp.mod index 3c2c364..a2a7797 100644 --- a/gcc/m2/gm2-compiler/M2Comp.mod +++ b/gcc/m2/gm2-compiler/M2Comp.mod @@ -59,14 +59,17 @@ FROM M2Batch IMPORT GetSource, GetModuleNo, GetDefinitionModuleFile, GetModuleFi FROM SymbolTable IMPORT GetSymName, IsDefImp, NulSym, IsHiddenTypeDeclared, GetFirstUsed, GetMainModule, SetMainModule, ResolveConstructorTypes, SanityCheckConstants, IsDefinitionForC, - IsBuiltinInModule, PutModLink, IsDefLink, IsModLink ; + IsBuiltinInModule, PutModLink, IsDefLink, IsModLink, + PutLibName ; FROM FIO IMPORT StdErr, StdOut ; FROM NameKey IMPORT Name, GetKey, KeyToCharStar, makekey ; FROM M2Printf IMPORT fprintf1 ; FROM M2Quiet IMPORT qprintf0, qprintf1, qprintf2 ; -FROM DynamicStrings IMPORT String, InitString, KillString, InitStringCharStar, Dup, Mark, string ; -FROM M2Options IMPORT Verbose ; +FROM DynamicStrings IMPORT String, InitString, KillString, InitStringCharStar, Dup, Mark, EqualArray, string ; +FROM M2Options IMPORT Verbose, GetM2Prefix ; +FROM PathName IMPORT DumpPathName ; + CONST Debugging = FALSE ; @@ -226,6 +229,19 @@ END PeepInto ; (* + qprintLibName - print the libname +*) + +PROCEDURE qprintLibName (LibName: String) ; +BEGIN + IF (LibName # NIL) AND (NOT EqualArray (LibName, '')) + THEN + qprintf1 (' [%s]', LibName) + END +END qprintLibName ; + + +(* DoPass0 - *) @@ -236,6 +252,7 @@ VAR i : CARDINAL ; SymName, FileName, + LibName, PPSource: String ; BEGIN P0Init ; @@ -251,27 +268,34 @@ BEGIN i := 1 ; Sym := GetModuleNo(i) ; qprintf1('Compiling: %s\n', PPSource) ; + IF Debugging + THEN + DumpPathName ('DoPass0') + END ; IF Verbose THEN - fprintf1(StdOut, 'Compiling: %s\n', PPSource) ; + fprintf1 (StdOut, 'Compiling: %s\n', PPSource) END ; qprintf0('Pass 0: lexical analysis, parsing, modules and associated filenames\n') ; WHILE Sym#NulSym DO - SymName := InitStringCharStar(KeyToCharStar(GetSymName(Sym))) ; - IF IsDefImp(Sym) + SymName := InitStringCharStar (KeyToCharStar (GetSymName (Sym))) ; + IF IsDefImp (Sym) THEN - IF FindSourceDefFile(SymName, FileName) + LibName := NIL ; + IF FindSourceDefFile (SymName, FileName, LibName) THEN ModuleType := Definition ; - IF OpenSource(AssociateDefinition(PreprocessModule(FileName, FALSE), Sym)) + IF OpenSource (AssociateDefinition (PreprocessModule (FileName, FALSE), Sym)) THEN - IF NOT P0SyntaxCheck.CompilationUnit() + IF NOT P0SyntaxCheck.CompilationUnit () THEN - WriteFormat0('compilation failed') ; + WriteFormat0 ('compilation failed') ; CloseSource ; RETURN END ; qprintf2 (' Module %-20s : %s', SymName, FileName) ; + qprintLibName (LibName) ; + PutLibName (Sym, makekey (string (LibName))) ; IF IsDefinitionForC (Sym) THEN qprintf0 (' (for C)') @@ -298,13 +322,17 @@ BEGIN IF (Main=Sym) OR NeedToParseImplementation(Sym) THEN (* only need to read implementation module if hidden types are declared or it is the main module *) + LibName := NIL ; IF Main=Sym THEN - FileName := Dup (PPSource) + FileName := Dup (PPSource) ; + LibName := InitStringCharStar (GetM2Prefix ()) ; + PutLibName (Sym, makekey (string (LibName))) ELSE - IF FindSourceModFile (SymName, FileName) + IF FindSourceModFile (SymName, FileName, LibName) THEN - FileName := PreprocessModule (FileName, FALSE) + FileName := PreprocessModule (FileName, FALSE) ; + PutLibName (Sym, makekey (string (LibName))) END END ; IF FileName#NIL @@ -318,6 +346,7 @@ BEGIN RETURN END ; qprintf2 (' Module %-20s : %s', SymName, FileName) ; + qprintLibName (LibName) ; IF IsModLink (Sym) THEN qprintf0 (' (linking)') @@ -343,9 +372,13 @@ BEGIN THEN (* The implementation is only useful if -fgen-module-list= is used and we do not insist upon it. *) - IF FindSourceModFile (SymName, FileName) + LibName := NIL ; + IF FindSourceModFile (SymName, FileName, LibName) THEN - qprintf2 (' Module %-20s : %s (linking)\n', SymName, FileName) ; + PutLibName (Sym, makekey (string (LibName))) ; + qprintf2 (' Module %-20s : %s' , SymName, FileName) ; + qprintLibName (LibName) ; + qprintf0 (' (linking)\n') ; IF OpenSource (AssociateModule (PreprocessModule (FileName, FALSE), Sym)) THEN PutModLink (Sym, TRUE) ; (* This source is only used to determine link time info. *) @@ -362,6 +395,7 @@ BEGIN END ; SymName := KillString (SymName) ; FileName := KillString (FileName) ; + LibName := KillString (LibName) ; INC (i) ; Sym := GetModuleNo (i) END ; |