]> gcc.gnu.org Git - gcc.git/commitdiff
Remove unused parameter warning via introducing attribute unused.
authorGaius Mulley <gaiusmod2@gmail.com>
Sat, 17 Sep 2022 15:17:50 +0000 (16:17 +0100)
committerGaius Mulley <gaiusmod2@gmail.com>
Sat, 17 Sep 2022 15:17:50 +0000 (16:17 +0100)
Introduce attribute unused into the grammar of gm2 and mc.
Emit attribute ((unused)) during parameters if specified.
Removes many unused warnings when building gm2 under bootstrap
(specifically used during generic walk procedures in M2GCCDeclare.mod).

gcc/m2/ChangeLog:

* gm2-compiler/M2AsmUtil.mod (UnderScoreString): Removed.
* gm2-compiler/M2GCCDeclare.mod (DeclareStringConstant): delete
variable location and remove passing it to any procedure.
(PromoteToString) remove variable location and remove it from all
usage.
(TryDeclareConst) remove tokenno.
(DeclareConst): remove tokenno.
* gm2-compiler/M2GenGCC.mod (CodeStatement): Remove first
parameter for CodeInitStart and CodeFinallyStart.
(BuildTreeFromInterface): Remove location variable as
BuildStringConstant no longer has this parameter.
(CodeInitStart): Remove the unused first parameter.
(CodeFinallyStart): Remove the unused first parameter.
(CodeAddr): Remove location variable as
BuildStringConstant no longer has this parameter.
* gm2-compiler/M2LexBuf.mod (stop): Removed.
* gm2-compiler/M2Options.def (m2linemap): Import list replaced
identifier GetSaveTempsDir.
* gm2-compiler/M2Options.mod (DynamicStrings): Import list replaced
identifiers GenModuleListFlag and SaveTempsDir.
(SetSaveTempsDir) copy directory string.
(GetSaveTempsDir) New procedure function.
* gm2-compiler/M2Range.mod (BuildStringParamLoc): Remove location
variable as it is no longer needed by BuildStringConstant.
* gm2-compiler/P0SyntaxCheck.bnf: Extend grammar to allow
attribute unused in parameters.
* gm2-compiler/P1Build.bnf: Extend grammar to allow
attribute unused in parameters.
* gm2-compiler/P2Build.bnf (NameKey): Imported.  (MetaErrorT1)
Imported.  Extend grammar to allow attribute unused in parameters
and also check attribute contents for usused and noreturn.
* gm2-compiler/P3Build.bnf: Extend grammar to allow attribute
unused in parameters.
* gm2-compiler/PCBuild.bnf: Extend grammar to allow attribute
unused in parameters.
* gm2-compiler/PHBuild.bnf: Extend grammar to allow attribute
unused in parameters.
* gm2-compiler/SymbolTable.mod (GetOuterModule): Remove function
procedure.
* gm2-gcc/m2decl.cc (BuildStringConstant): Remove unused
location parameter.
* gm2-gcc/m2decl.def (BuildStringConstant): Remove unused
location parameter.
* gm2-gcc/m2decl.h (BuildStringConstant): Remove unused
location parameter.
* m2/gm2-lang.cc: Tidy up comments.
* m2/m2-tree.def: Tidy up comments.
* m2/m2-tree.h: Tidy up comments.
* m2/m2pp.cc: Tidy up comments.
* m2/m2pp.h: Tidy up comments.
* mc-boot/GASCII.c: Rebuilt.
* mc-boot/GArgs.c: Rebuilt.
* mc-boot/GAssertion.c: Rebuilt.
* mc-boot/GBreak.c: Rebuilt.
* mc-boot/GCmdArgs.c: Rebuilt.
* mc-boot/GDebug.c: Rebuilt.
* mc-boot/GDynamicStrings.c: Rebuilt.
* mc-boot/GEnvironment.c: Rebuilt.
* mc-boot/GFIO.c: Rebuilt.
* mc-boot/GFormatStrings.c: Rebuilt.
* mc-boot/GFpuIO.c: Rebuilt.
* mc-boot/GIO.c: Rebuilt.
* mc-boot/GIndexing.c: Rebuilt.
* mc-boot/GM2Dependent.c: Rebuilt.
* mc-boot/GM2EXCEPTION.c: Rebuilt.
* mc-boot/GM2RTS.c: Rebuilt.
* mc-boot/GMemUtils.c: Rebuilt.
* mc-boot/GNumberIO.c: Rebuilt.
* mc-boot/GPushBackInput.c: Rebuilt.
* mc-boot/GRTExceptions.c: Rebuilt.
* mc-boot/GRTint.c: Rebuilt.
* mc-boot/GSArgs.c: Rebuilt.
* mc-boot/GSFIO.c: Rebuilt.
* mc-boot/GStdIO.c: Rebuilt.
* mc-boot/GStorage.c: Rebuilt.
* mc-boot/GStrCase.c: Rebuilt.
* mc-boot/GStrIO.c: Rebuilt.
* mc-boot/GStrLib.c: Rebuilt.
* mc-boot/GStringConvert.c: Rebuilt.
* mc-boot/GSysStorage.c: Rebuilt.
* mc-boot/GTimeString.c: Rebuilt.
* mc-boot/Galists.c: Rebuilt.
* mc-boot/Gdecl.h: Rebuilt.
* mc-boot/Gkeyc.c: Rebuilt.
* mc-boot/Glists.c: Rebuilt.
* mc-boot/GmcComment.c: Rebuilt.
* mc-boot/GmcComp.c: Rebuilt.
* mc-boot/GmcDebug.c: Rebuilt.
* mc-boot/GmcError.c: Rebuilt.
* mc-boot/GmcFileName.c: Rebuilt.
* mc-boot/GmcLexBuf.c: Rebuilt.
* mc-boot/GmcMetaError.c: Rebuilt.
* mc-boot/GmcPreprocess.c: Rebuilt.
* mc-boot/GmcPretty.c: Rebuilt.
* mc-boot/GmcPrintf.c: Rebuilt.
* mc-boot/GmcQuiet.c: Rebuilt.
* mc-boot/GmcReserved.c: Rebuilt.
* mc-boot/GmcSearch.c: Rebuilt.
* mc-boot/GmcStack.c: Rebuilt.
* mc-boot/GmcStream.c: Rebuilt.
* mc-boot/Gmcp1.c: Rebuilt.
* mc-boot/Gmcp2.c: Rebuilt.
* mc-boot/Gmcp3.c: Rebuilt.
* mc-boot/Gmcp4.c: Rebuilt.
* mc-boot/Gmcp5.c: Rebuilt.
* mc-boot/GnameKey.c: Rebuilt.
* mc-boot/GsymbolKey.c: Rebuilt.
* mc-boot/Gtop.c: Rebuilt.
* mc-boot/Gvarargs.c: Rebuilt.
* mc-boot/Gwlists.c: Rebuilt.
* mc/decl.def (makeVarParameter): Add parameter to signify used.
(makeNonVarParameter): Add parameter to signify used.
(addVarParameters): Add parameter to signify used.
* mc/decl.mod: Add isused boolean to parameters.
* mc/mcp1.bnf: Extend grammar to handle attribute unused during
parameters.
* mc/mcp2.bnf: Extend grammar to handle attribute unused during
parameters.
* mc/mcp3.bnf: Extend grammar to handle attribute unused during
parameters. (mcPrintf): Import list replaced identifiers makekey
and makeKey.
* mc/mcp4.bnf: Extend grammar to handle attribute unused during
parameters.
* mc/mcp5.bnf: Extend grammar to handle attribute unused during
parameters.
* tools-src/mklink.c: Pass envp with argc, argv parameters for
module initializer/finalization calls.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
92 files changed:
gcc/m2/gm2-compiler/M2AsmUtil.mod
gcc/m2/gm2-compiler/M2GCCDeclare.mod
gcc/m2/gm2-compiler/M2GenGCC.mod
gcc/m2/gm2-compiler/M2LexBuf.mod
gcc/m2/gm2-compiler/M2Options.def
gcc/m2/gm2-compiler/M2Options.mod
gcc/m2/gm2-compiler/M2Range.mod
gcc/m2/gm2-compiler/P0SyntaxCheck.bnf
gcc/m2/gm2-compiler/P1Build.bnf
gcc/m2/gm2-compiler/P2Build.bnf
gcc/m2/gm2-compiler/P3Build.bnf
gcc/m2/gm2-compiler/PCBuild.bnf
gcc/m2/gm2-compiler/PHBuild.bnf
gcc/m2/gm2-compiler/SymbolTable.mod
gcc/m2/gm2-gcc/m2decl.cc
gcc/m2/gm2-gcc/m2decl.def
gcc/m2/gm2-gcc/m2decl.h
gcc/m2/gm2-lang.cc
gcc/m2/m2-tree.def
gcc/m2/m2-tree.h
gcc/m2/m2pp.cc
gcc/m2/m2pp.h
gcc/m2/mc-boot/GASCII.c
gcc/m2/mc-boot/GArgs.c
gcc/m2/mc-boot/GAssertion.c
gcc/m2/mc-boot/GBreak.c
gcc/m2/mc-boot/GCmdArgs.c
gcc/m2/mc-boot/GDebug.c
gcc/m2/mc-boot/GDynamicStrings.c
gcc/m2/mc-boot/GEnvironment.c
gcc/m2/mc-boot/GFIO.c
gcc/m2/mc-boot/GFormatStrings.c
gcc/m2/mc-boot/GFpuIO.c
gcc/m2/mc-boot/GIO.c
gcc/m2/mc-boot/GIndexing.c
gcc/m2/mc-boot/GM2Dependent.c
gcc/m2/mc-boot/GM2EXCEPTION.c
gcc/m2/mc-boot/GM2RTS.c
gcc/m2/mc-boot/GMemUtils.c
gcc/m2/mc-boot/GNumberIO.c
gcc/m2/mc-boot/GPushBackInput.c
gcc/m2/mc-boot/GRTExceptions.c
gcc/m2/mc-boot/GRTint.c
gcc/m2/mc-boot/GSArgs.c
gcc/m2/mc-boot/GSFIO.c
gcc/m2/mc-boot/GStdIO.c
gcc/m2/mc-boot/GStorage.c
gcc/m2/mc-boot/GStrCase.c
gcc/m2/mc-boot/GStrIO.c
gcc/m2/mc-boot/GStrLib.c
gcc/m2/mc-boot/GStringConvert.c
gcc/m2/mc-boot/GSysStorage.c
gcc/m2/mc-boot/GTimeString.c
gcc/m2/mc-boot/Galists.c
gcc/m2/mc-boot/Gdecl.c
gcc/m2/mc-boot/Gdecl.h
gcc/m2/mc-boot/Gkeyc.c
gcc/m2/mc-boot/Glists.c
gcc/m2/mc-boot/GmcComment.c
gcc/m2/mc-boot/GmcComp.c
gcc/m2/mc-boot/GmcDebug.c
gcc/m2/mc-boot/GmcError.c
gcc/m2/mc-boot/GmcFileName.c
gcc/m2/mc-boot/GmcLexBuf.c
gcc/m2/mc-boot/GmcMetaError.c
gcc/m2/mc-boot/GmcOptions.c
gcc/m2/mc-boot/GmcPreprocess.c
gcc/m2/mc-boot/GmcPretty.c
gcc/m2/mc-boot/GmcPrintf.c
gcc/m2/mc-boot/GmcQuiet.c
gcc/m2/mc-boot/GmcReserved.c
gcc/m2/mc-boot/GmcSearch.c
gcc/m2/mc-boot/GmcStack.c
gcc/m2/mc-boot/GmcStream.c
gcc/m2/mc-boot/Gmcp1.c
gcc/m2/mc-boot/Gmcp2.c
gcc/m2/mc-boot/Gmcp3.c
gcc/m2/mc-boot/Gmcp4.c
gcc/m2/mc-boot/Gmcp5.c
gcc/m2/mc-boot/GnameKey.c
gcc/m2/mc-boot/GsymbolKey.c
gcc/m2/mc-boot/Gtop.c
gcc/m2/mc-boot/Gvarargs.c
gcc/m2/mc-boot/Gwlists.c
gcc/m2/mc/decl.def
gcc/m2/mc/decl.mod
gcc/m2/mc/mcp1.bnf
gcc/m2/mc/mcp2.bnf
gcc/m2/mc/mcp3.bnf
gcc/m2/mc/mcp4.bnf
gcc/m2/mc/mcp5.bnf
gcc/m2/tools-src/mklink.c

index 77afee0711a5975e72cdf4e3b22486ab07ff7ed7..cfaef418e027b53cb42981aee29e534c2216e4d8 100644 (file)
@@ -176,19 +176,4 @@ BEGIN
 END GetFullScopePrefix ;
 
 
-(*
-   UnderScoreString - emits a string with a leading underscore if the C compiler
-                      uses _ prefixes. The string without the underscore is returned.
-*)
-
-PROCEDURE UnderScoreString (s: String) : String ;
-BEGIN
-   IF UseUnderscoreForC
-   THEN
-      Write('_')
-   END ;
-   RETURN( WriteS(StdOut, s) )
-END UnderScoreString ;
-
-
 END M2AsmUtil.
index e0e84562ed74d22e56647b820f3c34013e3d0f89..15614dcd428898fda5c3cdd2313dbb37e8af9a0c 100644 (file)
@@ -1523,12 +1523,10 @@ END DeclareCharConstant ;
    DeclareStringConstant - declares a string constant.
 *)
 
-PROCEDURE DeclareStringConstant (tokenno: CARDINAL; sym: CARDINAL) ;
+PROCEDURE DeclareStringConstant (sym: CARDINAL) ;
 VAR
    symtree : Tree ;
-   location: location_t ;
 BEGIN
-   location := TokenToLocation (tokenno) ;
    IF IsConstStringM2nul (sym) OR IsConstStringCnul (sym)
    THEN
       (* in either case the string needs a nul terminator.  If the string
@@ -1537,8 +1535,7 @@ BEGIN
       symtree := BuildCStringConstant (KeyToCharStar (GetString (sym)),
                                        GetStringLength (sym))
    ELSE
-      symtree := BuildStringConstant (location,
-                                      KeyToCharStar (GetString (sym)),
+      symtree := BuildStringConstant (KeyToCharStar (GetString (sym)),
                                       GetStringLength (sym))
    END ;
    PreAddModGcc (sym, symtree) ;
@@ -1557,10 +1554,8 @@ END DeclareStringConstant ;
 
 PROCEDURE PromoteToString (tokenno: CARDINAL; sym: CARDINAL) : Tree ;
 VAR
-   size    : CARDINAL ;
-   location: location_t ;
+   size: CARDINAL ;
 BEGIN
-   location := TokenToLocation (tokenno) ;
    DeclareConstant (tokenno, sym) ;
    size := GetStringLength (sym) ;
    IF size > 1
@@ -1568,8 +1563,7 @@ BEGIN
       (* will be a string anyway *)
       RETURN Tree (Mod2Gcc (sym))
    ELSE
-      RETURN BuildStringConstant (location,
-                                  KeyToCharStar (GetString (sym)),
+      RETURN BuildStringConstant (KeyToCharStar (GetString (sym)),
                                   GetStringLength (sym))
    END
 END PromoteToString ;
@@ -1811,7 +1805,7 @@ BEGIN
          THEN
             DeclareCharConstant(sym)
          ELSE
-            DeclareStringConstant (tokenno, sym)
+            DeclareStringConstant (sym)
          END
       ELSIF IsValueSolved(sym)
       THEN
@@ -1870,7 +1864,7 @@ BEGIN
       THEN
          DeclareCharConstant(sym)
       ELSE
-         DeclareStringConstant (tokenno, sym)
+         DeclareStringConstant (sym)
       END
    ELSIF IsValueSolved(sym)
    THEN
@@ -1926,11 +1920,11 @@ VAR
    WalkFamilyOfUnbounded -
 *)
 
-PROCEDURE WalkFamilyOfUnbounded (oaf: CARDINAL; dim: CARDINAL; unbounded: CARDINAL) ;
+PROCEDURE WalkFamilyOfUnbounded (oaf: CARDINAL <* unused *> ; dim: CARDINAL <* unused *> ; unbounded: CARDINAL) ;
 BEGIN
-   IF unbounded#NulSym
+   IF unbounded # NulSym
    THEN
-      unboundedp(unbounded)
+      unboundedp (unbounded)
    END
 END WalkFamilyOfUnbounded ;
 
index 0b5c31bd82ea81562694f4ecf7dd44281dd9cd2d..722fb5739c9227e83049f0369dea0b939a4098bb 100644 (file)
@@ -458,9 +458,9 @@ BEGIN
    StartModFileOp     : CodeStartModFile (op3) |
    ModuleScopeOp      : CodeModuleScope (op3) |
    EndFileOp          : CodeEndFile |
-   InitStartOp        : CodeInitStart (op2, op3, IsCompilingMainModule (op3)) |
+   InitStartOp        : CodeInitStart (op3, IsCompilingMainModule (op3)) |
    InitEndOp          : CodeInitEnd (op3, IsCompilingMainModule (op3)) |
-   FinallyStartOp     : CodeFinallyStart (op2, op3, IsCompilingMainModule (op3)) |
+   FinallyStartOp     : CodeFinallyStart (op3, IsCompilingMainModule (op3)) |
    FinallyEndOp       : CodeFinallyEnd (op3, IsCompilingMainModule (op3)) |
    NewLocalVarOp      : CodeNewLocalVar (op1, op3) |
    KillLocalVarOp     : CodeKillLocalVar (op3) |
@@ -701,12 +701,10 @@ VAR
    obj     : CARDINAL ;
    gccName,
    tree    : Tree ;
-   location: location_t;
 BEGIN
    tree := Tree (NIL) ;
    IF sym#NulSym
    THEN
-      location := TokenToLocation (tokenno) ;
       i := 1 ;
       REPEAT
          GetRegInterface (sym, i, name, str, obj) ;
@@ -719,7 +717,7 @@ BEGIN
                THEN
                   gccName := NIL
                ELSE
-                  gccName := BuildStringConstant (location, KeyToCharStar (name), LengthKey (name))
+                  gccName := BuildStringConstant (KeyToCharStar (name), LengthKey (name))
                END ;
                tree := ChainOnParamValue (tree, gccName, PromoteToString (tokenno, str), Mod2Gcc (obj))
             ELSE
@@ -1067,7 +1065,7 @@ END CallInnerFinally ;
                    current module.
 *)
 
-PROCEDURE CodeInitStart (currentScope, moduleSym: CARDINAL;
+PROCEDURE CodeInitStart (moduleSym: CARDINAL;
                          CompilingMainModule: BOOLEAN) ;
 VAR
    location  : location_t;
@@ -1119,7 +1117,7 @@ END CodeInitEnd ;
                       current module.
 *)
 
-PROCEDURE CodeFinallyStart (outerModule, moduleSym: CARDINAL;
+PROCEDURE CodeFinallyStart (moduleSym: CARDINAL;
                             CompilingMainModule: BOOLEAN) ;
 VAR
    location  : location_t;
@@ -2593,7 +2591,7 @@ BEGIN
       DeclareConstructor (CurrentQuadToken, quad, op3) ;
       IF (IsConst (op3) AND (type=Char)) OR IsConstString (op3)
       THEN
-         value := BuildStringConstant (location, KeyToCharStar (GetString (op3)), GetStringLength (op3))
+         value := BuildStringConstant (KeyToCharStar (GetString (op3)), GetStringLength (op3))
       ELSE
          value := Mod2Gcc (op3)
       END ;
@@ -2910,7 +2908,7 @@ BEGIN
        *  create string from char and add nul to the end, nul is
        *  added by BuildStringConstant
        *)
-      op3t := BuildStringConstant (location, KeyToCharStar (GetString (op3)), 1)
+      op3t := BuildStringConstant (KeyToCharStar (GetString (op3)), 1)
    ELSE
       op3t := Mod2Gcc (op3)
    END ;
index 4199f1542e650695693e2e5104c8184eba7e1d49..ffdcb674d43f9cd6968c8416d4086f6d0d5157b3 100644 (file)
@@ -1022,9 +1022,6 @@ BEGIN
 END GetFileName ;
 
 
-PROCEDURE stop ; BEGIN END stop ;
-
-
 (*
    AddTokToList - adds a token to a dynamic list.
 *)
index 5f2490e7cd941d9de8e9854adb646b71c1d1af34..e381d5e9015bb1608a744ccb69aa7e12e6c36480 100644 (file)
@@ -81,8 +81,9 @@ EXPORT QUALIFIED SetReturnCheck, SetNilCheck, SetCaseCheck,
                  DumpSystemExports, GenerateSwig, Exceptions,
                  OverrideLocation, FinaliseOptions,
                  DebugBuiltins, setdefextension, setmodextension,
-                 SetStatistics, SetWall, SetSaveTemps, SetSaveTempsDir,
-                 SaveTemps, GenModuleList,
+                 SetStatistics, SetWall,
+                 SetSaveTemps, SetSaveTempsDir, SaveTemps, GetSaveTempsDir,
+                 GenModuleList,
                  CppArg, CppCommandLine, CppRemember,
                 SetDebugFunctionLineNumbers, DebugFunctionLineNumbers,
                 SetGenerateStatementNote, GenerateStatementNote,
@@ -784,6 +785,13 @@ PROCEDURE SetSaveTemps (value: BOOLEAN) ;
 PROCEDURE SetSaveTempsDir (arg: ADDRESS) ;
 
 
+(*
+   GetSaveTempsDir - return SaveTempsDir or NIL if -save-temps was not used.
+*)
+
+PROCEDURE GetSaveTempsDir () : String ;
+
+
 (*
    SetGenModuleList - set the GenModuleList flag to value and pass
                       set GenModuleListFilename to filename.
index eee1d9cffac1825ba512e49baaffd9a7c9e00dec..ec5f47a7db9d1528b13d0660ac64f704376d157a 100644 (file)
@@ -53,12 +53,12 @@ CONST
 
 VAR
    Barg,
+   SaveTempsDir,
    GenModuleListFilename,
    UselistFilename,
    RuntimeModuleOverride,
    CppArgs              : String ;
    UselistFlag,
-   GenModuleListFlag,
    CC1Quiet,
    SeenSources          : BOOLEAN ;
    ForcedLocationValue  : location_t ;
@@ -1075,10 +1075,20 @@ END SetSaveTemps ;
 
 PROCEDURE SetSaveTempsDir (arg: ADDRESS) ;
 BEGIN
-   (* printf1 ("SetSaveTempsDir: arg = %s\n", arg);  *)
+   SaveTempsDir := InitStringCharStar (arg)
 END SetSaveTempsDir ;
 
 
+(*
+   GetSaveTempsDir - return SaveTempsDir or NIL if -save-temps was not used.
+*)
+
+PROCEDURE GetSaveTempsDir () : String ;
+BEGIN
+   RETURN SaveTempsDir
+END GetSaveTempsDir ;
+
+
 (*
    SetScaffoldDynamic - set the -fscaffold-dynamic flag.
 *)
@@ -1261,5 +1271,6 @@ BEGIN
    GenModuleList                := FALSE ;
    GenModuleListFilename        := NIL ;
    SharedFlag                   := FALSE ;
-   Barg                         := NIL
+   Barg                         := NIL ;
+   SaveTempsDir                 := NIL
 END M2Options.
index b3bf888cfe24208a72d53109bfc4fae21fa55719..408cc1d18f187666e95f8efb95db4320ee172103 100644 (file)
@@ -2196,7 +2196,7 @@ PROCEDURE BuildStringParamLoc (location: location_t; s: String) ;
 BEGIN
    BuildParam (location,
                BuildConvert (location, Mod2Gcc (Address),
-                             BuildAddr (location, BuildStringConstant (location, string(s), Length(s)),
+                             BuildAddr (location, BuildStringConstant (string(s), Length(s)),
                                         FALSE), FALSE))
 END BuildStringParamLoc ;
 
index 8697755a8e392464afb21d3ef51ed7f8572b0ff3..2e599bdf154992ed3b9365a8a698c8b585e6dfba 100644 (file)
@@ -800,6 +800,8 @@ ProcedureHeading := "PROCEDURE"                                           % M2Er
 
 AttributeNoReturn := [ "<*" Ident "*>" ] =:
 
+AttributeUnused := [ "<*" Ident "*>" ] =:
+
 -- note that we do need to know whether builtins are used as they
 -- determine whether we need to parse the implementation module
 -- the same is true for hidden types
@@ -852,9 +854,9 @@ DefExtendedFP := DefOptArg | "..." =:
 
 ExtendedFP := OptArg | "..." =:
 
-VarFPSection := "VAR" IdentList ":" FormalType =:
+VarFPSection := "VAR" IdentList ":" FormalType [ AttributeUnused ] =:
 
-NonVarFPSection := IdentList ":" FormalType =:
+NonVarFPSection := IdentList ":" FormalType [ AttributeUnused ] =:
 
 OptArg := "[" Ident ":" FormalType [ "=" ConstExpression ] "]" =:
 
index a68908a0bbd583b039568111674e679567381c93..085114a07e9bf9feafef868c6b6f0eb71ec81c65 100644 (file)
@@ -680,24 +680,6 @@ IdentList := Ident                                                         % VAR
                                                                              END %
              =:
 
-IdentScopeList := IdentScope                                               % VAR
-                                                                                on: BOOLEAN ;
-                                                                                n : CARDINAL ; %
-                                                                           % on := IsAutoPushOn() ;
-                                                                             IF on
-                                                                             THEN
-                                                                                n := 1
-                                                                             END %
-             { "," IdentScope                                              % IF on
-                                                                             THEN
-                                                                                INC(n)
-                                                                             END %
-             }                                                             % IF on
-                                                                             THEN
-                                                                                PushT(n)
-                                                                             END %
-             =:
-
 PossiblyExportIdentList := PossiblyExportIdent                             % VAR
                                                                                 on: BOOLEAN ;
                                                                                 n : CARDINAL ; %
@@ -736,6 +718,10 @@ AttributeExpression :=                                                     % Pus
                        Ident '(' ConstExpression ')'                       % PopAuto %
                                                      =:
 
+AttributeUnused := [ "<*"                                                  % PushAutoOff %
+                          Ident                                            % PopAuto %
+                                "*>" ] =:
+
 FieldListSequence := FieldListStatement { ";" FieldListStatement } =:
 
 FieldListStatement := [ FieldList ] =:
@@ -962,9 +948,9 @@ DefExtendedFP := DefOptArg | "..." =:
 
 ExtendedFP := OptArg | "..." =:
 
-VarFPSection := "VAR" IdentScopeList ":" FormalType =:
+VarFPSection := "VAR" IdentList ":" FormalType [ AttributeUnused ] =:
 
-NonVarFPSection := IdentScopeList ":" FormalType =:
+NonVarFPSection := IdentList ":" FormalType [ AttributeUnused ] =:
 
 OptArg := "[" IdentScope ":" FormalType [ "=" ConstExpression ] "]" =:
 
index 999da57aed0217b45c92616e81b2e2fc2885dd48..359259472345a98edef06792f8adc91bfc057d6c 100644 (file)
@@ -46,7 +46,7 @@ see <https://www.gnu.org/licenses/>.  *)
 IMPLEMENTATION MODULE P2Build ;
 
 FROM M2LexBuf IMPORT currentstring, currenttoken, GetToken, InsertToken, InsertTokenAndRewind, GetTokenNo ;
-FROM M2MetaError IMPORT MetaErrorStringT0 ;
+FROM M2MetaError IMPORT MetaErrorStringT0, MetaErrorT1 ;
 FROM NameKey IMPORT NulName, Name, makekey, MakeKey ;
 FROM M2Reserved IMPORT tokToTok, toktype, NulTok, ImportTok, ExportTok, QualifiedTok, UnQualifiedTok ;
 FROM DynamicStrings IMPORT String, InitString, KillString, Mark, ConCat, ConCatChar ;
@@ -148,19 +148,52 @@ VAR
 
 PROCEDURE ErrorString (s: String) ;
 BEGIN
-   MetaErrorStringT0(GetTokenNo(), s) ;
+   MetaErrorStringT0 (GetTokenNo (), s) ;
    WasNoError := FALSE
 END ErrorString ;
 
 
 PROCEDURE ErrorArray (a: ARRAY OF CHAR) ;
 BEGIN
-   ErrorString(InitString(a))
+   ErrorString (InitString (a))
 END ErrorArray ;
 
 
 % declaration P2Build begin
 
+(*
+   checkReturnAttribute -
+*)
+
+PROCEDURE checkReturnAttribute ;
+VAR
+   ident: Name ;
+   tok  : CARDINAL ;
+BEGIN
+   PopTtok (ident, tok) ;
+   IF ident # MakeKey ('noreturn')
+   THEN
+      MetaErrorT1 (tok, 'attribute {%1k} is not allowed in the procedure return type, only noreturn is allowed', ident)
+   END
+END checkReturnAttribute ;
+
+
+(*
+   checkParameterAttribute -
+*)
+
+PROCEDURE checkParameterAttribute ;
+VAR
+   ident: Name ;
+   tok  : CARDINAL ;
+BEGIN
+   PopTtok (ident, tok) ;
+   IF ident # MakeKey ('noreturn')
+   THEN
+      MetaErrorT1 (tok, 'attribute {%1k} is not allowed in the parameter formal type section, only unused is allowed', ident)
+   END
+END checkParameterAttribute ;
+
 
 (*
    SyntaxError - after a syntax error we skip all tokens up until we reach
@@ -218,19 +251,19 @@ BEGIN
    s0 := SetOfStop0{} ;
    s1 := SetOfStop1{} ;
    s2 := SetOfStop2{} ;
-   IF ORD(t)<32
+   IF ORD (t) <32
    THEN
-      INCL(s0, t)
-   ELSIF ORD(t)<64
+      INCL (s0, t)
+   ELSIF ORD (t) <64
    THEN
-      INCL(s1, t)
+      INCL (s1, t)
    ELSE
-      INCL(s2, t)
+      INCL (s2, t)
    END ;
-   str := DescribeStop(s0, s1, s2) ;
+   str := DescribeStop (s0, s1, s2) ;
 
-   str := ConCat(InitString('syntax error,'), Mark(str)) ;
-   MetaErrorStringT0(GetTokenNo(), str)
+   str := ConCat (InitString ('syntax error,'), Mark (str)) ;
+   MetaErrorStringT0 (GetTokenNo (), str)
 END WarnMissingToken ;
 
 
@@ -1012,10 +1045,16 @@ DefProcedureHeading := "PROCEDURE"                                         % M2E
                         )                                                  % M2Error.LeaveErrorScope %
                     =:
 
-AttributeNoReturn := [ "<*"                                                % PushAutoOff %
+AttributeNoReturn := [ "<*"                                                % PushAutoOn %
                             Ident                                          % PopAuto %
+                                                                           % checkReturnAttribute %
                                    "*>" ] =:
 
+AttributeUnused := [ "<*"                                                  % PushAutoOn %
+                          Ident                                            % PopAuto %
+                                                                           % checkParameterAttribute %
+                                "*>" ] =:
+
 -- introduced procedure block so we can produce more informative
 -- error messages
 
@@ -1105,6 +1144,7 @@ VarFPSection := "VAR"                                                      % VAR
                                                                            % PopT(n) ; %
                                                                            % PushT(VarTok) ; %
                 IdentList ":" FormalType                                   % PushT(n) %
+                [ AttributeUnused ]
                                                                            % BuildFPSection %
              =:
 
@@ -1112,6 +1152,7 @@ NonVarFPSection :=                                                         % VAR
                                                                            % PopT(n) %
                                                                            % PushT(NulTok) %
                    IdentList ":" FormalType                                % PushT(n) %
+                   [ AttributeUnused ]
                                                                            % BuildFPSection %
                 =:
 
index 5cb5e286a0226d637c3701df1f3cc696f4ea3153..ec98b49992f65bebbee8d8333edacbecc08f4d92 100644 (file)
@@ -1306,6 +1306,8 @@ DefProcedureHeading := "PROCEDURE"                                         % M2E
 
 AttributeNoReturn := [ "<*" Ident "*>" ] =:
 
+AttributeUnused := [ "<*" Ident "*>" ] =:
+
 -- introduced procedure block so we can produce more informative
 -- error messages
 
@@ -1371,9 +1373,9 @@ DefExtendedFP := DefOptArg | "..." =:
 
 ExtendedFP := OptArg | "..." =:
 
-VarFPSection := "VAR" IdentList ":" FormalType =:
+VarFPSection := "VAR" IdentList ":" FormalType [ AttributeUnused ] =:
 
-NonVarFPSection := IdentList ":" FormalType =:
+NonVarFPSection := IdentList ":" FormalType [ AttributeUnused ] =:
 
 OptArg := "[" Ident ":" FormalType [ "=" ConstExpression                   % BuildOptArgInitializer %
                                                          ] "]" =:
index 0db317234bbe85c2056c1e44ab62b2b492c2e380..7db36e8dfd60b73466426b9e86cb499a364c51f1 100644 (file)
@@ -1109,6 +1109,8 @@ DefProcedureHeading := "PROCEDURE"                                         % M2E
 
 AttributeNoReturn := [ "<*" Ident "*>" ] =:
 
+AttributeUnused := [ "<*" Ident "*>" ] =:
+
 -- introduced procedure block so we can produce more informative
 -- error messages
 
@@ -1161,9 +1163,9 @@ DefExtendedFP := DefOptArg | "..." =:
 
 ExtendedFP := OptArg | "..." =:
 
-VarFPSection := "VAR" IdentList ":" FormalType =:
+VarFPSection := "VAR" IdentList ":" FormalType [ AttributeUnused ] =:
 
-NonVarFPSection := IdentList ":" FormalType =:
+NonVarFPSection := IdentList ":" FormalType [ AttributeUnused ] =:
 
 OptArg := "[" Ident ":" FormalType [ "=" ConstExpression ] "]" =:
 
index 5a24c6756bd5d04b5fbae0b172b1ff524641b341..472fd0ba7a04dc99e8d3817868690f33bf8a1d56 100644 (file)
@@ -1129,6 +1129,8 @@ DefProcedureHeading := "PROCEDURE"                                         % M2E
 
 AttributeNoReturn := [ "<*" Ident "*>" ] =:
 
+AttributeUnused := [ "<*" Ident "*>" ] =:
+
 -- introduced procedure block so we can produce more informative
 -- error messages
 
@@ -1169,9 +1171,9 @@ DefExtendedFP := DefOptArg | "..." =:
 
 ExtendedFP := OptArg | "..." =:
 
-VarFPSection := "VAR" IdentList ":" FormalType =:
+VarFPSection := "VAR" IdentList ":" FormalType [ AttributeUnused ] =:
 
-NonVarFPSection := IdentList ":" FormalType =:
+NonVarFPSection := IdentList ":" FormalType [ AttributeUnused ] =:
 
 OptArg := "[" Ident ":" FormalType [ "=" SilentConstExpression ] "]" =:
 
index d04b3283a29b0fd43b0388e6843ba7d68c098f28..920857a38b311a30ce373fb5d4cf7a20794fcdb3 100644 (file)
@@ -3334,26 +3334,6 @@ BEGIN
 END IsDefLink ;
 
 
-(*
-   GetOuterModule - returns the outer module or NulSym if there
-                    is no module being compiled.
-*)
-
-PROCEDURE GetOuterModule () : CARDINAL ;
-VAR
-   OuterModule: CARDINAL ;
-BEGIN
-   OuterModule := GetCurrentModule () ;
-   IF OuterModule # NulSym
-   THEN
-      WHILE GetScope (OuterModule) # NulSym DO
-         OuterModule := GetScope (OuterModule)
-      END
-   END ;
-   RETURN OuterModule
-END GetOuterModule ;
-
-
 (*
    GetLink - returns TRUE if the current module is only used for linkage.
 *)
index c3b5c892dc01affbc9af4a8e435520f534c90b9e..5fd391ea877726e361506cc6b2df88fd4cfdde90 100644 (file)
@@ -350,7 +350,7 @@ m2decl_BuildCStringConstant (const char *string, int length)
    and, length.  */
 
 tree
-m2decl_BuildStringConstant (location_t location, const char *string, int length)
+m2decl_BuildStringConstant (const char *string, int length)
 {
   tree elem, index, type;
 
index eea0b117b8cfc7e9e14b192547b7d0d3e624a448..1d257a89b71791d55fd5a9124cd2d9581e75136c 100644 (file)
@@ -183,7 +183,7 @@ PROCEDURE BuildConstLiteralNumber (location: location_t;
                           and, length.
 *)
 
-PROCEDURE BuildStringConstant (location: location_t; string: ADDRESS; length: INTEGER) : Tree ;
+PROCEDURE BuildStringConstant (string: ADDRESS; length: INTEGER) : Tree ;
 
 
 (*
index 72eb005bc2c17b5c0dd82dacb673235b34ce739e..87a96a94fb762fc90aaf83ba71a8be5c512ea1cc 100644 (file)
@@ -41,7 +41,7 @@ EXTERN void m2decl_DeclareM2linkGlobals (location_t location,
 EXTERN void m2decl_BuildModuleCtor (tree module_ctor);
 EXTERN tree m2decl_DeclareModuleCtor (tree decl);
 EXTERN tree m2decl_GetDeclContext (tree t);
-EXTERN tree m2decl_BuildStringConstant (location_t location, const char *string, int length);
+EXTERN tree m2decl_BuildStringConstant (const char *string, int length);
 EXTERN tree m2decl_BuildCStringConstant (const char *string, int length);
 EXTERN tree m2decl_BuildConstLiteralNumber (location_t location,
                                            const char *str,
index 63950722cdd7cb497581b68aac3a8c5700c73c87..0d6dd8a8afae041f5b434b3d4aa81460ed91d6fc 100644 (file)
@@ -576,9 +576,9 @@ gm2_langhook_pushdecl (tree decl ATTRIBUTE_UNUSED)
   gcc_unreachable ();
 }
 
-/* This hook is used to get the current list of declarations as
-   trees.  We don't support that; instead we use write_globals.  This
-   can't simply crash because it is called by -gstabs.  */
+/* This hook is used to get the current list of declarations as trees.
+   We don't support that; instead we use write_globals.  This can't
+   simply crash because it is called by -gstabs.  */
 
 static tree
 gm2_langhook_getdecls (void)
@@ -586,6 +586,8 @@ gm2_langhook_getdecls (void)
   return NULL;
 }
 
+/* m2_write_global_declarations writes out globals by coping into a vec
+   and calling wrapup_global_declarations.  */
 
 static void
 m2_write_global_declarations (tree globals)
@@ -632,7 +634,7 @@ write_globals (void)
 }
 
 
-/*  Gimplify an EXPR_STMT node.  */
+/* Gimplify an EXPR_STMT node.  */
 
 static void
 gimplify_expr_stmt (tree *stmt_p)
@@ -685,8 +687,8 @@ gm2_genericize (tree fndecl)
       {
 
         /* If a function's arguments are copied to create a thunk, then
-        DECL_BY_REFERENCE will be set -- but the type of the argument will be
-        a pointer type, so we will never get here.  */
+          DECL_BY_REFERENCE will be set -- but the type of the argument will be
+          a pointer type, so we will never get here.  */
         gcc_assert (!DECL_BY_REFERENCE (t));
         gcc_assert (DECL_ARG_TYPE (t) != TREE_TYPE (t));
         TREE_TYPE (t) = DECL_ARG_TYPE (t);
@@ -847,7 +849,7 @@ gm2_mark_addressable (tree exp)
       default:
         return true;
       }
-  /* never reach here.  */
+  /* Never reach here.  */
   gcc_unreachable ();
 }
 
index 34d07153a2b413d472d82deb49543648e06f7c7a..f7681a13b8e4cc3026082ab1cefe13fc3d62aba9 100644 (file)
@@ -20,5 +20,5 @@ along with GNU Modula-2; see the file COPYING.  If not, write to the
 Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
 02110-1301, USA.  */
 
-/* A SET_TYPE type */
+/* A SET_TYPE type */
 DEFTREECODE (SET_TYPE, "set_type", tcc_type, 0)
index 995622cd5a24f744aa7a58c5c4623430817444f6..c9bae4424f2100c801bc5dc94270fd447d84f041 100644 (file)
@@ -56,7 +56,7 @@ enum m2_tree_code {
 /* STMT_EXPR accessor.  */
 #define STMT_EXPR_STMT(NODE)   TREE_OPERAND (STMT_EXPR_CHECK (NODE), 0)
 
-/* EXPR_STMT accessor. This gives the expression associated with an
+/* EXPR_STMT accessor.  This gives the expression associated with an
    expression statement.  */
 #define EXPR_STMT_EXPR(NODE)   TREE_OPERAND (EXPR_STMT_CHECK (NODE), 0)
 
index 36b1e604ef41a8f024c1d4801112052939c4782a..6b9846ce834e3729d2cce6cb039e2dc5b4ff58cf 100644 (file)
@@ -180,7 +180,7 @@ do_pf (tree t, int bits)
   killPretty (state);
 }
 
-/* pf print function.  Expected to be printed interactively from
+/* pf print function.  Expected to be printed interactively from
    the debugger: print pf(func), or to be called from code.  */
 
 void
@@ -189,7 +189,7 @@ pf (tree t)
   do_pf (t, FALSE);
 }
 
-/* pe print expression.  Expected to be printed interactively from
+/* pe print expression.  Expected to be printed interactively from
    the debugger: print pe(expr), or to be called from code.  */
 
 void
@@ -203,7 +203,7 @@ pe (tree t)
   killPretty (state);
 }
 
-/* pet print expression and its type.  Expected to be printed
+/* pet print expression and its type.  Expected to be printed
    interactively from the debugger: print pet(expr), or to be called
    from code.  */
 
@@ -220,7 +220,7 @@ pet (tree t)
   killPretty (state);
 }
 
-/* pt print type.  Expected to be printed interactively from the
+/* pt print type.  Expected to be printed interactively from the
    debugger: print pt(expr), or to be called from code.  */
 
 void
@@ -233,7 +233,7 @@ pt (tree t)
   killPretty (state);
 }
 
-/* ptl print type low level.  Expected to be printed interactively
+/* ptl print type low level.  Expected to be printed interactively
    from the debugger: print ptl(type), or to be called from code.  */
 
 void
@@ -246,7 +246,7 @@ ptl (tree t)
   killPretty (state);
 }
 
-/* ptcl print TREE_CHAINed list.  */
+/* ptcl print TREE_CHAINed list.  */
 
 void
 ptcl (tree t)
@@ -258,7 +258,7 @@ ptcl (tree t)
   killPretty (state);
 }
 
-/* loc if tree has a location then display it within a comment.  */
+/* loc if tree has a location then display it within a comment.  */
 
 static void
 m2pp_loc (pretty *s, tree t)
@@ -288,7 +288,7 @@ m2pp_loc (pretty *s, tree t)
     }
 }
 
-/* m2pp_decl_list prints a TREE_CHAINed list for a decl node.  */
+/* m2pp_decl_list prints a TREE_CHAINed list for a decl node.  */
 
 static void
 m2pp_decl_list (pretty *s, tree t)
@@ -368,9 +368,9 @@ pv (tree t)
     }
 }
 
-/* */
-
 #if defined(GM2_MAINTAINER)
+
+/* remember an internal debugging hook. */
 static tree rememberF = NULL;
 
 static void
@@ -382,7 +382,7 @@ remember (tree t)
 }
 #endif
 
-/* push - pushes tree, t, onto stack.  */
+/* push pushes tree t onto stack.  */
 
 static void
 push (tree t)
@@ -394,7 +394,7 @@ push (tree t)
   stackPtr = s;
 }
 
-/* pop pops a tree, from the stack.  */
+/* pop pops a tree, from the stack.  */
 
 static void
 pop (void)
@@ -405,7 +405,7 @@ pop (void)
   free (s);
 }
 
-/* being_printed - returns TRUE if, t, is held on the stack.  */
+/* being_printed returns TRUE if t is held on the stack.  */
 
 static int
 begin_printed (tree t)
@@ -422,7 +422,7 @@ begin_printed (tree t)
   return FALSE;
 }
 
-/* dupPretty - duplicate and return a copy of state, s.  */
+/* dupPretty duplicate and return a copy of state s.  */
 
 static pretty *
 dupPretty (pretty *s)
@@ -432,7 +432,7 @@ dupPretty (pretty *s)
   return p;
 }
 
-/* initPretty initialise the state of the pretty printer.  */
+/* initPretty initialise the state of the pretty printer.  */
 
 static pretty *
 initPretty (int bits)
@@ -450,7 +450,7 @@ initPretty (int bits)
   return state;
 }
 
-/* killPretty cleans up the state.  */
+/* killPretty cleans up the state.  */
 
 static void
 killPretty (pretty *s)
@@ -459,7 +459,7 @@ killPretty (pretty *s)
   fflush (stdout);
 }
 
-/* getindent returns the current indent value.  */
+/* getindent returns the current indent value.  */
 
 static int
 getindent (pretty *s)
@@ -467,7 +467,7 @@ getindent (pretty *s)
   return s->indent;
 }
 
-/* setindent sets the current indent to, n.  */
+/* setindent sets the current indent to, n.  */
 
 static void
 setindent (pretty *s, int n)
@@ -475,7 +475,7 @@ setindent (pretty *s, int n)
   s->indent = n;
 }
 
-/* getcurpos returns the current cursor position.  */
+/* getcurpos returns the current cursor position.  */
 
 static int
 getcurpos (pretty *s)
@@ -486,7 +486,7 @@ getcurpos (pretty *s)
     return s->curpos;
 }
 
-/* m2pp_type_lowlevel prints out the low level details of a
+/* m2pp_type_lowlevel prints out the low level details of a
    fundamental type.  */
 
 static void
@@ -519,7 +519,7 @@ m2pp_type_lowlevel (pretty *s, tree t)
     }
 }
 
-/* m2pp_var emit a VAR if necessary.  */
+/* m2pp_var emit a VAR if necessary.  */
 
 static void
 m2pp_var (pretty *s)
@@ -532,7 +532,7 @@ m2pp_var (pretty *s)
     }
 }
 
-/* m2pp_types emit a TYPE if necessary.  */
+/* m2pp_types emit a TYPE if necessary.  */
 
 static void
 m2pp_types (pretty *s)
@@ -545,7 +545,7 @@ m2pp_types (pretty *s)
     }
 }
 
-/* hextree displays the critical fields for function, block and
+/* hextree displays the critical fields for function, block and
    bind_expr trees in raw hex.  */
 
 static void
@@ -697,7 +697,7 @@ m2pp_module_block (pretty *s, tree t)
       }
 }
 
-/* m2pp_begin emit a BEGIN if necessary.  */
+/* m2pp_begin emit a BEGIN if necessary.  */
 
 static void
 m2pp_begin (pretty *s)
@@ -721,7 +721,7 @@ m2pp_begin (pretty *s)
     }
 }
 
-/* m2pp_function walk over the function.  */
+/* m2pp_function walk over the function.  */
 
 static void
 m2pp_function (pretty *s, tree t)
@@ -741,7 +741,7 @@ m2pp_function (pretty *s, tree t)
     }
 }
 
-/* m2pp_bind_expr displays the bind expr tree node.  */
+/* m2pp_bind_expr displays the bind expr tree node.  */
 
 static void
 m2pp_bind_expr (pretty *s, tree t)
@@ -765,7 +765,7 @@ m2pp_bind_expr (pretty *s, tree t)
     }
 }
 
-/* m2pp_block_list iterates over the list of blocks.  */
+/* m2pp_block_list iterates over the list of blocks.  */
 
 static void
 m2pp_block_list (pretty *s, tree t)
@@ -774,7 +774,7 @@ m2pp_block_list (pretty *s, tree t)
     m2pp_block (s, t);
 }
 
-/* m2pp_block prints the VARiables and the TYPEs inside a block.  */
+/* m2pp_block prints the VARiables and the TYPEs inside a block.  */
 
 static void
 m2pp_block (pretty *s, tree t)
@@ -788,7 +788,7 @@ m2pp_block (pretty *s, tree t)
     }
 }
 
-/* m2pp_var_type_decl displays the variable and type declaration.  */
+/* m2pp_var_type_decl displays the variable and type declaration.  */
 
 static void
 m2pp_var_type_decl (pretty *s, tree t)
@@ -802,7 +802,7 @@ m2pp_var_type_decl (pretty *s, tree t)
   m2pp_print (s, ";\n");
 }
 
-/* m2pp_var_list print a variable list.  */
+/* m2pp_var_list print a variable list.  */
 
 static void
 m2pp_var_list (pretty *s, tree t)
@@ -834,7 +834,7 @@ m2pp_var_list (pretty *s, tree t)
 }
 
 #if 0
-/* m2pp_type_list print a variable list.  */
+/* m2pp_type_list print a variable list.  */
 
 static void
 m2pp_type_list (pretty *s, tree t)
@@ -853,7 +853,7 @@ m2pp_type_list (pretty *s, tree t)
 }
 #endif
 
-/* m2pp_needspace sets appropriate flag to TRUE.  */
+/* m2pp_needspace sets appropriate flag to TRUE.  */
 
 static void
 m2pp_needspace (pretty *s)
@@ -861,7 +861,7 @@ m2pp_needspace (pretty *s)
   s->needs_space = TRUE;
 }
 
-/* m2pp_identifer prints an identifier.  */
+/* m2pp_identifer prints an identifier.  */
 
 static void
 m2pp_identifier (pretty *s, tree t)
@@ -885,7 +885,7 @@ m2pp_identifier (pretty *s, tree t)
     }
 }
 
-/* m2pp_ident_pointer displays an ident pointer.  */
+/* m2pp_ident_pointer displays an ident pointer.  */
 
 static void
 m2pp_ident_pointer (pretty *s, tree t)
@@ -894,7 +894,7 @@ m2pp_ident_pointer (pretty *s, tree t)
     m2pp_print (s, IDENTIFIER_POINTER (t));
 }
 
-/* m2pp_parameter prints out a param decl tree.  */
+/* m2pp_parameter prints out a param decl tree.  */
 
 static void
 m2pp_parameter (pretty *s, tree t)
@@ -920,7 +920,7 @@ m2pp_parameter (pretty *s, tree t)
     }
 }
 
-/* m2pp_param_type prints out the type of parameter.  */
+/* m2pp_param_type prints out the type of parameter.  */
 
 static void
 m2pp_param_type (pretty *s, tree t)
@@ -935,7 +935,7 @@ m2pp_param_type (pretty *s, tree t)
     m2pp_simple_type (s, t);
 }
 
-/* m2pp_procedure_type displays a procedure type.  */
+/* m2pp_procedure_type displays a procedure type.  */
 
 static void
 m2pp_procedure_type (pretty *s, tree t)
@@ -963,7 +963,7 @@ m2pp_procedure_type (pretty *s, tree t)
               if (TREE_CHAIN (i) == NULL_TREE)
                 {
                   if (TREE_VALUE (i) == void_type_node)
-                    /* ignore void_type_node at the end.  */
+                    /* Ignore void_type_node at the end.  */
                     ;
                   else
                     {
@@ -1002,7 +1002,7 @@ m2pp_procedure_type (pretty *s, tree t)
   pop ();
 }
 
-/* m2pp_comment_header displays a simple header with some critical
+/* m2pp_comment_header displays a simple header with some critical
    tree info.  */
 
 static void
@@ -1036,7 +1036,7 @@ m2pp_comment_header (pretty *s, tree t)
   m2pp_print (s, "*)\n\n");
 }
 
-/* m2pp_function_header displays the function header.  */
+/* m2pp_function_header displays the function header.  */
 
 static void
 m2pp_function_header (pretty *s, tree t)
@@ -1088,7 +1088,7 @@ m2pp_function_header (pretty *s, tree t)
   pop ();
 }
 
-/* m2pp_add_var adds a variable into a list as defined by, data.  */
+/* m2pp_add_var adds a variable into a list as defined by, data.  */
 
 static tree
 m2pp_add_var (tree *tp, int *walk_subtrees, void *data)
@@ -1125,7 +1125,7 @@ m2pp_add_var (tree *tp, int *walk_subtrees, void *data)
   return NULL_TREE;
 }
 
-/* m2pp_function_vars displays variables as defined by the function
+/* m2pp_function_vars displays variables as defined by the function
    tree.  */
 
 static void
@@ -1141,8 +1141,8 @@ m2pp_function_vars (pretty *s, tree t)
     }
 }
 
-/* m2pp_print - print out a string, p, interpreting '\n' and
-   adjusting the fields within, state, s.  */
+/* m2pp_print print out a string p interpreting '\n' and
+   adjusting the fields within state s.  */
 
 static void
 m2pp_print (pretty *s, const char *p)
@@ -1184,7 +1184,7 @@ m2pp_print (pretty *s, const char *p)
     }
 }
 
-/* m2pp_print_char - prints out a character, ch, obeying needs_space
+/* m2pp_print_char prints out a character ch obeying needs_space
    and needs_indent.  */
 
 static void
@@ -1214,7 +1214,7 @@ m2pp_print_char (pretty *s, char ch)
   s->curpos++;
 }
 
-/* m2pp_integer display the appropriate integer type.  */
+/* m2pp_integer display the appropriate integer type.  */
 
 #if defined(GM2)
 void
@@ -1269,7 +1269,7 @@ m2pp_integer (pretty *s, tree t ATTRIBUTE_UNUSED)
 }
 #endif
 
-/* m2pp_complex display the actual complex type.  */
+/* m2pp_complex display the actual complex type.  */
 
 #if defined(GM2)
 static void
@@ -1304,7 +1304,7 @@ m2pp_complex (pretty *s, tree t ATTRIBUTE_UNUSED)
 }
 #endif
 
-/* m2pp_type prints a full type.  */
+/* m2pp_type prints a full type.  */
 
 void
 m2pp_type (pretty *s, tree t)
@@ -1363,7 +1363,7 @@ m2pp_type (pretty *s, tree t)
     }
 }
 
-/* m2pp_set_type prints out the set type.  */
+/* m2pp_set_type prints out the set type.  */
 
 static void
 m2pp_set_type (pretty *s, tree t)
@@ -1375,7 +1375,7 @@ m2pp_set_type (pretty *s, tree t)
   pop ();
 }
 
-/* m2pp_enum print out the enumeration type.  */
+/* m2pp_enum print out the enumeration type.  */
 
 static void
 m2pp_enum (pretty *s, tree t)
@@ -1395,7 +1395,7 @@ m2pp_enum (pretty *s, tree t)
   pop ();
 }
 
-/* m2pp_array prints out the array type.  */
+/* m2pp_array prints out the array type.  */
 
 static void
 m2pp_array (pretty *s, tree t)
@@ -1411,7 +1411,7 @@ m2pp_array (pretty *s, tree t)
   pop ();
 }
 
-/* m2pp_subrange prints out the subrange, but probably the lower
+/* m2pp_subrange prints out the subrange, but probably the lower
    bound will always be zero.  */
 
 static void
@@ -1427,7 +1427,7 @@ m2pp_subrange (pretty *s, tree t)
   m2pp_print (s, "]");
 }
 
-/* m2pp_gimplified print out a gimplified comment.  */
+/* m2pp_gimplified print out a gimplified comment.  */
 
 static void
 m2pp_gimpified (pretty *s, tree t)
@@ -1439,7 +1439,7 @@ m2pp_gimpified (pretty *s, tree t)
     }
 }
 
-/* m2pp_printer_type display the pointer type.  */
+/* m2pp_printer_type display the pointer type.  */
 
 static void
 m2pp_pointer_type (pretty *s, tree t)
@@ -1461,7 +1461,7 @@ m2pp_pointer_type (pretty *s, tree t)
   pop ();
 }
 
-/* m2pp_record_alignment prints out whether this record is aligned
+/* m2pp_record_alignment prints out whether this record is aligned
    (packed).  */
 
 static void
@@ -1528,7 +1528,7 @@ m2pp_recordfield_bitfield (pretty *s, tree t)
     }
 }
 
-/* m2pp_record_type displays the record type.  */
+/* m2pp_record_type displays the record type.  */
 
 static void
 m2pp_record_type (pretty *s, tree t)
@@ -1559,7 +1559,7 @@ m2pp_record_type (pretty *s, tree t)
   pop ();
 }
 
-/* m2pp_record_type displays the record type.  */
+/* m2pp_record_type displays the record type.  */
 
 static void
 m2pp_union_type (pretty *s, tree t)
@@ -1638,7 +1638,7 @@ m2pp_simple_type (pretty *s, tree t)
     }
 }
 
-/* m2pp_expression - */
+/* m2pp_expression display an expression.  */
 
 static void
 m2pp_expression (pretty *s, tree t)
@@ -1670,7 +1670,7 @@ m2pp_expression (pretty *s, tree t)
     }
 }
 
-/* m2pp_relop displays the lhs relop rhs.  */
+/* m2pp_relop displays the lhs relop rhs.  */
 
 static void
 m2pp_relop (pretty *s, tree t, const char *p)
@@ -1682,7 +1682,7 @@ m2pp_relop (pretty *s, tree t, const char *p)
   m2pp_expression (s, TREE_OPERAND (t, 1));
 }
 
-/* m2pp_compound_expression handle compound expression tree.  */
+/* m2pp_compound_expression handle compound expression tree.  */
 
 static void
 m2pp_compound_expression (pretty *s, tree t)
@@ -1695,7 +1695,7 @@ m2pp_compound_expression (pretty *s, tree t)
   m2pp_needspace (s);
 }
 
-/* m2pp_target_expression handle target expression tree.  */
+/* m2pp_target_expression handle target expression tree.  */
 
 static void
 m2pp_target_expression (pretty *s, tree t)
@@ -1734,7 +1734,7 @@ m2pp_target_expression (pretty *s, tree t)
   m2pp_needspace (s);
 }
 
-/* m2pp_constructor print out a constructor.  */
+/* m2pp_constructor print out a constructor.  */
 
 static void
 m2pp_constructor (pretty *s, tree t)
@@ -1759,7 +1759,7 @@ m2pp_constructor (pretty *s, tree t)
   m2pp_print (s, " *)\n");
 }
 
-/* m2pp_complex_expr handle GCC complex_expr tree.  */
+/* m2pp_complex_expr handle GCC complex_expr tree.  */
 
 static void
 m2pp_complex_expr (pretty *s, tree t)
@@ -1786,7 +1786,7 @@ m2pp_complex_expr (pretty *s, tree t)
     }
 }
 
-/* m2pp_imagpart_expr handle imagpart_expr tree.  */
+/* m2pp_imagpart_expr handle imagpart_expr tree.  */
 
 static void
 m2pp_imagpart_expr (pretty *s, tree t)
@@ -1801,7 +1801,7 @@ m2pp_imagpart_expr (pretty *s, tree t)
   m2pp_print (s, ")");
 }
 
-/* m2pp_realpart_expr handle imagpart_expr tree.  */
+/* m2pp_realpart_expr handle imagpart_expr tree.  */
 
 static void
 m2pp_realpart_expr (pretty *s, tree t)
@@ -1816,7 +1816,7 @@ m2pp_realpart_expr (pretty *s, tree t)
   m2pp_print (s, ")");
 }
 
-/* m2pp_bit_ior_expr - */
+/* m2pp_bit_ior_expr generate a C style bit or.  */
 
 static void
 m2pp_bit_ior_expr (pretty *s, tree t)
@@ -1840,7 +1840,7 @@ m2pp_truth_expr (pretty *s, tree t, const char *op)
   m2pp_print (s, ")");
 }
 
-/* m2pp_simple_expression handle GCC expression tree.  */
+/* m2pp_simple_expression handle GCC expression tree.  */
 
 static void
 m2pp_simple_expression (pretty *s, tree t)
@@ -1998,7 +1998,7 @@ m2pp_simple_expression (pretty *s, tree t)
     }
 }
 
-/* non_lvalue_expr indicates that operand 0 is not an lvalue.  */
+/* non_lvalue_expr indicates that operand 0 is not an lvalue.  */
 
 static void
 m2pp_non_lvalue_expr (pretty *s, tree t)
@@ -2011,7 +2011,7 @@ m2pp_non_lvalue_expr (pretty *s, tree t)
   m2pp_print (s, ")");
 }
 
-/* m2pp_array_ref prints out the array reference.  */
+/* m2pp_array_ref prints out the array reference.  */
 
 static void
 m2pp_array_ref (pretty *s, tree t)
@@ -2022,7 +2022,7 @@ m2pp_array_ref (pretty *s, tree t)
   m2pp_print (s, "]");
 }
 
-/* m2pp_ssa prints out the ssa variable name.  */
+/* m2pp_ssa prints out the ssa variable name.  */
 
 static void
 m2pp_ssa (pretty *s, tree t)
@@ -2030,7 +2030,7 @@ m2pp_ssa (pretty *s, tree t)
   m2pp_identifier (s, SSA_NAME_VAR (t));
 }
 
-/* m2pp_binary print the binary operator, p, and lhs, rhs.  */
+/* m2pp_binary print the binary operator, p, and lhs, rhs.  */
 
 static void
 m2pp_binary (pretty *s, tree t, const char *p)
@@ -2045,7 +2045,7 @@ m2pp_binary (pretty *s, tree t, const char *p)
   m2pp_expression (s, right);
 }
 
-/* m2pp_unary print the unary operator, p, and expression.  */
+/* m2pp_unary print the unary operator, p, and expression.  */
 
 static void
 m2pp_unary (pretty *s, tree t, const char *p)
@@ -2057,7 +2057,7 @@ m2pp_unary (pretty *s, tree t, const char *p)
   m2pp_expression (s, expr);
 }
 
-/* m2pp_integer_cst displays the integer constant.  */
+/* m2pp_integer_cst displays the integer constant.  */
 
 static void
 m2pp_integer_cst (pretty *s, tree t)
@@ -2068,7 +2068,7 @@ m2pp_integer_cst (pretty *s, tree t)
   m2pp_print (s, val);
 }
 
-/* m2pp_real_cst displays the real constant.  */
+/* m2pp_real_cst displays the real constant.  */
 
 static void
 m2pp_real_cst (pretty *s, tree t ATTRIBUTE_UNUSED)
@@ -2076,7 +2076,7 @@ m2pp_real_cst (pretty *s, tree t ATTRIBUTE_UNUSED)
   m2pp_print (s, "<unknown real>");
 }
 
-/* m2pp_string_cst displays the real constant.  */
+/* m2pp_string_cst displays the real constant.  */
 
 static void
 m2pp_string_cst (pretty *s, tree t)
@@ -2093,7 +2093,7 @@ m2pp_string_cst (pretty *s, tree t)
   m2pp_print (s, "\"");
 }
 
-/* m2pp_statement_sequence iterates over a statement list
+/* m2pp_statement_sequence iterates over a statement list
    displaying each statement in turn.  */
 
 static void
@@ -2114,7 +2114,7 @@ m2pp_statement_sequence (pretty *s, tree t)
     }
 }
 
-/* m2pp_unknown displays an error message.  */
+/* m2pp_unknown displays an error message.  */
 
 static void
 m2pp_unknown (pretty *s, const char *s1, const char *s2)
@@ -2126,7 +2126,7 @@ m2pp_unknown (pretty *s, const char *s1, const char *s2)
   m2pp_needspace (s);
 }
 
-/* m2pp_throw displays a throw statement.  */
+/* m2pp_throw displays a throw statement.  */
 
 static void
 m2pp_throw (pretty *s, tree t)
@@ -2144,7 +2144,7 @@ m2pp_throw (pretty *s, tree t)
     }
 }
 
-/* m2pp_catch_expr attempts to reconstruct a catch expr.  */
+/* m2pp_catch_expr attempts to reconstruct a catch expr.  */
 
 static void
 m2pp_catch_expr (pretty *s, tree t)
@@ -2165,7 +2165,7 @@ m2pp_catch_expr (pretty *s, tree t)
   m2pp_print (s, "(* end catch body *)\n");
 }
 
-/* m2pp_try_finally_expr attemts to reconstruct a try finally expr.  */
+/* m2pp_try_finally_expr attemts to reconstruct a try finally expr.  */
 
 static void
 m2pp_try_finally_expr (pretty *s, tree t)
@@ -2184,7 +2184,7 @@ m2pp_try_finally_expr (pretty *s, tree t)
 }
 
 #if !defined(GM2)
-/* m2pp_if_stmt pretty print a C++ if_stmt.  */
+/* m2pp_if_stmt pretty print a C++ if_stmt.  */
 
 static void
 m2pp_if_stmt (pretty *s, tree t)
@@ -2205,7 +2205,7 @@ m2pp_if_stmt (pretty *s, tree t)
 }
 #endif
 
-/* m2pp_statement attempts to reconstruct a statement.  */
+/* m2pp_statement attempts to reconstruct a statement.  */
 
 static void
 m2pp_statement (pretty *s, tree t)
@@ -2280,7 +2280,7 @@ m2pp_statement (pretty *s, tree t)
     }
 }
 
-/* m2pp_try_catch_expr is used after gimplification.  */
+/* m2pp_try_catch_expr is used after gimplification.  */
 
 static void
 m2pp_try_catch_expr (pretty *s, tree t)
@@ -2294,7 +2294,7 @@ m2pp_try_catch_expr (pretty *s, tree t)
   m2pp_print (s, "(* try_catch_expr ends *)\n");
 }
 
-/* m2pp_cleanup_point_expr emits a comment indicating a GCC
+/* m2pp_cleanup_point_expr emits a comment indicating a GCC
    cleanup_point_expr is present.  */
 
 static void
@@ -2306,7 +2306,7 @@ m2pp_cleanup_point_expr (pretty *s, tree t)
   m2pp_print (s, "(* cleanup point ends *)\n");
 }
 
-/* m2pp_decl_expr displays a local declaration.  */
+/* m2pp_decl_expr displays a local declaration.  */
 
 static void
 m2pp_decl_expr (pretty *s, tree t)
@@ -2316,7 +2316,7 @@ m2pp_decl_expr (pretty *s, tree t)
   m2pp_var_type_decl (s, DECL_EXPR_DECL (t));
 }
 
-/* m2pp_procedure_call print a call to a procedure.  */
+/* m2pp_procedure_call print a call to a procedure.  */
 
 static void
 m2pp_procedure_call (pretty *s, tree t)
@@ -2349,7 +2349,7 @@ m2pp_args (pretty *s, tree e)
   m2pp_print (s, ")");
 }
 
-/* m2pp_call_expr print a call to a procedure or function.  */
+/* m2pp_call_expr print a call to a procedure or function.  */
 
 static void
 m2pp_call_expr (pretty *s, tree t)
@@ -2368,12 +2368,12 @@ m2pp_call_expr (pretty *s, tree t)
   else
     proc = call;
 
-  m2pp_expression (s, proc); /* m2pp_identifier (s, proc);  */
+  m2pp_expression (s, proc);
   if (args || has_return_type)
     m2pp_args (s, t);
 }
 
-/* m2pp_return_expr displays the return statement.  */
+/* m2pp_return_expr displays the return statement.  */
 
 static void
 m2pp_return_expr (pretty *s, tree t)
@@ -2402,7 +2402,7 @@ m2pp_return_expr (pretty *s, tree t)
   m2pp_print (s, ";\n");
 }
 
-/* m2pp_try_block displays the try block.  */
+/* m2pp_try_block displays the try block.  */
 
 static void
 m2pp_try_block (pretty *s, tree t)
@@ -2420,7 +2420,7 @@ m2pp_try_block (pretty *s, tree t)
   m2pp_print (s, "(* END TRY *)\n");
 }
 
-/* m2pp_try_block displays the handler block.  */
+/* m2pp_try_block displays the handler block.  */
 
 static void
 m2pp_handler (pretty *s, tree t)
@@ -2443,7 +2443,7 @@ m2pp_handler (pretty *s, tree t)
   m2pp_statement_sequence (s, body);
 }
 
-/* m2pp_assignment prints out the assignment statement.  */
+/* m2pp_assignment prints out the assignment statement.  */
 
 static void
 m2pp_assignment (pretty *s, tree t)
@@ -2463,7 +2463,7 @@ m2pp_assignment (pretty *s, tree t)
   setindent (s, o);
 }
 
-/* m2pp_designator displays the lhs of an assignment.  */
+/* m2pp_designator displays the lhs of an assignment.  */
 
 static void
 m2pp_designator (pretty *s, tree t)
@@ -2471,7 +2471,7 @@ m2pp_designator (pretty *s, tree t)
   m2pp_expression (s, t);
 }
 
-/* m2pp_indirect_ref displays the indirect operator.  */
+/* m2pp_indirect_ref displays the indirect operator.  */
 
 static void
 m2pp_indirect_ref (pretty *s, tree t)
@@ -2481,7 +2481,7 @@ m2pp_indirect_ref (pretty *s, tree t)
   m2pp_print (s, ")^");
 }
 
-/* m2pp_conditional builds an IF THEN ELSE END.  With more work
+/* m2pp_conditional builds an IF THEN ELSE END.  With more work
    this should be moved into statement sequence which could look for
    repeat and while loops.  */
 
@@ -2509,7 +2509,7 @@ m2pp_conditional (pretty *s, tree t)
   m2pp_print (s, "END ;\n");
 }
 
-/* m2pp_label_decl displays a label.  Again should be moved into
+/* m2pp_label_decl displays a label.  Again should be moved into
    statement sequence to determine proper loop constructs.  */
 
 static void
@@ -2521,7 +2521,7 @@ m2pp_label_decl (pretty *s, tree t)
   m2pp_print (s, ": *)\n");
 }
 
-/* m2pp_label_expr skips the LABEL_EXPR to find the LABEL_DECL.  */
+/* m2pp_label_expr skips the LABEL_EXPR to find the LABEL_DECL.  */
 
 static void
 m2pp_label_expr (pretty *s, tree t)
@@ -2530,7 +2530,7 @@ m2pp_label_expr (pretty *s, tree t)
   m2pp_statement (s, TREE_OPERAND (t, 0));
 }
 
-/* m2pp_goto displays a goto statement.  Again should be moved into
+/* m2pp_goto displays a goto statement.  Again should be moved into
    statement sequence to determine proper loop constructs.  */
 
 static void
@@ -2542,7 +2542,7 @@ m2pp_goto (pretty *s, tree t)
   m2pp_print (s, " *)\n");
 }
 
-/* m2pp_list prints a TREE_CHAINed list.  */
+/* m2pp_list prints a TREE_CHAINed list.  */
 
 static void
 m2pp_list (pretty *s, tree t)
@@ -2564,7 +2564,7 @@ m2pp_list (pretty *s, tree t)
   m2pp_print (s, ")");
 }
 
-/* m2pp_offset displays the offset operator.  */
+/* m2pp_offset displays the offset operator.  */
 
 static void
 m2pp_offset (pretty *s, tree t)
@@ -2579,7 +2579,7 @@ m2pp_offset (pretty *s, tree t)
   m2pp_print (s, ")");
 }
 
-/* m2pp_addr_expr - */
+/* m2pp_addr_expr create an ADR expression.  */
 
 static void
 m2pp_addr_expr (pretty *s, tree t)
@@ -2590,7 +2590,7 @@ m2pp_addr_expr (pretty *s, tree t)
   m2pp_print (s, ")");
 }
 
-/* m2pp_nop - */
+/* m2pp_nop generate a CAST expression.  */
 
 static void
 m2pp_nop (pretty *s, tree t)
@@ -2603,7 +2603,7 @@ m2pp_nop (pretty *s, tree t)
   m2pp_print (s, ")");
 }
 
-/* m2pp_convert - */
+/* m2pp_convert generate a CONVERT expression.  */
 
 static void
 m2pp_convert (pretty *s, tree t)
@@ -2616,7 +2616,7 @@ m2pp_convert (pretty *s, tree t)
   m2pp_print (s, ")");
 }
 
-/* m2pp_var_decl - */
+/* m2pp_var_decl generate a variable.  */
 
 static void
 m2pp_var_decl (pretty *s, tree t)
@@ -2624,7 +2624,7 @@ m2pp_var_decl (pretty *s, tree t)
   m2pp_identifier (s, t);
 }
 
-/* m2pp_result_decl - */
+/* m2pp_result_decl generate a result declaration (variable).  */
 
 static void
 m2pp_result_decl (pretty *s, tree t)
@@ -2632,7 +2632,7 @@ m2pp_result_decl (pretty *s, tree t)
   m2pp_identifier (s, t);
 }
 
-/* m2pp_component_ref - */
+/* m2pp_component_ref generate a record field access.  */
 
 static void
 m2pp_component_ref (pretty *s, tree t)
index 444fa901e27e300e53306772f6a965868f9512c5..5bef04954fba1db09db95c23a0d7611221c0617d 100644 (file)
@@ -28,6 +28,8 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 #      define EXTERN extern
 #   endif
 
+/* These functions allow a maintainer to dump the trees in Modula-2.  */
+
 EXTERN void pf (tree t);
 EXTERN void pe (tree t);
 EXTERN void pt (tree t);
index 1983d81bd98b2775eeab8922c1c95ef6d418ed98..2e95d5cc3c7c2f5ac6b1f601d419c37cebe692fb 100644 (file)
@@ -77,10 +77,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #   define ASCII_del (char) 0177
 #   define ASCII_EOL ASCII_nl
 
-extern "C" void _M2_ASCII_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_ASCII_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_ASCII_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_ASCII_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
index 919182ca511f22cc8a67932ae8d2819f47f718df..70464ef55c8c6c43a85459014b478f4811d3a62c 100644 (file)
@@ -111,10 +111,10 @@ extern "C" unsigned int Args_Narg (void)
   __builtin_unreachable ();
 }
 
-extern "C" void _M2_Args_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_Args_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_Args_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_Args_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
index 6aaa9695db579c02daca683831ca3fe70b7fbe45..9faab7b4946a330dee78db62612fccd2fd6369aa 100644 (file)
@@ -62,10 +62,10 @@ extern "C" void Assertion_Assert (unsigned int Condition)
     }
 }
 
-extern "C" void _M2_Assertion_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_Assertion_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_Assertion_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_Assertion_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
index 9b800b3b2e1e82a32d077dec8b17f6f9bc0b8a36..655018d0b0ac983e579e45f9ea3aa053d78b72c2 100644 (file)
@@ -38,10 +38,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 
 
 
-extern "C" void _M2_Break_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_Break_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_Break_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_Break_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
index 3813aa63c2d381fde066bb1ef8c1da9039fea020..f4c5cf4c27c0a40f04d7c006e51c75b049543c57 100644 (file)
@@ -313,10 +313,10 @@ extern "C" unsigned int CmdArgs_Narg (const char *CmdLine_, unsigned int _CmdLin
   __builtin_unreachable ();
 }
 
-extern "C" void _M2_CmdArgs_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_CmdArgs_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_CmdArgs_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_CmdArgs_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
index 8a74e1c4cdb6b824583bf7c6f3aa519475e9d611..f42fbc7ee6584518126461226a383d5f6bee1593 100644 (file)
@@ -159,10 +159,10 @@ extern "C" void Debug_DebugString (const char *a_, unsigned int _a_high)
     }
 }
 
-extern "C" void _M2_Debug_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_Debug_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_Debug_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_Debug_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
index b87a8db60156f9c2ada68c326ef42538bc25e0b7..e3b75d3bbdca1e2a11febd6041a0b8913f4042cc 100644 (file)
@@ -2675,12 +2675,12 @@ extern "C" DynamicStrings_String DynamicStrings_PopAllocationExemption (unsigned
   __builtin_unreachable ();
 }
 
-extern "C" void _M2_DynamicStrings_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_DynamicStrings_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
   Initialized = FALSE;
   Init ();
 }
 
-extern "C" void _M2_DynamicStrings_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_DynamicStrings_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
index ea0a6cbf21e9faa16072af2becc0ee9ef3176bb0..2cb4c7570e1da6b8f7a22cff2ccd6ca54c519c50 100644 (file)
@@ -120,10 +120,10 @@ extern "C" unsigned int Environment_PutEnvironment (const char *EnvDef_, unsigne
   __builtin_unreachable ();
 }
 
-extern "C" void _M2_Environment_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_Environment_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_Environment_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_Environment_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
index 3a9c103411ecc6cf3bca3de333de0a54658080b1..d2f5c87122f031fd847cf712cb68511d188058ac 100644 (file)
@@ -2311,12 +2311,12 @@ extern "C" void FIO_FlushOutErr (void)
     }
 }
 
-extern "C" void _M2_FIO_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_FIO_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
   Init ();
 }
 
-extern "C" void _M2_FIO_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_FIO_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
   FIO_FlushOutErr ();
 }
index 9811ba5d535e9f6705a221a494ba3cfbbc320db9..65d5d67598b71e96de7d345c9a6a64d9d8364680 100644 (file)
@@ -836,10 +836,10 @@ extern "C" DynamicStrings_String FormatStrings_HandleEscape (DynamicStrings_Stri
   __builtin_unreachable ();
 }
 
-extern "C" void _M2_FormatStrings_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_FormatStrings_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_FormatStrings_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_FormatStrings_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
index 3ec1118c162f76e8b8e053fd932139e9a6e1f955..8c35b4eca298663e8ccd0492a3bcfa7f16f125fc 100644 (file)
@@ -327,10 +327,10 @@ extern "C" void FpuIO_LongIntToStr (long int x, unsigned int n, char *a, unsigne
   s = DynamicStrings_KillString (s);
 }
 
-extern "C" void _M2_FpuIO_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_FpuIO_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_FpuIO_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_FpuIO_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
index ea4c2d8c5d58251d602cba95732d9fe48c492f98..47dfa33ff456cfcf0b2e41c805758ab426738754 100644 (file)
@@ -469,11 +469,11 @@ extern "C" void IO_EchoOff (int fd, unsigned int input)
   term = termios_KillTermios (term);
 }
 
-extern "C" void _M2_IO_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_IO_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
   Init ();
 }
 
-extern "C" void _M2_IO_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_IO_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
index c865caaf590d7240c71fd55f799be36256520215..78678bc005868ba7be11cd0a7e82e1c383e8f4a5 100644 (file)
@@ -482,10 +482,10 @@ extern "C" void Indexing_ForeachIndiceInIndexDo (Indexing_Index i, Indexing_Inde
     }
 }
 
-extern "C" void _M2_Indexing_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_Indexing_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_Indexing_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_Indexing_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
index 16a4501961a0127991f3d440c1c15a11621086ff..97f99eed71414a33d4852316c4d9e773dcda1f46 100644 (file)
@@ -1106,11 +1106,11 @@ extern "C" void M2Dependent_RequestDependant (void * modulename, void * dependan
     }
 }
 
-extern "C" void _M2_M2Dependent_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_M2Dependent_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
   CheckInitialized ();
 }
 
-extern "C" void _M2_M2Dependent_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_M2Dependent_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
index 53747fe0a287c987bf5f562655dd3de509deb35f..f216888d279dfa3b71c99829a6387ba14514d21a 100644 (file)
@@ -79,11 +79,11 @@ extern "C" unsigned int M2EXCEPTION_IsM2Exception (void)
   __builtin_unreachable ();
 }
 
-extern "C" void _M2_M2EXCEPTION_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_M2EXCEPTION_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
   RTExceptions_SetExceptionBlock (RTExceptions_InitExceptionBlock ());
 }
 
-extern "C" void _M2_M2EXCEPTION_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_M2EXCEPTION_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
index 956620170664d60ebd9a33f363d0b5e3f3605431..906d512ea5ed638103b718acb84d315700cf8fd9 100644 (file)
@@ -734,11 +734,11 @@ extern "C" void M2RTS_NoException (void * filename, unsigned int line, unsigned
   RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_exException)), filename, line, column, scope, message);
 }
 
-extern "C" void _M2_M2RTS_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_M2RTS_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
   CheckInitialized ();
 }
 
-extern "C" void _M2_M2RTS_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_M2RTS_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
index 798899786ca2d34dff450afa68ed1de9549ac9eb..f65e724dede36cc519154f39c0e592c8f6fbd090 100644 (file)
@@ -117,10 +117,10 @@ extern "C" void MemUtils_MemZero (void * a, unsigned int length)
     }
 }
 
-extern "C" void _M2_MemUtils_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_MemUtils_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_MemUtils_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_MemUtils_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
index 0fd21573a86df1dbe9dab1952112608448a852af..eded30be0e914ae6e5ecc7dfa5b136f49a0d78dd 100644 (file)
@@ -767,10 +767,10 @@ extern "C" void NumberIO_StrToOctInt (const char *a_, unsigned int _a_high, int
     }
 }
 
-extern "C" void _M2_NumberIO_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_NumberIO_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_NumberIO_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_NumberIO_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
index 4dee3ebf8ed62e252a395b2d3d730f3ce0bdbed4..1209e957ee6f7d6c0971f1867ba74885ff6bd79c 100644 (file)
@@ -477,12 +477,12 @@ extern "C" unsigned int PushBackInput_GetCurrentLine (void)
   __builtin_unreachable ();
 }
 
-extern "C" void _M2_PushBackInput_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_PushBackInput_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
   PushBackInput_SetDebug (FALSE);
   Init ();
 }
 
-extern "C" void _M2_PushBackInput_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_PushBackInput_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
index 10ed3684dc5856609e6faff84867b52346a6f7b9..4b6a7f267e9b834c4b52db3b22e9855e34f57bd4 100644 (file)
@@ -1210,12 +1210,12 @@ extern "C" void * RTExceptions_GetExceptionSource (void)
   __builtin_unreachable ();
 }
 
-extern "C" void _M2_RTExceptions_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_RTExceptions_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
   Init ();
 }
 
-extern "C" void _M2_RTExceptions_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_RTExceptions_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
   TidyUp ();
 }
index e0b1889d383200cb251603e813fa29a178a639f0..b65623932d37e0c94259fb87630fcde62671e2f6 100644 (file)
@@ -1112,11 +1112,11 @@ extern "C" void RTint_Init (void)
     }
 }
 
-extern "C" void _M2_RTint_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_RTint_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
   RTint_Init ();
 }
 
-extern "C" void _M2_RTint_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_RTint_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
index c2612d66d7435d06ecf966671486859e23bd8086..8c747d6cd83ab2ccba1ce242d7fcf6c657aaaafa 100644 (file)
@@ -116,10 +116,10 @@ extern "C" unsigned int SArgs_Narg (void)
   __builtin_unreachable ();
 }
 
-extern "C" void _M2_SArgs_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_SArgs_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_SArgs_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_SArgs_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
index 79de278f7eabb3ca9a05fd547c94c59f2a867d68..cbe50fc386daccce023a425747f81f0a04b3abfa 100644 (file)
@@ -207,10 +207,10 @@ extern "C" DynamicStrings_String SFIO_ReadS (FIO_File file)
   __builtin_unreachable ();
 }
 
-extern "C" void _M2_SFIO_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_SFIO_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_SFIO_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_SFIO_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
index 894a83e1e95211b9843e186fb73262932438696c..8aab393a0e38800714a35c0e108cb2753b165595 100644 (file)
@@ -256,7 +256,7 @@ extern "C" StdIO_ProcRead StdIO_GetCurrentInput (void)
   __builtin_unreachable ();
 }
 
-extern "C" void _M2_StdIO_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_StdIO_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
   StackWPtr = 0;
   StackRPtr = 0;
@@ -264,6 +264,6 @@ extern "C" void _M2_StdIO_init (__attribute__((unused)) int argc, __attribute__(
   StdIO_PushInput ((StdIO_ProcRead) {(StdIO_ProcRead_t) IO_Read});
 }
 
-extern "C" void _M2_StdIO_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_StdIO_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
index 3a5f50163755c029bbde82bec9a47ab7191a0854..aae84c8d75b9b1c1de1a4c1c042bc88c95d0a453 100644 (file)
@@ -65,10 +65,10 @@ extern "C" unsigned int Storage_Available (unsigned int Size)
   __builtin_unreachable ();
 }
 
-extern "C" void _M2_Storage_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_Storage_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_Storage_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_Storage_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
index 6917e1799d1d41011e6ca5e0684789cfa90b40a7..1ac42d81107fe65bcd98f2bfbc9ddb768a7788b3 100644 (file)
@@ -166,10 +166,10 @@ extern "C" char StrCase_Lower (char ch)
   __builtin_unreachable ();
 }
 
-extern "C" void _M2_StrCase_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_StrCase_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_StrCase_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_StrCase_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
index 9f194a767c9e2373685753bf33f3daeb0f762152..59f1ba50b3be80a7b4434218142d201d3c4d84ff 100644 (file)
@@ -266,12 +266,12 @@ extern "C" void StrIO_WriteString (const char *a_, unsigned int _a_high)
     }
 }
 
-extern "C" void _M2_StrIO_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_StrIO_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
   /* IsATTY := isatty()  */
   IsATTY = FALSE;
 }
 
-extern "C" void _M2_StrIO_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_StrIO_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
index da7d2bcdaf03d22e5576cc953ff5591417600700..eaf63fa275bde5447f7cabfe3a221629e35c35fc 100644 (file)
@@ -337,10 +337,10 @@ extern "C" void StrLib_StrRemoveWhitePrefix (const char *a_, unsigned int _a_hig
     }
 }
 
-extern "C" void _M2_StrLib_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_StrLib_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_StrLib_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_StrLib_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
index 6cca341215f93c630d61be4962768a41156f9b2b..75ad8fd6614ba74150d183614de809f8e4ac32d6 100644 (file)
@@ -1996,10 +1996,10 @@ extern "C" DynamicStrings_String StringConvert_ToDecimalPlaces (DynamicStrings_S
   __builtin_unreachable ();
 }
 
-extern "C" void _M2_StringConvert_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_StringConvert_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_StringConvert_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_StringConvert_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
index 10dd88bbda3bb0fb6c418ee6a379515ad466bab8..aae6cd7db73b8db14b819d10ba628b610a3d0943 100644 (file)
@@ -223,7 +223,7 @@ extern "C" void SysStorage_Init (void)
 {
 }
 
-extern "C" void _M2_SysStorage_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_SysStorage_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
   callno = 0;
   if (enableTrace)
@@ -244,6 +244,6 @@ extern "C" void _M2_SysStorage_init (__attribute__((unused)) int argc, __attribu
     }
 }
 
-extern "C" void _M2_SysStorage_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_SysStorage_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
index bd22f16769cea5b25037de660c2fd0ab5b886780..512c58506249d6390130fc830a6d9e482229d3e9 100644 (file)
@@ -82,10 +82,10 @@ extern "C" void TimeString_GetTimeString (char *a, unsigned int _a_high)
     }
 }
 
-extern "C" void _M2_TimeString_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_TimeString_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_TimeString_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_TimeString_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
index 0fd66a720454de4d95adc40641a511394bfcecce..ec4d76058c9d2780021affeea82fa342a109a113 100644 (file)
@@ -431,10 +431,10 @@ extern "C" alists_alist alists_duplicateList (alists_alist l)
   __builtin_unreachable ();
 }
 
-extern "C" void _M2_alists_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_alists_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_alists_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_alists_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
index d156866f65f74523c0d2dcaf6c5c5d4c7e93593f..0e10b1fb9b2d32d950d78ecfd2f259274b20c73e 100644 (file)
@@ -503,6 +503,7 @@ struct varparamT_r {
                      decl_node scope;
                      unsigned int isUnbounded;
                      unsigned int isForC;
+                     unsigned int isUsed;
                    };
 
 struct paramT_r {
@@ -511,6 +512,7 @@ struct paramT_r {
                   decl_node scope;
                   unsigned int isUnbounded;
                   unsigned int isForC;
+                  unsigned int isUsed;
                 };
 
 struct varargsT_r {
@@ -699,6 +701,7 @@ struct varT_r {
                 unsigned int isInitialised;
                 unsigned int isParameter;
                 unsigned int isVarParameter;
+                unsigned int isUsed;
                 cnameT cname;
               };
 
@@ -1680,13 +1683,13 @@ extern "C" void decl_putOptReturn (decl_node proc);
    makeVarParameter - returns a var parameter node with, name: type.
 */
 
-extern "C" decl_node decl_makeVarParameter (decl_node l, decl_node type, decl_node proc);
+extern "C" decl_node decl_makeVarParameter (decl_node l, decl_node type, decl_node proc, unsigned int isused);
 
 /*
    makeNonVarParameter - returns a non var parameter node with, name: type.
 */
 
-extern "C" decl_node decl_makeNonVarParameter (decl_node l, decl_node type, decl_node proc);
+extern "C" decl_node decl_makeNonVarParameter (decl_node l, decl_node type, decl_node proc, unsigned int isused);
 
 /*
    paramEnter - reset the parameter count.
@@ -1718,14 +1721,14 @@ extern "C" unsigned int decl_putIdent (decl_node n, nameKey_Name i);
                       in procedure, n.
 */
 
-extern "C" void decl_addVarParameters (decl_node n, decl_node i, decl_node type);
+extern "C" void decl_addVarParameters (decl_node n, decl_node i, decl_node type, unsigned int isused);
 
 /*
    addNonVarParameters - adds the identlist, i, of, type, to be parameters
                          in procedure, n.
 */
 
-extern "C" void decl_addNonVarParameters (decl_node n, decl_node i, decl_node type);
+extern "C" void decl_addNonVarParameters (decl_node n, decl_node i, decl_node type, unsigned int isused);
 
 /*
    makeVarargs - returns a varargs node.
@@ -3523,10 +3526,10 @@ static void completedEnum (decl_node n);
 static void setUnary (decl_node u, nodeT k, decl_node a, decl_node t);
 
 /*
-   putVarBool - assigns the three booleans associated with a variable.
+   putVarBool - assigns the four booleans associated with a variable.
 */
 
-static void putVarBool (decl_node v, unsigned int init, unsigned int param, unsigned int isvar);
+static void putVarBool (decl_node v, unsigned int init, unsigned int param, unsigned int isvar, unsigned int isused);
 
 /*
    checkPtr - in C++ we need to create a typedef for a pointer
@@ -3545,7 +3548,7 @@ static unsigned int isVarDecl (decl_node n);
    makeVariablesFromParameters - creates variables which are really parameters.
 */
 
-static void makeVariablesFromParameters (decl_node proc, decl_node id, decl_node type, unsigned int isvar);
+static void makeVariablesFromParameters (decl_node proc, decl_node id, decl_node type, unsigned int isvar, unsigned int isused);
 
 /*
    addProcedureToScope - add a procedure name n and node d to the
@@ -3600,7 +3603,7 @@ static unsigned int identListLen (decl_node n);
    checkParameters - placeholder for future parameter checking.
 */
 
-static void checkParameters (decl_node p, decl_node i, decl_node type, unsigned int var);
+static void checkParameters (decl_node p, decl_node i, decl_node type, unsigned int isvar, unsigned int isused);
 
 /*
    checkMakeVariables - create shadow local variables for parameters providing that
@@ -3608,7 +3611,7 @@ static void checkParameters (decl_node p, decl_node i, decl_node type, unsigned
                         a module or an implementation module.
 */
 
-static void checkMakeVariables (decl_node n, decl_node i, decl_node type, unsigned int isvar);
+static void checkMakeVariables (decl_node n, decl_node i, decl_node type, unsigned int isvar, unsigned int isused);
 
 /*
    makeVarientField - create a varient field within varient, v,
@@ -4406,11 +4409,17 @@ static void doFQNameC (mcPretty_pretty p, decl_node n);
 
 static void doNameM2 (mcPretty_pretty p, decl_node n);
 
+/*
+   doUsed -
+*/
+
+static void doUsed (mcPretty_pretty p, unsigned int used);
+
 /*
    doHighC -
 */
 
-static void doHighC (mcPretty_pretty p, decl_node a, nameKey_Name n);
+static void doHighC (mcPretty_pretty p, decl_node a, nameKey_Name n, unsigned int isused);
 
 /*
    doParamConstCast -
@@ -7106,15 +7115,16 @@ static void setUnary (decl_node u, nodeT k, decl_node a, decl_node t)
 
 
 /*
-   putVarBool - assigns the three booleans associated with a variable.
+   putVarBool - assigns the four booleans associated with a variable.
 */
 
-static void putVarBool (decl_node v, unsigned int init, unsigned int param, unsigned int isvar)
+static void putVarBool (decl_node v, unsigned int init, unsigned int param, unsigned int isvar, unsigned int isused)
 {
   mcDebug_assert (decl_isVar (v));
   v->varF.isInitialised = init;
   v->varF.isParameter = param;
   v->varF.isVarParameter = isvar;
+  v->varF.isUsed = isused;
 }
 
 
@@ -7161,7 +7171,7 @@ static unsigned int isVarDecl (decl_node n)
    makeVariablesFromParameters - creates variables which are really parameters.
 */
 
-static void makeVariablesFromParameters (decl_node proc, decl_node id, decl_node type, unsigned int isvar)
+static void makeVariablesFromParameters (decl_node proc, decl_node id, decl_node type, unsigned int isvar, unsigned int isused)
 {
   decl_node v;
   unsigned int i;
@@ -7178,7 +7188,7 @@ static void makeVariablesFromParameters (decl_node proc, decl_node id, decl_node
       m = static_cast<nameKey_Name> (wlists_getItemFromList (id->identlistF.names, i));
       v = decl_makeVar (m);
       decl_putVar (v, type, NULL);
-      putVarBool (v, TRUE, TRUE, isvar);
+      putVarBool (v, TRUE, TRUE, isvar, isused);
       if (debugScopes)
         {
           libc_printf ((const char *) "adding parameter variable into top scope\\n", 42);
@@ -7319,7 +7329,7 @@ static unsigned int identListLen (decl_node n)
    checkParameters - placeholder for future parameter checking.
 */
 
-static void checkParameters (decl_node p, decl_node i, decl_node type, unsigned int var)
+static void checkParameters (decl_node p, decl_node i, decl_node type, unsigned int isvar, unsigned int isused)
 {
   /* do check.  */
   disposeNode (&i);
@@ -7332,11 +7342,11 @@ static void checkParameters (decl_node p, decl_node i, decl_node type, unsigned
                         a module or an implementation module.
 */
 
-static void checkMakeVariables (decl_node n, decl_node i, decl_node type, unsigned int isvar)
+static void checkMakeVariables (decl_node n, decl_node i, decl_node type, unsigned int isvar, unsigned int isused)
 {
   if (((decl_isImp (currentModule)) || (decl_isModule (currentModule))) && ! n->procedureF.built)
     {
-      makeVariablesFromParameters (n, i, type, isvar);
+      makeVariablesFromParameters (n, i, type, isvar, isused);
     }
 }
 
@@ -11589,11 +11599,25 @@ static void doNameM2 (mcPretty_pretty p, decl_node n)
 }
 
 
+/*
+   doUsed -
+*/
+
+static void doUsed (mcPretty_pretty p, unsigned int used)
+{
+  if (! used)
+    {
+      mcPretty_setNeedSpace (p);
+      outText (p, (const char *) "__attribute__((unused))", 23);
+    }
+}
+
+
 /*
    doHighC -
 */
 
-static void doHighC (mcPretty_pretty p, decl_node a, nameKey_Name n)
+static void doHighC (mcPretty_pretty p, decl_node a, nameKey_Name n, unsigned int isused)
 {
   if ((decl_isArray (a)) && (decl_isUnbounded (a)))
     {
@@ -11605,6 +11629,7 @@ static void doHighC (mcPretty_pretty p, decl_node a, nameKey_Name n)
       mcPretty_print (p, (const char *) "_", 1);
       outTextN (p, n);
       mcPretty_print (p, (const char *) "_high", 5);
+      doUsed (p, isused);
     }
 }
 
@@ -11694,6 +11719,7 @@ static void doParamC (mcPretty_pretty p, decl_node n)
       /* avoid dangling else.  */
       doParamConstCast (p, n);
       doTypeNameC (p, ptype);
+      doUsed (p, n->paramF.isUsed);
       if ((decl_isArray (ptype)) && (decl_isUnbounded (ptype)))
         {
           outText (p, (const char *) ",", 1);
@@ -11712,6 +11738,7 @@ static void doParamC (mcPretty_pretty p, decl_node n)
           doParamTypeEmit (p, n, ptype);
           if ((decl_isArray (ptype)) && (decl_isUnbounded (ptype)))
             {
+              doUsed (p, n->paramF.isUsed);
               outText (p, (const char *) ",", 1);
               mcPretty_setNeedSpace (p);
               outText (p, (const char *) "unsigned int", 12);
@@ -11747,7 +11774,8 @@ static void doParamC (mcPretty_pretty p, decl_node n)
                 {
                   outText (p, (const char *) "_", 1);
                 }
-              doHighC (p, ptype, i);
+              doUsed (p, n->paramF.isUsed);
+              doHighC (p, ptype, i, n->paramF.isUsed);
               if (c < t)
                 {
                   outText (p, (const char *) ",", 1);
@@ -11785,6 +11813,7 @@ static void doVarParamC (mcPretty_pretty p, decl_node n)
           mcPretty_setNeedSpace (p);
           outText (p, (const char *) "*", 1);
         }
+      doUsed (p, n->varparamF.isUsed);
       if ((decl_isArray (ptype)) && (decl_isUnbounded (ptype)))
         {
           outText (p, (const char *) ",", 1);
@@ -11799,6 +11828,7 @@ static void doVarParamC (mcPretty_pretty p, decl_node n)
       if (l == NULL)
         {
           doParamTypeEmit (p, n, ptype);
+          doUsed (p, n->varparamF.isUsed);
         }
       else
         {
@@ -11822,7 +11852,8 @@ static void doVarParamC (mcPretty_pretty p, decl_node n)
                 {
                   doFQDNameC (p, v, TRUE);
                 }
-              doHighC (p, ptype, i);
+              doUsed (p, n->varparamF.isUsed);
+              doHighC (p, ptype, i, n->varparamF.isUsed);
               if (c < t)
                 {
                   outText (p, (const char *) ",", 1);
@@ -20047,7 +20078,9 @@ static void scaffoldStatic (mcPretty_pretty p, decl_node n)
   doFQNameC (p, n);
   outText (p, (const char *) "_init", 5);
   mcPretty_setNeedSpace (p);
-  outText (p, (const char *) "(__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])\\n", 74);
+  outText (p, (const char *) "(__attribute__((unused)) int argc", 33);
+  outText (p, (const char *) ",__attribute__((unused)) char *argv[]", 37);
+  outText (p, (const char *) ",__attribute__((unused)) char *envp[])\\n", 40);
   p = outKc (p, (const char *) "{\\n", 3);
   doStatementsC (p, n->impF.beginStatements);
   p = outKc (p, (const char *) "}\\n", 3);
@@ -20059,7 +20092,9 @@ static void scaffoldStatic (mcPretty_pretty p, decl_node n)
   doFQNameC (p, n);
   outText (p, (const char *) "_finish", 7);
   mcPretty_setNeedSpace (p);
-  outText (p, (const char *) "(__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])\\n", 74);
+  outText (p, (const char *) "(__attribute__((unused)) int argc", 33);
+  outText (p, (const char *) ",__attribute__((unused)) char *argv[]", 37);
+  outText (p, (const char *) ",__attribute__((unused)) char *envp[])\\n", 40);
   p = outKc (p, (const char *) "{\\n", 3);
   doStatementsC (p, n->impF.finallyStatements);
   p = outKc (p, (const char *) "}\\n", 3);
@@ -20129,7 +20164,7 @@ static void scaffoldDynamic (mcPretty_pretty p, decl_node n)
   outText (p, (const char *) "_init", 5);
   mcPretty_setNeedSpace (p);
   outText (p, (const char *) "(__attribute__((unused)) int argc,", 34);
-  outText (p, (const char *) " __attribute__((unused)) char *argv[],", 38);
+  outText (p, (const char *) " __attribute__((unused)) char *argv[]", 37);
   outText (p, (const char *) " __attribute__((unused)) char *envp[])\\n", 40);
   p = outKc (p, (const char *) "{\\n", 3);
   doStatementsC (p, n->impF.beginStatements);
@@ -20143,7 +20178,7 @@ static void scaffoldDynamic (mcPretty_pretty p, decl_node n)
   outText (p, (const char *) "_fini", 5);
   mcPretty_setNeedSpace (p);
   outText (p, (const char *) "(__attribute__((unused)) int argc,", 34);
-  outText (p, (const char *) " __attribute__((unused)) char *argv[],", 38);
+  outText (p, (const char *) " __attribute__((unused)) char *argv[]", 37);
   outText (p, (const char *) " __attribute__((unused)) char *envp[])\\n", 40);
   p = outKc (p, (const char *) "{\\n", 3);
   doStatementsC (p, n->impF.finallyStatements);
@@ -20396,7 +20431,9 @@ static void outModuleInitC (mcPretty_pretty p, decl_node n)
   doFQNameC (p, n);
   outText (p, (const char *) "_init", 5);
   mcPretty_setNeedSpace (p);
-  outText (p, (const char *) "(__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])\\n", 74);
+  outText (p, (const char *) "(__attribute__((unused)) int argc", 33);
+  outText (p, (const char *) ",__attribute__((unused)) char *argv[]", 37);
+  outText (p, (const char *) ",__attribute__((unused)) char *envp[])\\n", 40);
   p = outKc (p, (const char *) "{\\n", 3);
   doStatementsC (p, n->moduleF.beginStatements);
   p = outKc (p, (const char *) "}\\n", 3);
@@ -20408,7 +20445,9 @@ static void outModuleInitC (mcPretty_pretty p, decl_node n)
   doFQNameC (p, n);
   outText (p, (const char *) "_finish", 7);
   mcPretty_setNeedSpace (p);
-  outText (p, (const char *) "(__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])\\n", 74);
+  outText (p, (const char *) "(__attribute__((unused)) int argc", 33);
+  outText (p, (const char *) ",__attribute__((unused)) char *argv[]", 37);
+  outText (p, (const char *) ",__attribute__((unused)) char *envp[])\\n", 40);
   p = outKc (p, (const char *) "{\\n", 3);
   doStatementsC (p, n->moduleF.finallyStatements);
   p = outKc (p, (const char *) "}\\n", 3);
@@ -23619,7 +23658,7 @@ extern "C" decl_node decl_addOptParameter (decl_node proc, nameKey_Name id, decl
   mcDebug_assert (decl_isProcedure (proc));
   l = decl_makeIdentList ();
   mcDebug_assert (decl_putIdent (l, id));
-  checkMakeVariables (proc, l, type, FALSE);
+  checkMakeVariables (proc, l, type, FALSE, TRUE);
   if (! proc->procedureF.checking)
     {
       p = makeOptParameter (l, type, init);
@@ -25021,7 +25060,7 @@ extern "C" void decl_putOptReturn (decl_node proc)
    makeVarParameter - returns a var parameter node with, name: type.
 */
 
-extern "C" decl_node decl_makeVarParameter (decl_node l, decl_node type, decl_node proc)
+extern "C" decl_node decl_makeVarParameter (decl_node l, decl_node type, decl_node proc, unsigned int isused)
 {
   decl_node d;
 
@@ -25032,6 +25071,7 @@ extern "C" decl_node decl_makeVarParameter (decl_node l, decl_node type, decl_no
   d->varparamF.scope = proc;
   d->varparamF.isUnbounded = FALSE;
   d->varparamF.isForC = isDefForCNode (proc);
+  d->varparamF.isUsed = isused;
   return d;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
@@ -25042,7 +25082,7 @@ extern "C" decl_node decl_makeVarParameter (decl_node l, decl_node type, decl_no
    makeNonVarParameter - returns a non var parameter node with, name: type.
 */
 
-extern "C" decl_node decl_makeNonVarParameter (decl_node l, decl_node type, decl_node proc)
+extern "C" decl_node decl_makeNonVarParameter (decl_node l, decl_node type, decl_node proc, unsigned int isused)
 {
   decl_node d;
 
@@ -25053,6 +25093,7 @@ extern "C" decl_node decl_makeNonVarParameter (decl_node l, decl_node type, decl
   d->paramF.scope = proc;
   d->paramF.isUnbounded = FALSE;
   d->paramF.isForC = isDefForCNode (proc);
+  d->paramF.isUsed = isused;
   return d;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
@@ -25129,20 +25170,20 @@ extern "C" unsigned int decl_putIdent (decl_node n, nameKey_Name i)
                       in procedure, n.
 */
 
-extern "C" void decl_addVarParameters (decl_node n, decl_node i, decl_node type)
+extern "C" void decl_addVarParameters (decl_node n, decl_node i, decl_node type, unsigned int isused)
 {
   decl_node p;
 
   mcDebug_assert (isIdentList (i));
   mcDebug_assert (decl_isProcedure (n));
-  checkMakeVariables (n, i, type, TRUE);
+  checkMakeVariables (n, i, type, TRUE, isused);
   if (n->procedureF.checking)
     {
-      checkParameters (n, i, type, TRUE);  /* will destroy, i.  */
+      checkParameters (n, i, type, TRUE, isused);  /* will destroy, i.  */
     }
   else
     {
-      p = decl_makeVarParameter (i, type, n);
+      p = decl_makeVarParameter (i, type, n, isused);
       Indexing_IncludeIndiceIntoIndex (n->procedureF.parameters, reinterpret_cast<void *> (p));
     }
 }
@@ -25153,20 +25194,20 @@ extern "C" void decl_addVarParameters (decl_node n, decl_node i, decl_node type)
                          in procedure, n.
 */
 
-extern "C" void decl_addNonVarParameters (decl_node n, decl_node i, decl_node type)
+extern "C" void decl_addNonVarParameters (decl_node n, decl_node i, decl_node type, unsigned int isused)
 {
   decl_node p;
 
   mcDebug_assert (isIdentList (i));
   mcDebug_assert (decl_isProcedure (n));
-  checkMakeVariables (n, i, type, FALSE);
+  checkMakeVariables (n, i, type, FALSE, isused);
   if (n->procedureF.checking)
     {
-      checkParameters (n, i, type, FALSE);  /* will destroy, i.  */
+      checkParameters (n, i, type, FALSE, isused);  /* will destroy, i.  */
     }
   else
     {
-      p = decl_makeNonVarParameter (i, type, n);
+      p = decl_makeNonVarParameter (i, type, n, isused);
       Indexing_IncludeIndiceIntoIndex (n->procedureF.parameters, reinterpret_cast<void *> (p));
     }
 }
@@ -26824,11 +26865,11 @@ extern "C" void decl_out (void)
   closeOutput ();
 }
 
-extern "C" void _M2_decl_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_decl_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
   init ();
 }
 
-extern "C" void _M2_decl_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_decl_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
index 1eda4fc42af07e4ed993a266d6e7a8d61b7a8b71..cd01904ca36f15bfbc5e9ba363182dd017ca85f5 100644 (file)
@@ -674,14 +674,14 @@ EXTERN void decl_putOptReturn (decl_node proc);
                       Where the parameters are declared as l: type.
 */
 
-EXTERN decl_node decl_makeVarParameter (decl_node l, decl_node type, decl_node proc);
+EXTERN decl_node decl_makeVarParameter (decl_node l, decl_node type, decl_node proc, unsigned int isused);
 
 /*
    makeNonVarParameter - returns a non var parameter node with namelist and type.
                          Where the parameters are declared as l: type.
 */
 
-EXTERN decl_node decl_makeNonVarParameter (decl_node l, decl_node type, decl_node proc);
+EXTERN decl_node decl_makeNonVarParameter (decl_node l, decl_node type, decl_node proc, unsigned int isused);
 
 /*
    paramEnter - reset the parameter count.
@@ -712,14 +712,14 @@ EXTERN unsigned int decl_putIdent (decl_node n, nameKey_Name i);
                       in procedure, n.
 */
 
-EXTERN void decl_addVarParameters (decl_node n, decl_node i, decl_node type);
+EXTERN void decl_addVarParameters (decl_node n, decl_node i, decl_node type, unsigned int isused);
 
 /*
    addNonVarParameters - adds the identlist, i, of, type, to be parameters
                          in procedure, n.
 */
 
-EXTERN void decl_addNonVarParameters (decl_node n, decl_node i, decl_node type);
+EXTERN void decl_addNonVarParameters (decl_node n, decl_node i, decl_node type, unsigned int isused);
 
 /*
    makeVarargs - returns a varargs node.
index 81f82ba36e56e8287239ef17534cc1ccbeb38bee..b23089e1cacd205781ba7e182d91ceba26e2a9de 100644 (file)
@@ -1611,11 +1611,11 @@ extern "C" void keyc_cp (void)
     }
 }
 
-extern "C" void _M2_keyc_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_keyc_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
   init ();
 }
 
-extern "C" void _M2_keyc_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_keyc_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
index 9001ae5fd8cec1fb91fb7bfeda5e7a6afb042a75..bba2ed4c401f2dbd191bd8cb264c369857a0f691 100644 (file)
@@ -430,10 +430,10 @@ extern "C" lists_list lists_duplicateList (lists_list l)
   __builtin_unreachable ();
 }
 
-extern "C" void _M2_lists_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_lists_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_lists_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_lists_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
index b1f5dfa7a8beb8ad83cff9b589063fe3f7e59f11..6d369e1d982f2d49d2adb4fd4524f7b3c1c50260 100644 (file)
@@ -459,10 +459,10 @@ extern "C" unsigned int mcComment_isAfterComment (mcComment_commentDesc cd)
   __builtin_unreachable ();
 }
 
-extern "C" void _M2_mcComment_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_mcComment_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_mcComment_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_mcComment_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
index c6824bbfc0499c81bfd9d7351643554da01f16fb..c9d378ae2fc774f247b8d14abe03deab4e455b85 100644 (file)
@@ -650,11 +650,11 @@ extern "C" unsigned int mcComp_getPassNo (void)
   __builtin_unreachable ();
 }
 
-extern "C" void _M2_mcComp_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_mcComp_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
   init ();
 }
 
-extern "C" void _M2_mcComp_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_mcComp_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
index ddb761d3a01aabcacaa462b43c13de7d3bc1bd02..3c471965c40e7b748ef93b21bf89a2fb1dc521f2 100644 (file)
@@ -77,10 +77,10 @@ extern "C" void mcDebug_writeDebug (const char *a_, unsigned int _a_high)
     }
 }
 
-extern "C" void _M2_mcDebug_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_mcDebug_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_mcDebug_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_mcDebug_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
index b83e1a4a97ab5d2f96d91b2cf921d22e9b555ec3..68706db576851470ede285146b777e2c08ebabcc 100644 (file)
@@ -1187,11 +1187,11 @@ extern "C" void mcError_errorAbort0 (const char *a_, unsigned int _a_high)
   __builtin_unreachable ();
 }
 
-extern "C" void _M2_mcError_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_mcError_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
   init ();
 }
 
-extern "C" void _M2_mcError_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_mcError_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
index 86ef5d200c8d604f2d8ef8a445e158c7bce9cc73..b41bcf6debef290c3157d78ae879da326756e6ad 100644 (file)
@@ -143,10 +143,10 @@ extern "C" DynamicStrings_String mcFileName_extractModule (DynamicStrings_String
   __builtin_unreachable ();
 }
 
-extern "C" void _M2_mcFileName_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_mcFileName_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_mcFileName_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_mcFileName_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
index 9db12f38337ab427be44d0d15c2792dcd512aa78..651a91d6fd3350d50e7031857a342007eba39c17 100644 (file)
@@ -1839,11 +1839,11 @@ extern "C" void mcLexBuf_popFile (void * filename)
   /* source file list is empty, cannot pop an include..  */
 }
 
-extern "C" void _M2_mcLexBuf_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_mcLexBuf_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
   init ();
 }
 
-extern "C" void _M2_mcLexBuf_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_mcLexBuf_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
index 847ec0f1059cf0eb9f74e721b05ad0293a1de55b..6e43c8f2a4151fa1a710d5d98dcc51ab6a9d1997 100644 (file)
@@ -1871,10 +1871,10 @@ extern "C" void mcMetaError_metaErrorStringT4 (unsigned int tok, DynamicStrings_
   varargs_end (&sym);
 }
 
-extern "C" void _M2_mcMetaError_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_mcMetaError_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_mcMetaError_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_mcMetaError_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
index 9cda6357a639fb90d76552cd2ca76ef3c1916466..42717cf9588c08ab356f738a88dfe2ab269aef9c 100644 (file)
@@ -1011,7 +1011,7 @@ extern "C" void mcOptions_writeGPLheader (FIO_File f)
   issueGPL (f);
 }
 
-extern "C" void _M2_mcOptions_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_mcOptions_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
   langC = TRUE;
   langCPP = FALSE;
@@ -1041,6 +1041,6 @@ extern "C" void _M2_mcOptions_init (__attribute__((unused)) int argc, __attribut
   projectContents = DynamicStrings_InitString ((const char *) "GNU Modula-2", 12);
 }
 
-extern "C" void _M2_mcOptions_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_mcOptions_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
index 859ca61443526dbad167f277b74342e166f5b93f..df335c08e204d0d7441f7d9a4a4c60e785337530 100644 (file)
@@ -166,7 +166,7 @@ extern "C" DynamicStrings_String mcPreprocess_preprocessModule (DynamicStrings_S
   __builtin_unreachable ();
 }
 
-extern "C" void _M2_mcPreprocess_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_mcPreprocess_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
   listOfFiles = alists_initList ();
   if (! (M2RTS_InstallTerminationProcedure ((PROC ) {(PROC_t) removeFiles})))
@@ -176,6 +176,6 @@ extern "C" void _M2_mcPreprocess_init (__attribute__((unused)) int argc, __attri
     }
 }
 
-extern "C" void _M2_mcPreprocess_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_mcPreprocess_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
index 618579d095eaa280e7f1543ad2492f6a2fea9dd0..8d70c0b4924f37fc29c268ed606fb9798922f1f4 100644 (file)
@@ -459,10 +459,10 @@ extern "C" void mcPretty_raw (mcPretty_pretty p, DynamicStrings_String s)
     }
 }
 
-extern "C" void _M2_mcPretty_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_mcPretty_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_mcPretty_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_mcPretty_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
index 4b5b06c558661f57587d9fc87ae6bda34bfab562..0bfe898e155d0e21fe1b0abcfd260ad0bfe96e2c 100644 (file)
@@ -646,10 +646,10 @@ extern "C" void mcPrintf_fprintf4 (FIO_File file, const char *a_, unsigned int _
     {}  /* empty.  */
 }
 
-extern "C" void _M2_mcPrintf_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_mcPrintf_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_mcPrintf_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_mcPrintf_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
index 93171d78d1121032e777407cc0a131686f73d452..88115761c8b4db59dfb89e0772fda0c8f26d4005 100644 (file)
@@ -120,10 +120,10 @@ extern "C" void mcQuiet_qprintf4 (const char *a_, unsigned int _a_high, const un
     }
 }
 
-extern "C" void _M2_mcQuiet_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_mcQuiet_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_mcQuiet_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_mcQuiet_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
index afba13b2521512c62a917683c3051bed881ee333..a1221f9d85e4b06a64c214f15260eb082324f13f 100644 (file)
@@ -31,10 +31,10 @@ Boston, MA 02110-1301, USA.  */
 typedef enum {mcReserved_eoftok, mcReserved_plustok, mcReserved_minustok, mcReserved_timestok, mcReserved_dividetok, mcReserved_becomestok, mcReserved_ambersandtok, mcReserved_periodtok, mcReserved_commatok, mcReserved_semicolontok, mcReserved_lparatok, mcReserved_rparatok, mcReserved_lsbratok, mcReserved_rsbratok, mcReserved_lcbratok, mcReserved_rcbratok, mcReserved_uparrowtok, mcReserved_singlequotetok, mcReserved_equaltok, mcReserved_hashtok, mcReserved_lesstok, mcReserved_greatertok, mcReserved_lessgreatertok, mcReserved_lessequaltok, mcReserved_greaterequaltok, mcReserved_ldirectivetok, mcReserved_rdirectivetok, mcReserved_periodperiodtok, mcReserved_colontok, mcReserved_doublequotestok, mcReserved_bartok, mcReserved_andtok, mcReserved_arraytok, mcReserved_begintok, mcReserved_bytok, mcReserved_casetok, mcReserved_consttok, mcReserved_definitiontok, mcReserved_divtok, mcReserved_dotok, mcReserved_elsetok, mcReserved_elsiftok, mcReserved_endtok, mcReserved_excepttok, mcReserved_exittok, mcReserved_exporttok, mcReserved_finallytok, mcReserved_fortok, mcReserved_fromtok, mcReserved_iftok, mcReserved_implementationtok, mcReserved_importtok, mcReserved_intok, mcReserved_looptok, mcReserved_modtok, mcReserved_moduletok, mcReserved_nottok, mcReserved_oftok, mcReserved_ortok, mcReserved_packedsettok, mcReserved_pointertok, mcReserved_proceduretok, mcReserved_qualifiedtok, mcReserved_unqualifiedtok, mcReserved_recordtok, mcReserved_remtok, mcReserved_repeattok, mcReserved_retrytok, mcReserved_returntok, mcReserved_settok, mcReserved_thentok, mcReserved_totok, mcReserved_typetok, mcReserved_untiltok, mcReserved_vartok, mcReserved_whiletok, mcReserved_withtok, mcReserved_asmtok, mcReserved_volatiletok, mcReserved_periodperiodperiodtok, mcReserved_datetok, mcReserved_linetok, mcReserved_filetok, mcReserved_attributetok, mcReserved_builtintok, mcReserved_inlinetok, mcReserved_integertok, mcReserved_identtok, mcReserved_realtok, mcReserved_stringtok, mcReserved_commenttok} mcReserved_toktype;
 
 
-extern "C" void _M2_mcReserved_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_mcReserved_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_mcReserved_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_mcReserved_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
index 44d4aa5a7d04587276fca7124fb889359db56faa..08b9312c22fb105bec43aa9bfbe12c53217a61ca 100644 (file)
@@ -398,11 +398,11 @@ extern "C" void mcSearch_setModExtension (DynamicStrings_String ext)
   Mod = DynamicStrings_Dup (ext);
 }
 
-extern "C" void _M2_mcSearch_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_mcSearch_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
   Init ();
 }
 
-extern "C" void _M2_mcSearch_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_mcSearch_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
index 3cac417038a7a32e14e12f9896b6d5ace4d57b54..1b0910cc1ca45083271adbcd9d80cd727f9342b8 100644 (file)
@@ -219,10 +219,10 @@ extern "C" void * mcStack_access (mcStack_stack s, unsigned int i)
   __builtin_unreachable ();
 }
 
-extern "C" void _M2_mcStack_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_mcStack_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_mcStack_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_mcStack_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
index f4180dae9bfec8e476915f562a0ff0f539ae29b2..65df35192babcce0bf5ba5118e125140b0c1ca56 100644 (file)
@@ -252,13 +252,13 @@ extern "C" FIO_File mcStream_combine (void)
   __builtin_unreachable ();
 }
 
-extern "C" void _M2_mcStream_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_mcStream_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
   listOfFiles = alists_initList ();
   seenDest = FALSE;
   frag = Indexing_InitIndex (1);
 }
 
-extern "C" void _M2_mcStream_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_mcStream_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
index be8ad2cfea04bcdec3f091ec2cc165058d0d6de0..510be985ea6585dd4331ac1d2aa5dcb2332c5cc5 100644 (file)
@@ -1609,6 +1609,16 @@ static void FormalParameters (SetOfStop0 stopset0, SetOfStop1 stopset1, SetOfSto
 
 static void AttributeNoReturn (SetOfStop0 stopset0, SetOfStop1 stopset1, SetOfStop2 stopset2);
 
+/*
+   AttributeUnused := [ ''  ] 
+
+   first  symbols:ldirectivetok
+   
+   reachend
+*/
+
+static void AttributeUnused (SetOfStop0 stopset0, SetOfStop1 stopset1, SetOfStop2 stopset2);
+
 /*
    MultiFPSection := ExtendedFP  | FPSection [ ';' 
                                                MultiFPSection  ] 
@@ -1652,7 +1662,8 @@ static void DefExtendedFP (SetOfStop0 stopset0, SetOfStop1 stopset1, SetOfStop2
 static void ExtendedFP (SetOfStop0 stopset0, SetOfStop1 stopset1, SetOfStop2 stopset2);
 
 /*
-   VarFPSection := 'VAR' IdentList ':' FormalType 
+   VarFPSection := 'VAR' IdentList ':' FormalType [ 
+   AttributeUnused  ] 
 
    first  symbols:vartok
    
@@ -1662,7 +1673,7 @@ static void ExtendedFP (SetOfStop0 stopset0, SetOfStop1 stopset1, SetOfStop2 sto
 static void VarFPSection (SetOfStop0 stopset0, SetOfStop1 stopset1, SetOfStop2 stopset2);
 
 /*
-   NonVarFPSection := IdentList ':' FormalType 
+   NonVarFPSection := IdentList ':' FormalType [ AttributeUnused  ] 
 
    first  symbols:identtok
    
@@ -6448,6 +6459,25 @@ static void AttributeNoReturn (SetOfStop0 stopset0, SetOfStop1 stopset1, SetOfSt
 }
 
 
+/*
+   AttributeUnused := [ ''  ] 
+
+   first  symbols:ldirectivetok
+   
+   reachend
+*/
+
+static void AttributeUnused (SetOfStop0 stopset0, SetOfStop1 stopset1, SetOfStop2 stopset2)
+{
+  if (mcLexBuf_currenttoken == mcReserved_ldirectivetok)
+    {
+      Expect (mcReserved_ldirectivetok, stopset0, stopset1, stopset2|(SetOfStop2) ((1 << (mcReserved_identtok-mcReserved_recordtok))));
+      Ident (stopset0|(SetOfStop0) ((1 << (mcReserved_rdirectivetok-mcReserved_eoftok))), stopset1, stopset2);
+      Expect (mcReserved_rdirectivetok, stopset0, stopset1, stopset2);
+    }
+}
+
+
 /*
    MultiFPSection := ExtendedFP  | FPSection [ ';' 
                                                MultiFPSection  ] 
@@ -6564,7 +6594,8 @@ static void ExtendedFP (SetOfStop0 stopset0, SetOfStop1 stopset1, SetOfStop2 sto
 
 
 /*
-   VarFPSection := 'VAR' IdentList ':' FormalType 
+   VarFPSection := 'VAR' IdentList ':' FormalType [ 
+   AttributeUnused  ] 
 
    first  symbols:vartok
    
@@ -6576,12 +6607,16 @@ static void VarFPSection (SetOfStop0 stopset0, SetOfStop1 stopset1, SetOfStop2 s
   Expect (mcReserved_vartok, stopset0, stopset1, stopset2|(SetOfStop2) ((1 << (mcReserved_identtok-mcReserved_recordtok))));
   IdentList (stopset0|(SetOfStop0) ((1 << (mcReserved_colontok-mcReserved_eoftok))), stopset1, stopset2);
   Expect (mcReserved_colontok, stopset0, stopset1|(SetOfStop1) ((1 << (mcReserved_arraytok-mcReserved_arraytok))), stopset2|(SetOfStop2) ((1 << (mcReserved_identtok-mcReserved_recordtok))));
-  FormalType (stopset0, stopset1, stopset2);
+  FormalType (stopset0|(SetOfStop0) ((1 << (mcReserved_ldirectivetok-mcReserved_eoftok))), stopset1, stopset2);
+  if (mcLexBuf_currenttoken == mcReserved_ldirectivetok)
+    {
+      AttributeUnused (stopset0, stopset1, stopset2);
+    }
 }
 
 
 /*
-   NonVarFPSection := IdentList ':' FormalType 
+   NonVarFPSection := IdentList ':' FormalType [ AttributeUnused  ] 
 
    first  symbols:identtok
    
@@ -6592,7 +6627,11 @@ static void NonVarFPSection (SetOfStop0 stopset0, SetOfStop1 stopset1, SetOfStop
 {
   IdentList (stopset0|(SetOfStop0) ((1 << (mcReserved_colontok-mcReserved_eoftok))), stopset1, stopset2);
   Expect (mcReserved_colontok, stopset0, stopset1|(SetOfStop1) ((1 << (mcReserved_arraytok-mcReserved_arraytok))), stopset2|(SetOfStop2) ((1 << (mcReserved_identtok-mcReserved_recordtok))));
-  FormalType (stopset0, stopset1, stopset2);
+  FormalType (stopset0|(SetOfStop0) ((1 << (mcReserved_ldirectivetok-mcReserved_eoftok))), stopset1, stopset2);
+  if (mcLexBuf_currenttoken == mcReserved_ldirectivetok)
+    {
+      AttributeUnused (stopset0, stopset1, stopset2);
+    }
 }
 
 
@@ -7217,10 +7256,10 @@ extern "C" unsigned int mcp1_CompilationUnit (void)
   __builtin_unreachable ();
 }
 
-extern "C" void _M2_mcp1_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_mcp1_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_mcp1_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_mcp1_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
index f085fc93079fed56e7f9bcbc8b137c05bc2a6abc..4f8f054d472b478cd6d5579e64bf22a9cfe2521e 100644 (file)
@@ -1647,6 +1647,16 @@ static void FormalParameters (SetOfStop0 stopset0, SetOfStop1 stopset1, SetOfSto
 
 static void AttributeNoReturn (SetOfStop0 stopset0, SetOfStop1 stopset1, SetOfStop2 stopset2);
 
+/*
+   AttributeUnused := [ ''  ] 
+
+   first  symbols:ldirectivetok
+   
+   reachend
+*/
+
+static void AttributeUnused (SetOfStop0 stopset0, SetOfStop1 stopset1, SetOfStop2 stopset2);
+
 /*
    MultiFPSection := ExtendedFP  | FPSection [ ';' 
                                                MultiFPSection  ] 
@@ -1690,7 +1700,8 @@ static void DefExtendedFP (SetOfStop0 stopset0, SetOfStop1 stopset1, SetOfStop2
 static void ExtendedFP (SetOfStop0 stopset0, SetOfStop1 stopset1, SetOfStop2 stopset2);
 
 /*
-   VarFPSection := 'VAR' IdentList ':' FormalType 
+   VarFPSection := 'VAR' IdentList ':' FormalType [ 
+   AttributeUnused  ] 
 
    first  symbols:vartok
    
@@ -1700,7 +1711,7 @@ static void ExtendedFP (SetOfStop0 stopset0, SetOfStop1 stopset1, SetOfStop2 sto
 static void VarFPSection (SetOfStop0 stopset0, SetOfStop1 stopset1, SetOfStop2 stopset2);
 
 /*
-   NonVarFPSection := IdentList ':' FormalType 
+   NonVarFPSection := IdentList ':' FormalType [ AttributeUnused  ] 
 
    first  symbols:identtok
    
@@ -6632,6 +6643,25 @@ static void AttributeNoReturn (SetOfStop0 stopset0, SetOfStop1 stopset1, SetOfSt
 }
 
 
+/*
+   AttributeUnused := [ ''  ] 
+
+   first  symbols:ldirectivetok
+   
+   reachend
+*/
+
+static void AttributeUnused (SetOfStop0 stopset0, SetOfStop1 stopset1, SetOfStop2 stopset2)
+{
+  if (mcLexBuf_currenttoken == mcReserved_ldirectivetok)
+    {
+      Expect (mcReserved_ldirectivetok, stopset0, stopset1, stopset2|(SetOfStop2) ((1 << (mcReserved_identtok-mcReserved_recordtok))));
+      Ident (stopset0|(SetOfStop0) ((1 << (mcReserved_rdirectivetok-mcReserved_eoftok))), stopset1, stopset2);
+      Expect (mcReserved_rdirectivetok, stopset0, stopset1, stopset2);
+    }
+}
+
+
 /*
    MultiFPSection := ExtendedFP  | FPSection [ ';' 
                                                MultiFPSection  ] 
@@ -6748,7 +6778,8 @@ static void ExtendedFP (SetOfStop0 stopset0, SetOfStop1 stopset1, SetOfStop2 sto
 
 
 /*
-   VarFPSection := 'VAR' IdentList ':' FormalType 
+   VarFPSection := 'VAR' IdentList ':' FormalType [ 
+   AttributeUnused  ] 
 
    first  symbols:vartok
    
@@ -6760,12 +6791,16 @@ static void VarFPSection (SetOfStop0 stopset0, SetOfStop1 stopset1, SetOfStop2 s
   Expect (mcReserved_vartok, stopset0, stopset1, stopset2|(SetOfStop2) ((1 << (mcReserved_identtok-mcReserved_recordtok))));
   IdentList (stopset0|(SetOfStop0) ((1 << (mcReserved_colontok-mcReserved_eoftok))), stopset1, stopset2);
   Expect (mcReserved_colontok, stopset0, stopset1|(SetOfStop1) ((1 << (mcReserved_arraytok-mcReserved_arraytok))), stopset2|(SetOfStop2) ((1 << (mcReserved_identtok-mcReserved_recordtok))));
-  FormalType (stopset0, stopset1, stopset2);
+  FormalType (stopset0|(SetOfStop0) ((1 << (mcReserved_ldirectivetok-mcReserved_eoftok))), stopset1, stopset2);
+  if (mcLexBuf_currenttoken == mcReserved_ldirectivetok)
+    {
+      AttributeUnused (stopset0, stopset1, stopset2);
+    }
 }
 
 
 /*
-   NonVarFPSection := IdentList ':' FormalType 
+   NonVarFPSection := IdentList ':' FormalType [ AttributeUnused  ] 
 
    first  symbols:identtok
    
@@ -6776,7 +6811,11 @@ static void NonVarFPSection (SetOfStop0 stopset0, SetOfStop1 stopset1, SetOfStop
 {
   IdentList (stopset0|(SetOfStop0) ((1 << (mcReserved_colontok-mcReserved_eoftok))), stopset1, stopset2);
   Expect (mcReserved_colontok, stopset0, stopset1|(SetOfStop1) ((1 << (mcReserved_arraytok-mcReserved_arraytok))), stopset2|(SetOfStop2) ((1 << (mcReserved_identtok-mcReserved_recordtok))));
-  FormalType (stopset0, stopset1, stopset2);
+  FormalType (stopset0|(SetOfStop0) ((1 << (mcReserved_ldirectivetok-mcReserved_eoftok))), stopset1, stopset2);
+  if (mcLexBuf_currenttoken == mcReserved_ldirectivetok)
+    {
+      AttributeUnused (stopset0, stopset1, stopset2);
+    }
 }
 
 
@@ -7589,10 +7628,10 @@ extern "C" unsigned int mcp2_CompilationUnit (void)
   __builtin_unreachable ();
 }
 
-extern "C" void _M2_mcp2_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_mcp2_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_mcp2_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_mcp2_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
index 0cf16fcad1cba5a199f29c6543ea3d0fc271862c..ce426dc1d99ef40953e6d5a2c0d5a59a8ef670bb 100644 (file)
@@ -69,6 +69,7 @@ typedef unsigned int stop2;
 typedef unsigned int SetOfStop2;
 
 static unsigned int WasNoError;
+static unsigned int curisused;
 static nameKey_Name curstring;
 static nameKey_Name curident;
 static decl_node curproc;
@@ -133,6 +134,18 @@ static void ErrorString (DynamicStrings_String s);
 
 static void ErrorArray (const char *a_, unsigned int _a_high);
 
+/*
+   checkParameterAttribute -
+*/
+
+static void checkParameterAttribute (void);
+
+/*
+   checkReturnAttribute -
+*/
+
+static void checkReturnAttribute (void);
+
 /*
    pushNunbounded -
 */
@@ -1070,9 +1083,9 @@ static void ProcedureParameters (SetOfStop0 stopset0, SetOfStop1 stopset1, SetOf
                          
                          % n := push (makeVarargs ())  %
                           | 'VAR' FormalType 
-                         % n := push (makeVarParameter (NIL, pop (), curproc))  %
+                         % n := push (makeVarParameter (NIL, pop (), curproc, TRUE))  %
                           | FormalType 
-                         % n := push (makeNonVarParameter (NIL, pop (), curproc))  %
+                         % n := push (makeNonVarParameter (NIL, pop (), curproc, TRUE))  %
                          
 
    first  symbols:identtok, arraytok, vartok, periodperiodperiodtok
@@ -1705,6 +1718,26 @@ static void AttributeNoReturn (SetOfStop0 stopset0, SetOfStop1 stopset1, SetOfSt
 
 static void NoReturn (SetOfStop0 stopset0, SetOfStop1 stopset1, SetOfStop2 stopset2);
 
+/*
+   AttributeUnused := [ Unused  ] 
+
+   first  symbols:ldirectivetok
+   
+   reachend
+*/
+
+static void AttributeUnused (SetOfStop0 stopset0, SetOfStop1 stopset1, SetOfStop2 stopset2);
+
+/*
+   Unused := '' 
+
+   first  symbols:ldirectivetok
+   
+   cannot reachend
+*/
+
+static void Unused (SetOfStop0 stopset0, SetOfStop1 stopset1, SetOfStop2 stopset2);
+
 /*
    MultiFPSection := ExtendedFP  | FPSection [ ';' 
                                                MultiFPSection  ] 
@@ -1757,7 +1790,9 @@ static void ExtendedFP (SetOfStop0 stopset0, SetOfStop1 stopset1, SetOfStop2 sto
                    
                    % l := pop ()  %
                    
-                   % addVarParameters (curproc, l, t)  %
+                   % curisused := TRUE  %
+                   [ AttributeUnused  ] 
+                   % addVarParameters (curproc, l, t, curisused)  %
                    
 
    first  symbols:vartok
@@ -1775,7 +1810,9 @@ static void VarFPSection (SetOfStop0 stopset0, SetOfStop1 stopset1, SetOfStop2 s
                       
                       % l := pop ()  %
                       
-                      % addNonVarParameters (curproc, l, t)  %
+                      % curisused := TRUE  %
+                      [ AttributeUnused  ] 
+                      % addNonVarParameters (curproc, l, t, curisused)  %
                       
 
    first  symbols:identtok
@@ -2282,6 +2319,32 @@ static void ErrorArray (const char *a_, unsigned int _a_high)
 }
 
 
+/*
+   checkParameterAttribute -
+*/
+
+static void checkParameterAttribute (void)
+{
+  if ((nameKey_makeKey ((const char *) "unused", 6)) != curident)
+    {
+      mcMetaError_metaError1 ((const char *) "attribute {%1k} is not allowed in the formal parameter section, currently only unused is allowed", 96, (const unsigned char *) &curident, (sizeof (curident)-1));
+    }
+}
+
+
+/*
+   checkReturnAttribute -
+*/
+
+static void checkReturnAttribute (void)
+{
+  if ((nameKey_makeKey ((const char *) "noreturn", 8)) != curident)
+    {
+      mcMetaError_metaError1 ((const char *) "attribute {%1k} is not allowed in the procedure return type, only noreturn is allowed", 85, (const unsigned char *) &curident, (sizeof (curident)-1));
+    }
+}
+
+
 /*
    pushNunbounded -
 */
@@ -5200,9 +5263,9 @@ static void ProcedureParameters (SetOfStop0 stopset0, SetOfStop1 stopset1, SetOf
                          
                          % n := push (makeVarargs ())  %
                           | 'VAR' FormalType 
-                         % n := push (makeVarParameter (NIL, pop (), curproc))  %
+                         % n := push (makeVarParameter (NIL, pop (), curproc, TRUE))  %
                           | FormalType 
-                         % n := push (makeNonVarParameter (NIL, pop (), curproc))  %
+                         % n := push (makeNonVarParameter (NIL, pop (), curproc, TRUE))  %
                          
 
    first  symbols:identtok, arraytok, vartok, periodperiodperiodtok
@@ -5224,13 +5287,13 @@ static void ProcedureParameter (SetOfStop0 stopset0, SetOfStop1 stopset1, SetOfS
       /* avoid dangling else.  */
       Expect (mcReserved_vartok, stopset0, stopset1|(SetOfStop1) ((1 << (mcReserved_arraytok-mcReserved_arraytok))), stopset2|(SetOfStop2) ((1 << (mcReserved_identtok-mcReserved_recordtok))));
       FormalType (stopset0, stopset1, stopset2);
-      n = push (decl_makeVarParameter (static_cast<decl_node> (NULL), pop (), curproc));
+      n = push (decl_makeVarParameter (static_cast<decl_node> (NULL), pop (), curproc, TRUE));
     }
   else if ((mcLexBuf_currenttoken == mcReserved_arraytok) || (mcLexBuf_currenttoken == mcReserved_identtok))
     {
       /* avoid dangling else.  */
       FormalType (stopset0, stopset1, stopset2);
-      n = push (decl_makeNonVarParameter (static_cast<decl_node> (NULL), pop (), curproc));
+      n = push (decl_makeNonVarParameter (static_cast<decl_node> (NULL), pop (), curproc, TRUE));
     }
   else
     {
@@ -6648,6 +6711,42 @@ static void NoReturn (SetOfStop0 stopset0, SetOfStop1 stopset1, SetOfStop2 stops
   Expect (mcReserved_ldirectivetok, stopset0, stopset1, stopset2|(SetOfStop2) ((1 << (mcReserved_identtok-mcReserved_recordtok))));
   Ident (stopset0|(SetOfStop0) ((1 << (mcReserved_rdirectivetok-mcReserved_eoftok))), stopset1, stopset2);
   decl_setNoReturn (curproc, TRUE);
+  checkReturnAttribute ();
+  Expect (mcReserved_rdirectivetok, stopset0, stopset1, stopset2);
+}
+
+
+/*
+   AttributeUnused := [ Unused  ] 
+
+   first  symbols:ldirectivetok
+   
+   reachend
+*/
+
+static void AttributeUnused (SetOfStop0 stopset0, SetOfStop1 stopset1, SetOfStop2 stopset2)
+{
+  if (mcLexBuf_currenttoken == mcReserved_ldirectivetok)
+    {
+      Unused (stopset0, stopset1, stopset2);
+    }
+}
+
+
+/*
+   Unused := '' 
+
+   first  symbols:ldirectivetok
+   
+   cannot reachend
+*/
+
+static void Unused (SetOfStop0 stopset0, SetOfStop1 stopset1, SetOfStop2 stopset2)
+{
+  Expect (mcReserved_ldirectivetok, stopset0, stopset1, stopset2|(SetOfStop2) ((1 << (mcReserved_identtok-mcReserved_recordtok))));
+  Ident (stopset0|(SetOfStop0) ((1 << (mcReserved_rdirectivetok-mcReserved_eoftok))), stopset1, stopset2);
+  curisused = FALSE;
+  checkParameterAttribute ();
   Expect (mcReserved_rdirectivetok, stopset0, stopset1, stopset2);
 }
 
@@ -6778,7 +6877,9 @@ static void ExtendedFP (SetOfStop0 stopset0, SetOfStop1 stopset1, SetOfStop2 sto
                    
                    % l := pop ()  %
                    
-                   % addVarParameters (curproc, l, t)  %
+                   % curisused := TRUE  %
+                   [ AttributeUnused  ] 
+                   % addVarParameters (curproc, l, t, curisused)  %
                    
 
    first  symbols:vartok
@@ -6794,10 +6895,15 @@ static void VarFPSection (SetOfStop0 stopset0, SetOfStop1 stopset1, SetOfStop2 s
   Expect (mcReserved_vartok, stopset0, stopset1, stopset2|(SetOfStop2) ((1 << (mcReserved_identtok-mcReserved_recordtok))));
   PushIdentList (stopset0|(SetOfStop0) ((1 << (mcReserved_colontok-mcReserved_eoftok))), stopset1, stopset2);
   Expect (mcReserved_colontok, stopset0, stopset1|(SetOfStop1) ((1 << (mcReserved_arraytok-mcReserved_arraytok))), stopset2|(SetOfStop2) ((1 << (mcReserved_identtok-mcReserved_recordtok))));
-  FormalType (stopset0, stopset1, stopset2);
+  FormalType (stopset0|(SetOfStop0) ((1 << (mcReserved_ldirectivetok-mcReserved_eoftok))), stopset1, stopset2);
   t = pop ();
   l = pop ();
-  decl_addVarParameters (curproc, l, t);
+  curisused = TRUE;
+  if (mcLexBuf_currenttoken == mcReserved_ldirectivetok)
+    {
+      AttributeUnused (stopset0, stopset1, stopset2);
+    }
+  decl_addVarParameters (curproc, l, t, curisused);
 }
 
 
@@ -6809,7 +6915,9 @@ static void VarFPSection (SetOfStop0 stopset0, SetOfStop1 stopset1, SetOfStop2 s
                       
                       % l := pop ()  %
                       
-                      % addNonVarParameters (curproc, l, t)  %
+                      % curisused := TRUE  %
+                      [ AttributeUnused  ] 
+                      % addNonVarParameters (curproc, l, t, curisused)  %
                       
 
    first  symbols:identtok
@@ -6824,10 +6932,15 @@ static void NonVarFPSection (SetOfStop0 stopset0, SetOfStop1 stopset1, SetOfStop
 
   PushIdentList (stopset0|(SetOfStop0) ((1 << (mcReserved_colontok-mcReserved_eoftok))), stopset1, stopset2);
   Expect (mcReserved_colontok, stopset0, stopset1|(SetOfStop1) ((1 << (mcReserved_arraytok-mcReserved_arraytok))), stopset2|(SetOfStop2) ((1 << (mcReserved_identtok-mcReserved_recordtok))));
-  FormalType (stopset0, stopset1, stopset2);
+  FormalType (stopset0|(SetOfStop0) ((1 << (mcReserved_ldirectivetok-mcReserved_eoftok))), stopset1, stopset2);
   t = pop ();
   l = pop ();
-  decl_addNonVarParameters (curproc, l, t);
+  curisused = TRUE;
+  if (mcLexBuf_currenttoken == mcReserved_ldirectivetok)
+    {
+      AttributeUnused (stopset0, stopset1, stopset2);
+    }
+  decl_addNonVarParameters (curproc, l, t, curisused);
 }
 
 
@@ -7732,10 +7845,10 @@ extern "C" unsigned int mcp3_CompilationUnit (void)
   __builtin_unreachable ();
 }
 
-extern "C" void _M2_mcp3_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_mcp3_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_mcp3_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_mcp3_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
index d55c80410d921012ce9c55baa851f5b302933be4..24e185b21630987af6c03c579be19fe6d51540c1 100644 (file)
@@ -1647,6 +1647,16 @@ static void FormalParameters (SetOfStop0 stopset0, SetOfStop1 stopset1, SetOfSto
 
 static void AttributeNoReturn (SetOfStop0 stopset0, SetOfStop1 stopset1, SetOfStop2 stopset2);
 
+/*
+   AttributeUnused := [ ''  ] 
+
+   first  symbols:ldirectivetok
+   
+   reachend
+*/
+
+static void AttributeUnused (SetOfStop0 stopset0, SetOfStop1 stopset1, SetOfStop2 stopset2);
+
 /*
    MultiFPSection := ExtendedFP  | FPSection [ ';' 
                                                MultiFPSection  ] 
@@ -1691,6 +1701,7 @@ static void ExtendedFP (SetOfStop0 stopset0, SetOfStop1 stopset1, SetOfStop2 sto
 
 /*
    VarFPSection := 'VAR' PushIdentList ':' FormalType 
+                   [ AttributeUnused  ] 
 
    first  symbols:vartok
    
@@ -1701,6 +1712,7 @@ static void VarFPSection (SetOfStop0 stopset0, SetOfStop1 stopset1, SetOfStop2 s
 
 /*
    NonVarFPSection := PushIdentList ':' FormalType 
+                      [ AttributeUnused  ] 
 
    first  symbols:identtok
    
@@ -6501,6 +6513,25 @@ static void AttributeNoReturn (SetOfStop0 stopset0, SetOfStop1 stopset1, SetOfSt
 }
 
 
+/*
+   AttributeUnused := [ ''  ] 
+
+   first  symbols:ldirectivetok
+   
+   reachend
+*/
+
+static void AttributeUnused (SetOfStop0 stopset0, SetOfStop1 stopset1, SetOfStop2 stopset2)
+{
+  if (mcLexBuf_currenttoken == mcReserved_ldirectivetok)
+    {
+      Expect (mcReserved_ldirectivetok, stopset0, stopset1, stopset2|(SetOfStop2) ((1 << (mcReserved_identtok-mcReserved_recordtok))));
+      Ident (stopset0|(SetOfStop0) ((1 << (mcReserved_rdirectivetok-mcReserved_eoftok))), stopset1, stopset2);
+      Expect (mcReserved_rdirectivetok, stopset0, stopset1, stopset2);
+    }
+}
+
+
 /*
    MultiFPSection := ExtendedFP  | FPSection [ ';' 
                                                MultiFPSection  ] 
@@ -6618,6 +6649,7 @@ static void ExtendedFP (SetOfStop0 stopset0, SetOfStop1 stopset1, SetOfStop2 sto
 
 /*
    VarFPSection := 'VAR' PushIdentList ':' FormalType 
+                   [ AttributeUnused  ] 
 
    first  symbols:vartok
    
@@ -6629,12 +6661,17 @@ static void VarFPSection (SetOfStop0 stopset0, SetOfStop1 stopset1, SetOfStop2 s
   Expect (mcReserved_vartok, stopset0, stopset1, stopset2|(SetOfStop2) ((1 << (mcReserved_identtok-mcReserved_recordtok))));
   PushIdentList (stopset0|(SetOfStop0) ((1 << (mcReserved_colontok-mcReserved_eoftok))), stopset1, stopset2);
   Expect (mcReserved_colontok, stopset0, stopset1|(SetOfStop1) ((1 << (mcReserved_arraytok-mcReserved_arraytok))), stopset2|(SetOfStop2) ((1 << (mcReserved_identtok-mcReserved_recordtok))));
-  FormalType (stopset0, stopset1, stopset2);
+  FormalType (stopset0|(SetOfStop0) ((1 << (mcReserved_ldirectivetok-mcReserved_eoftok))), stopset1, stopset2);
+  if (mcLexBuf_currenttoken == mcReserved_ldirectivetok)
+    {
+      AttributeUnused (stopset0, stopset1, stopset2);
+    }
 }
 
 
 /*
    NonVarFPSection := PushIdentList ':' FormalType 
+                      [ AttributeUnused  ] 
 
    first  symbols:identtok
    
@@ -6645,7 +6682,11 @@ static void NonVarFPSection (SetOfStop0 stopset0, SetOfStop1 stopset1, SetOfStop
 {
   PushIdentList (stopset0|(SetOfStop0) ((1 << (mcReserved_colontok-mcReserved_eoftok))), stopset1, stopset2);
   Expect (mcReserved_colontok, stopset0, stopset1|(SetOfStop1) ((1 << (mcReserved_arraytok-mcReserved_arraytok))), stopset2|(SetOfStop2) ((1 << (mcReserved_identtok-mcReserved_recordtok))));
-  FormalType (stopset0, stopset1, stopset2);
+  FormalType (stopset0|(SetOfStop0) ((1 << (mcReserved_ldirectivetok-mcReserved_eoftok))), stopset1, stopset2);
+  if (mcLexBuf_currenttoken == mcReserved_ldirectivetok)
+    {
+      AttributeUnused (stopset0, stopset1, stopset2);
+    }
 }
 
 
@@ -7667,10 +7708,10 @@ extern "C" unsigned int mcp4_CompilationUnit (void)
   __builtin_unreachable ();
 }
 
-extern "C" void _M2_mcp4_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_mcp4_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_mcp4_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_mcp4_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
index 6018ba9ef080d30831d8a29db12103b8f0cb31f8..27b286397456444e9331c609697a5cfa0771cde5 100644 (file)
@@ -2003,6 +2003,16 @@ static void DefFormalParameters (SetOfStop0 stopset0, SetOfStop1 stopset1, SetOf
 
 static void AttributeNoReturn (SetOfStop0 stopset0, SetOfStop1 stopset1, SetOfStop2 stopset2);
 
+/*
+   AttributeUnused := [ ''  ] 
+
+   first  symbols:ldirectivetok
+   
+   reachend
+*/
+
+static void AttributeUnused (SetOfStop0 stopset0, SetOfStop1 stopset1, SetOfStop2 stopset2);
+
 /*
    DefMultiFPSection := DefExtendedFP  | 
                         FPSection [ ';' DefMultiFPSection  ] 
@@ -2071,7 +2081,8 @@ static void DefExtendedFP (SetOfStop0 stopset0, SetOfStop1 stopset1, SetOfStop2
 static void ExtendedFP (SetOfStop0 stopset0, SetOfStop1 stopset1, SetOfStop2 stopset2);
 
 /*
-   VarFPSection := 'VAR' IdentList ':' FormalType 
+   VarFPSection := 'VAR' IdentList ':' FormalType [ 
+   AttributeUnused  ] 
 
    first  symbols:vartok
    
@@ -2081,7 +2092,7 @@ static void ExtendedFP (SetOfStop0 stopset0, SetOfStop1 stopset1, SetOfStop2 sto
 static void VarFPSection (SetOfStop0 stopset0, SetOfStop1 stopset1, SetOfStop2 stopset2);
 
 /*
-   NonVarFPSection := IdentList ':' FormalType 
+   NonVarFPSection := IdentList ':' FormalType [ AttributeUnused  ] 
 
    first  symbols:identtok
    
@@ -7489,6 +7500,25 @@ static void AttributeNoReturn (SetOfStop0 stopset0, SetOfStop1 stopset1, SetOfSt
 }
 
 
+/*
+   AttributeUnused := [ ''  ] 
+
+   first  symbols:ldirectivetok
+   
+   reachend
+*/
+
+static void AttributeUnused (SetOfStop0 stopset0, SetOfStop1 stopset1, SetOfStop2 stopset2)
+{
+  if (mcLexBuf_currenttoken == mcReserved_ldirectivetok)
+    {
+      Expect (mcReserved_ldirectivetok, stopset0, stopset1, stopset2|(SetOfStop2) ((1 << (mcReserved_identtok-mcReserved_recordtok))));
+      Ident (stopset0|(SetOfStop0) ((1 << (mcReserved_rdirectivetok-mcReserved_eoftok))), stopset1, stopset2);
+      Expect (mcReserved_rdirectivetok, stopset0, stopset1, stopset2);
+    }
+}
+
+
 /*
    DefMultiFPSection := DefExtendedFP  | 
                         FPSection [ ';' DefMultiFPSection  ] 
@@ -7664,7 +7694,8 @@ static void ExtendedFP (SetOfStop0 stopset0, SetOfStop1 stopset1, SetOfStop2 sto
 
 
 /*
-   VarFPSection := 'VAR' IdentList ':' FormalType 
+   VarFPSection := 'VAR' IdentList ':' FormalType [ 
+   AttributeUnused  ] 
 
    first  symbols:vartok
    
@@ -7676,12 +7707,16 @@ static void VarFPSection (SetOfStop0 stopset0, SetOfStop1 stopset1, SetOfStop2 s
   Expect (mcReserved_vartok, stopset0, stopset1, stopset2|(SetOfStop2) ((1 << (mcReserved_identtok-mcReserved_recordtok))));
   IdentList (stopset0|(SetOfStop0) ((1 << (mcReserved_colontok-mcReserved_eoftok))), stopset1, stopset2);
   Expect (mcReserved_colontok, stopset0, stopset1|(SetOfStop1) ((1 << (mcReserved_arraytok-mcReserved_arraytok))), stopset2|(SetOfStop2) ((1 << (mcReserved_identtok-mcReserved_recordtok))));
-  FormalType (stopset0, stopset1, stopset2);
+  FormalType (stopset0|(SetOfStop0) ((1 << (mcReserved_ldirectivetok-mcReserved_eoftok))), stopset1, stopset2);
+  if (mcLexBuf_currenttoken == mcReserved_ldirectivetok)
+    {
+      AttributeUnused (stopset0, stopset1, stopset2);
+    }
 }
 
 
 /*
-   NonVarFPSection := IdentList ':' FormalType 
+   NonVarFPSection := IdentList ':' FormalType [ AttributeUnused  ] 
 
    first  symbols:identtok
    
@@ -7692,7 +7727,11 @@ static void NonVarFPSection (SetOfStop0 stopset0, SetOfStop1 stopset1, SetOfStop
 {
   IdentList (stopset0|(SetOfStop0) ((1 << (mcReserved_colontok-mcReserved_eoftok))), stopset1, stopset2);
   Expect (mcReserved_colontok, stopset0, stopset1|(SetOfStop1) ((1 << (mcReserved_arraytok-mcReserved_arraytok))), stopset2|(SetOfStop2) ((1 << (mcReserved_identtok-mcReserved_recordtok))));
-  FormalType (stopset0, stopset1, stopset2);
+  FormalType (stopset0|(SetOfStop0) ((1 << (mcReserved_ldirectivetok-mcReserved_eoftok))), stopset1, stopset2);
+  if (mcLexBuf_currenttoken == mcReserved_ldirectivetok)
+    {
+      AttributeUnused (stopset0, stopset1, stopset2);
+    }
 }
 
 
@@ -8528,10 +8567,10 @@ extern "C" unsigned int mcp5_CompilationUnit (void)
   __builtin_unreachable ();
 }
 
-extern "C" void _M2_mcp5_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_mcp5_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_mcp5_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_mcp5_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
index 81d2af920270fdb98144750d413276348e7c8505..438db4a888864ff051223d7b1c50a20932dfe554 100644 (file)
@@ -571,7 +571,7 @@ extern "C" void * nameKey_keyToCharStar (nameKey_Name key)
   __builtin_unreachable ();
 }
 
-extern "C" void _M2_nameKey_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_nameKey_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
   lastIndice = 0;
   keyIndex = Indexing_InitIndex (1);
@@ -579,6 +579,6 @@ extern "C" void _M2_nameKey_init (__attribute__((unused)) int argc, __attribute_
   binaryTree->left = NULL;
 }
 
-extern "C" void _M2_nameKey_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_nameKey_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
index 13f2d067b6d65756051d09a1ba57ad263279fce0..b859468bf704bc115c258742d4bc8dd401d4d5fc 100644 (file)
@@ -397,10 +397,10 @@ extern "C" void symbolKey_foreachNodeDo (symbolKey_symbolTree t, symbolKey_perfo
   searchAndDo (t->left, p);
 }
 
-extern "C" void _M2_symbolKey_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_symbolKey_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_symbolKey_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_symbolKey_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
index 3e8ee482666df1bb1c4f243158e1bc176c1915a5..85121b38e08c9bba757d5dad2d5112e824128056 100644 (file)
@@ -59,11 +59,11 @@ static void init (void)
   mcComp_compile (mcOptions_handleOptions ());
 }
 
-extern "C" void _M2_top_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_top_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
   init ();
 }
 
-extern "C" void _M2_top_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_top_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
index 2ada1f8bfb05be79300d9829b866f15ee264ff38..68af667bea8fddd18bc4d6d3ae9bf819b2c19e64 100644 (file)
@@ -422,10 +422,10 @@ extern "C" varargs_vararg varargs_start4 (const unsigned char *a_, unsigned int
   __builtin_unreachable ();
 }
 
-extern "C" void _M2_varargs_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_varargs_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_varargs_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_varargs_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
index 70b60bb17b98142f5e830ea0a2843e1801795c7f..6058d44f524d6dcb0dcbc15f01044b92b0a6c748 100644 (file)
@@ -462,10 +462,10 @@ extern "C" wlists_wlist wlists_duplicateList (wlists_wlist l)
   __builtin_unreachable ();
 }
 
-extern "C" void _M2_wlists_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_wlists_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_wlists_finish (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
+extern "C" void _M2_wlists_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
 {
 }
index cae1db1d756feb76c6bea9246bab781a143afa55..820312bbc5ab8e6b4dbbf08bff70da00a5dfe48a 100644 (file)
@@ -745,7 +745,7 @@ PROCEDURE putOptReturn (proc: node) ;
                       Where the parameters are declared as l: type.
 *)
 
-PROCEDURE makeVarParameter (l: node; type, proc: node) : node ;
+PROCEDURE makeVarParameter (l: node; type, proc: node; isused: BOOLEAN) : node ;
 
 
 (*
@@ -753,7 +753,7 @@ PROCEDURE makeVarParameter (l: node; type, proc: node) : node ;
                          Where the parameters are declared as l: type.
 *)
 
-PROCEDURE makeNonVarParameter (l: node; type, proc: node) : node ;
+PROCEDURE makeNonVarParameter (l: node; type, proc: node; isused: BOOLEAN) : node ;
 
 
 (*
@@ -789,7 +789,7 @@ PROCEDURE putIdent (n: node; i: Name) : BOOLEAN ;
                       in procedure, n.
 *)
 
-PROCEDURE addVarParameters (n: node; i: node; type: node) ;
+PROCEDURE addVarParameters (n: node; i: node; type: node; isused: BOOLEAN) ;
 
 
 (*
@@ -797,7 +797,7 @@ PROCEDURE addVarParameters (n: node; i: node; type: node) ;
                          in procedure, n.
 *)
 
-PROCEDURE addNonVarParameters (n: node; i: node; type: node) ;
+PROCEDURE addNonVarParameters (n: node; i: node; type: node; isused: BOOLEAN) ;
 
 
 (*
index 90cfa6dfcdd5912629f6f90d3e9528fe140e61df..3e40cb022a05a18e5fa5eab16157850b2df1cd11 100644 (file)
@@ -345,7 +345,8 @@ TYPE
                 scope         :  node ;
                 isInitialised,
                 isParameter,
-                isVarParameter:  BOOLEAN ;
+                isVarParameter,
+                 isUsed        :  BOOLEAN ;
                  cname         :  cnameT ;
               END ;
 
@@ -403,6 +404,7 @@ TYPE
                      scope      :  node ;
                       isUnbounded:  BOOLEAN ;
                       isForC     :  BOOLEAN ;
+                      isUsed     :  BOOLEAN ;
                    END ;
 
        paramT = RECORD
@@ -411,6 +413,7 @@ TYPE
                    scope      :  node ;
                    isUnbounded:  BOOLEAN ;
                    isForC     :  BOOLEAN ;
+                   isUsed     :  BOOLEAN ;
                 END ;
 
        varargsT = RECORD
@@ -1993,15 +1996,16 @@ END putVar ;
 
 
 (*
-   putVarBool - assigns the three booleans associated with a variable.
+   putVarBool - assigns the four booleans associated with a variable.
 *)
 
-PROCEDURE putVarBool (v: node; init, param, isvar: BOOLEAN) ;
+PROCEDURE putVarBool (v: node; init, param, isvar, isused: BOOLEAN) ;
 BEGIN
    assert (isVar (v)) ;
    v^.varF.isInitialised := init ;
    v^.varF.isParameter := param ;
-   v^.varF.isVarParameter := isvar
+   v^.varF.isVarParameter := isvar ;
+   v^.varF.isUsed := isused
 END putVarBool ;
 
 
@@ -2073,7 +2077,7 @@ END isVarDecl ;
    makeVariablesFromParameters - creates variables which are really parameters.
 *)
 
-PROCEDURE makeVariablesFromParameters (proc, id, type: node; isvar: BOOLEAN) ;
+PROCEDURE makeVariablesFromParameters (proc, id, type: node; isvar, isused: BOOLEAN) ;
 VAR
    v   : node ;
    i, n: CARDINAL ;
@@ -2088,7 +2092,7 @@ BEGIN
       m := wlists.getItemFromList (id^.identlistF.names, i) ;
       v := makeVar (m) ;
       putVar (v, type, NIL) ;
-      putVarBool (v, TRUE, TRUE, isvar) ;
+      putVarBool (v, TRUE, TRUE, isvar, isused) ;
       IF debugScopes
       THEN
          printf ("adding parameter variable into top scope\n") ;
@@ -2302,7 +2306,7 @@ END putProcTypeOptReturn ;
    makeNonVarParameter - returns a non var parameter node with, name: type.
 *)
 
-PROCEDURE makeNonVarParameter (l: node; type, proc: node) : node ;
+PROCEDURE makeNonVarParameter (l: node; type, proc: node; isused: BOOLEAN) : node ;
 VAR
    d: node ;
 BEGIN
@@ -2313,6 +2317,7 @@ BEGIN
    d^.paramF.scope := proc ;
    d^.paramF.isUnbounded := FALSE ;
    d^.paramF.isForC := isDefForCNode (proc) ;
+   d^.paramF.isUsed := isused ;
    RETURN d
 END makeNonVarParameter ;
 
@@ -2321,7 +2326,7 @@ END makeNonVarParameter ;
    makeVarParameter - returns a var parameter node with, name: type.
 *)
 
-PROCEDURE makeVarParameter (l: node; type, proc: node) : node ;
+PROCEDURE makeVarParameter (l: node; type, proc: node; isused: BOOLEAN) : node ;
 VAR
    d: node ;
 BEGIN
@@ -2332,6 +2337,7 @@ BEGIN
    d^.varparamF.scope := proc ;
    d^.varparamF.isUnbounded := FALSE ;
    d^.varparamF.isForC := isDefForCNode (proc) ;
+   d^.varparamF.isUsed := isused ;
    RETURN d
 END makeVarParameter ;
 
@@ -2432,7 +2438,7 @@ BEGIN
    assert (isProcedure (proc)) ;
    l := makeIdentList () ;
    assert (putIdent (l, id)) ;
-   checkMakeVariables (proc, l, type, FALSE) ;
+   checkMakeVariables (proc, l, type, FALSE, TRUE) ;
    IF NOT proc^.procedureF.checking
    THEN
       p := makeOptParameter (l, type, init) ;
@@ -2530,7 +2536,7 @@ END identListLen ;
    checkParameters - placeholder for future parameter checking.
 *)
 
-PROCEDURE checkParameters (p: node; i: node; type: node; var: BOOLEAN) ;
+PROCEDURE checkParameters (p: node; i: node; type: node; isvar, isused: BOOLEAN) ;
 BEGIN
    (* do check.  *)
    disposeNode (i)
@@ -2569,12 +2575,12 @@ END avoidCnames ;
                         a module or an implementation module.
 *)
 
-PROCEDURE checkMakeVariables (n, i, type: node; isvar: BOOLEAN) ;
+PROCEDURE checkMakeVariables (n, i, type: node; isvar, isused: BOOLEAN) ;
 BEGIN
    IF (isImp (currentModule) OR isModule (currentModule)) AND
       (NOT n^.procedureF.built)
    THEN
-      makeVariablesFromParameters (n, i, type, isvar)
+      makeVariablesFromParameters (n, i, type, isvar, isused)
    END ;
 END checkMakeVariables ;
 
@@ -2584,18 +2590,18 @@ END checkMakeVariables ;
                       in procedure, n.
 *)
 
-PROCEDURE addVarParameters (n: node; i: node; type: node) ;
+PROCEDURE addVarParameters (n: node; i: node; type: node; isused: BOOLEAN) ;
 VAR
    p: node ;
 BEGIN
    assert (isIdentList (i)) ;
    assert (isProcedure (n)) ;
-   checkMakeVariables (n, i, type, TRUE) ;
+   checkMakeVariables (n, i, type, TRUE, isused) ;
    IF n^.procedureF.checking
    THEN
-      checkParameters (n, i, type, TRUE)  (* will destroy, i.  *)
+      checkParameters (n, i, type, TRUE, isused)  (* will destroy, i.  *)
    ELSE
-      p := makeVarParameter (i, type, n) ;
+      p := makeVarParameter (i, type, n, isused) ;
       IncludeIndiceIntoIndex (n^.procedureF.parameters, p) ;
    END ;
 END addVarParameters ;
@@ -2606,18 +2612,18 @@ END addVarParameters ;
                          in procedure, n.
 *)
 
-PROCEDURE addNonVarParameters (n: node; i: node; type: node) ;
+PROCEDURE addNonVarParameters (n: node; i: node; type: node; isused: BOOLEAN) ;
 VAR
    p: node ;
 BEGIN
    assert (isIdentList (i)) ;
    assert (isProcedure (n)) ;
-   checkMakeVariables (n, i, type, FALSE) ;
+   checkMakeVariables (n, i, type, FALSE, isused) ;
    IF n^.procedureF.checking
    THEN
-      checkParameters (n, i, type, FALSE)  (* will destroy, i.  *)
+      checkParameters (n, i, type, FALSE, isused)  (* will destroy, i.  *)
    ELSE
-      p := makeNonVarParameter (i, type, n) ;
+      p := makeNonVarParameter (i, type, n, isused) ;
       IncludeIndiceIntoIndex (n^.procedureF.parameters, p)
    END ;
 END addNonVarParameters ;
@@ -7078,18 +7084,33 @@ BEGIN
 END doNameM2 ;
 
 
+(*
+   doUsed -
+*)
+
+PROCEDURE doUsed (p: pretty; used: BOOLEAN) ;
+BEGIN
+   IF NOT used
+   THEN
+      setNeedSpace (p) ;
+      outText (p, "__attribute__((unused))")
+   END
+END doUsed ;
+
+
 (*
    doHighC -
 *)
 
-PROCEDURE doHighC (p: pretty; a: node; n: Name) ;
+PROCEDURE doHighC (p: pretty; a: node; n: Name; isused: BOOLEAN) ;
 BEGIN
    IF isArray (a) AND isUnbounded (a)
    THEN
       (* need to display high.  *)
       print (p, ",") ; setNeedSpace (p) ;
       doTypeNameC (p, cardinalN) ; setNeedSpace (p) ;
-      print (p, "_") ; outTextN (p, n) ; print (p, "_high")
+      print (p, "_") ; outTextN (p, n) ; print (p, "_high") ;
+      doUsed (p, isused)
    END
 END doHighC ;
 
@@ -7171,6 +7192,7 @@ BEGIN
    THEN
       doParamConstCast (p, n) ;
       doTypeNameC (p, ptype) ;
+      doUsed (p, n^.paramF.isUsed) ;
       IF isArray (ptype) AND isUnbounded (ptype)
       THEN
          outText (p, ',') ; setNeedSpace (p) ;
@@ -7185,6 +7207,7 @@ BEGIN
          doParamTypeEmit (p, n, ptype) ;
          IF isArray (ptype) AND isUnbounded (ptype)
          THEN
+            doUsed (p, n^.paramF.isUsed) ;
             outText (p, ',') ; setNeedSpace (p) ;
             outText (p, 'unsigned int')
          END
@@ -7212,7 +7235,8 @@ BEGIN
             THEN
                outText (p, '_')
             END ;
-            doHighC (p, ptype, i) ;
+            doUsed (p, n^.paramF.isUsed) ;
+            doHighC (p, ptype, i, n^.paramF.isUsed) ;
             IF c<t
             THEN
                outText (p, ',') ; setNeedSpace (p)
@@ -7247,6 +7271,7 @@ BEGIN
          setNeedSpace (p) ;
          outText (p, "*")
       END ;
+      doUsed (p, n^.varparamF.isUsed) ;
       IF isArray (ptype) AND isUnbounded (ptype)
       THEN
          outText (p, ',') ; setNeedSpace (p) ;
@@ -7257,7 +7282,8 @@ BEGIN
       l := n^.varparamF.namelist^.identlistF.names ;
       IF l=NIL
       THEN
-         doParamTypeEmit (p, n, ptype)
+         doParamTypeEmit (p, n, ptype) ;
+         doUsed (p, n^.varparamF.isUsed)
       ELSE
          t := wlists.noOfItemsInList (l) ;
          c := 1 ;
@@ -7276,7 +7302,8 @@ BEGIN
             ELSE
                doFQDNameC (p, v, TRUE)
             END ;
-            doHighC (p, ptype, i) ;
+            doUsed (p, n^.varparamF.isUsed) ;
+            doHighC (p, ptype, i, n^.varparamF.isUsed) ;
             IF c<t
             THEN
                outText (p, ',') ; setNeedSpace (p)
@@ -14062,7 +14089,9 @@ BEGIN
    doFQNameC (p, n) ;
    outText (p, "_init") ;
    setNeedSpace (p) ;
-   outText (p, "(__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])\n") ;
+   outText (p, "(__attribute__((unused)) int argc") ;
+   outText (p, ",__attribute__((unused)) char *argv[]") ;
+   outText (p, ",__attribute__((unused)) char *envp[])\n");
    p := outKc (p, "{\n") ;
    doStatementsC (p, n^.impF.beginStatements) ;
    p := outKc (p, "}\n") ;
@@ -14074,7 +14103,9 @@ BEGIN
    doFQNameC (p, n) ;
    outText (p, "_finish") ;
    setNeedSpace (p) ;
-   outText (p, "(__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])\n") ;
+   outText (p, "(__attribute__((unused)) int argc") ;
+   outText (p, ",__attribute__((unused)) char *argv[]") ;
+   outText (p, ",__attribute__((unused)) char *envp[])\n");
    p := outKc (p, "{\n") ;
    doStatementsC (p, n^.impF.finallyStatements) ;
    p := outKc (p, "}\n")
@@ -14144,7 +14175,7 @@ BEGIN
    outText (p, "_init") ;
    setNeedSpace (p) ;
    outText (p, "(__attribute__((unused)) int argc,") ;
-   outText (p, " __attribute__((unused)) char *argv[],") ;
+   outText (p, " __attribute__((unused)) char *argv[]") ;
    outText (p, " __attribute__((unused)) char *envp[])\n") ;
    p := outKc (p, "{\n") ;
    doStatementsC (p, n^.impF.beginStatements) ;
@@ -14158,7 +14189,7 @@ BEGIN
    outText (p, "_fini") ;
    setNeedSpace (p) ;
    outText (p, "(__attribute__((unused)) int argc,") ;
-   outText (p, " __attribute__((unused)) char *argv[],") ;
+   outText (p, " __attribute__((unused)) char *argv[]") ;
    outText (p, " __attribute__((unused)) char *envp[])\n") ;
    p := outKc (p, "{\n") ;
    doStatementsC (p, n^.impF.finallyStatements) ;
@@ -14416,7 +14447,9 @@ BEGIN
    doFQNameC (p, n) ;
    outText (p, "_init") ;
    setNeedSpace (p) ;
-   outText (p, "(__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])\n") ;
+   outText (p, "(__attribute__((unused)) int argc") ;
+   outText (p, ",__attribute__((unused)) char *argv[]") ;
+   outText (p, ",__attribute__((unused)) char *envp[])\n");
    p := outKc (p, "{\n") ;
    doStatementsC (p, n^.moduleF.beginStatements) ;
    p := outKc (p, "}\n") ;
@@ -14428,7 +14461,9 @@ BEGIN
    doFQNameC (p, n) ;
    outText (p, "_finish") ;
    setNeedSpace (p) ;
-   outText (p, "(__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])\n") ;
+   outText (p, "(__attribute__((unused)) int argc") ;
+   outText (p, ",__attribute__((unused)) char *argv[]") ;
+   outText (p, ",__attribute__((unused)) char *envp[])\n");
    p := outKc (p, "{\n") ;
    doStatementsC (p, n^.moduleF.finallyStatements) ;
    p := outKc (p, "}\n")
index 538dfc79da1fab55b3ac67358e19d0a3755d0107..e41102e67e0ae7f251580ad6c63b87df459edc38 100644 (file)
@@ -1002,6 +1002,8 @@ FormalParameters := "(" [ MultiFPSection ] ")" FormalReturn =:
 
 AttributeNoReturn := [ "<*" Ident "*>" ] =:
 
+AttributeUnused := [ "<*" Ident "*>" ] =:
+
 MultiFPSection := ExtendedFP | FPSection [ ";" MultiFPSection ] =:
 
 FPSection := NonVarFPSection | VarFPSection =:
@@ -1010,9 +1012,9 @@ DefExtendedFP := DefOptArg | "..." =:
 
 ExtendedFP := OptArg | "..." =:
 
-VarFPSection := "VAR" IdentList ":" FormalType =:
+VarFPSection := "VAR" IdentList ":" FormalType [ AttributeUnused ] =:
 
-NonVarFPSection := IdentList ":" FormalType =:
+NonVarFPSection := IdentList ":" FormalType [ AttributeUnused ] =:
 
 OptArg := "[" Ident ":" FormalType [ "=" ConstExpression ] "]" =:
 
index 1a55563ed8997b1e2986fed6ffcf97a749533ead..fa4c918ac0f8def38cf53fb0a5bf7b9dd3d93653 100644 (file)
@@ -1011,6 +1011,8 @@ FormalParameters := "(" [ MultiFPSection ] ")" FormalReturn =:
 
 AttributeNoReturn := [ "<*" Ident "*>" ] =:
 
+AttributeUnused := [ "<*" Ident "*>" ] =:
+
 MultiFPSection := ExtendedFP | FPSection [ ";" MultiFPSection ] =:
 
 FPSection := NonVarFPSection | VarFPSection =:
@@ -1019,9 +1021,9 @@ DefExtendedFP := DefOptArg | "..." =:
 
 ExtendedFP := OptArg | "..." =:
 
-VarFPSection := "VAR" IdentList ":" FormalType =:
+VarFPSection := "VAR" IdentList ":" FormalType [ AttributeUnused ] =:
 
-NonVarFPSection := IdentList ":" FormalType =:
+NonVarFPSection := IdentList ":" FormalType [ AttributeUnused ] =:
 
 OptArg := "[" Ident ":" FormalType [ "=" ConstExpression ] "]" =:
 
index de925210b3c760923befd683eb859b934f0a301a..8d26b86ffdfe814341bba6ac1638ed7346dcd214 100644 (file)
@@ -47,7 +47,7 @@ FROM DynamicStrings IMPORT String, InitString, KillString, Mark,
                            ConCat, ConCatChar ;
 
 FROM mcError IMPORT errorStringAt ;
-FROM nameKey IMPORT NulName, Name, makekey ;
+FROM nameKey IMPORT NulName, Name, makekey, makeKey ;
 FROM mcPrintf IMPORT printf0, printf1 ;
 FROM mcDebug IMPORT assert ;
 FROM mcReserved IMPORT toktype ;
@@ -85,6 +85,7 @@ CONST
 
 VAR
    WasNoError : BOOLEAN ;
+   curisused  : BOOLEAN ;
    curstring,
    curident   : Name ;
    curproc,
@@ -168,6 +169,32 @@ BEGIN
 END ErrorArray ;
 
 
+(*
+   checkParameterAttribute -
+*)
+
+PROCEDURE checkParameterAttribute ;
+BEGIN
+   IF makeKey ("unused") # curident
+   THEN
+      metaError1 ('attribute {%1k} is not allowed in the formal parameter section, currently only unused is allowed', curident)
+   END
+END checkParameterAttribute ;
+
+
+(*
+   checkReturnAttribute -
+*)
+
+PROCEDURE checkReturnAttribute ;
+BEGIN
+   IF makeKey ("noreturn") # curident
+   THEN
+      metaError1 ('attribute {%1k} is not allowed in the procedure return type, only noreturn is allowed', curident)
+   END
+END checkReturnAttribute ;
+
+
 (*
    pushNunbounded -
 *)
@@ -899,8 +926,8 @@ ProcedureParameters := ProcedureParameter                              % addPara
 
 ProcedureParameter := "..."                                            % VAR n: node ; %
                                                                        % n := push (makeVarargs ()) %
-                            | "VAR" FormalType                         % n := push (makeVarParameter (NIL, pop (), curproc)) %
-                                              | FormalType            % n := push (makeNonVarParameter (NIL, pop (), curproc)) %
+                            | "VAR" FormalType                         % n := push (makeVarParameter (NIL, pop (), curproc, TRUE)) %
+                                              | FormalType            % n := push (makeNonVarParameter (NIL, pop (), curproc, TRUE)) %
                                                            =:
 
 
@@ -1118,12 +1145,19 @@ FormalParameters := "("                                               % paramEnt
                         [ MultiFPSection ] ")"                        % paramLeave (curproc) %
                                               FormalReturn =:
 
-AttributeNoReturn := [ NoReturn |                          % setNoReturn (curproc, FALSE) %
+AttributeNoReturn := [ NoReturn |                                     % setNoReturn (curproc, FALSE) %
                                   ] =:
 
-NoReturn := "<*" Ident                                     % setNoReturn (curproc, TRUE) %
+NoReturn := "<*" Ident                                                % setNoReturn (curproc, TRUE) %
+                                                                      % checkReturnAttribute %
                        "*>" =:
 
+AttributeUnused := [ Unused ] =:
+
+Unused := "<*" Ident                                                  % curisused := FALSE %
+                                                                      % checkParameterAttribute %
+                     "*>" =:
+
 MultiFPSection := ExtendedFP | FPSection [ ";" MultiFPSection ] =:
 
 FPSection := NonVarFPSection | VarFPSection =:
@@ -1137,13 +1171,17 @@ ExtendedFP := OptArg | "..."
 VarFPSection := "VAR" PushIdentList                                   % VAR l, t: node ; %
                                     ":" FormalType                    % t := pop () %
                                                                      % l := pop () %
-                                                                      % addVarParameters (curproc, l, t) %
+                                                                      % curisused := TRUE %
+                                                  [ AttributeUnused ]
+                                                                      % addVarParameters (curproc, l, t, curisused) %
               =:
 
 NonVarFPSection := PushIdentList                                      % VAR l, t: node ; %
                                  ":" FormalType                       % t := pop () %
                                                                      % l := pop () %
-                                                                     % addNonVarParameters (curproc, l, t) %
+                                                                      % curisused := TRUE %
+                                                [ AttributeUnused ]
+                                                                     % addNonVarParameters (curproc, l, t, curisused) %
                  =:
 
 OptArg :=                                                             % VAR p, init, type: node ; id: Name ; %
index 05be2a6b6723ae49f284e4a7e35218a2e3ddb895..b9f13f9700871de5b3a6a9ef26ade8debb144281 100644 (file)
@@ -1117,6 +1117,8 @@ FormalParameters := "("                                               % paramEnt
 
 AttributeNoReturn := [ "<*" Ident "*>" ] =:
 
+AttributeUnused := [ "<*" Ident "*>" ] =:
+
 MultiFPSection := ExtendedFP | FPSection [ ";" MultiFPSection ] =:
 
 FPSection := NonVarFPSection | VarFPSection =:
@@ -1125,9 +1127,9 @@ DefExtendedFP := DefOptArg | "..." =:
 
 ExtendedFP := OptArg | "..." =:
 
-VarFPSection := "VAR" PushIdentList ":" FormalType =:
+VarFPSection := "VAR" PushIdentList ":" FormalType [ AttributeUnused ] =:
 
-NonVarFPSection := PushIdentList ":" FormalType =:
+NonVarFPSection := PushIdentList ":" FormalType [ AttributeUnused ] =:
 
 OptArg := "[" Ident ":" FormalType [ "=" ConstExpression ] "]" =:
 
index ba5a75b2c83c4974a18a9f93955a42f9965f3103..6e843bf301bb9b15fd999cd12b15047d7da190ce 100644 (file)
@@ -1429,6 +1429,8 @@ DefFormalParameters := "("                                             % paramEn
 
 AttributeNoReturn := [ "<*" Ident "*>" ] =:
 
+AttributeUnused := [ "<*" Ident "*>" ] =:
+
 DefMultiFPSection := DefExtendedFP | FPSection [ ";" DefMultiFPSection ] =:
 
 FormalParameters := "("                                                % paramEnter (curproc) %
@@ -1443,10 +1445,10 @@ DefExtendedFP := DefOptArg | "..." =:
 
 ExtendedFP := OptArg | "..." =:
 
-VarFPSection := "VAR" IdentList ":" FormalType
+VarFPSection := "VAR" IdentList ":" FormalType [ AttributeUnused ]
               =:
 
-NonVarFPSection := IdentList ":" FormalType
+NonVarFPSection := IdentList ":" FormalType [ AttributeUnused ]
                  =:
 
 OptArg := "[" Ident ":" FormalType [ "=" ConstExpressionNop ] "]" =:
index 42d66d86420b85dbe9e5dab11c0a024dfc77a825..9d3c7fc1dbbac89b74fae42a855969a091cebeb1 100644 (file)
@@ -354,7 +354,7 @@ GenerateInitCalls (functList *p)
 {
   while (p != NULL)
     {
-      printf ("   _M2_%s_init(argc, argv);\n", p->functname);
+      printf ("   _M2_%s_init (argc, argv, envp);\n", p->functname);
       p = p->next;
     }
 }
@@ -364,7 +364,7 @@ GenerateFinishCalls (functList *p)
 {
   if (p->next != NULL)
     GenerateFinishCalls (p->next);
-  printf ("   _M2_%s_finish(argc, argv);\n", p->functname);
+  printf ("   _M2_%s_finish (argc, argv, envp);\n", p->functname);
 }
 
 static void
@@ -374,16 +374,16 @@ GeneratePrototypes (functList *p)
     {
       if (langC)
         {
-          printf ("extern void _M2_%s_init(int argc, char *argv[]);\n",
+          printf ("extern void _M2_%s_init (int argc, char *argv[], char *envp[]);\n",
                   p->functname);
-          printf ("extern void _M2_%s_finish(int argc, char *argv[]);\n",
+          printf ("extern void _M2_%s_finish (int argc, char *argv[], char *envp[]);\n",
                   p->functname);
         }
       else
         {
-          printf ("extern \"C\" void _M2_%s_init(int argc, char *argv[]);\n",
+          printf ("extern \"C\" void _M2_%s_init (int argc, char *argv[], char *envp[]);\n",
                   p->functname);
-          printf ("extern \"C\" void _M2_%s_finish(int argc, char *argv[]);\n",
+          printf ("extern \"C\" void _M2_%s_finish (int argc, char *argv[], char *envp[]);\n",
                   p->functname);
         }
       p = p->next;
@@ -411,7 +411,7 @@ ParseFileStartup (void)
     printf (" \"C\"");
   printf (" void _exit(int);\n");
 
-  printf ("\n\nint %s(int argc, char *argv[])\n", NameOfMain);
+  printf ("\n\nint %s(int argc, char *argv[], char *envp[])\n", NameOfMain);
   printf ("{\n");
   GenerateInitCalls (head);
   GenerateFinishCalls (head);
This page took 0.26098 seconds and 5 git commands to generate.