From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by sourceware.org (Postfix) with ESMTPS id E45843AA902E for ; Fri, 20 May 2022 11:43:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E45843AA902E Received: by mail-wr1-x434.google.com with SMTP id f2so11185407wrc.0 for ; Fri, 20 May 2022 04:43:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:subject:to:message-id:date; bh=7oKnbAki1XnlAHPrcT9KqY0kUWNpWO1tYHNqjE4rdDs=; b=wCG3ANDlYJcTHC3lxEkxCgOJWAJ7xBTAoo+nbqlXFnJ/qcqWQxUvv98pz37pRjvXIa 5JzHMDib/idtc9aEPHHNXIBVGBORzhgDA0p/DStuaKJiEf1K++IZu7yeyQgv9zOpbwiz zvldv7vB3OuT84qJbvoZII6bgY47E8xPJz3mY9mjzqPYpEBxW7Pr+AlViSXf2ykRp6rf /N4WWPO1f+MPPu7ni8d2C5wQ7geDC1DGRujknaX7wxbQH2t59gE7xunot5+yNlMPgDsf E6oGsS7EurrhPmiyI9LVM0U+wegcVPH66uD0Pj06Nv3TPr+szflo4Pg9qSZV4meUr3aF ZO8w== X-Gm-Message-State: AOAM533e+7b1eVfqow/Rtaf7hcynXQzRhjoUBcian0z5hV1Q8mh9Tq3M Rj+rL16hYaDYX7UmdeYkmv6bOOgHq6g= X-Google-Smtp-Source: ABdhPJxmgiCPu7Lo5Z79G7lpaBux7KDYNO80bXyicNtcVSpiSWYa+jkvSQqreukfECqmmIpeXGXViA== X-Received: by 2002:a05:6000:1ac8:b0:20c:dced:2f6c with SMTP id i8-20020a0560001ac800b0020cdced2f6cmr7804511wry.107.1653046995225; Fri, 20 May 2022 04:43:15 -0700 (PDT) Received: from lancelot (host31-54-80-182.range31-54.btcentralplus.com. [31.54.80.182]) by smtp.gmail.com with ESMTPSA id a21-20020a7bc1d5000000b00397259c2a64sm1728753wmj.38.2022.05.20.04.43.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 May 2022 04:43:14 -0700 (PDT) From: Gaius Mulley X-Google-Original-From: Gaius Mulley Received: from gaius by lancelot with local (Exim 4.94.2) (envelope-from ) id 1ns12H-003J7S-AE for gcc-patches@gcc.gnu.org; Fri, 20 May 2022 12:43:13 +0100 Subject: [PATCH] Modula-2: merge proposal/review: 7/9 07.patch-set-05 v2 To: X-Mailer: mail (GNU Mailutils 3.10) Message-Id: Date: Fri, 20 May 2022 12:43:13 +0100 X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FILL_THIS_FORM, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, KAM_ASCII_DIVIDERS, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 May 2022 11:43:25 -0000 Hello, this file contains v2 of the patch set for: 5. all the driver code /gcc/m2. ================================ (v2 contains a missing m2pp.cc file, a developer debugging file to dump trees as close to Modula-2 as possible). It also contains correctly formatted comments and I've removed an unused file. ----------------------------- New file: gcc/m2/ChangeLog ----------------------------- 2022-05-20 Gaius Mulley * m2pp.cc: (Renamed from m2pp.c). Comments tidied up. * Make-lang.in: m2pp.c changed to m2pp.cc. (m2rte.so) Added insn-flags.h as a dependent 2022-05-19 Gaius Mulley * gm2-gcc/m2builtins.cc: Corrected comments (specifically those referring to .c files). * gm2-gcc/m2convert.cc: Corrected comments (specifically those referring to .c files). * gm2-gcc/m2expr.cc: Corrected comments (specifically those referring to .c files). * gm2-gcc/m2statement.cc: Corrected comments (specifically those referring to .c files). * gm2-gcc/m2treelib.cc: Corrected comments (specifically those referring to .c files). * gm2-gcc/m2type.cc: Corrected comments (specifically those referring to .c files). * gm2-gcc/rtegraph.cc: Corrected comments (specifically those referring to .c files). * gm2-lang.cc: Corrected comments (specifically those referring to .c files). * plugin/m2rte.cc: Reformatted comments. * lang-options.h: (Removed). * plugin/m2rte.cc: Further reformatting of comments. * gm2-gcc/m2statement.cc: Corrected comment formatting and removed usused debugging code. * gm2-gcc/m2assert.cc: Corrected comment formatting. * gm2-gcc/m2block.cc: Corrected comment formatting. * gm2-gcc/m2builtins.cc: Corrected comment formatting. * gm2-gcc/m2convert.cc: Corrected comment formatting. * gm2-gcc/m2decl.cc: Corrected comment formatting. * gm2-gcc/m2except.cc: Corrected comment formatting. * gm2-gcc/m2expr.cc: Corrected comment formatting. * gm2-gcc/m2linemap.cc: Corrected comment formatting. * gm2-gcc/m2statement.cc: Corrected comment formatting. * gm2-gcc/m2treelib.cc: Corrected comment formatting. * gm2-gcc/m2type.cc: Corrected comment formatting. * gm2-gcc/rtegraph.cc: Corrected comment formatting. * gm2-gcc/m2color.h: Corrected comment formatting. * gm2-gcc/gcc-consolidation.h: Corrected comment formatting. 2022-05-16 Gaius Mulley * plugin/m2rte.cc (alias.h, predict.h, tm.h) (stringpool.h, toplev.h, basic-block.h, hash-table.h) (vec.h, ggc.h, basic-block.h, tree-ssa-alias.h) (internal-fn.h, gimple-fold.h, tree-eh.h, gimple-expr.h) (is-a.h): Header file includes removed. (plugin/m2rte$(exeext).so) Make dependent upon $(GCC_HEADER_DEPENDENCIES_FOR_M2) and insn-addr-common.h. 2022-05-15 Gaius Mulley * m2/Make-lang.in (GCC_HEADER_DEPENDENCIES_FOR_M2): New define. m2/gm2-gcc/%.o: Add GCC_HEADER_DEPENDENCIES_FOR_M2 as a dependent. m2/gm2-lang.o: Add GCC_HEADER_DEPENDENCIES_FOR_M2 as a dependent. m2/stor-layout.o: Add GCC_HEADER_DEPENDENCIES_FOR_M2 as a dependent. m2/m2pp.o: Add GCC_HEADER_DEPENDENCIES_FOR_M2 as a dependent. m2/gm2-gcc/rtegraph.o: Add GCC_HEADER_DEPENDENCIES_FOR_M2 as a dependent. c-family/m2pp.o: Add GCC_HEADER_DEPENDENCIES_FOR_M2 as a dependent. Added new comments. * m2/tools-src/calcpath: Remove -e option to realpath to help the build on FreeBSD. 2022-05-13 Gaius Mulley * gm2-compiler/ppg.mod: Reduced the line wrap marker to ensure texi pretty print rules do not cause overful box errors in gm2 pdf documentation. * gm2-libs-iso/SYSTEM.def: Shorten the comment lines and parameter lists per line to avoid overful box errors. * gm2-libs/Assertion.def: Shorten the comment lines and parameter lists per line to avoid overful box errors. * gm2-libs/Builtins.def: Shorten the comment lines and parameter lists per line to avoid overful box errors. * gm2-libs/Builtins.mod: Name change n to nbytes for memcpy, memset and memmove. * gm2-libs/DynamicStrings.def: Shorten the comment lines and parameter lists per line to avoid overful box errors. * gm2-libs/Environment.def: Shorten the comment lines and parameter lists per line to avoid overful box errors. * gm2-libs/FIO.def: Shorten the comment lines and parameter lists per line to avoid overful box errors. * gm2-libs/FIO.mod: Shorten the comment lines and parameter lists per line to avoid overful box errors. * gm2-libs/FormatStrings.def: Shorten the comment lines and parameter lists per line to avoid overful box errors. * gm2-libs/FpuIO.def: Shorten the comment lines and parameter lists per line to avoid overful box errors. * gm2-libs/GetOpt.def: Shorten the comment lines and parameter lists per line to avoid overful box errors. * gm2-libs/SYSTEM.def: Shorten the comment lines and parameter lists per line to avoid overful box errors. 2022-05-05 Gaius Mulley * m2-link-support.h (GM2CC): Add CC1_SPEC to the cc1/cc1plus invocation. 2022-05-04 Gaius Mulley * m2/m2-link-support.h (RM_IF_NOSAVETEMP) New macro. (GM2CC) Use RM_IF_NOSAVETEMP on the assembler intermediate file. (GM2LCC) Use RM_IF_NOSAVETEMP when creating an archive of the application. (GEN_SCAFFOLD_SRC) Use RM_IF_NOSAVETEMP when creating the scaffold source program. (M2LINK) Use RM_IF_NOSAVETEMP when creating the assembler source name and use RM_IF_NOSAVETEMP when creating the main program object. 2022-05-03 Gaius Mulley * Make-lang.in: Replaced sh with $(SHELL). * gm2-lang.cc (gm2_langhook_post_options): Assign main_input_filename. (gm2_parse_input_files) Assign main_input_filename before every source filename is compiled. 2022-04-29 Gaius Mulley * m2/gm2-libs-ch/SysExceptions.c: Replace sigfpe with sigfpe_ to avoid name clash with C signal infastructure. * m2/mc-boot-ch/GSysExceptions.c: Replace sigfpe with sigfpe_ to avoid name clash with C signal infastructure. 2022-04-28 Gaius Mulley * Make-lang.in: Added $(INCLUDES) to all %.o rules requiring gmp.h. * mc-boot/Gkeyc.c: Rebuilt. * mc/keyc.mod (initMacros): Add sigfpe to the list of names to be avoided. * m2/mc-boot/GEnvironment.c: Rebuilt. * mc-boot/GEnvironment.h: Rebuilt. * mc-boot/Gdecl.c: Rebuilt. * mc-boot/Gkeyc.c: Rebuilt. * mc-boot/Glibc.h: Rebuilt. * mc/keyc.mod (initMacros): Add trunc to the list of functions to be avoided. 2022-04-20 Gaius Mulley * tools-src/mklink.c (FindObject): Replace calls to sprintf with calls to snprintf. 2022-03-02 Gaius Mulley * ChangeLog: Correct month for last commit. 2022-03-02 Gaius Mulley * ChangeLog-2021: (New file). 2022-03-02 Gaius Mulley * gm2-libs/Args.def (GetArg): Corrected formatting. * gm2-libs/Environment.def (GetEnvironment): Renamed parameter a to dest. (PutEnvironment) New procedure function. * gm2-libs/Environment.mod (GetEnvironment): Renamed parameter a to dest. (PutEnvironment) New procedure function. * gm2-libs/SEnvironment.def (GetEnvironment): Renamed parameter a to dest. (PutEnvironment) New procedure function. * gm2-libs/SEnvironment.mod (GetEnvironment): Renamed parameter a to dest. (PutEnvironment) New procedure function. * gm2-libs/libc.def: Export list introduced identifiers putenv, execv. * m2/m2-link-support.h: Ensure that the scaffold program is not deleted if the user specified -fmakeinit. * mc-boot-ch/Glibc.c (libc_putenv): New function. * ChangeLog-2021: (New file). * m2/m2-link-support.h (GEN_SCAFFOLD_SRC): New definition. (M2LINK) use GEN_SCAFFOLD_SRC to generate the scaffold name. * m2/configure.ac: Added rule to test for Python3. Added rule to detect realpath. 2022-01-25 Gaius Mulley * gm2spec.cc: Replaced save_switch by fe_save_switch. Replaced xputenv by fe_putenv. Replaced xgetenv by fe_getenv. 2022-01-23 Gaius Mulley * mc/decl.mod: (isZtypeEquivalent) New procedure function. (isEquivalentType) New procedure function. (doExprCastC) Added header comment and check for type equivalence. (needsCast) Added header comment and skip types for the formal and actual parameters before comparison. Add check for actual = nil parameter. (checkSystemCast) check for actual = nil being passed to a pointer parameter. * mc-boot/GArgs.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/GIO.c: Rebuilt. * mc-boot/GIndexing.c: Rebuilt. * mc-boot/GM2RTS.c: Rebuilt. * mc-boot/GNumberIO.c: Rebuilt. * mc-boot/GPushBackInput.c: Rebuilt. * mc-boot/GRTExceptions.c: Rebuilt. * mc-boot/GRTint.c: Rebuilt. * mc-boot/GStdIO.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.c: Rebuilt. * mc-boot/Gkeyc.c: Rebuilt. * mc-boot/Glists.c: Rebuilt. * mc-boot/GmcComment.c: Rebuilt. * mc-boot/GmcError.c: Rebuilt. * mc-boot/GmcLexBuf.c: Rebuilt. * mc-boot/GmcMetaError.c: Rebuilt. * mc-boot/GmcOptions.c: Rebuilt. * mc-boot/GmcPretty.c: Rebuilt. * mc-boot/GmcPrintf.c: Rebuilt. * mc-boot/GmcSearch.c: Rebuilt. * mc-boot/GmcStack.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/Gvarargs.c: Rebuilt. * mc-boot/Gwlists.c: Rebuilt. 2022-01-22 Gaius Mulley * mc/decl.mod: (doReturnC) Use getExprType rather than getType. (getExprType) Added header comment. * mc-boot/GCmdArgs.c: Rebuilt. * mc-boot/GDynamicStrings.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/GM2EXCEPTION.c: Rebuilt. * mc-boot/GM2RTS.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/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/Galists.c: Rebuilt. * mc-boot/Gdecl.c: Rebuilt. * mc-boot/Gkeyc.c: Rebuilt. * mc-boot/Glists.c: Rebuilt. * mc-boot/GmcComment.c: Rebuilt. * mc-boot/GmcComp.c: Rebuilt. * mc-boot/GmcError.c: Rebuilt. * mc-boot/GmcFileName.c: Rebuilt. * mc-boot/GmcLexBuf.c: Rebuilt. * mc-boot/GmcMetaError.c: Rebuilt. * mc-boot/GmcOptions.c: Rebuilt. * mc-boot/GmcPreprocess.c: Rebuilt. * mc-boot/GmcPretty.c: Rebuilt. * mc-boot/GmcPrintf.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/Gvarargs.c: Rebuilt. * mc-boot/Gwlists.c: Rebuilt. 2022-01-22 Gaius Mulley * mc-boot-ch/Gabort.c: (New file). * Make-lang.in: Use $(CXX) rather than $(CC). Use $(CC) rather than $(HOSTCC) when compiling mcflex.c. Invoke $(M2LINK) with --langc++ rather than --g++. (MCC_ARGS) changed to use --olang=c++. (m2/ppg$(exeext)) link with Gabort.o and make dependant upon Gabort.o. (m2/pg$(exeext)) link with Gabort.o and make dependant upon Gabort.o. (m2/pge$(exeext)) link with Gabort.o and make dependant upon Gabort.o. (gm2-check-examples) Removed. * gm2-ici/m2linemap.c: Introduce extern C for complete source file. * gm2-libs-ch/README: Reformatted. * gm2-libs-ch/RTcodummy.c: Introduce extern C for complete source file. * gm2-libs-ch/RTintdummy.c: Introduce extern C for complete source file. * gm2-libs-ch/Selective.c: Introduce extern C for complete source file. * gm2-libs-ch/SysExceptions.c: Introduce extern C for complete source file. * gm2-libs-ch/UnixArgs.c: Introduce extern C for complete source file. * gm2-libs-ch/UnixArgs.c: Introduce extern C for complete source file. * gm2-libs-ch/cgetopt.c: Introduce extern C for complete source file. * gm2-libs-ch/choosetemp.c: Introduce extern C for complete source file. * gm2-libs-ch/dtoa.c: Introduce extern C for complete source file. * gm2-libs-ch/errno.c: Introduce extern C for complete source file. * gm2-libs-ch/host.c: Introduce extern C for complete source file. * gm2-libs-ch/ldtoa.c: Introduce extern C for complete source file. * gm2-libs-ch/termios.c: Introduce extern C for complete source file. * gm2-libs-ch/tools.c: Reformatted source. * gm2-libs-ch/wrapc.c: Introduce extern C for complete source file. * gm2-libs-ch/xlibc.c: Introduce extern C for complete source file. * mc-boot-ch/GBuiltins.c: Introduce extern C for complete source file. * mc-boot-ch/GRTco.c: Introduce extern C for complete source file. * mc-boot-ch/GSYSTEM.c: Introduce extern C for complete source file. * mc-boot-ch/GSelective.c: Introduce extern C for complete source file. * mc-boot-ch/GSysExceptions.c: Introduce extern C for complete source file. * mc-boot-ch/GUnixArgs.c: Introduce extern C for complete source file. * mc-boot-ch/Gdtoa.c: Introduce extern C for complete source file. * mc-boot-ch/Gerrno.c: Introduce extern C for complete source file. * mc-boot-ch/Gldtoa.c: Introduce extern C for complete source file. * mc-boot-ch/Glibc.c: Introduce extern C for complete source file. * mc-boot-ch/Gmcrts.c: Removed fancy_abort. Introduce extern C for complete source file. * mc-boot-ch/Gtermios.c: Introduce extern C for complete source file. * mc-boot-ch/Gwrapc.c: Introduce extern C for complete source file. * mc-boot/GASCII.c: Rebuilt. * mc-boot/GASCII.h: Rebuilt. * mc-boot/GArgs.c: Rebuilt. * mc-boot/GArgs.h: Rebuilt. * mc-boot/GAssertion.c: Rebuilt. * mc-boot/GAssertion.h: Rebuilt. * mc-boot/GBreak.c: Rebuilt. * mc-boot/GBreak.h: Rebuilt. * mc-boot/GCOROUTINES.h: Rebuilt. * mc-boot/GCmdArgs.c: Rebuilt. * mc-boot/GCmdArgs.h: Rebuilt. * mc-boot/GDebug.c: Rebuilt. * mc-boot/GDebug.h: Rebuilt. * mc-boot/GDynamicStrings.c: Rebuilt. * mc-boot/GDynamicStrings.h: Rebuilt. * mc-boot/GEnvironment.c: Rebuilt. * mc-boot/GEnvironment.h: Rebuilt. * mc-boot/GFIO.c: Rebuilt. * mc-boot/GFIO.h: Rebuilt. * mc-boot/GFormatStrings.c Rebuilt.: * mc-boot/GFormatStrings.h: Rebuilt. * mc-boot/GFpuIO.c: Rebuilt. * mc-boot/GFpuIO.h: Rebuilt. * mc-boot/GIO.c: Rebuilt. * mc-boot/GIO.h: Rebuilt. * mc-boot/GIndexing.c: Rebuilt. * mc-boot/GIndexing.h: Rebuilt. * mc-boot/GM2EXCEPTION.c: Rebuilt. * mc-boot/GM2EXCEPTION.h: Rebuilt. * mc-boot/GM2RTS.c: Rebuilt. * mc-boot/GM2RTS.h: Rebuilt. * mc-boot/GMemUtils.c: Rebuilt. * mc-boot/GMemUtils.h: Rebuilt. * mc-boot/GNumberIO.c: Rebuilt. * mc-boot/GNumberIO.h: Rebuilt. * mc-boot/GPushBackInput.c: Rebuilt. * mc-boot/GPushBackInput.h: Rebuilt. * mc-boot/GRTExceptions.c: Rebuilt. * mc-boot/GRTExceptions.h: Rebuilt. * mc-boot/GRTco.h: Rebuilt. * mc-boot/GRTint.c: Rebuilt. * mc-boot/GRTint.h: Rebuilt. * mc-boot/GSArgs.c: Rebuilt. * mc-boot/GSArgs.h: Rebuilt. * mc-boot/GSFIO.c: Rebuilt. * mc-boot/GSFIO.h: Rebuilt. * mc-boot/GSYSTEM.h: Rebuilt. * mc-boot/GSelective.h: Rebuilt. * mc-boot/GStdIO.c: Rebuilt. * mc-boot/GStdIO.h: Rebuilt. * mc-boot/GStorage.c: Rebuilt. * mc-boot/GStorage.h: Rebuilt. * mc-boot/GStrCase.c: Rebuilt. * mc-boot/GStrCase.h: Rebuilt. * mc-boot/GStrIO.c: Rebuilt. * mc-boot/GStrIO.h: Rebuilt. * mc-boot/GStrLib.c: Rebuilt. * mc-boot/GStrLib.h: Rebuilt. * mc-boot/GStringConvert.c: Rebuilt. * mc-boot/GStringConvert.h: Rebuilt. * mc-boot/GSysExceptions.h: Rebuilt. * mc-boot/GSysStorage.c: Rebuilt. * mc-boot/GSysStorage.h: Rebuilt. * mc-boot/GTimeString.c: Rebuilt. * mc-boot/GTimeString.h: Rebuilt. * mc-boot/GUnixArgs.h: Rebuilt. * mc-boot/Galists.c: Rebuilt. * mc-boot/Galists.h: Rebuilt. * mc-boot/Gdecl.c: Rebuilt. * mc-boot/Gdecl.h: Rebuilt. * mc-boot/Gdtoa.h: Rebuilt. * mc-boot/Gerrno.h: Rebuilt. * mc-boot/Gkeyc.c: Rebuilt. * mc-boot/Gkeyc.h: Rebuilt. * mc-boot/Gldtoa.h: Rebuilt. * mc-boot/Glibc.h: Rebuilt. * mc-boot/Glibm.h: Rebuilt. * mc-boot/Glists.c: Rebuilt. * mc-boot/Glists.h: Rebuilt. * mc-boot/GmcComment.c: Rebuilt. * mc-boot/GmcComment.h: Rebuilt. * mc-boot/GmcComp.c: Rebuilt. * mc-boot/GmcComp.h: Rebuilt. * mc-boot/GmcDebug.c: Rebuilt. * mc-boot/GmcDebug.h: Rebuilt. * mc-boot/GmcError.c: Rebuilt. * mc-boot/GmcError.h: Rebuilt. * mc-boot/GmcFileName.c: Rebuilt. * mc-boot/GmcFileName.h: Rebuilt. * mc-boot/GmcLexBuf.c: Rebuilt. * mc-boot/GmcLexBuf.h: Rebuilt. * mc-boot/GmcMetaError.c: Rebuilt. * mc-boot/GmcMetaError.h: Rebuilt. * mc-boot/GmcOptions.c: Rebuilt. * mc-boot/GmcOptions.h: Rebuilt. * mc-boot/GmcPreprocess.c: Rebuilt. * mc-boot/GmcPreprocess.h: Rebuilt. * mc-boot/GmcPretty.c: Rebuilt. * mc-boot/GmcPretty.h: Rebuilt. * mc-boot/GmcPrintf.c: Rebuilt. * mc-boot/GmcPrintf.h: Rebuilt. * mc-boot/GmcQuiet.c: Rebuilt. * mc-boot/GmcQuiet.h: Rebuilt. * mc-boot/GmcReserved.c: Rebuilt. * mc-boot/GmcReserved.h: Rebuilt. * mc-boot/GmcSearch.c: Rebuilt. * mc-boot/GmcSearch.h: Rebuilt. * mc-boot/GmcStack.c: Rebuilt. * mc-boot/GmcStack.h: Rebuilt. * mc-boot/GmcStream.c: Rebuilt. * mc-boot/GmcStream.h: Rebuilt. * mc-boot/Gmcflex.h: Rebuilt. * mc-boot/Gmcp1.c: Rebuilt. * mc-boot/Gmcp1.h: Rebuilt. * mc-boot/Gmcp2.c: Rebuilt. * mc-boot/Gmcp2.h: Rebuilt. * mc-boot/Gmcp3.c: Rebuilt. * mc-boot/Gmcp3.h: Rebuilt. * mc-boot/Gmcp4.c: Rebuilt. * mc-boot/Gmcp4.h: Rebuilt. * mc-boot/Gmcp5.c: Rebuilt. * mc-boot/Gmcp5.h: Rebuilt. * mc-boot/GnameKey.c: Rebuilt. * mc-boot/GnameKey.h: Rebuilt. * mc-boot/GsymbolKey.c: Rebuilt. * mc-boot/GsymbolKey.h: Rebuilt. * mc-boot/Gtermios.h: Rebuilt. * mc-boot/Gtop.c: Rebuilt. * mc-boot/Gvarargs.c: Rebuilt. * mc-boot/Gvarargs.h: Rebuilt. * mc-boot/Gwlists.c: Rebuilt. * mc-boot/Gwlists.h: Rebuilt. * mc-boot/Gwrapc.h: Rebuilt. * mc/decl.mod: (returnT) scope field added. (makeReturn) initialize scope field. (doReturnC) check scope field and generate error if expression exists and no return type specified. Call doExprCastC to cast the return expression. (outDefC) Call keyc.genConfigSystem before entering extern C block. (outImpC) Call keyc.genConfigSystem prior to keyc.genDefs. (outModuleC) Call keyc.genConfigSystem prior to keyc.genDefs. * mc/keyc.def: (genConfigSystem) exported. * mc/varargs.mod: (copy) Rewritten pointer arithmetic to allow for Modula-2 and translated C++ versions to compile cleanly. * tools-src/mklink.c: Replace option --gcc with --langc. Replace option --g++ with --langc++. 2022-01-18 Gaius Mulley * Make-lang.in: (gm2spec.o) Use gm2spec.cc source file. (plugin/m2rte$(exeext).so) Use m2/plugin/m2rte.cc source file. (m2/gm2-gcc/%.o) Use .cc rather than .c source files. (m2/stor-layout.o) Build from stor-layout.cc rather than stor-layout.c. * config-lang.in: Renamed all .c files to .cc files. * gm2-gcc/init.cc: Remamed from m2/gm2-gcc/init.c. * gm2-gcc/init.h: Summary name change. * gm2-gcc/m2assert.cc: Remamed from m2/gm2-gcc/m2assert.c. * gm2-gcc/m2assert.h: Summary name change. * gm2-gcc/m2block.cc: Renamed from m2/gm2-gcc/m2block.c. * gm2-gcc/m2block.def: Summary name change. * gcc/m2/gm2-gcc/m2block.h: Summary name change. * gm2-gcc/m2builtins.cc: Renamed from m2/gm2-gcc/m2builtins.c. * gm2-gcc/m2builtins.def: Summary name change. * gm2-gcc/m2builtins.h: Summary name change. * gm2-gcc/m2color.cc: Renamed from m2/gm2-gcc/m2color.c. * gm2-gcc/m2convert.cc: Renamed from m2/gm2-gcc/m2convert.c. * gm2-gcc/m2convert.def: Summary name change. * gm2-gcc/m2convert.h: Summary name change. * gm2-gcc/m2decl.cc: Renamed from m2/gm2-gcc/m2decl.c. * gm2-gcc/m2decl.def: Summary name change. * gm2-gcc/m2decl.h: Summary name change. * gm2-gcc/m2except.cc: Renamed from m2/gm2-gcc/m2except.c. * gm2-gcc/m2except.h: Summary name change. * gm2-gcc/m2expr.cc: Renamed from m2/gm2-gcc/m2expr.c. * gm2-gcc/m2expr.def: Summary name change. * gm2-gcc/m2expr.h: Summary name change. * gm2-gcc/m2linemap.cc: Renamed from m2/gm2-gcc/m2linemap.c. * gm2-gcc/m2linemap.h: Summary name change. * gm2-gcc/m2misc.cc: Renamed from m2/gm2-gcc/m2misc.c. * gm2-gcc/m2misc.def: Summary name change. * gm2-gcc/m2misc.h: Summary name change. * gm2-gcc/m2statement.cc: Renamed from m2/gm2-gcc/m2statement.c. * gm2-gcc/m2statement.def: Summary name change. * gm2-gcc/m2statement.h: Summary name change. * gm2-gcc/m2top.cc: Renamed from m2/gm2-gcc/m2top.c. * gm2-gcc/m2top.def: Summary name change. * gm2-gcc/m2top.h: Summary name change. * gm2-gcc/m2tree.cc: Renamed from m2/gm2-gcc/m2tree.c. * gm2-gcc/m2tree.def: Summary name change. * gm2-gcc/m2tree.h: Summary name change. * gm2-gcc/m2treelib.cc: Renamed from m2/gm2-gcc/m2treelib.c. * gm2-gcc/m2treelib.def: Summary name change. * gm2-gcc/m2treelib.h: Summary name change. * gm2-gcc/m2type.cc: Renamed from m2/gm2-gcc/m2type.c. * gm2-gcc/m2type.def: Summary name change. * gm2-gcc/m2type.h: Summary name change. * gm2-gcc/rtegraph.cc: Renamed from m2/gm2-gcc/rtegraph.c. * gm2-lang.cc: Renamed from m2/gm2-lang.c. * gm2spec.cc: Renamed from m2/gm2spec.c. * plugin/m2rte.cc: Renamed from m2/plugin/m2rte.c. 2022-01-18 Gaius Mulley * COPYING.FDL: Update copyright notice dates. * COPYING.RUNTIME: Update copyright notice dates. * Make-lang.in: Update copyright notice dates. * bnf/gm2l.bnf: Update copyright notice dates. * bnf/gm2m.bnf: Update copyright notice dates. * bnf/m2-1.bnf: Update copyright notice dates. * bnf/m2-2.bnf: Update copyright notice dates. * bnf/m2-3.bnf: Update copyright notice dates. * bnf/m2-c.bnf: Update copyright notice dates. * bnf/m2-h.bnf: Update copyright notice dates. * bnf/m2.bnf: Update copyright notice dates. * bnf/mc-1.bnf: Update copyright notice dates. * bnf/mc-2.bnf: Update copyright notice dates. * bnf/mc-3.bnf: Update copyright notice dates. * bnf/mc-4.bnf: Update copyright notice dates. * bnf/mc-5.bnf: Update copyright notice dates. * config-lang.in: Update copyright notice dates. * configure.ac: Update copyright notice dates. * gm2-compiler/CLexBuf.def: Update copyright notice dates. * gm2-compiler/CLexBuf.mod: Update copyright notice dates. * gm2-compiler/FifoQueue.def: Update copyright notice dates. * gm2-compiler/FifoQueue.mod: Update copyright notice dates. * gm2-compiler/Lists.def: Update copyright notice dates. * gm2-compiler/Lists.mod: Update copyright notice dates. * gm2-compiler/M2ALU.def: Update copyright notice dates. * gm2-compiler/M2ALU.mod: Update copyright notice dates. * gm2-compiler/M2AsmUtil.def: Update copyright notice dates. * gm2-compiler/M2AsmUtil.mod: Update copyright notice dates. * gm2-compiler/M2Base.def: Update copyright notice dates. * gm2-compiler/M2Base.mod: Update copyright notice dates. * gm2-compiler/M2BasicBlock.def: Update copyright notice dates. * gm2-compiler/M2BasicBlock.mod: Update copyright notice dates. * gm2-compiler/M2Batch.def: Update copyright notice dates. * gm2-compiler/M2Batch.mod: Update copyright notice dates. * gm2-compiler/M2Bitset.def: Update copyright notice dates. * gm2-compiler/M2Bitset.mod: Update copyright notice dates. * gm2-compiler/M2CaseList.def: Update copyright notice dates. * gm2-compiler/M2CaseList.mod: Update copyright notice dates. * gm2-compiler/M2Check.def: Update copyright notice dates. * gm2-compiler/M2Check.mod: Update copyright notice dates. * gm2-compiler/M2Code.def: Update copyright notice dates. * gm2-compiler/M2Code.mod: Update copyright notice dates. * gm2-compiler/M2ColorString.def: Update copyright notice dates. * gm2-compiler/M2ColorString.mod: Update copyright notice dates. * gm2-compiler/M2Comp.def: Update copyright notice dates. * gm2-compiler/M2Comp.mod: Update copyright notice dates. * gm2-compiler/M2Configure.def: Update copyright notice dates. * gm2-compiler/M2Configure.mod: Update copyright notice dates. * gm2-compiler/M2Const.def: Update copyright notice dates. * gm2-compiler/M2Const.mod: Update copyright notice dates. * gm2-compiler/M2Debug.def: Update copyright notice dates. * gm2-compiler/M2Debug.mod: Update copyright notice dates. * gm2-compiler/M2DebugStack.def: Update copyright notice dates. * gm2-compiler/M2DebugStack.mod: Update copyright notice dates. * gm2-compiler/M2Defaults.def: Update copyright notice dates. * gm2-compiler/M2Defaults.mod: Update copyright notice dates. * gm2-compiler/M2Depth.def: Update copyright notice dates. * gm2-compiler/M2Depth.mod: Update copyright notice dates. * gm2-compiler/M2DriverOptions.def: Update copyright notice dates. * gm2-compiler/M2DriverOptions.mod: Update copyright notice dates. * gm2-compiler/M2Emit.def: Update copyright notice dates. * gm2-compiler/M2Emit.mod: Update copyright notice dates. * gm2-compiler/M2Error.def: Update copyright notice dates. * gm2-compiler/M2Error.mod: Update copyright notice dates. * gm2-compiler/M2EvalSym.def: Update copyright notice dates. * gm2-compiler/M2FileName.def: Update copyright notice dates. * gm2-compiler/M2FileName.mod: Update copyright notice dates. * gm2-compiler/M2GCCDeclare.def: Update copyright notice dates. * gm2-compiler/M2GCCDeclare.mod: Update copyright notice dates. * gm2-compiler/M2GenGCC.def: Update copyright notice dates. * gm2-compiler/M2GenGCC.mod: Update copyright notice dates. * gm2-compiler/M2Lex.def: Update copyright notice dates. * gm2-compiler/M2Lex.mod: Update copyright notice dates. * gm2-compiler/M2LexBuf.def: Update copyright notice dates. * gm2-compiler/M2LexBuf.mod: Update copyright notice dates. * gm2-compiler/M2MetaError.def: Update copyright notice dates. * gm2-compiler/M2MetaError.mod: Update copyright notice dates. * gm2-compiler/M2Optimize.def: Update copyright notice dates. * gm2-compiler/M2Optimize.mod: Update copyright notice dates. * gm2-compiler/M2Options.def: Update copyright notice dates. * gm2-compiler/M2Options.mod: Update copyright notice dates. * gm2-compiler/M2Pass.def: Update copyright notice dates. * gm2-compiler/M2Pass.mod: Update copyright notice dates. * gm2-compiler/M2Preprocess.def: Update copyright notice dates. * gm2-compiler/M2Preprocess.mod: Update copyright notice dates. * gm2-compiler/M2Printf.def: Update copyright notice dates. * gm2-compiler/M2Printf.mod: Update copyright notice dates. * gm2-compiler/M2Quads.def: Update copyright notice dates. * gm2-compiler/M2Quads.mod: Update copyright notice dates. * gm2-compiler/M2Quiet.def: Update copyright notice dates. * gm2-compiler/M2Quiet.mod: Update copyright notice dates. * gm2-compiler/M2Range.def: Update copyright notice dates. * gm2-compiler/M2Range.mod: Update copyright notice dates. * gm2-compiler/M2Reserved.def: Update copyright notice dates. * gm2-compiler/M2Reserved.mod: Update copyright notice dates. * gm2-compiler/M2SSA.mod: Update copyright notice dates. * gm2-compiler/M2Scope.def: Update copyright notice dates. * gm2-compiler/M2Scope.mod: Update copyright notice dates. * gm2-compiler/M2Search.def: Update copyright notice dates. * gm2-compiler/M2Search.mod: Update copyright notice dates. * gm2-compiler/M2Size.def: Update copyright notice dates. * gm2-compiler/M2Size.mod: Update copyright notice dates. * gm2-compiler/M2StackAddress.def: Update copyright notice dates. * gm2-compiler/M2StackAddress.mod: Update copyright notice dates. * gm2-compiler/M2StackWord.def: Update copyright notice dates. * gm2-compiler/M2StackWord.mod: Update copyright notice dates. * gm2-compiler/M2Students.def: Update copyright notice dates. * gm2-compiler/M2Students.mod: Update copyright notice dates. * gm2-compiler/M2Swig.def: Update copyright notice dates. * gm2-compiler/M2Swig.mod: Update copyright notice dates. * gm2-compiler/M2System.def: Update copyright notice dates. * gm2-compiler/M2System.mod: Update copyright notice dates. * gm2-compiler/M2Version.def: Update copyright notice dates. * gm2-compiler/NameKey.def: Update copyright notice dates. * gm2-compiler/NameKey.mod: Update copyright notice dates. * gm2-compiler/ObjectFiles.def: Update copyright notice dates. * gm2-compiler/ObjectFiles.mod: Update copyright notice dates. * gm2-compiler/Output.def: Update copyright notice dates. * gm2-compiler/Output.mod: Update copyright notice dates. * gm2-compiler/P0SymBuild.def: Update copyright notice dates. * gm2-compiler/P0SymBuild.mod: Update copyright notice dates. * gm2-compiler/P0SyntaxCheck.def: Update copyright notice dates. * gm2-compiler/P1Build.def: Update copyright notice dates. * gm2-compiler/P1SymBuild.def: Update copyright notice dates. * gm2-compiler/P1SymBuild.mod: Update copyright notice dates. * gm2-compiler/P2Build.def: Update copyright notice dates. * gm2-compiler/P2SymBuild.def: Update copyright notice dates. * gm2-compiler/P2SymBuild.mod: Update copyright notice dates. * gm2-compiler/P3Build.def: Update copyright notice dates. * gm2-compiler/P3SymBuild.def: Update copyright notice dates. * gm2-compiler/P3SymBuild.mod: Update copyright notice dates. * gm2-compiler/PCBuild.def: Update copyright notice dates. * gm2-compiler/PCSymBuild.def: Update copyright notice dates. * gm2-compiler/PCSymBuild.mod: Update copyright notice dates. * gm2-compiler/PHBuild.def: Update copyright notice dates. * gm2-compiler/Sets.def: Update copyright notice dates. * gm2-compiler/Sets.mod: Update copyright notice dates. * gm2-compiler/SymbolConversion.def: Update copyright notice dates. * gm2-compiler/SymbolConversion.mod: Update copyright notice dates. * gm2-compiler/SymbolKey.def: Update copyright notice dates. * gm2-compiler/SymbolKey.mod: Update copyright notice dates. * gm2-compiler/SymbolTable.def: Update copyright notice dates. * gm2-compiler/SymbolTable.mod: Update copyright notice dates. * gm2-compiler/bnflex.def: Update copyright notice dates. * gm2-compiler/bnflex.mod: Update copyright notice dates. * gm2-compiler/cflex.def: Update copyright notice dates. * gm2-compiler/gm2.mod: Update copyright notice dates. * gm2-compiler/gm2lcc.mod: Update copyright notice dates. * gm2-compiler/gm2lgen.mod: Update copyright notice dates. * gm2-compiler/gm2lorder.mod: Update copyright notice dates. * gm2-compiler/m2flex.def: Update copyright notice dates. * gm2-compiler/ppg.mod: Update copyright notice dates. * gm2-gcc/dynamicstrings.h: Update copyright notice dates. * gm2-gcc/gcc-consolidation.h: Update copyright notice dates. * gm2-gcc/init.c: Update copyright notice dates. * gm2-gcc/init.def: Update copyright notice dates. * gm2-gcc/init.h: Update copyright notice dates. * gm2-gcc/m2assert.c: Update copyright notice dates. * gm2-gcc/m2assert.h: Update copyright notice dates. * gm2-gcc/m2block.c: Update copyright notice dates. * gm2-gcc/m2block.def: Update copyright notice dates. * gm2-gcc/m2block.h: Update copyright notice dates. * gm2-gcc/m2builtins.c: Update copyright notice dates. * gm2-gcc/m2builtins.def: Update copyright notice dates. * gm2-gcc/m2builtins.h: Update copyright notice dates. * gm2-gcc/m2color.c: Update copyright notice dates. * gm2-gcc/m2color.def: Update copyright notice dates. * gm2-gcc/m2color.h: Update copyright notice dates. * gm2-gcc/m2convert.c: Update copyright notice dates. * gm2-gcc/m2convert.def: Update copyright notice dates. * gm2-gcc/m2convert.h: Update copyright notice dates. * gm2-gcc/m2decl.c: Update copyright notice dates. * gm2-gcc/m2decl.def: Update copyright notice dates. * gm2-gcc/m2decl.h: Update copyright notice dates. * gm2-gcc/m2except.c: Update copyright notice dates. * gm2-gcc/m2except.def: Update copyright notice dates. * gm2-gcc/m2except.h: Update copyright notice dates. * gm2-gcc/m2expr.c: Update copyright notice dates. * gm2-gcc/m2expr.def: Update copyright notice dates. * gm2-gcc/m2expr.h: Update copyright notice dates. * gm2-gcc/m2linemap.c: Update copyright notice dates. * gm2-gcc/m2linemap.def: Update copyright notice dates. * gm2-gcc/m2linemap.h: Update copyright notice dates. * gm2-gcc/m2misc.c: Update copyright notice dates. * gm2-gcc/m2misc.def: Update copyright notice dates. * gm2-gcc/m2misc.h: Update copyright notice dates. * gm2-gcc/m2options.h: Update copyright notice dates. * gm2-gcc/m2range.h: Update copyright notice dates. * gm2-gcc/m2search.h: Update copyright notice dates. * gm2-gcc/m2statement.c: Update copyright notice dates. * gm2-gcc/m2statement.def: Update copyright notice dates. * gm2-gcc/m2statement.h: Update copyright notice dates. * gm2-gcc/m2top.c: Update copyright notice dates. * gm2-gcc/m2top.def: Update copyright notice dates. * gm2-gcc/m2top.h: Update copyright notice dates. * gm2-gcc/m2tree.c: Update copyright notice dates. * gm2-gcc/m2tree.def: Update copyright notice dates. * gm2-gcc/m2tree.h: Update copyright notice dates. * gm2-gcc/m2treelib.c: Update copyright notice dates. * gm2-gcc/m2treelib.def: Update copyright notice dates. * gm2-gcc/m2treelib.h: Update copyright notice dates. * gm2-gcc/m2type.c: Update copyright notice dates. * gm2-gcc/m2type.def: Update copyright notice dates. * gm2-gcc/m2type.h: Update copyright notice dates. * gm2-gcc/rtegraph.c: Update copyright notice dates. * gm2-gcc/rtegraph.h: Update copyright notice dates. * gm2-internals.texi: Update copyright notice dates. * gm2-lang.c: Update copyright notice dates. * gm2-lang.h: Update copyright notice dates. * gm2-libs-ch/RTcodummy.c: Update copyright notice dates. * gm2-libs-ch/RTintdummy.c: Update copyright notice dates. * gm2-libs-ch/Selective.c: Update copyright notice dates. * gm2-libs-ch/SysExceptions.c: Update copyright notice dates. * gm2-libs-ch/UnixArgs.c: Update copyright notice dates. * gm2-libs-ch/cgetopt.c: Update copyright notice dates. * gm2-libs-ch/choosetemp.c: Update copyright notice dates. * gm2-libs-ch/dtoa.c: Update copyright notice dates. * gm2-libs-ch/errno.c: Update copyright notice dates. * gm2-libs-ch/host.c: Update copyright notice dates. * gm2-libs-ch/ldtoa.c: Update copyright notice dates. * gm2-libs-ch/pthdummy.c: Update copyright notice dates. * gm2-libs-ch/termios.c: Update copyright notice dates. * gm2-libs-ch/tools.c: Update copyright notice dates. * gm2-libs-ch/wrapc.c: Update copyright notice dates. * gm2-libs-ch/xlibc.c: Update copyright notice dates. * gm2-libs-coroutines/Debug.def: Update copyright notice dates. * gm2-libs-coroutines/Debug.mod: Update copyright notice dates. * gm2-libs-coroutines/Executive.def: Update copyright notice dates. * gm2-libs-coroutines/Executive.mod: Update copyright notice dates. * gm2-libs-coroutines/KeyBoardLEDs.def: Update copyright notice dates. * gm2-libs-coroutines/README.texi: Update copyright notice dates. * gm2-libs-coroutines/SYSTEM.def: Update copyright notice dates. * gm2-libs-coroutines/SYSTEM.mod: Update copyright notice dates. * gm2-libs-coroutines/TimerHandler.def: Update copyright notice dates. * gm2-libs-coroutines/TimerHandler.mod: Update copyright notice dates. * gm2config.h.in: Update copyright notice dates. * gm2spec.c: Update copyright notice dates. * gm2version.h: Update copyright notice dates. * lang-options.h: Update copyright notice dates. * lang-specs.h: Update copyright notice dates. * lang.opt: Update copyright notice dates. * m2-link-support.h: Update copyright notice dates. * m2-tree.def: Update copyright notice dates. * m2-tree.h: Update copyright notice dates. * m2.flex: Update copyright notice dates. * m2pp.c: Update copyright notice dates. * m2pp.h: Update copyright notice dates. * mc-boot-ch/GBuiltins.c: Update copyright notice dates. * mc-boot-ch/GRTco.c: Update copyright notice dates. * mc-boot-ch/GSYSTEM.c: Update copyright notice dates. * mc-boot-ch/GSelective.c: Update copyright notice dates. * mc-boot-ch/GSysExceptions.c: Update copyright notice dates. * mc-boot-ch/GUnixArgs.c: Update copyright notice dates. * mc-boot-ch/Gcbuiltin.c: Update copyright notice dates. * mc-boot-ch/Gdtoa.c: Update copyright notice dates. * mc-boot-ch/Gerrno.c: Update copyright notice dates. * mc-boot-ch/Gldtoa.c: Update copyright notice dates. * mc-boot-ch/Glibc.c: Update copyright notice dates. * mc-boot-ch/Glibm.c: Update copyright notice dates. * mc-boot-ch/Gmcrts.c: Update copyright notice dates. * mc-boot-ch/Gmcrts.h: Update copyright notice dates. * mc-boot-ch/Gnetwork.h: Update copyright notice dates. * mc-boot-ch/Gpth.c: Update copyright notice dates. * mc-boot-ch/Gtermios.c: Update copyright notice dates. * mc-boot-ch/Gwrapc.c: Update copyright notice dates. * mc-boot-ch/network.c: Update copyright notice dates. * mc/Indexing.def: Update copyright notice dates. * mc/Indexing.mod: Update copyright notice dates. * mc/alists.def: Update copyright notice dates. * mc/alists.mod: Update copyright notice dates. * mc/decl.def: Update copyright notice dates. * mc/decl.mod: Update copyright notice dates. * mc/keyc.def: Update copyright notice dates. * mc/keyc.mod: Update copyright notice dates. * mc/lists.def: Update copyright notice dates. * mc/lists.mod: Update copyright notice dates. * mc/m2flex.def: Update copyright notice dates. * mc/mc.flex: Update copyright notice dates. * mc/mcComment.def: Update copyright notice dates. * mc/mcComment.h: Update copyright notice dates. * mc/mcComment.mod: Update copyright notice dates. * mc/mcComp.def: Update copyright notice dates. * mc/mcComp.mod: Update copyright notice dates. * mc/mcDebug.def: Update copyright notice dates. * mc/mcDebug.mod: Update copyright notice dates. * mc/mcError.def: Update copyright notice dates. * mc/mcError.mod: Update copyright notice dates. * mc/mcFileName.def: Update copyright notice dates. * mc/mcFileName.mod: Update copyright notice dates. * mc/mcLexBuf.def: Update copyright notice dates. * mc/mcLexBuf.h: Update copyright notice dates. * mc/mcLexBuf.mod: Update copyright notice dates. * mc/mcMetaError.def: Update copyright notice dates. * mc/mcMetaError.mod: Update copyright notice dates. * mc/mcOptions.def: Update copyright notice dates. * mc/mcOptions.mod: Update copyright notice dates. * mc/mcPreprocess.def: Update copyright notice dates. * mc/mcPreprocess.mod: Update copyright notice dates. * mc/mcPretty.def: Update copyright notice dates. * mc/mcPretty.mod: Update copyright notice dates. * mc/mcPrintf.def: Update copyright notice dates. * mc/mcPrintf.mod: Update copyright notice dates. * mc/mcQuiet.def: Update copyright notice dates. * mc/mcQuiet.mod: Update copyright notice dates. * mc/mcReserved.def: Update copyright notice dates. * mc/mcReserved.h: Update copyright notice dates. * mc/mcReserved.mod: Update copyright notice dates. * mc/mcSearch.def: Update copyright notice dates. * mc/mcSearch.mod: Update copyright notice dates. * mc/mcStack.def: Update copyright notice dates. * mc/mcStack.mod: Update copyright notice dates. * mc/mcStream.def: Update copyright notice dates. * mc/mcStream.mod: Update copyright notice dates. * mc/mcflex.def: Update copyright notice dates. * mc/mcp1.def: Update copyright notice dates. * mc/mcp2.def: Update copyright notice dates. * mc/mcp3.def: Update copyright notice dates. * mc/mcp4.def: Update copyright notice dates. * mc/mcp5.def: Update copyright notice dates. * mc/nameKey.def: Update copyright notice dates. * mc/nameKey.mod: Update copyright notice dates. * mc/symbolKey.def: Update copyright notice dates. * mc/symbolKey.mod: Update copyright notice dates. * mc/top.mod: Update copyright notice dates. * mc/varargs.def: Update copyright notice dates. * mc/varargs.mod: Update copyright notice dates. * mc/wlists.def: Update copyright notice dates. * mc/wlists.mod: Update copyright notice dates. * tools-src/array2index.py: Update copyright notice dates. * tools-src/boilerplate.py: Update copyright notice dates. * tools-src/buildpg: Update copyright notice dates. * tools-src/buildsyntax: Update copyright notice dates. * tools-src/calcpath: Update copyright notice dates. * tools-src/createUlmSys: Update copyright notice dates. * tools-src/def2texi.py: Update copyright notice dates. * tools-src/gensum.py: Update copyright notice dates. * tools-src/incfile: Update copyright notice dates. * tools-src/makeSystem: Update copyright notice dates. * tools-src/makeconfigure: Update copyright notice dates. * tools-src/makeversion: Update copyright notice dates. * tools-src/mklink.c: Update copyright notice dates. * tools-src/tidydates.py: Update copyright notice dates. 2022-01-11 Gaius Mulley * Make-lang.in (m2/gm2spec.o): Added $(LIBS) to the dependants. (stage1/m2/gm2l): Added $(LIBS) to the dependants. (stage1/m2/gm2lcc): Added $(LIBS) to the dependants. (stage1/m2/gm2lgen): Added $(LIBS) to the dependants. (stage1/m2/gm2lorder): Added $(LIBS) to the dependants. (stage1/m2/gm2m): Added $(LIBS) to the dependants. 2022-01-04 Gaius Mulley * mc/decl.mod: Added missing comments to many procedures. (getStringContents) Completed missing code removing a --fixme--. (getLiteralStringContents) New procedure function. (doMakeEnumField) Return f even if an error should occur. * mc-boot/Gdecl.c: Rebuilt. ----------------------------- New file: gcc/m2/ChangeLog-2021 ----------------------------- 2021-12-30 Gaius Mulley * gm2-gcc/m2expr.def: Use FOR "C" keyword and ident. * mc-boot/GRTExceptions.c: Rebuilt. * mc-boot/GSArgs.c: Rebuilt. * mc-boot/Gdecl.c: Rebuilt. * mc-boot/Glibc.h: Rebuilt. * mc/decl.mod (varparamT): isForC new field. (paramT) isForC new field. (varargsT) isForC new field. (putDefForC) Implemented. (makeNonVarParameter) assign isForC. (makeVarParameter) Assign isForC. (getParameterVariable) ignore isDefForC. (doParamTypeEmit) New procedure. (doParamC) Call doParamTypeEmit. (doVarParamC) call doParamTypeEmit. (doCompletePartialProcType) Emit a C named type which differs from the m2 proctype. (doPrototypeC) Ignore isDefForC and extended opaque option. (doFuncUnbounded) Disable C string parameters. (doProcedureParamC) Handle isForC for a formal parameter. (isForC) New procedure function. (isDefForCNode) New procedure function. (doFuncParamC) Detect var param for a definition module for "C" proc type parameter and emit error message. Detect param for a definition module for "C" and reference the .proc field. (outputPartialRecordArrayProcType) New procedure. (outputPartial) Rewritten. 2021-12-25 Gaius Mulley * gm2-compiler/M2Error.mod (EnterProcedureScope): Corrected indentation. (EnterModuleScope): Corrected indentation. (EnterProgramScope): Corrected indentation. (EnterImplementationScope) Corrected indentation. (FlushAll) Assign currentScope to the error scope. 2021-12-25 Gaius Mulley * gm2-compiler/M2Error.mod (GetAnnounceScope): Issue "no scope active" message. (AnnounceScope) Add ": " after the no scope active message. 2021-12-25 Gaius Mulley * Make-lang.in (m2/gm2-compiler-boot/M2Error.o): New rule to build M2Error.o using the --entended-opaque option since M2Error.mod aggressively uses opaque data types. * bnf/m2-1.bnf (DefProcedureHeading) ensure DefaultProcedure scope is created before any further tokens are consumed. Call LeaveErrorScope at the end of the rule. * bnf/m2-2.bnf (DefProcedureHeading): Call LeaveErrorScope at the end of the rule. * bnf/m2-3.bnf (DefProcedureHeading): Call LeaveErrorScope at the end of the rule. * bnf/m2-c.bnf (DefProcedureHeading): Call LeaveErrorScope at the end of the rule. * bnf/m2-h.bnf (DefProcedureHeading): Call DefaultProcedure and the beginning and LeaveErrorScope at the end of the rule. * bnf/m2.bnf (DefProcedureHeading): Call DefaultProcedure and the beginning of the rule. * gm2-compiler/M2Comp.mod (M2Error): Import list replaced identifiers ParsingComplete; and ResetErrorScope;. * gm2-compiler/M2Error.def (NameKey): Renamed ParsingComplete to ResetErrorScope. Call ResetErrorScope before each pass commenses. Import list replaced identifiers LeaveScope, ParsingComplete by EnterErrorScope, ErrorScope, GetCurrentErrorScope, (LeaveErrorScope): New procedure. (ResetErrorScope): New procedure. (LeaveScope) Removed. * gm2-compiler/M2Error.mod (M2Options): Import StackOfAddress. (printf2) Imported. (printf3) Imported. (IsErrorScopeNul): New procedure function. (GetAnnounceScope): Re-implementation. (IsSameScope): New procedure function. (AnnounceScope): Detect no scope. (newErrorScope): Use scopeArray to push a new scope. (DefaultProgramModule): New implementation. (DefaultImplementationModule): New implementation. (DefaultDefinitionModule): New implementation. (DefaultInnerModule): New implementation. (GetCurrentErrorScope): New procedure function. * gm2-compiler/M2MetaError.def: Extend the specifiers to allow error contents to be pushed to a string stack; string stack contents to be popped onto the output string; replace dictionary string by the current output string and remove all contents in the dictionary. * gm2-compiler/M2MetaError.mod (addEntry) New procedure. (killEntry) New procedure function. (lookupDefine) New procedure function. (lookupString) New procedure function. (newEntry) New procedure function. (popOutput) New procedure function. (processDefine) New procedure. (pushOutput) New procedure function. (readWord) New procedure function. (resetDictionary) New procedure. (doErrorScopeMod) Enter error scope before generate an error. (doErrorScopeDef) Enter error scope before generate an error. (op): Handle 'Q', 'X', 'Y', 'Z' format directives. * gm2-compiler/M2Scope.mod (SymbolTable): Import list includes identifier GetErrorScope. (enter): Re-implemented. * gm2-compiler/M2StackWord.mod: Renamed data types so they are easier to debug during bootstrap (avoid name clashes with the M2StackAddress module). * gm2-compiler/P0SymBuild.mod (EndProcedure): Call LeaseErrorScope instead of LeaveScope at the end of the procedure. * gm2-compiler/P2SymBuild.mod (P2EndBuildDefModule): Call LeaseErrorScope instead of LeaveScope at the end of the procedure. (P2EndBuildImplementationModule): Call LeaseErrorScope instead of LeaveScope at the end of the procedure. (P2EndBuildProgramModule): Call LeaseErrorScope instead of LeaveScope at the end of the procedure. (EndBuildInnerModule): Call LeaseErrorScope instead of LeaveScope at the end of the procedure. (P3EndBuildImpModule): Call LeaseErrorScope instead of LeaveScope at the end of the procedure. (P3EndBuildProgModule): Call LeaseErrorScope instead of LeaveScope at the end of the procedure. (EndBuildInnerModule): Call LeaseErrorScope instead of LeaveScope at the end of the procedure. * gm2-compiler/PCSymBuild.mod (PCEndBuildDefModule): Call LeaseErrorScope instead of LeaveScope at the end of the procedure. (PCEndBuildImpModule): Call LeaseErrorScope instead of LeaveScope at the end of the procedure. (PCEndBuildProgModule): Call LeaseErrorScope instead of LeaveScope at the end of the procedure. (PCEndBuildInnerModule): Call LeaseErrorScope instead of LeaveScope at the end of the procedure. * gm2-compiler/SymbolKey.def (NoOfNodes): New procedure function. (ForeachNodeConditionDo) New procedure. * gm2-compiler/SymbolKey.mod (NoOfNodes): New procedure function. (ContainsSymKey): Call FindNodeParentInTree instead of FindNodeAndParentInTree. (GetSymKey): Call FindNodeParentInTree instead of FindNodeAndParentInTree. (DelSymKey): Call FindNodeParentInTree instead of FindNodeAndParentInTree. (FindNodeParentInTree): Renamed from FindNodeAndParentInTree. (IsEmptyTree): Reformatted. (DoesTreeContainAny): Reformatted. (SearchForAny): Reformatted. (ForeachNodeConditionDo) New procedure. (SearchConditional) New procedure. * gm2-compiler/SymbolTable.def (GetErrorScope): New procedure function. (PutErrorScope) New procedure. * gm2-compiler/SymbolTable.def (GetErrorScope): New procedure function implemented. (PutErrorScope) New procedure implemented. (AddListify) New procedure. (Listify) New procedure. (errorScope) field added to procedure, module, defimp symbols and initialized during their construction. 2021-12-17 Gaius Mulley * bnf/m2-1.bnf (ProgramModule): Set up DefaultProgramModule scope. (ImplementationModule) Set up DefaultImplementationModule scope. (ProcedureHeading) Set up DefaultProcedureScope. (ModuleDeclaration) Set up DefaultInnerModule scope. * bnf/m2-2.bnf (ProgramModule): Set up DefaultProgramModule scope. (ImplementationModule) Set up DefaultImplementationModule scope. (ProcedureHeading) Set up DefaultProcedureScope. (ModuleDeclaration) Set up DefaultInnerModule scope. * bnf/m2-3.bnf (ProgramModule): Set up DefaultProgramModule scope. (ImplementationModule) Set up DefaultImplementationModule scope. (ProcedureHeading) Set up DefaultProcedureScope. (ModuleDeclaration) Set up DefaultInnerModule scope. * bnf/m2-c.bnf (ProgramModule): Set up DefaultProgramModule scope. (ImplementationModule) Set up DefaultImplementationModule scope. (ProcedureHeading) Set up DefaultProcedureScope. (ModuleDeclaration) Set up DefaultInnerModule scope. * bnf/m2-h.bnf (ProgramModule): Set up DefaultProgramModule scope. (ImplementationModule) Set up DefaultImplementationModule scope. (ProcedureHeading) Set up DefaultProcedureScope. (ModuleDeclaration) Set up DefaultInnerModule scope. * bnf/m2.bnf (ProgramModule): Set up DefaultProgramModule scope. (ImplementationModule) Set up DefaultImplementationModule scope. (ProcedureHeading) Set up DefaultProcedureScope. (ModuleDeclaration) Set up DefaultInnerModule scope. (WasNoError) replaced by seenError. (Expect) reformatted. (CheckInsertCandiate) New procedure which replaces CheckAndInsert. (PeepToken) use CheckInsertCandiate. (WarnMissingToken) generate a warning using %W. * gm2-compiler/M2Comp.mod (DefaultProgramModule): New procedure. (DefaultImplementationModule) New procedure. (DefaultDefinitionModule) New procedure. (DefaultInnerModule) New procedure. (DefaultProcedure) New procedure. (EnterImplementationScope) call LeaveScope if parsing. (EnterProgramScope) call LeaveScope if parsing. (EnterDefinitionScope) call LeaveScope if parsing. (EnterModuleScope) call LeaveScope if parsing. (EnterProcedureScope) call LeaveScope if parsing. (ParsingComplete) New procedure. * gm2-compiler/M2Comp.def (DefaultProgramModule): New procedure. (DefaultImplementationModule) New procedure. (DefaultDefinitionModule) New procedure. (DefaultInnerModule) New procedure. (DefaultProcedure) New procedure. (ParsingComplete) New procedure. * gm2-compiler/M2Error.def (DefaultProgramModule) New procedure. (DefaultImplementationModule) New procedure. (DefaultDefinitionModule) New procedure. (DefaultInnerModule) New procedure. (DefaultProcedure) New procedure. (ParsingComplete) New procedure. * gm2-compiler/M2Error.mod (DefaultProgramModule) New procedure. (DefaultImplementationModule) New procedure. (DefaultDefinitionModule) New procedure. (DefaultInnerModule) New procedure. (DefaultProcedure) New procedure. (ParsingComplete) New procedure. (GetAnnounceScope) check to see scopeName is non null before using name. * gm2-compiler/M2LexBuf.def (NameKey): Import list replaced identifiers DisplayToken and DumpTokens. * gm2-compiler/M2LexBuf.mod (InsertToken) Reimplemented. (InsertTokenAndRewind) Reimplemented. * gm2-compiler/M2MetaError.mod (doErrorScopeMod): setup DefaultScope before calling EnterScope. (doErrorScopeMod) (doErrorScopeDef): setup DefaultScope before calling EnterScope. * gm2-compiler/P0SymBuild.mod (RegisterProgramModule): Reformatted. (RegisterImplementationModule) Reformatted. (RegisterDefinitionModule) Reformatted. 2021-11-19 Gaius Mulley * gm2-compiler/M2Error.mod (ChainError): Initialize scopeKind and scopeName. * gm2-compiler/M2Range.mod (CodeErrorCheckLoc): Added comment. 2021-11-18 Gaius Mulley * gm2-compiler/M2Error.def (GetAnnounceScope): Exported. (AnnounceScope) changed to use an extra parameter message. * gm2-compiler/M2Error.mod (GetAnnounceScope): New procedure function. (AnnounceScope) Rewritten to use GetAnnounceScope. * gm2-compiler/M2Range.mod (M2Error): Added GetAnnounceScope to import list. (CodeErrorCheckLoc) Rewritten to use GetAnnounceScope. * gm2-gcc/rtegraph.c (generate_report): Emit error message using the GCC scope heading and message house style. * gm2-libs/RTExceptions.mod (Raise): Emit the message using the GCC scope heading and message house style. 2021-11-16 Gaius Mulley * gm2-compiler/M2Error.def (NameKey): Imported identifier Name. (AnnounceScope) defined and exported. (EnterDefinitionScope) defined and exported. (EnterImplementationScope) defined and exported. (EnterProcedureScope) defined and exported. (EnterProgramScope) defined and exported. (EnterModuleScope) defined exported. (LeaveScope) defined and exported. (DepthScope) defined and exported. * gm2-compiler/M2Error.mod (M2Debug): Import Assert. (M2StackWord) Import StackOfWord, InitStackWord, InitStackWord, NoOfItemsInStackWord, PopWord, and PushWord. (M2ColorString) Import quoteOpen and quoteClose. (M2Error) Added scopeKind. (ScopeBlock) Added scopeName and kindScope. (New) Reformatted. (SetScope) New procedure. (AddToRange) call InitScopeBlock. (GetGlobalQuads) Rewritten to call SetScope whether a new error scope occurs. Ensure that scope starts when a new file starts and ends. (GetProcQuads) Rewritten to start and end error scope when procedure or module starts or ends. (DisplayScope) rewritten to display the error scope. (InitScopeBlock) initialize kindScope to unsetscope. (KillScopeBlock) Reformatted. (ForeachScopeBlockDo) call enter and leave for every scope. (enter) New procedure. (leave) New procedure. * gm2-compiler/Output.mod (WriteKey) assign buffer to result of ConCat. (StartBuffer) fixbug call InitString with an empty string. gm2-compiler/P0SymBuild.mod (M2Error): Imported. (RegisterProgramModule) call EnterProgramModule. (RegisterImplementationModule) call EnterImplementationScope. (RegisterInnerModule) call EnterModuleScope. (RegisterProcedure) call EnterProcedureScope. (EndModule) call LeaveScope. * gm2-compiler/P2SymBuild.mod (P2StartBuildDefModule) call EnterDefinitionScope. (P2EndBuildDefModule) call LeaveScope. (P2StartBuildImplementationModule) call EnterImplementationScope. (P2StartBuildProgramModule) call EnterProgramScope. (P2EndBuildProgramModule) call LeaveScope. (StartBuildInnerModule) call EnterModuleScope. (EndBuildInnerModule) call LeaveScope. (StartBuildProcedure) call EnterProcedureScope. (EndBuildProcedure) call LeaveScope. * gm2-compiler/P3SymBuild.mod (P3StartBuildDefModule) call EnterDefinitionScope. (P3EndBuildDefModule) call LeaveScope. (P3EndBuildImpModule) call LeaveScope. (P3StartBuildProgModule) call EnterProgramScope. (P3EndBuildProgModule) call LeaveScope. (StartBuildInnerModule) call EnterModuleScope. (EndBuildInnerModule) call LeaveScope. (StartBuildProcedure) call EnterProcedureScope. (EndBuildProcedure) call LeaveScope. (PCStartBuildDefModule) call EnterDefinitionScope. (PCEndBuildDefModule) call LeaveScope. (PCStartBuildImpModule) call EnterImplementationScope. (PCEndBuildImpModule) call LeaveScope. (PCStartBuildProgModule) call EnterProgramScope. (PCEndBuildProgModule) call LeaveScope. (PCStartBuildInnerModule) call EnterModuleScope. (PCEndBuildInnerModule) call LeaveScope. (PCStartBuildProcedure) call EnterProcedureScope. (PCEndBuildProcedure) call LeaveScope. * gm2-compiler/SymbolTable.def (GetDeclaredDefinition) exported. (GetDeclaredModule) exported. 2021-10-26 Gaius Mulley * gm2-compiler/M2Options.def (m2linemap): Import list replaced identifiers SaveTemps, SetSaveTemps and SetSaveTempsDir. * gm2-compiler/M2Options.mod (SetSaveTemps): New procedure. Sets SaveTemps to value. (MakeSaveTempsFileName) New procedure which appends ".i" to filename. (PreprocessModule) Check SaveTemps to determine whether the temporary file should be deleted upon exit. (SetSaveTempsDir) Stub added. * gm2-gcc/m2options.h (SetSaveTemps): Prototype added. (SetSaveTempsDir) Prototype added. * gm2-lang.c (gm2_langhook_handle_option): Extended to include OP_save_temps and OP_save_temps_. * lang-options.h: Add -fsave-temps and -fsave-temps=. * lang-specs.h: Pass %{save-temps*} to cc1gm2. * lang.opt: Add -save-temps as an alias to save-temps. Add save-temps, add save-temps=. ChangeLog: * m2tools/Makefile.in : Rebuilt. 2021-10-13 Gaius Mulley * gm2-libs-ch/termios.c (GetFlag): Corrected macro test against absence of __MAX_BAUD. 2021-10-13 Gaius Mulley * Make-lang.in (lang_checks_parallelized): Include check-gm2. (check_gm2_parallelize) Set to 10000. 2021-10-13 Gaius Mulley * m2-link-support.h (SCAFFOLDNAME): Add %d so scaffold files are removed when gcc finishes without error. 2021-10-11 Gaius Mulley * gm2-compiler/M2GCCDeclare.mod (mystop): Removed. (DebugSets): Commented out. (TryFindSymbol): Commented out. (DeclareTypePartially): Delete variable t and use Assert to test return values. (NotAllDependantsPartiallyOrFullyDeclared): Commented out. (DeclareTypeFromPartial): Commented out. (DeclarePointerTypeFully): Commented out. (ForeachTryDeclare): Remove unused parameters start and end. (DeclaredOutstandingTypes): Alter all calls to ForeachTryDeclare. (DeclareType): Alter all calls to ForeachTryDeclare. (DeclareStringConstant): Commented out. (PromoteToString): Use tokenno to derive location. (DeclareConstructor): Add location to a call to BuildStringConstant. (TryDeclareConstant): Delete variable tok introduce parameter tokenno. (DeclareConst): Change all calls to BuildConvert to pass the location. (WalkFamilyOfUnbounded): Add location to the calls of DeclareStringConstant. (WalkDependants): Reformatted. (PopBinding): Remove start, end quadruple values from ResolveConstantExpressions. (AssertAllTypesDeclared): delete variable and use Assert to check return result. (DoVariableDeclaration): delete variables s and t. (DeclareImportedVariables): Remove call to AlignDeclarationWithSource. (DeclareLocalVariable): Remove call to AlignDeclarationWithSource. (DeclareEnumeration): Remove call to AlignDeclarationWithSource. (IncludeGetNth): Remove call to AlignDeclarationWithSource. (DeclarePackedSubrange): Reformatted. (WalkVarientDependants): Commented out. (BuildTreeFromInterface): replace variable location. * gm2-compiler/M2GenGCC.mod: (CodeInline): Add tokenno to calls to BuildTreeFromInterface. (CodeAddr): Change call to BuildStringConstant to use location parameter. * gm2-compiler/M2MetaError.mod (InternalFormat): Generate error message using line number. (OutColorS): Commented out. (doGetType): Introduce safely check using HIGH. (doGetSkipType): Introduce safely check using HIGH. (ConCatWord): Commented out. (copySym): Commented out. * gm2-compiler/M2Quads.mod: Remove CheckRangeAddVariableRead and CheckRangeRemoveVariableRead from the import list. * gm2-compiler/M2Range.def (DynamicStrings): Import list commented out identifiers CheckRangeAddVariableRead, CheckRangeRemoveVariableRead. (CheckRangeAddVariableRead): Commented out. * gm2-compiler/M2Range.mod (InitAssignmentRangeCheck): Delete variable p and use Assert to check the return result. (InitReturnRangeCheck): Delete variable p and use Assert to check the return result. (InitSubrangeRangeCheck): Delete variable p and use Assert to check the return result. (InitStaticArraySubscriptRangeCheck): Delete variable p and use Assert to check the return result. (InitDynamicArraySubscriptRangeCheck): Delete variable p and use Assert to check the return result. (InitIncRangeCheck): Delete variable p and use Assert to check the return result. (InitDecRangeCheck): Delete variable p and use Assert to check the return result. (InitInclCheck): Delete variable p and use Assert to check the return result. (InitExclCheck): Delete variable p and use Assert to check the return result. (InitShiftCheck): Delete variable p and use Assert to check the return result. (InitRotateCheck): Delete variable p and use Assert to check the return result. (InitTypesAssignmentCheck): Delete variable p and use Assert to check the return result. (InitTypesParameterCheck): Delete variable p and use Assert to check the return result. (InitTypesExpressionCheck): Delete variable p and use Assert to check the return result. (InitForLoopBeginRangeCheck): Delete variable p and use Assert to check the return result. (InitForLoopToRangeCheck): Delete variable p and use Assert to check the return result. (InitForLoopEndRangeCheck): Delete variable p and use Assert to check the return result. (InitPointerRangeCheck): Delete variable p and use Assert to check the return result. (InitNoReturnRangeCheck): Delete variable p and use Assert to check the return result. (InitNoElseRangeCheck): Delete variable p and use Assert to check the return result. (InitWholeNonPosDivCheck): Delete variable p and use Assert to check the return result. (InitWholeNonPosModCheck): Delete variable p and use Assert to check the return result. (InitWholeZeroDivisionCheck): Delete variable p and use Assert to check the return result. (FoldNil): Delete variable p and use Assert to check the return result. (FoldTypeExpr): Delete variable p and use Assert to check the return result. (CodeTypeExpr): Delete variable p and use Assert to check the return result. (FoldForLoopBegin): Delete variable p and use Assert to check the return result. (MakeAndDeclareConstLit): Delete variable p and use Assert to check the return result. (FoldNonPosMod): Delete variable p and use Assert to check the return result. (FoldZeroDiv): Delete variable p and use Assert to check the return result. (FoldZeroRem): Delete variable p and use Assert to check the return result. (FoldRangeCheck): Delete variable p and use Assert to check the return result. (CodeErrorCheck): Delete variable p and use Assert to check the return result. (CodeInclExcl): Delete variable p and use Assert to check the return result. (DiffTypesCodeForLoopEnd): Delete variable p and use Assert to check the return result. (DiffTypesCodeForLoopEnd): Delete variable p and use Assert to check the return result. (CodeNil): Delete variable p and use Assert to check the return result. (CodeWholeZero): Delete variable p and use Assert to check the return result. (InitCaseBounds): Delete variable p and use Assert to check the return result. (AddVarRead): Delete variable p and use Assert to check the return result. (SubVarRead): Delete variable p and use Assert to check the return result. (CheckRangeAddVariableRead): Delete variable p and use Assert to check the return result. (CheckRangeRemoveVariableRead): Delete variable p and use Assert to check the return result. (WriteRangeCheck): Delete variable p and use Assert to check the return result. * gm2-gcc/m2decl.c: (BuildStringConstant) add location parameter. * gm2-gcc/m2decl.def: (BuildStringConstant) add location parameter. * gm2-gcc/m2decl.h: (BuildStringConstant) add location parameter. 2021-10-08 Gaius Mulley * gm2-compiler/M2GenGCC.mod (m2statement): Import list inserted identifier BuildFunctionCallTree. (ConvertQuadsToTree): Delete variable Prev. Reformatted. (IsCompilingMainModule): Reformatted. (CodeStatement): Remove unused parameters for many of the Code procedures. (ResolveConstantExpressions): Remove unused parameters for many of the Fold procedures. (CodeSaveException): replace variables exceptionCall and functValue. Use BuildFunctionCallTree to avoid an unused return result. (CodeRestoreException): Replace variables exceptionCall and functValue. Use BuildFunctionCallTree to avoid an unused return result. (PopScope): Check return result. (CodeRange): Remove unused parameters. (CodeError): Remove unused parameters. (CodeStartModFile): Remove unused parameters. (CodeStartDefFile): Remove unused parameters and renamed existing parameters. (CodeEndFile): Remove unused parameters. (CodeInitStart): Remove unused parameters. (CodeInitStart): Reformatted. (CodeInitEnd): replace variables t and moduleTree. (CodeInitEnd): Reformatted. (CodeFinallyStart): Rewritten to remove unused parameters and renamed remaining parameters. (CodeFinallyEnd): replace variables t and moduleTree. (CodeFinallyEnd): Rewritten to remove unused parameters and renamed remaining parameters. (GetHighFromUnbounded): Commented out unused variable remainingDim. (MakeCopyUse): Insert variables Type and NewArray. Reformatted. (BuildCascadedIfThenElsif): Reformatted. (CheckUnboundedNonVarParameter): Reformatted. (IsParameterWritten): Removed usused variable i. (AutoInitVariable): Removed usused variable i. (CodeNewLocalVar): Reformatted. (CodeKillLocalVar): Reformatted. (CodeProcedureScope): Reformatted. (CodeCall): Reformatted. (FoldBuiltin): Renamed parameter. (CodeFunctValue): Removed unused parameter. (CodeAddr): Removed unused parameter. (FoldBecomes): Delete variable t. Removed unused parameter. (CodeTry): Removed all parameters. (CodeThrow): Removed unused parameters. (CodeCatchBegin): Reformatted. (checkDeclare): Reformatted and renamed parameters. Removed unused parameters. (LValueToGenericPtr): Removed unused parameter and reformatted. (CodeAddCheck): Renamed parameters. (FoldSub): Renamed parameters. (CodeAddCheck): Renamed parameters. (CodeSubCheck): Renamed parameters. (FoldMult): Renamed parameters. (CodeSub): Renamed parameters. (CodeMultCheck): Rewritten and reformatted. (CodeDivM2Checked): Rewritten and reformatted. (CodeDivM2Check): Rewritten and reformatted. (CodeModM2Checked): Rewritten and reformatted. (CodeModM2Check): Rewritten and reformatted. (FoldDivM2): Rewritten and reformatted. (CodeDivM2): Rewritten and reformatted. (FoldModM2): Rewritten and reformatted. (FoldDivTrunc): Rewritten and reformatted. (FoldDivCeil): Rewritten and reformatted. (FoldDivFloor): Rewritten and reformatted. (FoldBuiltinConst): Rewritten and reformatted. (FoldBuiltinTypeInfo): Rewritten and reformatted. (CodeStandardFunction): Rewritten and reformatted. (CodeSavePriority): Rewritten and reformatted. (CodeRestorePriority): Rewritten and reformatted. (CodeUnarySet): Rewritten and reformatted. (FoldIfIn): Rewritten and reformatted. (GetSetLimits): Rewritten and reformatted. (CodeIncl): Rewritten and reformatted. (CodeExcl): Rewritten and reformatted. (FoldUnary): Rewritten and reformatted. (FoldUnarySet): Rewritten and reformatted. (CodeUnaryCheck): Rewritten and reformatted. (CodeUnary): Rewritten and reformatted. (CodeNegateChecked): Rewritten and reformatted. (CodeSize): Rewritten and reformatted. (FoldRecordField): Delete variables location and t. (BuildHighFromArray): Rewritten and reformatted. (BuildHighFromStaticArray): Rewritten and reformatted. (ResolveHigh): Rewritten and reformatted. (FoldHigh): Rewritten and reformatted. (CodeArray): Rewritten and reformatted. (FoldElementSizeForArray): Rewritten and reformatted. (FoldElementSizeForUnbounded): Rewritten and reformatted. (FoldConvert): Rewritten and reformatted. (CodeIfNotEqu): Rewritten and reformatted. (MixTypes3): Rewritten and reformatted. (AddQuadInformation): Rewritten and reformatted. (UndoReadWriteInfo): Rewritten and reformatted. (WriteQuad): Rewritten and reformatted. * gm2-gcc/m2statement.c (BuildFunctionCallTree): New function. * gm2-gcc/m2statement.def (BuildFunctionCallTree): New function. * gm2-gcc/m2statement.h (BuildFunctionCallTree): New function. 2021-10-08 Gaius Mulley * gm2-compiler/M2GenGCC.mod (m2statement): Import list inserted identifier BuildFunctionCallTree. (ConvertQuadsToTree): Delete variable Prev. Reformatted. (IsCompilingMainModule): Reformatted. (CodeStatement): Remove unused parameters for many of the Code procedures. (ResolveConstantExpressions): Remove unused parameters for many of the Fold procedures. (CodeSaveException): replace variables exceptionCall and functValue. Use BuildFunctionCallTree to avoid an unused return result. (CodeRestoreException): Replace variables exceptionCall and functValue. Use BuildFunctionCallTree to avoid an unused return result. (PopScope): Check return result. (CodeRange): Remove unused parameters. (CodeError): Remove unused parameters. (CodeStartModFile): Remove unused parameters. (CodeStartDefFile): Remove unused parameters and renamed existing parameters. (CodeEndFile): Remove unused parameters. (CodeInitStart): Remove unused parameters. (CodeInitStart): Reformatted. (CodeInitEnd): replace variables t and moduleTree. (CodeInitEnd): Reformatted. (CodeFinallyStart): Rewritten to remove unused parameters and renamed remaining parameters. (CodeFinallyEnd): replace variables t and moduleTree. (CodeFinallyEnd): Rewritten to remove unused parameters and renamed remaining parameters. (GetHighFromUnbounded): Commented out unused variable remainingDim. (MakeCopyUse): Insert variables Type and NewArray. Reformatted. (BuildCascadedIfThenElsif): Reformatted. (CheckUnboundedNonVarParameter): Reformatted. (IsParameterWritten): Removed usused variable i. (AutoInitVariable): Removed usused variable i. (CodeNewLocalVar): Reformatted. (CodeKillLocalVar): Reformatted. (CodeProcedureScope): Reformatted. (CodeCall): Reformatted. (FoldBuiltin): Renamed parameter. (CodeFunctValue): Removed unused parameter. (CodeAddr): Removed unused parameter. (FoldBecomes): Delete variable t. Removed unused parameter. (CodeTry): Removed all parameters. (CodeThrow): Removed unused parameters. (CodeCatchBegin): Reformatted. (checkDeclare): Reformatted and renamed parameters. Removed unused parameters. (LValueToGenericPtr): Removed unused parameter and reformatted. (CodeAddCheck): Renamed parameters. (FoldSub): Renamed parameters. (CodeAddCheck): Renamed parameters. (CodeSubCheck): Renamed parameters. (FoldMult): Renamed parameters. (CodeSub): Renamed parameters. (CodeMultCheck): Rewritten and reformatted. (CodeDivM2Checked): Rewritten and reformatted. (CodeDivM2Check): Rewritten and reformatted. (CodeModM2Checked): Rewritten and reformatted. (CodeModM2Check): Rewritten and reformatted. (FoldDivM2): Rewritten and reformatted. (CodeDivM2): Rewritten and reformatted. (FoldModM2): Rewritten and reformatted. (FoldDivTrunc): Rewritten and reformatted. (FoldDivCeil): Rewritten and reformatted. (FoldDivFloor): Rewritten and reformatted. (FoldBuiltinConst): Rewritten and reformatted. (FoldBuiltinTypeInfo): Rewritten and reformatted. (CodeStandardFunction): Rewritten and reformatted. (CodeSavePriority): Rewritten and reformatted. (CodeRestorePriority): Rewritten and reformatted. (CodeUnarySet): Rewritten and reformatted. (FoldIfIn): Rewritten and reformatted. (GetSetLimits): Rewritten and reformatted. (CodeIncl): Rewritten and reformatted. (CodeExcl): Rewritten and reformatted. (FoldUnary): Rewritten and reformatted. (FoldUnarySet): Rewritten and reformatted. (CodeUnaryCheck): Rewritten and reformatted. (CodeUnary): Rewritten and reformatted. (CodeNegateChecked): Rewritten and reformatted. (CodeSize): Rewritten and reformatted. (FoldRecordField): Delete variables location and t. (BuildHighFromArray): Rewritten and reformatted. (BuildHighFromStaticArray): Rewritten and reformatted. (ResolveHigh): Rewritten and reformatted. (FoldHigh): Rewritten and reformatted. (CodeArray): Rewritten and reformatted. (FoldElementSizeForArray): Rewritten and reformatted. (FoldElementSizeForUnbounded): Rewritten and reformatted. (FoldConvert): Rewritten and reformatted. (CodeIfNotEqu): Rewritten and reformatted. (MixTypes3): Rewritten and reformatted. (AddQuadInformation): Rewritten and reformatted. (UndoReadWriteInfo): Rewritten and reformatted. (WriteQuad): Rewritten and reformatted. * gm2-gcc/m2statement.c (BuildFunctionCallTree): New function. * gm2-gcc/m2statement.def (BuildFunctionCallTree): New function. * gm2-gcc/m2statement.h (BuildFunctionCallTree): New function. 2021-09-16 Gaius Mulley * gm2-compiler/M2GenGCC.def (DoCopyString): Renamed parameter t to length. * gm2-compiler/M2GenGCC.mod (CodeStatement): Call FoldStatementNote with one parameter. Call CodeGoto with one parameter. Call CodeReturnValue without op2. Call CodeInline without q, op1 and op2. Call CodeStatement with a single parameter. Call CodeSaveException a single parameter op3. Call CodeRestoreException with op1 and op3. (ResolveConstantExpressions) Call FoldStatementNote with one parameter. Call FoldRange without op1 and op2. Call FoldStatementNote with only op3. (CodeInline) Reformatted. (FoldStatementNote) changed to use a single parameter. (FoldRange) Renamed parameter q to quad, commented out p and removed op1, op2. (CodeSaveException) Rewritten using descriptive variable names. (CodeRestoreException) Rewritten using descriptive variable names. (MakeCopyAndUse) Use BuildAssignmentStatement and remove variable t. (AutoInitVariable) Use BuildAssignmentStatement and remove variable t. (CodeMakeAdr) Use BuildAssignmentStatement. (CodeAddr) Use BuildAssignmentStatement and remove variable t. (DoCopyString) Renamed parameter t to length. (CodeInitAddress) Use BuildAssignmentStatement and remove variable t. (CodeBecomes) Use BuildAssignmentStatement and remove variable t. (CodeBinaryCheck) Use BuildAssignmentStatement and remove variable t. (CodeBinary) Use BuildAssignmentStatement and remove variable t. (CodeStandardFunction) Use BuildAssignmentStatement and remove variable t. (CodeUnaryCheck) Use BuildAssignmentStatement and remove variable t. (CodeUnary) Use BuildAssignmentStatement and remove variable t. (CodeSize) Use BuildAssignmentStatement and remove variable t. (CodeOffset) Use BuildAssignmentStatement and remove variable t. (CodeHigh) Use BuildAssignmentStatement and remove variable t. (CodeUnbounded) Use BuildAssignmentStatement and remove variable t. (CodeArray) Use BuildAssignmentStatement and remove variable t. (FoldRecordField) renamed local variable t to ptr. (CodeOffset) renamed local variable t to offset. * gm2-gcc/m2statement.def (BuildAssignmentStatement): New procedure. * gm2-gcc/m2statement.h (BuildAssignmentStatement): New function declaration. * gm2-gcc/m2statement.c: (BuildAssignmentStatement): New function. 2021-09-13 Gaius Mulley * gm2-compiler/M2ALU.mod (WatchedValue): Removed. (stop) Removed. (AddElement) Removed. (SetNegate) Removed variable j. (DisplayElements) Removed variable t. (WalkConstructorDependants) Removed variable r. (PerformSetIn) Removed variable v. (BuildStructBitset) Removed GccField. (ConstructRecordConstant) Removed variables GccFieldType, gccsym, high, low and location. (InitialiseArrayOfCharWithString) Removed parameter v. (CheckElementString) Remove parameter baseType. Call InitialiseArrayOfCharWithString without the NIL third parameter. (InitialiseArrayWith) Remove parameter baseType. Call CheckElementString without baseType. (InitialiseArrayOfCharWith) Remove parameter baseType. Remove variables Subrange, Subscript and seenString. * gm2-compiler/M2CaseList.def (OverlappingCaseBounds): Remove unused tokenno parameter. (MissingCaseBounds) use MetaErrorT2 and position the error at tokenno. (WriteCase) Simplistic implmentation. * gm2-compiler/M2Range.mod: (FoldCaseBounds) call OverlappingCaseBounds without tokenno parameter. 2021-08-26 Gaius Mulley * Make-lang.in (GM2-COMP-BOOT-DEFS): Remove cflex.def from list. (GM2-COMP-BOOT-MODS) Remove cflex.mod from list. * gm2-compiler/CLexBuf.mod (GetToken): Remove unused local variable a. Use AdvanceToken instead of GetToken. (AddTokToList) Remove unused variable b. (IsLastTokenEof) Remove unused variable t. * gm2-compiler/M2ALU.mod (Reduce): New procedure. (PrintValue) Use Reduce rather than PopIntegerTree. * gm2-compiler/M2Base.mod (Param): Remove unused global variable. (IsVarientSame) Initialize ga at the procedure start. Initialize gb at the procedure start. * gm2-compiler/M2CaseList.def (CaseBoundsResolved): tokenno parameter removed. * gm2-compiler/M2CaseList.mod (RangePair): Data type simplified. (ConflictingPair) Data type simplified. (CaseList) Data type simplified. (SetRange) Data type simplified. (Overlaps) Reformatted. (OverlappingCaseBound) Remove tokenno parameter. * gm2-compiler/M2GenGCC.mod (ConvertForComparison): Commented out. (IsWord) Removed. (HaveDifferentTypes) Removed. (FoldSetLogicalDifference) Commented out. (DetermineFieldOf) Commented out. (CodeMath) Commented out. * gm2-compiler/M2Range.mod (FoldCaseBounds): Remove first parameter to TypeCaseBounds. (CodeCaseBounds) Remove first parameter to TypeCaseBounds. * gm2-compiler/M2Search.mod (Assert): Imported. (GarbageDebugging) Declared. (doDSdbEnter) Commented out. (doDSdbExit) Commented out. (DSdbEnter) Commented out. (DSdbExit) Commented out. (DSdbExit) Assert s # NIL. * gm2-compiler/M2Swig.mod (Doresolveorder): Remove parameter main. (DetermineParameter) Remove annotate parameter. * gm2-compiler/ObjectFiles.mod (RegisterModuleObject): Remove local variable r as libc.close and libc.read procedure functions have an optional return result. (IsRegistered) Remove local variable r as libc.close and libc.read procedure functions have an optional return result. * gm2-compiler/PCSymBuild.mod (WalkConst): Commented out. * gm2-compiler/Sets.mod (checkRange): Remove unused variable a. Use Assert to check memset and memcpy results instead of assigning to a. (DuplicateSet) Remove unused variable a. Use Assert to check return value of memset and memcpy instead of assigning to a. * gm2-compiler/SymbolTable.mod (MetaErrorT2): Imported. (AlreadyImportedError) Commented out. (DisplayScopes) Commented out. (GetConstFromTypeTree) Commented out. (PutConstIntoTypeTree) Commented out. (SkipHiddenType) Commented out. (GetLastMainScopeId) Commented out. (PutExportUnImplemented) Commented out. (DumpSymbols) Commented out. * gm2-compiler/cflex.def (AdvanceToken): New procedure. * gm2-libs-min/libc.c (abort): Add infinite loop. (exit) Add infinite loop. * gm2-libs/libc.def (read): Define return value as optional. (write) Define return value as optional. (close) Define return value as optional. (system) Define return value as optional. (readv) Define return value as optional. (writev) Define return value as optional. (chown) Define return value as optional. (strcpy) Define return value as optional. (strncpy) Define return value as optional. (unlink) Define return value as optional. (memcpy) Define return value as optional. (memset) Define return value as optional. (memmove) Define return value as optional. (setenv) Define return value as optional. (ftime) Define return value as optional. (shutdown) Define return value as optional. (rename) Define return value as optional. (atexit) Sefine return value as optional. * Makefile.in: Rebuilt. 2021-08-26 Gaius Mulley * gcc/m2/Make-lang.in (cflex.def): Removed from GM2-COMP-BOOT-DEFS. (cflex.mod) Removed from GM2-COMP-BOOT-MODS. * gcc/m2/gm2-compiler/CLexBuf.mod (GetToken): Remove unused local variable a. Use AdvanceToken instead of GetToken. (AddTokToList) Remove unused variable b. (IsLastTokenEof) Remove unused variable t. * gcc/m2/gm2-compiler/M2ALU.mod (Reduce): New procedure. (PrintValue) Use Reduce rather than PopIntegerTree. * gcc/m2/gm2-compiler/M2Base.mod (Param): Remove unused global variable. (IsVarientSame) Initialize ga at the procedure start. Initialize gb at the procedure start. * gcc/m2/gm2-compiler/M2CaseList.def (CaseBoundsResolved) tokenno parameter removed. * gcc/m2/gm2-compiler/M2CaseList.mod (RangePair) Data type simplified. (ConflictingPair) Data type simplified. (CaseList) Data type simplified. (SetRange) Data type simplified. (Overlaps) Reformatted. (OverlappingCaseBound) Remove tokenno parameter. * gcc/m2/gm2-compiler/M2GenGCC.mod: (ConvertForComparison) Commented out. (IsWord) Removed. (HaveDifferentTypes) Removed. (FoldSetLogicalDifference) Commented out. (DetermineFieldOf) Commented out. (CodeMath) Commented out. * gcc/m2/gm2-compiler/M2Range.mod (FoldCaseBounds) remove first parameter to TypeCaseBounds. (CodeCaseBounds) remove first parameter to TypeCaseBounds. * gcc/m2/gm2-compiler/M2Search.mod (Assert) Imported. (GarbageDebugging) Declared. (doDSdbEnter) Commented out. (doDSdbExit) Commented out. (DSdbEnter) Commented out. (DSdbExit) Commented out. (DSdbExit) Assert s # NIL. * gcc/m2/gm2-compiler/M2Swig.mod (Doresolveorder) Remove parameter main. (DetermineParameter) Remove annotate parameter. * gcc/m2/gm2-compiler/ObjectFiles.mod (RegisterModuleObject) Remove local variable r as libc.close and libc.read procedure functions have an optional return result. (IsRegistered) Remove local variable r as libc.close and libc.read procedure functions have an optional return result. * gcc/m2/gm2-compiler/PCSymBuild.mod (WalkConst): Commented out. * gcc/m2/gm2-compiler/Sets.mod (checkRange): Remove unused variable a. Use Assert to check memset and memcpy results instead of assigning to a. (DuplicateSet): Remove unused variable a. Use Assert to check return value of memset and memcpy instead of assigning to a. * gcc/m2/gm2-compiler/SymbolTable.mod (MetaErrorT2): Imported. (AlreadyImportedError) Commented out. (DisplayScopes) Commented out. (GetConstFromTypeTree) Commented out. (PutConstIntoTypeTree) Commented out. (SkipHiddenType) Commented out. (GetLastMainScopeId) Commented out. (PutExportUnImplemented) Commented out. (DumpSymbols) Commented out. * gcc/m2/gm2-compiler/cflex.def (AdvanceToken): New procedure. * gcc/m2/gm2-libs-min/libc.c (abort): Add infinite loop. (exit): Add infinite loop. * gcc/m2/gm2-libs/libc.def (read): define return value as optional. (write) define return value as optional. (close) define return value as optional. (system) define return value as optional. (readv) define return value as optional. (writev) define return value as optional. (chown) define return value as optional. (strcpy) define return value as optional. (strncpy) define return value as optional. (unlink) define return value as optional. (memcpy) define return value as optional. (memset) define return value as optional. (memmove) define return value as optional. (setenv) define return value as optional. (ftime) define return value as optional. (shutdown) define return value as optional. (rename) define return value as optional. (atexit) define return value as optional. (Makefile.in): Rebuilt. 2021-08-18 Gaius Mulley * gm2-compiler/M2Options.def (SetMakeall): Commented out. (SetMakeall0) Commented out. (SetIncludePath) Commented out. * gm2-compiler/M2Options.mod: (SetMakeall): Commented out. (SetMakeall0) Commented out. (SetIncludePath) Commented out. * gm2-libs/SArgs.mod (GetArg): Cast ArgV to PtrToChar before adding the offset. Removes a warning from the resultant C/C++ code. 2021-08-18 Gaius Mulley * Make-lang.in: Add $(generated_files) to the list of dependanies for all .o files. 2021-08-17 Gaius Mulley * Make-lang.in (m2/gm2-gcc/%.o): Add $(generated_files) to the list of dependanies. 2021-08-15 Gaius Mulley * m2-boot-ch/Gtermios.c (GetFlag): Correct guard using defined(__MAX_BAUD). (SetFlag): Correct guard using defined(__MAX_BAUD). 2021-08-12 Gaius Mulley * gm2-libs/GetOpt.mod: Rename the getopt module with cgetopt to avoid a clash of source filenames in the gcc tree. 2021-08-12 Gaius Mulley * Make-lang.in (PGE): bootstrap binary location changed. Use gcc-12 version of the gm2 libraries when regenerating mc. All automatically generated parser files for mc are now built by PGE using the -o option. * gm2-compiler/M2Base.def (NegateType): Remove NearTok parameter. * gm2-compiler/M2Base.mod (NegateType): Remove NearTok parameter. (IsEnumerationSame) Remove error parameter. * gm2-compiler/M2GenGCC.mod: Caller to NegateType removes token position parameter. * gm2-compiler/M2Quads.mod: Caller to NegateType removes token position parameter. * gm2-compiler/M2System.mod (Assert) Imported. (AttemptToCreateType) renamed to CreateType. (AttemptToCreateSetType) renamed to CreateSetType. (AttemptToCreateSetType) reimplemented. (AttemptToCreateType) reimplemented. (MakeFixedSizedTypes) reimplemented. (InitPIMTypes) reimplemented. (InitISOTypes) reimplemented. (MakeExtraSystemTypes) reimplemented. * gm2-compiler/PCSymBuild.mod (stackPtr) Removed. (currentConst) removed. (BuildVarAtAddress) Commented out. (BuildOptArgInitializer) Commented out. * mc/keyc.mod: Introduce prototype for throw. * mc-boot/GDynamicStrings.c: Rebuilt. * mc-boot/GFIO.c: Rebuilt. * mc-boot/GIndexing.c: Rebuilt. * mc-boot/GM2EXCEPTION.c: Rebuilt. * mc-boot/GPushBackInput.c: Rebuilt. * mc-boot/GRTExceptions.c: Rebuilt. * mc-boot/GRTint.c: Rebuilt. * mc-boot/GStdIO.c: Rebuilt. * mc-boot/GStrLib.c: Rebuilt. * mc-boot/GStrLib.h: Rebuilt. * mc-boot/GStringConvert.c: Rebuilt. * mc-boot/GSysStorage.c: Rebuilt. * mc-boot/Gdecl.c: Rebuilt. * mc-boot/Gkeyc.c: Rebuilt. * mc-boot/GmcComment.c: Rebuilt. * mc-boot/GmcComp.c: Rebuilt. * mc-boot/GmcDebug.c: Rebuilt. * mc-boot/GmcMetaError.c: Rebuilt. * mc-boot/GmcStack.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. 2021-08-10 Gaius Mulley * gm2-compiler/M2Quads.mod (doDSdbEnter): Commented out. (DSdbExit) Remove parameter. (GetQF) Cast procedure function return result. (CheckAddVariableReadLeftValue) Commented out. (CheckRemoveVariableReadLeftValue) Commented out. (CheckParameterOrdinals) Remove parameter. (CheckProcTypeAndProcedure) Remove tokpos and TypeList parameters. (BuildCapFunction) Use local optok instead of erroneous global vartok. (BuildProcedureEnd) Use RemoveTop rather than PopWord. (CheckReadBeforeInitialized) Call CheckReadBeforeInitialized without Start parameter. (CheckForLogicalOperator) Renamed CheckLogicalOperator. (CheckGenericNulSet) Renamed doCheckGenericNulSet and commented out. (CheckForGenericNulSet) Renamed CheckGenericNulSet and commented out. (ds) Commented out. (DSdbExit) called without a parameter. (BuildStmtNote) Reformatted and INTEGER i is cast to a CARDINAL prior to comparison. (IncOperandD) Commented out. (PushTrw) Commented out. (StressStack) Commented out. * gm2-compiler/M2StackWord.def (RemoveTop): Definition added. * gm2-compiler/M2StackWord.mod (RemoveTop): Implementation added. 2021-08-02 Gaius Mulley * gm2-compiler/M2BasicBlock.mod (ConvertQuads2BasicBlock): Assign CurrentBB to NIL. (Sub): Commented out. (DisplayBasicBlocks): Commented out. (DisplayBlock): Commented out. * gm2-compiler/M2Code.mod (PrintModule): Commented out. (DisplayQuadsInScope): Commented out. (DisplayQuadNumbers): Commented out. * gm2-compiler/M2Error.mod: Import NulName. (DoFormat1) initialize n. (DoFormat2) initialize n. * gm2-compiler/M2Optimize.mod (DeleteUnReachableProcedures): Commented out. * gm2-compiler/M2Options.mod: Commented out string garbage debugging procedures. (SetDebugging) Commented out. * gm2-compiler/M2Printf.mod (IsDigit): Commented out. * gm2-compiler/P1SymBuild.mod (CheckProcedure): Removed. (CheckFileName) Commented out. (BuildHiddenType) Remove Sym. Use Assert to check return value. * gm2-compiler/P2SymBuild.def (SeenBoolean): Remove sym parameter. (SeenZType): Remove sym parameter. (SeenRType): Remove sym parameter. (SeenCType): Remove sym parameter. * gm2-compiler/P2SymBuild.mod (SeenBoolean): Remove sym parameter. (SeenZType): Remove sym parameter. (SeenRType): Remove sym parameter. (SeenCType): Remove sym parameter. (StartBuildEnumeration): Remove name. (FailParameter) Use default ELSE and Assert. (BuildNulParam) Removed. (BuildFieldRecord) Remove name. Assign Field to NulSym. (BuildVarientSelector) Remove Parent. * gm2-compiler/SymbolTable.def (GCFieldVarient): Removed. (FillInUnboundedFields): Remove field. * gm2-compiler/gm2lcc.mod (CollectObjects): remove s. (WriteModuleName) Removed. * gm2-compiler/gm2lorder.mod (InitRuntimeModules) Remove l. * gm2-gcc/m2expr.c (divFloorOverflowPosPos) Remove unused parameters. (divFloorOverflowPosNeg) Remove unused parameters. (divFloorOverflowNegPos) Remove unused parameters. 2021-07-28 Gaius Mulley * Make-lang.in: Added Output.mod to the list of ppg modules. * Make-lang.in: Added Output.def to the list of ppg modules. * gm2-compiler/Output.def: (New file). * gm2-compiler/Output.mod: (New file). * bnf/gm2l.bnf: (DescribeError) no longer has any parameters. Removed unused rules. * bnf/gm2m.bnf: (DescribeError) no longer has any parameters. Removed unused rules. * bnf/m2-1.bnf: (DescribeError) no longer has any parameters. Removed unused rules. * bnf/m2-2.bnf: (DescribeError) no longer has any parameters. Removed unused rules. * bnf/m2-3.bnf: (DescribeError) no longer has any parameters. Removed unused rules. * bnf/m2-c.bnf: (DescribeError) no longer has any parameters. Removed unused rules. * bnf/m2-h.bnf: (DescribeError) no longer has any parameters. Removed unused rules. * bnf/m2.bnf: (DescribeError) no longer has any parameters. Removed unused rules. * bnf/mc-1.bnf: (DescribeError) no longer has any parameters. Removed unused rules. * bnf/mc-2.bnf: (DescribeError) no longer has any parameters. Removed unused rules. * bnf/mc-3.bnf: (DescribeError) no longer has any parameters. Removed unused rules. * bnf/mc-4.bnf: (DescribeError) no longer has any parameters. Removed unused rules. * bnf/mc-5.bnf: (DescribeError) no longer has any parameters. Removed unused rules. * gm2-compiler/M2ALU.mod: (InitialiseArrayOfCharWithString) isChar set to FALSE. * gm2-compiler/M2ALU.def: (DisplayModules) exported. * gm2-compiler/M2Depth.def: (DisplayGraph) exported. * gm2-compiler/M2Depth.mod: (DisplayGraph) added comment. * gm2-compiler/M2Options.mod: (SetProfiling) commented out. * gm2-compiler/M2Quads.mod: (BuildAddAdrFunction) vartok removed. (BuildAbsFunction) combinedtok removed. (BuildRotateFunction) paramtok removed. * gm2-compiler/P0SymBuild.mod: (pc) commented out. (FlushImports) removed sym and reformatted. (DeclareModules) reformatted. (MoveNext) commented out. * gm2-compiler/SymbolKey.mod: (stop) commented out. * gm2-compiler/ppg.mod: (Output) imported. (ArgName) declared. (ParametersUsed) declared. (PrettyFollow) use the Output module to delay emitting text. (WriteCodeHunkList) use the Output module to delay emitting text. (WriteIndent) use the Output module to delay emitting text. (WriteIndent) (CheckWrite) use the Output module to delay emitting text. (WriteIndent) use the Output module to delay emitting text. (NewLine) use the Output module to delay emitting text. (IndentString) use the Output module to delay emitting text. (DescribeError) remove parameters. (SyntaxError) call DescribeError without parameters. (KeyWord) use the Output module to delay emitting text. (PrettyPara) use the Output module to delay emitting text. (WriteKeyTexinfo) use the Output module to delay emitting text. (PrettyCommentFactor) use the Output module to delay emitting text. (PrettyCommentTerm) use the Output module to delay emitting text. (PrettyCommentProduction) use the Output module to delay emitting text. (PrettyPrintProduction) use the Output module to delay emitting text. (EmitFileLineTag) use the Output module to delay emitting text. (CodeThenDo) use the Output module to delay emitting text. (CodeElseEnd) use the Output module to delay emitting text. (EmitNonVarCode) use the Output module to delay emitting text. (FlushCode) use the Output module to delay emitting text. (CodeFactor) use the Output module to delay emitting text. (CodeProduction) use the Output module to delay emitting text. (WriteElement) use the Output module to delay emitting text. (EmitIsInSet) use the Output module to delay emitting text. (EmitIsInSubSet) use the Output module to delay emitting text. (EmitIsInFirst) use the Output module to delay emitting text. (RecoverFactor) use the Output module to delay emitting text. (RecoverTerm) use the Output module to delay emitting text. (EmitUsed) use the Output module to delay emitting text. (EmitStopParameters) use the Output module to delay emitting text. (EmitSet) use the Output module to delay emitting text. (EmitSetName) use the Output module to delay emitting text. (EmitStopParametersAndSet) use the Output module to delay emitting text. (EmitSetAsParameters) use the Output module to delay emitting text. (EmitStopParametersAndFollow) use the Output module to delay emitting text. (RecoverProduction) use the Output module to delay emitting text. (WriteUpto) use the Output module to delay emitting text. (CheckForVar) use the Output module to delay emitting text. (EmitFDLNotice) use the Output module to delay emitting text. (DescribeElement) use the Output module to delay emitting text. (EmitInTestStop) use the Output module to delay emitting text. (DescribeStopElement) use the Output module to delay emitting text. (EmitDescribeStop) use the Output module to delay emitting text. (EmitDescribeError) use the Output module to delay emitting text. (EmitSetTypes) use the Output module to delay emitting text. (ParseArgs) open output filename. * gm2-gcc/m2decl.c: (m2decl_DeclareKnownVariable) change format specifier to generate quoted declaration. Call internal_error and use quoted format specifier. * gm2-gcc/m2except.c: (ASSERT) removed. (ERROR) removed. (m2except_BuildThrow) rewritten. * gm2-gcc/m2expr.c: (m2expr_GetSizeOfInBits) use quoted format specifier for error. (m2type_BuildSetTypeFromSubrange) add attribute unused for the name of the subrange and add comment about dwarf-5 set type. * gm2-libs/StrLib.def: (StrLen) renamed parameters. * gm2-libs/StrLib.mod: (StrLen) renamed parameters. * init/ppginit: Add SFIO and Output to the list of modules. * gm2-compiler/Output.def: (New file). * gm2-compiler/Output.mod: (New file). 2021-07-07 Gaius Mulley * COPYING.FDL: New file. * COPYING.RUNTIME: New file. * COPYING3: New file. * COPYING3.LIB: New file. * ChangeLog-2001: New file. * ChangeLog-2002: New file. * ChangeLog-2003: New file. * ChangeLog-2004: New file. * ChangeLog-2005: New file. * ChangeLog-2006: New file. * ChangeLog-2007: New file. * ChangeLog-2008: New file. * ChangeLog-2009: New file. * ChangeLog-2010: New file. * ChangeLog-2011: New file. * ChangeLog-2012: New file. * ChangeLog-2013: New file. * ChangeLog-2014: New file. * ChangeLog-2015: New file. * ChangeLog-2016: New file. * ChangeLog-2017: New file. * ChangeLog-2018: New file. * ChangeLog-2019: New file. * ChangeLog-2020: New file. * Make-lang.in: New file. * NEWS: New file. * README: New file. * aclocal.m4: New file. * bnf/README: New file. * bnf/gm2l.bnf: New file. * bnf/gm2m.bnf: New file. * bnf/m2-1.bnf: New file. * bnf/m2-2.bnf: New file. * bnf/m2-3.bnf: New file. * bnf/m2-c.bnf: New file. * bnf/m2-h.bnf: New file. * bnf/m2.bnf: New file. * bnf/mc-1.bnf: New file. * bnf/mc-2.bnf: New file. * bnf/mc-3.bnf: New file. * bnf/mc-4.bnf: New file. * bnf/mc-5.bnf: New file. * config-lang.in: New file. * config-make.in: New file. * configure: New file. * configure.ac: New file. * el/gm2-mode.el: New file. * gm2-compiler/CLexBuf.def: New file. * gm2-compiler/CLexBuf.mod: New file. * gm2-compiler/FifoQueue.def: New file. * gm2-compiler/FifoQueue.mod: New file. * gm2-compiler/Lists.def: New file. * gm2-compiler/Lists.mod: New file. * gm2-compiler/M2ALU.def: New file. * gm2-compiler/M2ALU.mod: New file. * gm2-compiler/M2AsmUtil.def: New file. * gm2-compiler/M2AsmUtil.mod: New file. * gm2-compiler/M2Base.def: New file. * gm2-compiler/M2Base.mod: New file. * gm2-compiler/M2BasicBlock.def: New file. * gm2-compiler/M2BasicBlock.mod: New file. * gm2-compiler/M2Batch.def: New file. * gm2-compiler/M2Batch.mod: New file. * gm2-compiler/M2Bitset.def: New file. * gm2-compiler/M2Bitset.mod: New file. * gm2-compiler/M2CaseList.def: New file. * gm2-compiler/M2CaseList.mod: New file. * gm2-compiler/M2Check.def: New file. * gm2-compiler/M2Check.mod: New file. * gm2-compiler/M2Code.def: New file. * gm2-compiler/M2Code.mod: New file. * gm2-compiler/M2ColorString.def: New file. * gm2-compiler/M2ColorString.mod: New file. * gm2-compiler/M2Comp.def: New file. * gm2-compiler/M2Comp.mod: New file. * gm2-compiler/M2Configure.def: New file. * gm2-compiler/M2Configure.mod: New file. * gm2-compiler/M2Const.def: New file. * gm2-compiler/M2Const.mod: New file. * gm2-compiler/M2Debug.def: New file. * gm2-compiler/M2Debug.mod: New file. * gm2-compiler/M2DebugStack.def: New file. * gm2-compiler/M2DebugStack.mod: New file. * gm2-compiler/M2Defaults.def: New file. * gm2-compiler/M2Defaults.mod: New file. * gm2-compiler/M2Depth.def: New file. * gm2-compiler/M2Depth.mod: New file. * gm2-compiler/M2DriverOptions.def: New file. * gm2-compiler/M2DriverOptions.mod: New file. * gm2-compiler/M2Emit.def: New file. * gm2-compiler/M2Emit.mod: New file. * gm2-compiler/M2Error.def: New file. * gm2-compiler/M2Error.mod: New file. * gm2-compiler/M2EvalSym.def: New file. * gm2-compiler/M2FileName.def: New file. * gm2-compiler/M2FileName.mod: New file. * gm2-compiler/M2GCCDeclare.def: New file. * gm2-compiler/M2GCCDeclare.mod: New file. * gm2-compiler/M2GenGCC.def: New file. * gm2-compiler/M2GenGCC.mod: New file. * gm2-compiler/M2Lex.def: New file. * gm2-compiler/M2Lex.mod: New file. * gm2-compiler/M2LexBuf.def: New file. * gm2-compiler/M2LexBuf.mod: New file. * gm2-compiler/M2MetaError.def: New file. * gm2-compiler/M2MetaError.mod: New file. * gm2-compiler/M2Optimize.def: New file. * gm2-compiler/M2Optimize.mod: New file. * gm2-compiler/M2Options.def: New file. * gm2-compiler/M2Options.mod: New file. * gm2-compiler/M2Pass.def: New file. * gm2-compiler/M2Pass.mod: New file. * gm2-compiler/M2Preprocess.def: New file. * gm2-compiler/M2Preprocess.mod: New file. * gm2-compiler/M2Printf.def: New file. * gm2-compiler/M2Printf.mod: New file. * gm2-compiler/M2Quads.def: New file. * gm2-compiler/M2Quads.mod: New file. * gm2-compiler/M2Quiet.def: New file. * gm2-compiler/M2Quiet.mod: New file. * gm2-compiler/M2Range.def: New file. * gm2-compiler/M2Range.mod: New file. * gm2-compiler/M2Reserved.def: New file. * gm2-compiler/M2Reserved.mod: New file. * gm2-compiler/M2SSA.def: New file. * gm2-compiler/M2SSA.mod: New file. * gm2-compiler/M2Scope.def: New file. * gm2-compiler/M2Scope.mod: New file. * gm2-compiler/M2Search.def: New file. * gm2-compiler/M2Search.mod: New file. * gm2-compiler/M2Size.def: New file. * gm2-compiler/M2Size.mod: New file. * gm2-compiler/M2StackAddress.def: New file. * gm2-compiler/M2StackAddress.mod: New file. * gm2-compiler/M2StackWord.def: New file. * gm2-compiler/M2StackWord.mod: New file. * gm2-compiler/M2Students.def: New file. * gm2-compiler/M2Students.mod: New file. * gm2-compiler/M2Swig.def: New file. * gm2-compiler/M2Swig.mod: New file. * gm2-compiler/M2System.def: New file. * gm2-compiler/M2System.mod: New file. * gm2-compiler/M2Version.def: New file. * gm2-compiler/NameKey.def: New file. * gm2-compiler/NameKey.mod: New file. * gm2-compiler/ObjectFiles.def: New file. * gm2-compiler/ObjectFiles.mod: New file. * gm2-compiler/P0SymBuild.def: New file. * gm2-compiler/P0SymBuild.mod: New file. * gm2-compiler/P0SyntaxCheck.def: New file. * gm2-compiler/P1Build.def: New file. * gm2-compiler/P1SymBuild.def: New file. * gm2-compiler/P1SymBuild.mod: New file. * gm2-compiler/P2Build.def: New file. * gm2-compiler/P2SymBuild.def: New file. * gm2-compiler/P2SymBuild.mod: New file. * gm2-compiler/P3Build.def: New file. * gm2-compiler/P3SymBuild.def: New file. * gm2-compiler/P3SymBuild.mod: New file. * gm2-compiler/PCBuild.def: New file. * gm2-compiler/PCSymBuild.def: New file. * gm2-compiler/PCSymBuild.mod: New file. * gm2-compiler/PHBuild.def: New file. * gm2-compiler/README: New file. * gm2-compiler/Sets.def: New file. * gm2-compiler/Sets.mod: New file. * gm2-compiler/SymbolConversion.def: New file. * gm2-compiler/SymbolConversion.mod: New file. * gm2-compiler/SymbolKey.def: New file. * gm2-compiler/SymbolKey.mod: New file. * gm2-compiler/SymbolTable.def: New file. * gm2-compiler/SymbolTable.mod: New file. * gm2-compiler/bnflex.def: New file. * gm2-compiler/bnflex.mod: New file. * gm2-compiler/cflex.def: New file. * gm2-compiler/gm2.mod: New file. * gm2-compiler/gm2lcc.mod: New file. * gm2-compiler/gm2lgen.mod: New file. * gm2-compiler/gm2lorder.mod: New file. * gm2-compiler/m2flex.def: New file. * gm2-compiler/ppg.mod: New file. * gm2-gcc/README: New file. * gm2-gcc/dynamicstrings.h: New file. * gm2-gcc/gcc-consolidation.h: New file. * gm2-gcc/init.c: New file. * gm2-gcc/init.def: New file. * gm2-gcc/init.h: New file. * gm2-gcc/m2assert.c: New file. * gm2-gcc/m2assert.h: New file. * gm2-gcc/m2block.c: New file. * gm2-gcc/m2block.def: New file. * gm2-gcc/m2block.h: New file. * gm2-gcc/m2builtins.c: New file. * gm2-gcc/m2builtins.def: New file. * gm2-gcc/m2builtins.h: New file. * gm2-gcc/m2color.c: New file. * gm2-gcc/m2color.def: New file. * gm2-gcc/m2color.h: New file. * gm2-gcc/m2convert.c: New file. * gm2-gcc/m2convert.def: New file. * gm2-gcc/m2convert.h: New file. * gm2-gcc/m2decl.c: New file. * gm2-gcc/m2decl.def: New file. * gm2-gcc/m2decl.h: New file. * gm2-gcc/m2except.c: New file. * gm2-gcc/m2except.def: New file. * gm2-gcc/m2except.h: New file. * gm2-gcc/m2expr.c: New file. * gm2-gcc/m2expr.def: New file. * gm2-gcc/m2expr.h: New file. * gm2-gcc/m2linemap.c: New file. * gm2-gcc/m2linemap.def: New file. * gm2-gcc/m2linemap.h: New file. * gm2-gcc/m2misc.c: New file. * gm2-gcc/m2misc.def: New file. * gm2-gcc/m2misc.h: New file. * gm2-gcc/m2options.h: New file. * gm2-gcc/m2range.h: New file. * gm2-gcc/m2search.h: New file. * gm2-gcc/m2statement.c: New file. * gm2-gcc/m2statement.def: New file. * gm2-gcc/m2statement.h: New file. * gm2-gcc/m2top.c: New file. * gm2-gcc/m2top.def: New file. * gm2-gcc/m2top.h: New file. * gm2-gcc/m2tree.c: New file. * gm2-gcc/m2tree.def: New file. * gm2-gcc/m2tree.h: New file. * gm2-gcc/m2treelib.c: New file. * gm2-gcc/m2treelib.def: New file. * gm2-gcc/m2treelib.h: New file. * gm2-gcc/m2type.c: New file. * gm2-gcc/m2type.def: New file. * gm2-gcc/m2type.h: New file. * gm2-gcc/rtegraph.c: New file. * gm2-gcc/rtegraph.h: New file. * gm2-ici/M2Emit.mod: New file. * gm2-ici/README: New file. * gm2-ici/m2linemap.c: New file. * gm2-internals.texi: New file. * gm2-lang.c: New file. * gm2-lang.h: New file. * gm2-libiberty/README: New file. * gm2-libiberty/choosetemp.def: New file. * gm2-libiberty/pexecute.def: New file. * gm2-libs-ch/README: New file. * gm2-libs-ch/RTcodummy.c: New file. * gm2-libs-ch/RTintdummy.c: New file. * gm2-libs-ch/Selective.c: New file. * gm2-libs-ch/SysExceptions.c: New file. * gm2-libs-ch/UnixArgs.c: New file. * gm2-libs-ch/cgetopt.c: New file. * gm2-libs-ch/choosetemp.c: New file. * gm2-libs-ch/dtoa.c: New file. * gm2-libs-ch/errno.c: New file. * gm2-libs-ch/host.c: New file. * gm2-libs-ch/ldtoa.c: New file. * gm2-libs-ch/pthdummy.c: New file. * gm2-libs-ch/termios.c: New file. * gm2-libs-ch/tools.c: New file. * gm2-libs-ch/wrapc.c: New file. * gm2-libs-ch/xlibc.c: New file. * gm2-libs-coroutines/Debug.def: New file. * gm2-libs-coroutines/Debug.mod: New file. * gm2-libs-coroutines/Executive.def: New file. * gm2-libs-coroutines/Executive.mod: New file. * gm2-libs-coroutines/KeyBoardLEDs.def: New file. * gm2-libs-coroutines/README.texi: New file. * gm2-libs-coroutines/SYSTEM.def: New file. * gm2-libs-coroutines/SYSTEM.mod: New file. * gm2-libs-coroutines/TimerHandler.def: New file. * gm2-libs-coroutines/TimerHandler.mod: New file. * gm2-libs-iso/COROUTINES.def: New file. * gm2-libs-iso/COROUTINES.mod: New file. * gm2-libs-iso/ChanConsts.def: New file. * gm2-libs-iso/ChanConsts.h: New file. * gm2-libs-iso/ChanConsts.mod: New file. * gm2-libs-iso/CharClass.def: New file. * gm2-libs-iso/CharClass.mod: New file. * gm2-libs-iso/ClientSocket.def: New file. * gm2-libs-iso/ClientSocket.mod: New file. * gm2-libs-iso/ComplexMath.def: New file. * gm2-libs-iso/ComplexMath.mod: New file. * gm2-libs-iso/ConvStringLong.def: New file. * gm2-libs-iso/ConvStringLong.mod: New file. * gm2-libs-iso/ConvStringReal.def: New file. * gm2-libs-iso/ConvStringReal.mod: New file. * gm2-libs-iso/ConvTypes.def: New file. * gm2-libs-iso/ConvTypes.mod: New file. * gm2-libs-iso/EXCEPTIONS.def: New file. * gm2-libs-iso/EXCEPTIONS.mod: New file. * gm2-libs-iso/ErrnoCategory.c: New file. * gm2-libs-iso/ErrnoCategory.def: New file. * gm2-libs-iso/GeneralUserExceptions.def: New file. * gm2-libs-iso/GeneralUserExceptions.mod: New file. * gm2-libs-iso/IOChan.def: New file. * gm2-libs-iso/IOChan.mod: New file. * gm2-libs-iso/IOConsts.def: New file. * gm2-libs-iso/IOConsts.mod: New file. * gm2-libs-iso/IOLink.def: New file. * gm2-libs-iso/IOLink.mod: New file. * gm2-libs-iso/IOResult.def: New file. * gm2-libs-iso/IOResult.mod: New file. * gm2-libs-iso/LongComplexMath.def: New file. * gm2-libs-iso/LongComplexMath.mod: New file. * gm2-libs-iso/LongConv.def: New file. * gm2-libs-iso/LongConv.mod: New file. * gm2-libs-iso/LongIO.def: New file. * gm2-libs-iso/LongIO.mod: New file. * gm2-libs-iso/LongMath.def: New file. * gm2-libs-iso/LongMath.mod: New file. * gm2-libs-iso/LongStr.def: New file. * gm2-libs-iso/LongStr.mod: New file. * gm2-libs-iso/LongWholeIO.def: New file. * gm2-libs-iso/LongWholeIO.mod: New file. * gm2-libs-iso/LowLong.def: New file. * gm2-libs-iso/LowLong.mod: New file. * gm2-libs-iso/LowReal.def: New file. * gm2-libs-iso/LowReal.mod: New file. * gm2-libs-iso/LowShort.def: New file. * gm2-libs-iso/LowShort.mod: New file. * gm2-libs-iso/M2EXCEPTION.def: New file. * gm2-libs-iso/M2EXCEPTION.mod: New file. * gm2-libs-iso/M2RTS.def: New file. * gm2-libs-iso/M2RTS.mod: New file. * gm2-libs-iso/MemStream.def: New file. * gm2-libs-iso/MemStream.mod: New file. * gm2-libs-iso/Preemptive.def: New file. * gm2-libs-iso/Preemptive.mod: New file. * gm2-libs-iso/Processes.def: New file. * gm2-libs-iso/Processes.mod: New file. * gm2-libs-iso/ProgramArgs.def: New file. * gm2-libs-iso/ProgramArgs.mod: New file. * gm2-libs-iso/README.texi: New file. * gm2-libs-iso/RTco.def: New file. * gm2-libs-iso/RTdata.def: New file. * gm2-libs-iso/RTdata.mod: New file. * gm2-libs-iso/RTentity.def: New file. * gm2-libs-iso/RTentity.mod: New file. * gm2-libs-iso/RTfio.def: New file. * gm2-libs-iso/RTfio.mod: New file. * gm2-libs-iso/RTgen.def: New file. * gm2-libs-iso/RTgen.mod: New file. * gm2-libs-iso/RTgenif.def: New file. * gm2-libs-iso/RTgenif.mod: New file. * gm2-libs-iso/RTio.def: New file. * gm2-libs-iso/RTio.mod: New file. * gm2-libs-iso/RandomNumber.def: New file. * gm2-libs-iso/RandomNumber.mod: New file. * gm2-libs-iso/RawIO.def: New file. * gm2-libs-iso/RawIO.mod: New file. * gm2-libs-iso/RealConv.def: New file. * gm2-libs-iso/RealConv.mod: New file. * gm2-libs-iso/RealIO.def: New file. * gm2-libs-iso/RealIO.mod: New file. * gm2-libs-iso/RealMath.def: New file. * gm2-libs-iso/RealMath.mod: New file. * gm2-libs-iso/RealStr.def: New file. * gm2-libs-iso/RealStr.mod: New file. * gm2-libs-iso/RndFile.def: New file. * gm2-libs-iso/RndFile.mod: New file. * gm2-libs-iso/SIOResult.def: New file. * gm2-libs-iso/SIOResult.mod: New file. * gm2-libs-iso/SLongIO.def: New file. * gm2-libs-iso/SLongIO.mod: New file. * gm2-libs-iso/SLongWholeIO.def: New file. * gm2-libs-iso/SLongWholeIO.mod: New file. * gm2-libs-iso/SRawIO.def: New file. * gm2-libs-iso/SRawIO.mod: New file. * gm2-libs-iso/SRealIO.def: New file. * gm2-libs-iso/SRealIO.mod: New file. * gm2-libs-iso/SShortIO.def: New file. * gm2-libs-iso/SShortIO.mod: New file. * gm2-libs-iso/SShortWholeIO.def: New file. * gm2-libs-iso/SShortWholeIO.mod: New file. * gm2-libs-iso/STextIO.def: New file. * gm2-libs-iso/STextIO.mod: New file. * gm2-libs-iso/SWholeIO.def: New file. * gm2-libs-iso/SWholeIO.mod: New file. * gm2-libs-iso/SYSTEM.def: New file. * gm2-libs-iso/SYSTEM.mod: New file. * gm2-libs-iso/Semaphores.def: New file. * gm2-libs-iso/Semaphores.mod: New file. * gm2-libs-iso/SeqFile.def: New file. * gm2-libs-iso/SeqFile.mod: New file. * gm2-libs-iso/ServerSocket.def: New file. * gm2-libs-iso/ServerSocket.mod: New file. * gm2-libs-iso/ShortComplexMath.def: New file. * gm2-libs-iso/ShortComplexMath.mod: New file. * gm2-libs-iso/ShortIO.def: New file. * gm2-libs-iso/ShortIO.mod: New file. * gm2-libs-iso/ShortWholeIO.def: New file. * gm2-libs-iso/ShortWholeIO.mod: New file. * gm2-libs-iso/SimpleCipher.def: New file. * gm2-libs-iso/SimpleCipher.mod: New file. * gm2-libs-iso/StdChans.def: New file. * gm2-libs-iso/StdChans.mod: New file. * gm2-libs-iso/Storage.def: New file. * gm2-libs-iso/Storage.mod: New file. * gm2-libs-iso/StreamFile.def: New file. * gm2-libs-iso/StreamFile.mod: New file. * gm2-libs-iso/StringChan.def: New file. * gm2-libs-iso/StringChan.mod: New file. * gm2-libs-iso/Strings.def: New file. * gm2-libs-iso/Strings.mod: New file. * gm2-libs-iso/SysClock.def: New file. * gm2-libs-iso/SysClock.mod: New file. * gm2-libs-iso/TERMINATION.def: New file. * gm2-libs-iso/TERMINATION.mod: New file. * gm2-libs-iso/TermFile.def: New file. * gm2-libs-iso/TermFile.mod: New file. * gm2-libs-iso/TextIO.def: New file. * gm2-libs-iso/TextIO.mod: New file. * gm2-libs-iso/WholeConv.def: New file. * gm2-libs-iso/WholeConv.mod: New file. * gm2-libs-iso/WholeIO.def: New file. * gm2-libs-iso/WholeIO.mod: New file. * gm2-libs-iso/WholeStr.def: New file. * gm2-libs-iso/WholeStr.mod: New file. * gm2-libs-iso/wrapsock.c: New file. * gm2-libs-iso/wrapsock.def: New file. * gm2-libs-iso/wraptime.c: New file. * gm2-libs-iso/wraptime.def: New file. * gm2-libs-min/M2RTS.def: New file. * gm2-libs-min/M2RTS.mod: New file. * gm2-libs-min/SYSTEM.def: New file. * gm2-libs-min/SYSTEM.mod: New file. * gm2-libs-min/libc.c: New file. * gm2-libs-min/libc.def: New file. * gm2-libs-pim/BitBlockOps.def: New file. * gm2-libs-pim/BitBlockOps.mod: New file. * gm2-libs-pim/BitByteOps.def: New file. * gm2-libs-pim/BitByteOps.mod: New file. * gm2-libs-pim/BitWordOps.def: New file. * gm2-libs-pim/BitWordOps.mod: New file. * gm2-libs-pim/BlockOps.def: New file. * gm2-libs-pim/BlockOps.mod: New file. * gm2-libs-pim/Break.c: New file. * gm2-libs-pim/Break.def: New file. * gm2-libs-pim/CardinalIO.def: New file. * gm2-libs-pim/CardinalIO.mod: New file. * gm2-libs-pim/Conversions.def: New file. * gm2-libs-pim/Conversions.mod: New file. * gm2-libs-pim/DebugPMD.def: New file. * gm2-libs-pim/DebugPMD.mod: New file. * gm2-libs-pim/DebugTrace.def: New file. * gm2-libs-pim/DebugTrace.mod: New file. * gm2-libs-pim/Delay.def: New file. * gm2-libs-pim/Delay.mod: New file. * gm2-libs-pim/Display.def: New file. * gm2-libs-pim/Display.mod: New file. * gm2-libs-pim/ErrorCode.def: New file. * gm2-libs-pim/ErrorCode.mod: New file. * gm2-libs-pim/FileSystem.def: New file. * gm2-libs-pim/FileSystem.mod: New file. * gm2-libs-pim/FloatingUtilities.def: New file. * gm2-libs-pim/FloatingUtilities.mod: New file. * gm2-libs-pim/InOut.def: New file. * gm2-libs-pim/InOut.mod: New file. * gm2-libs-pim/Keyboard.def: New file. * gm2-libs-pim/Keyboard.mod: New file. * gm2-libs-pim/LongIO.def: New file. * gm2-libs-pim/LongIO.mod: New file. * gm2-libs-pim/NumberConversion.def: New file. * gm2-libs-pim/NumberConversion.mod: New file. * gm2-libs-pim/README.texi: New file. * gm2-libs-pim/Random.def: New file. * gm2-libs-pim/Random.mod: New file. * gm2-libs-pim/RealConversions.def: New file. * gm2-libs-pim/RealConversions.mod: New file. * gm2-libs-pim/RealInOut.def: New file. * gm2-libs-pim/RealInOut.mod: New file. * gm2-libs-pim/Strings.def: New file. * gm2-libs-pim/Strings.mod: New file. * gm2-libs-pim/Termbase.def: New file. * gm2-libs-pim/Termbase.mod: New file. * gm2-libs-pim/Terminal.def: New file. * gm2-libs-pim/Terminal.mod: New file. * gm2-libs-pim/TimeDate.def: New file. * gm2-libs-pim/TimeDate.mod: New file. * gm2-libs/ASCII.def: New file. * gm2-libs/ASCII.mod: New file. * gm2-libs/Args.def: New file. * gm2-libs/Args.mod: New file. * gm2-libs/Assertion.def: New file. * gm2-libs/Assertion.mod: New file. * gm2-libs/Break.def: New file. * gm2-libs/Break.mod: New file. * gm2-libs/Builtins.def: New file. * gm2-libs/Builtins.mod: New file. * gm2-libs/COROUTINES.def: New file. * gm2-libs/COROUTINES.mod: New file. * gm2-libs/CmdArgs.def: New file. * gm2-libs/CmdArgs.mod: New file. * gm2-libs/Debug.def: New file. * gm2-libs/Debug.mod: New file. * gm2-libs/DynamicStrings.def: New file. * gm2-libs/DynamicStrings.mod: New file. * gm2-libs/Environment.def: New file. * gm2-libs/Environment.mod: New file. * gm2-libs/FIO.def: New file. * gm2-libs/FIO.mod: New file. * gm2-libs/FormatStrings.def: New file. * gm2-libs/FormatStrings.mod: New file. * gm2-libs/FpuIO.def: New file. * gm2-libs/FpuIO.mod: New file. * gm2-libs/GetOpt.def: New file. * gm2-libs/GetOpt.mod: New file. * gm2-libs/IO.def: New file. * gm2-libs/IO.mod: New file. * gm2-libs/Indexing.def: New file. * gm2-libs/Indexing.mod: New file. * gm2-libs/LMathLib0.def: New file. * gm2-libs/LMathLib0.mod: New file. * gm2-libs/LegacyReal.def: New file. * gm2-libs/LegacyReal.mod: New file. * gm2-libs/M2EXCEPTION.def: New file. * gm2-libs/M2EXCEPTION.mod: New file. * gm2-libs/M2RTS.def: New file. * gm2-libs/M2RTS.mod: New file. * gm2-libs/MathLib0.def: New file. * gm2-libs/MathLib0.mod: New file. * gm2-libs/MemUtils.def: New file. * gm2-libs/MemUtils.mod: New file. * gm2-libs/NumberIO.def: New file. * gm2-libs/NumberIO.mod: New file. * gm2-libs/OptLib.def: New file. * gm2-libs/OptLib.mod: New file. * gm2-libs/PushBackInput.def: New file. * gm2-libs/PushBackInput.mod: New file. * gm2-libs/README.texi: New file. * gm2-libs/RTExceptions.def: New file. * gm2-libs/RTExceptions.mod: New file. * gm2-libs/RTint.def: New file. * gm2-libs/RTint.mod: New file. * gm2-libs/SArgs.def: New file. * gm2-libs/SArgs.mod: New file. * gm2-libs/SCmdArgs.def: New file. * gm2-libs/SCmdArgs.mod: New file. * gm2-libs/SEnvironment.def: New file. * gm2-libs/SEnvironment.mod: New file. * gm2-libs/SFIO.def: New file. * gm2-libs/SFIO.mod: New file. * gm2-libs/SMathLib0.def: New file. * gm2-libs/SMathLib0.mod: New file. * gm2-libs/SYSTEM.def: New file. * gm2-libs/SYSTEM.mod: New file. * gm2-libs/Scan.def: New file. * gm2-libs/Scan.mod: New file. * gm2-libs/Selective.def: New file. * gm2-libs/StdIO.def: New file. * gm2-libs/StdIO.mod: New file. * gm2-libs/Storage.def: New file. * gm2-libs/Storage.mod: New file. * gm2-libs/StrCase.def: New file. * gm2-libs/StrCase.mod: New file. * gm2-libs/StrIO.def: New file. * gm2-libs/StrIO.mod: New file. * gm2-libs/StrLib.def: New file. * gm2-libs/StrLib.mod: New file. * gm2-libs/StringConvert.def: New file. * gm2-libs/StringConvert.mod: New file. * gm2-libs/SysExceptions.def: New file. * gm2-libs/SysStorage.def: New file. * gm2-libs/SysStorage.mod: New file. * gm2-libs/TimeString.def: New file. * gm2-libs/TimeString.mod: New file. * gm2-libs/UnixArgs.def: New file. * gm2-libs/cbuiltin.def: New file. * gm2-libs/cgetopt.def: New file. * gm2-libs/config-host: New file. * gm2-libs/config-host.in: New file. * gm2-libs/cxxabi.def: New file. * gm2-libs/dtoa.def: New file. * gm2-libs/errno.def: New file. * gm2-libs/gdbif.def: New file. * gm2-libs/gdbif.mod: New file. * gm2-libs/gm2-libs-host.h.in: New file. * gm2-libs/ldtoa.def: New file. * gm2-libs/libc.def: New file. * gm2-libs/libm.def: New file. * gm2-libs/sckt.def: New file. * gm2-libs/termios.def: New file. * gm2-libs/wrapc.def: New file. * gm2config.h.in: New file. * gm2spec.c: New file. * gm2version.h: New file. * images/LICENSE.IMG: New file. * images/gnu.eps: New file. * images/gnupng: New file. * init/README: New file. * init/gm2-gccinit: New file. * init/gm2lccinit: New file. * init/gm2lgeninit: New file. * init/gm2linit: New file. * init/gm2lorderinit: New file. * init/gm2minit: New file. * init/mcinit: New file. * init/ppginit: New file. * lang-options.h: New file. * lang-specs.h: New file. * lang.opt: New file. * m2-link-support.h: New file. * m2-tree.def: New file. * m2-tree.h: New file. * m2.flex: New file. * m2pp.c: New file. * m2pp.h: New file. * mc-boot-ch/GBuiltins.c: New file. * mc-boot-ch/GRTco.c: New file. * mc-boot-ch/GSYSTEM.c: New file. * mc-boot-ch/GSelective.c: New file. * mc-boot-ch/GSysExceptions.c: New file. * mc-boot-ch/GUnixArgs.c: New file. * mc-boot-ch/Gcbuiltin.c: New file. * mc-boot-ch/Gdtoa.c: New file. * mc-boot-ch/Gerrno.c: New file. * mc-boot-ch/Gldtoa.c: New file. * mc-boot-ch/Glibc.c: New file. * mc-boot-ch/Glibm.c: New file. * mc-boot-ch/Gmcrts.c: New file. * mc-boot-ch/Gmcrts.h: New file. * mc-boot-ch/Gnetwork.h: New file. * mc-boot-ch/Gpth.c: New file. * mc-boot-ch/Gtermios.c: New file. * mc-boot-ch/Gwrapc.c: New file. * mc-boot-ch/README: New file. * mc-boot-ch/network.c: New file. * mc-boot/GASCII.c: New file. * mc-boot/GASCII.h: New file. * mc-boot/GArgs.c: New file. * mc-boot/GArgs.h: New file. * mc-boot/GAssertion.c: New file. * mc-boot/GAssertion.h: New file. * mc-boot/GBreak.c: New file. * mc-boot/GBreak.h: New file. * mc-boot/GCOROUTINES.h: New file. * mc-boot/GCmdArgs.c: New file. * mc-boot/GCmdArgs.h: New file. * mc-boot/GDebug.c: New file. * mc-boot/GDebug.h: New file. * mc-boot/GDynamicStrings.c: New file. * mc-boot/GDynamicStrings.h: New file. * mc-boot/GEnvironment.c: New file. * mc-boot/GEnvironment.h: New file. * mc-boot/GFIO.c: New file. * mc-boot/GFIO.h: New file. * mc-boot/GFormatStrings.c: New file. * mc-boot/GFormatStrings.h: New file. * mc-boot/GFpuIO.c: New file. * mc-boot/GFpuIO.h: New file. * mc-boot/GIO.c: New file. * mc-boot/GIO.h: New file. * mc-boot/GIndexing.c: New file. * mc-boot/GIndexing.h: New file. * mc-boot/GM2EXCEPTION.c: New file. * mc-boot/GM2EXCEPTION.h: New file. * mc-boot/GM2RTS.c: New file. * mc-boot/GM2RTS.h: New file. * mc-boot/GMemUtils.c: New file. * mc-boot/GMemUtils.h: New file. * mc-boot/GNumberIO.c: New file. * mc-boot/GNumberIO.h: New file. * mc-boot/GPushBackInput.c: New file. * mc-boot/GPushBackInput.h: New file. * mc-boot/GRTExceptions.c: New file. * mc-boot/GRTExceptions.h: New file. * mc-boot/GRTco.h: New file. * mc-boot/GRTint.c: New file. * mc-boot/GRTint.h: New file. * mc-boot/GSArgs.c: New file. * mc-boot/GSArgs.h: New file. * mc-boot/GSFIO.c: New file. * mc-boot/GSFIO.h: New file. * mc-boot/GSYSTEM.h: New file. * mc-boot/GSelective.h: New file. * mc-boot/GStdIO.c: New file. * mc-boot/GStdIO.h: New file. * mc-boot/GStorage.c: New file. * mc-boot/GStorage.h: New file. * mc-boot/GStrCase.c: New file. * mc-boot/GStrCase.h: New file. * mc-boot/GStrIO.c: New file. * mc-boot/GStrIO.h: New file. * mc-boot/GStrLib.c: New file. * mc-boot/GStrLib.h: New file. * mc-boot/GStringConvert.c: New file. * mc-boot/GStringConvert.h: New file. * mc-boot/GSysExceptions.h: New file. * mc-boot/GSysStorage.c: New file. * mc-boot/GSysStorage.h: New file. * mc-boot/GTimeString.c: New file. * mc-boot/GTimeString.h: New file. * mc-boot/GUnixArgs.h: New file. * mc-boot/Galists.c: New file. * mc-boot/Galists.h: New file. * mc-boot/Gdecl.c: New file. * mc-boot/Gdecl.h: New file. * mc-boot/Gdtoa.h: New file. * mc-boot/Gerrno.h: New file. * mc-boot/Gkeyc.c: New file. * mc-boot/Gkeyc.h: New file. * mc-boot/Gldtoa.h: New file. * mc-boot/Glibc.h: New file. * mc-boot/Glibm.h: New file. * mc-boot/Glists.c: New file. * mc-boot/Glists.h: New file. * mc-boot/GmcComment.c: New file. * mc-boot/GmcComment.h: New file. * mc-boot/GmcComp.c: New file. * mc-boot/GmcComp.h: New file. * mc-boot/GmcDebug.c: New file. * mc-boot/GmcDebug.h: New file. * mc-boot/GmcError.c: New file. * mc-boot/GmcError.h: New file. * mc-boot/GmcFileName.c: New file. * mc-boot/GmcFileName.h: New file. * mc-boot/GmcLexBuf.c: New file. * mc-boot/GmcLexBuf.h: New file. * mc-boot/GmcMetaError.c: New file. * mc-boot/GmcMetaError.h: New file. * mc-boot/GmcOptions.c: New file. * mc-boot/GmcOptions.h: New file. * mc-boot/GmcPreprocess.c: New file. * mc-boot/GmcPreprocess.h: New file. * mc-boot/GmcPretty.c: New file. * mc-boot/GmcPretty.h: New file. * mc-boot/GmcPrintf.c: New file. * mc-boot/GmcPrintf.h: New file. * mc-boot/GmcQuiet.c: New file. * mc-boot/GmcQuiet.h: New file. * mc-boot/GmcReserved.c: New file. * mc-boot/GmcReserved.h: New file. * mc-boot/GmcSearch.c: New file. * mc-boot/GmcSearch.h: New file. * mc-boot/GmcStack.c: New file. * mc-boot/GmcStack.h: New file. * mc-boot/GmcStream.c: New file. * mc-boot/GmcStream.h: New file. * mc-boot/Gmcflex.h: New file. * mc-boot/Gmcp1.c: New file. * mc-boot/Gmcp1.h: New file. * mc-boot/Gmcp2.c: New file. * mc-boot/Gmcp2.h: New file. * mc-boot/Gmcp3.c: New file. * mc-boot/Gmcp3.h: New file. * mc-boot/Gmcp4.c: New file. * mc-boot/Gmcp4.h: New file. * mc-boot/Gmcp5.c: New file. * mc-boot/Gmcp5.h: New file. * mc-boot/GnameKey.c: New file. * mc-boot/GnameKey.h: New file. * mc-boot/Gpth.h: New file. * mc-boot/GsymbolKey.c: New file. * mc-boot/GsymbolKey.h: New file. * mc-boot/Gtermios.h: New file. * mc-boot/Gtop.c: New file. * mc-boot/Gvarargs.c: New file. * mc-boot/Gvarargs.h: New file. * mc-boot/Gwlists.c: New file. * mc-boot/Gwlists.h: New file. * mc-boot/Gwrapc.h: New file. * mc-boot/README: New file. * mc/Indexing.def: New file. * mc/Indexing.mod: New file. * mc/README: New file. * mc/alists.def: New file. * mc/alists.mod: New file. * mc/decl.def: New file. * mc/decl.mod: New file. * mc/decl.mod-extra: New file. * mc/keyc.def: New file. * mc/keyc.mod: New file. * mc/lists.def: New file. * mc/lists.mod: New file. * mc/m2flex.def: New file. * mc/mc.flex: New file. * mc/mcComment.def: New file. * mc/mcComment.h: New file. * mc/mcComment.mod: New file. * mc/mcComp.def: New file. * mc/mcComp.mod: New file. * mc/mcDebug.def: New file. * mc/mcDebug.mod: New file. * mc/mcError.def: New file. * mc/mcError.mod: New file. * mc/mcFileName.def: New file. * mc/mcFileName.mod: New file. * mc/mcLexBuf.def: New file. * mc/mcLexBuf.h: New file. * mc/mcLexBuf.mod: New file. * mc/mcMetaError.def: New file. * mc/mcMetaError.mod: New file. * mc/mcOptions.def: New file. * mc/mcOptions.mod: New file. * mc/mcPreprocess.def: New file. * mc/mcPreprocess.mod: New file. * mc/mcPretty.def: New file. * mc/mcPretty.mod: New file. * mc/mcPrintf.def: New file. * mc/mcPrintf.mod: New file. * mc/mcQuiet.def: New file. * mc/mcQuiet.mod: New file. * mc/mcReserved.def: New file. * mc/mcReserved.h: New file. * mc/mcReserved.mod: New file. * mc/mcSearch.def: New file. * mc/mcSearch.mod: New file. * mc/mcStack.def: New file. * mc/mcStack.mod: New file. * mc/mcStream.def: New file. * mc/mcStream.mod: New file. * mc/mcflex.def: New file. * mc/mcp1.def: New file. * mc/mcp2.def: New file. * mc/mcp3.def: New file. * mc/mcp4.def: New file. * mc/mcp5.def: New file. * mc/nameKey.def: New file. * mc/nameKey.mod: New file. * mc/symbolKey.def: New file. * mc/symbolKey.mod: New file. * mc/top.mod: New file. * mc/varargs.def: New file. * mc/varargs.mod: New file. * mc/wlists.def: New file. * mc/wlists.mod: New file. * patches/gcc/11.1.0/01-patches: New file. * patches/gcc/11.1.0/02-patches: New file. * patches/gcc/11.1.0/03-patches: New file. * patches/gcc/11.1.0/04-patches: New file. * patches/gcc/11.1.0/05-patches: New file. * patches/gcc/11.1.0/06-patches: New file. * patches/gcc/11.1.0/07-patches: New file. * patches/gcc/11.1.0/08-patches: New file. * patches/gcc/11.1.0/09-patches: New file. * patches/gcc/11.1.0/10-patches: New file. * patches/gcc/11.1.0/11-patches: New file. * patches/gcc/11.1.0/12-patches: New file. * patches/gcc/11.1.0/13-patches: New file. * patches/gcc/11.1.0/14-patches: New file. * patches/gcc/11.1.0/15-patches: New file. * patches/gcc/11.1.0/16-patches: New file. * patches/gcc/11.1.0/17-patches: New file. * patches/gcc/11.1.0/18-patches: New file. * patches/gcc/11.1.0/19-patches: New file. * patches/gcc/11.1.0/20-patches: New file. * patches/gcc/11.1.0/21-patches: New file. * patches/gcc/11.1.0/22-patches: New file. * patches/gcc/11.1.0/23-patches: New file. * patches/gcc/3.3.6/01.waldek_patch_gcc: New file. * patches/gcc/3.3.6/02.gaius_patch_gcc: New file. * patches/gcc/4.1.0/01.gaius_patch_gcc: New file. * patches/gcc/4.1.1/01.gaius_patch_gcc: New file. * patches/gcc/4.1.2/01-patches: New file. * patches/gcc/4.1.2/02-patches: New file. * patches/gcc/4.1.2/ChangeLog: New file. * patches/gcc/4.1.2/old/01.gaius_patch_gcc: New file. * patches/gcc/4.1.2/old/02.gaius_rs6000_lang: New file. * patches/gcc/4.1.2/old/03.michael_i386: New file. * patches/gcc/4.1.2/old/04.gaius_patch_gcc: New file. * patches/gcc/4.1.2/old/05.gaius_patch_gcc: New file. * patches/gcc/4.1.2/old/06.gaius_patch_tree: New file. * patches/gcc/4.1.2/old/07.michael_i386: New file. * patches/gcc/4.1.2/old/08.gaius_ipa_type_escape.c: New file. * patches/gcc/4.1.2/old/09.gaius_patch_config: New file. * patches/gcc/4.1.2/old/10.michael_snowleopard1: New file. * patches/gcc/4.1.2/old/11.michael_snowleopard2: New file. * patches/gcc/4.1.2/old/12.gaius_patch_tree_flow_inline_h: New file. * patches/gcc/4.7.1/01-patches: New file. * patches/gcc/4.7.1/02-patches: New file. * patches/gcc/4.7.3/01-patches: New file. * patches/gcc/4.7.3/02-patches: New file. * patches/gcc/4.7.3/03-patches: New file. * patches/gcc/4.7.3/04-patches: New file. * patches/gcc/4.7.3/05-patches: New file. * patches/gcc/4.7.3/06-patches: New file. * patches/gcc/4.7.3/07-patches: New file. * patches/gcc/4.7.3/08-patches: New file. * patches/gcc/4.7.3/09-patches: New file. * patches/gcc/4.7.3/10-patches: New file. * patches/gcc/4.7.3/11-patches: New file. * patches/gcc/4.7.3/12-patches: New file. * patches/gcc/4.7.4/01-patches: New file. * patches/gcc/4.7.4/02-patches: New file. * patches/gcc/4.7.4/03-patches: New file. * patches/gcc/4.7.4/04-patches: New file. * patches/gcc/4.7.4/05-patches: New file. * patches/gcc/4.7.4/06-patches: New file. * patches/gcc/4.7.4/07-patches: New file. * patches/gcc/4.7.4/08-patches: New file. * patches/gcc/4.7.4/09-patches: New file. * patches/gcc/4.7.4/10-patches: New file. * patches/gcc/4.7.4/11-patches: New file. * patches/gcc/4.7.4/12-patches: New file. * patches/gcc/5.2.0/01-patches: New file. * patches/gcc/5.2.0/02-patches: New file. * patches/gcc/5.2.0/03-patches: New file. * patches/gcc/5.2.0/04-patches: New file. * patches/gcc/5.2.0/05-patches: New file. * patches/gcc/5.2.0/06-patches: New file. * patches/gcc/5.2.0/07-patches: New file. * patches/gcc/5.2.0/08-patches: New file. * patches/gcc/5.2.0/09-patches: New file. * patches/gcc/5.2.0/10-patches: New file. * patches/gcc/5.2.0/11-patches: New file. * patches/gcc/5.2.0/12-patches: New file. * patches/gcc/6.4.0/01-patches: New file. * patches/gcc/6.4.0/02-patches: New file. * patches/gcc/6.4.0/03-patches: New file. * patches/gcc/6.4.0/04-patches: New file. * patches/gcc/6.4.0/05-patches: New file. * patches/gcc/6.4.0/06-patches: New file. * patches/gcc/6.4.0/07-patches: New file. * patches/gcc/6.4.0/08-patches: New file. * patches/gcc/6.4.0/09-patches: New file. * patches/gcc/6.4.0/10-patches: New file. * patches/gcc/6.4.0/11-patches: New file. * patches/gcc/trunc/01-patches: New file. * patches/gcc/trunc/02-patches: New file. * patches/gcc/trunc/03-patches: New file. * patches/gcc/trunc/04-patches: New file. * patches/gcc/trunc/05-patches: New file. * patches/gcc/trunc/06-patches: New file. * patches/gcc/trunc/07-patches: New file. * patches/gcc/trunc/08-patches: New file. * patches/gcc/trunc/09-patches: New file. * patches/gcc/trunc/10-patches: New file. * patches/gcc/trunc/11-patches: New file. * patches/gcc/trunk/01-patches: New file. * patches/gcc/trunk/02-patches: New file. * patches/gcc/trunk/03-patches: New file. * patches/gcc/trunk/04-patches: New file. * patches/gcc/trunk/05-patches: New file. * patches/gcc/trunk/06-patches: New file. * patches/gcc/trunk/07-patches: New file. * patches/gcc/trunk/08-patches: New file. * patches/gcc/trunk/09-patches: New file. * patches/gcc/trunk/10-patches: New file. * patches/gcc/trunk/11-patches: New file. * patches/gcc/trunk/12-patches: New file. * patches/gcc/trunk/13-patches: New file. * patches/gcc/trunk/15-patches: New file. * patches/gcc/trunk/23-patches: New file. * patches/gcc/trunk/24-patches: New file. * patches/gcc/trunk/25-patches: New file. * patches/gdb/6.3/01.waldek_patch_gdb: New file. * patches/gdb/6.3/02.gaius_patch_gdb: New file. * plugin/README: New file. * plugin/m2rte.c: New file. * tools-src/README: New file. * tools-src/array2index.py: New file. * tools-src/boilerplate.py: New file. * tools-src/buildpg: New file. * tools-src/buildsyntax: New file. * tools-src/calcpath: New file. * tools-src/createUlmSys: New file. * tools-src/def2texi.py: New file. * tools-src/gensum.py: New file. * tools-src/incfile: New file. * tools-src/makeSystem: New file. * tools-src/makeconfigure: New file. * tools-src/makeversion: New file. * tools-src/mklink.c: New file. * tools-src/tidydates.py: New file. * version.c: New file. * www/Makefile.in: New file. * www/README: New file. * www/gm2-logo.ms: New file. * www/gm2.css: New file. * www/tools/createhtml.py: New file. * www/tools/texi2tr/html/about.tpl: New file. * www/tools/texi2tr/html/community.html: New file. * www/tools/texi2tr/html/community.tpl: New file. * www/tools/texi2tr/html/development.html: New file. * www/tools/texi2tr/html/development.tpl: New file. * www/tools/texi2tr/html/download.tpl: New file. * www/tools/texi2tr/html/footer.ht: New file. * www/tools/texi2tr/html/header.ht: New file. * www/tools/texi2tr/html/heading.ht: New file. * www/tools/texi2tr/html/homepage.tpl: New file. * www/tools/texi2tr/html/index.html: New file. * www/tools/texi2tr/html/license.tpl: New file. * www/tools/texi2tr/html/news.html: New file. * www/tools/texi2tr/html/news.tpl: New file. * www/tools/texi2tr/html/platforms.tpl: New file. * www/tools/texi2tr/html/release.tpl: New file. * www/tools/texi2tr/html/texi2tr.css: New file. * www/tools/texi2tr/html/title.ht: New file. * www/tools/texi2tr/html/users.tpl: New file. * www/tools/texi2tr/png/200px-Heckert_GNU_white.png: New file. * www/tools/texi2tr/png/debian-swirl48x48.png: New file. * www/tools/texi2tr/png/develop.png: New file. * www/tools/texi2tr/png/install.png: New file. * www/tools/texi2tr/png/library.png: New file. * www/tools/texi2tr/png/menu-left-tab.png: New file. * www/tools/texi2tr/png/menu-right-tab.png: New file. * www/tools/texi2tr/png/menu-selected-left-tab.png: New file. * www/tools/texi2tr/png/menu-selected-right-tab.png: New file. * www/tools/texi2tr/png/next.png: New file. * www/tools/texi2tr/png/note.png: New file. * www/tools/texi2tr/png/prev.png: New file. * www/tools/texi2tr/png/release.png: New file. * www/tools/texi2tr/png/snapshot.png: New file. * www/tools/texi2tr/png/terminal.png: New file. * www/tools/texi2tr/png/users.png: New file. * www/tools/texi2tr/src/config.py: New file. * www/tools/texi2tr/src/navigation.py: New file. * www/tools/texi2tr/src/outputdev.py: New file. * www/tools/texi2tr/src/texi2tr.py: New file. 2021-07-02 Gaius Mulley * doc/gm2.texi (Obtaining): added. (Obtaining) New using node added. * www/tools/createhtml.py: __RELEASE__ substitution implemented. * www/tools/texi2tr/html/users.tpl (User guide): points to __RELEASE__/using.html. (Libaries) point to __RELEASE__/Libraries.html. 2021-07-01 Gaius Mulley * www/Makefile.in: moved {news,community,development}.html into .tpl and adjusted the rules. * www/tools/createhtml.py: (__WEBRELEASE__) substitution implemented. (usage) New function. Handle the -w option. * www/tools/texi2tr/html/news.tpl: (New file). * www/tools/texi2tr/html/development.tpl: (New file). * www/tools/texi2tr/html/community.tpl: (New file). * www/Makefile.in: remove development.html rule. * www/tools/texi2tr/html/users.tpl: (using) reference use __WEBRELEASE__. (obtaining) reference use __WEBRELEASE__. (libraries) reference use __WEBRELEASE__. * www/tools/texi2tr/html/title.ht: use template for HOME_HREF and 12_HREF. * www/Makefile.in: create copy of title.ht in build directory and include build directory in template path for texi2tr. * www/Makefile.in: corrected install rule. * www/Makefile.in: added -w option to invocation of createhtml.py. 2021-06-30 Gaius Mulley * www/Makefile.in: copy $(RELEASE)/*.{html,png} files into WWWROOT/www/gm2/$(RELEASE). * www/tools/createhtml.py: add 11_HREF substitution. * www/tools/texi2tr/html/release.tpl: added note about GCC_11. * www/tools/texi2tr/html/texi2tr.css: updated to include new style for release tag. * www/tools/texi2tr/src/outputdev.py: (setSubDirectory) New method. * www/tools/texi2tr/src/texi2tr.py: set subDirectory. Join subdirectory to node. Permit -s subdirectory option. 2021-06-27 Gaius Mulley * Make-lang.in: renamed getopt.c to cgetopt.c. * gm2-compiler/P2SymBuild.mod: (BuildProcedureType) call CheckForExportedImplementation. Fixes a bug report by Derek Wyss (https://lists.nongnu.org/archive/html/gm2/2021-06/msg00005.html). * gm2-compiler/SymbolTable.mod: (CheckForImplementedExports) reformatted. (UnImplementedSymbolError) detect procedure types and issue a message about undeclared procedure types. Also provide a generic error for any non procedure, proc type or type. 2021-06-24 Gaius Mulley * website branch created. 2021-06-22 Gaius Mulley * m2/gm2-compiler/M2ColorString.mod: import open_quote and close_quote from m2color. * m2/gm2-gcc/m2color.c: (open_quote) New function implemented. (close_quote) New function implemented, both functions import open and close quotes from gcc/intl.c to pick up whether the host has utf-8 capability. * m2/gm2-gcc/m2color.def: (open_quote) New function defined. (close_quote) New function defined. * m2/gm2-gcc/m2color.h: (open_quote) and (close_quote) provide C prototypes for external functions. 2021-06-21 Gaius Mulley * tools-src/calcpath: (New file). * Make-lang.in: (m2/gm2-libs/gm2-libs-host.h) use calcpath to determine the srcdir of the new subdirectory. (m2/gm2config.h) use calcpath to determine the srcdir of the new subdirectory. Fixes an error and based on a patch reported by Segher Boessenkool . * Make-lang.in: (m2/gm2-libs/gm2-libs-host.h) Restore tabs. * Make-lang.in: (m2/gm2config.h) Restore tabs. * Make-lang.in: Replaced getopt.c by cgetopt.c. * gm2-libs/getopt.def: Renamed gm2-libs/cgetopt.def. * gm2-libs-ch/getopt.c: Renamed gm2-libs-ch/cgetopt.c. Replaced getopt_ by cgetopt_. Fixes an error reported by Segher Boessenkool . * tools-src/calcpath: (Corrected header comment). * tools-src/calcpath: (Redirect error echo to stderr). 2021-06-19 Matthias Klose * Make-lang.in: introduce parallel linking. * Make-lang.in (m2.serial): New target. (cc1gm2): Depend on $(m2.prev). (stageN/m2/cc1gm2): Call LLINKER, also call LINK_PROGRESS. 2021-06-19 Gaius Mulley * Make-lang.in: commented out libgcc-support from %.o rules. * Make-lang.in: removed libgcc-support from %.o rules. Fixes make install as it no longer rebuilds the executables. 2021-06-17 Gaius Mulley * Make-lang.in: removed gm2m from the tools to be installed. * tools-src/makeSystem: write SYSTEM.o to /dev/null. * patches/gcc/trunk/01-patches: (rebuilt). * patches/gcc/trunk/02-patches: (rebuilt). Add objects containing a date string into the list of objects to be ignored. * Make-lang.in: added header dependancies to m2rte. * patches/gcc/trunk/24-patches: (rebuilt). Corrected missing text. 2021-06-16 Gaius Mulley * patches/gcc/trunk/01-patches: (Rebuilt). Cast value since on some hosts value is declared as a long long int. * tools-src/makeSystem: remove SYSTEM.o after creating definition module. * Make-lang.in: rewritten m2.info rule. * Make-lang.in: added $(M2LINK) as a dependancy to all link rules. Added GCC header dependancies to object build rules. 2021-06-15 Gaius Mulley * patches/gcc/trunk/01-patches: (Rebuilt). Disable libgm2 by default and do not configure it unless Modula-2 was specified. * patches/gcc/trunk/02-patches: (Rebuilt). Disable libgm2 by default and do not configure it unless Modula-2 was specified. * patches/gcc/trunk/08-patches: (Rebuilt). add libstdc++-v3 as a dependant for gm2tools. 2021-06-14 Gaius Mulley * Make-lang.in: corrected many include paths to pick up gm2-libs-host.h. * gm2-gcc/rtegraph.c: remove include use "mpfr.h" instead. * gm2-ici/m2linemap.c: remove include use config.h system.h. * gm2-libs-ch/Selective.c: remove system includes and use gcc config.h system.h instead. * gm2-libs-ch/SysExceptions.c: remove system includes and use gcc config.h system.h instead. * gm2-libs-ch/choosetemp.c: remove system includes and use gcc config.h system.h instead. * gm2-libs-ch/dtoa.c: remove system includes and use gcc config.h system.h instead. * gm2-libs-ch/errno.c: remove system includes and use gcc config.h system.h instead. * gm2-libs-ch/getopt.c: remove system includes and use gcc config.h system.h instead. * gm2-libs-ch/host.c: remove system includes and use gcc config.h system.h instead. * gm2-libs-ch/ldtoa.c: remove system includes and use gcc config.h system.h instead. * gm2-libs-ch/termios.c: remove system includes and use gcc config.h system.h instead. * gm2-libs-ch/tools.c: remove system includes and use gcc config.h system.h instead. * gm2-libs-ch/wrapc.c: remove system includes and use gcc config.h system.h instead. * gm2-libs-ch/xlibc.c: remove system includes and use gcc config.h system.h instead. * gm2-libs/gm2-libs-host.h.in: remove PACKAGE_BUGREPORT, PACKAGE_NAME, PACKAGE_STRING, PACKAGE_TARNAME, PACKAGE_VERSION and PACKAGE_URL. * mc-boot-ch/GSelective.c: remove system includes and use gcc config.h system.h instead. * mc-boot-ch/GSysExceptions.c: remove system includes and use gcc config.h system.h instead. * mc-boot-ch/Gcbuiltin.c: remove system includes and use gcc config.h system.h instead. * mc-boot-ch/Gdtoa.c: remove system includes and use gcc config.h system.h instead. * mc-boot-ch/Gerrno.c: remove system includes and use gcc config.h system.h instead. * mc-boot-ch/Gldtoa.c: remove system includes and use gcc config.h system.h instead. * mc-boot-ch/Glibc.c: remove system includes and use gcc config.h system.h instead. * mc-boot-ch/Glibm.c: remove system includes and use gcc config.h system.h instead. * mc-boot-ch/Gmcrts.c: remove system includes and use gcc config.h system.h instead. * mc-boot-ch/Gpth.c: remove system includes and use gcc config.h system.h instead. * mc-boot-ch/Gtermios.c: remove system includes and use gcc config.h system.h instead. * mc-boot-ch/Gwrapc.c: remove system includes and use gcc config.h system.h instead. * mc-boot-ch/network.c: remove system includes and use gcc config.h system.h instead. * analyzer branch created. * removed all analyzer patches and analyzer testsuite tests on master for now. 2021-06-12 Gaius Mulley * Make-lang.in: remove duplicate --gcc-config-system from mc. Documentation rules now refer to gm2.texi contained in ../gcc. * NEWS: (updated gm2 into the gcc tree). * config-lang.in: removed examples. * el/gm2-mode.el: fixed date. * gm2-compiler/M2Base.mod: (InitSystem) no longer has a parameter. * gm2-compiler/M2LexBuf.mod: improved formatting. * gm2-compiler/M2Quads.mod: (PushTFADrwtok) corrected end name. * gm2-compiler/M2SSA.def: (EnableSSA) disabled. * gm2-compiler/M2System.def: (InitSystem) no longer has a parameter. * gm2-compiler/M2System.mod: (InitSystem) no longer has a parameter. * gm2-compiler/P1SymBuild.mod: (P1StartBuildImplementationModule) removed unused variable and tidied up formatting. * gm2-gcc/m2block.c: added comment explaining why commented out code should remain. * gm2-gcc/m2builtins.c: removed commented out code. * gm2-gcc/m2expr.c: removed commented out code. 2021-06-11 Gaius Mulley * patches/gcc/trunk/23-patches: (New file). Patch for hwint.h. * patches/gcc/trunk/24-patches: (new file). Patch for install.texi. * patches/gcc/trunk/24-patches: (new file). Patch for sourcebuild.texi. * m2/Make-lang.in: (m2.html) renamed documentation m2.texi. (m2.dvi) renamed documentation m2.texi, (m2.pdf) renamed documentation m2.texi. (MC_ARGS) add --gcc-config-system. (m2/gm2-libs-boot/%.o) use --gcc-config-system. Add --gcc-config-system to all bootstrap rules to use GCC config.h and system.h rather than installed headers. Alter all include search paths to find config.h and system.h and libiberty. * bnf/gm2l.bnf: (DisplayUsage) New procedure called when -h or --help is used. * gm2-compiler/gm2lcc.mod: (DisplayHelp) New procedure called when -h or --help is used. * gm2-compiler/gm2lgen.mod: (DisplayHelp) New procedure called when -h or --help is used. Tidied up formatting. * gm2-compiler/gm2lorder.mod: Tidied up formatting. * gm2-compiler/ppg.mod: (DisplayHelp) New procedure called when -h or --help is used. * gm2-libs-ch/choosetemp.c: use "libiberty.h" rather than . * gm2.texi: removed subsection. * gm2spec.c: remove dependance upon installed headers. * mc-boot: (all files in this directory rebuilt). * mc/README: removed old done markers. * mc/decl.mod: (doCapC) detect getGccConfigSystem and use TOUPPER rather than toupper. * mc/keyc.mod: import getGccConfigSystem and issue include config.h include system.h if this switch is on. Also use safe-ctype.h rather than ctype.h. Avoid system headers if this switch is on. Add true and false to the macros to be avoided. Add new to the list of keywords to be avoided. * mc/mcOptions.def: (getGccConfigSystem) New procedure function. * mc/mcOptions.mod: Updated year and implemented (getGccConfigSystem). Update help to include --gcc-config-system. (handleOption) detect --gcc-config-system. * tools-src/mklink.c: allow to be build by a c++ compiler. Remove dependance upon installed headers, use config.h and system.h. 2021-06-07 Gaius Mulley * gm2-ici/README: added gm2m to list of tools. * Make-lang.in: (GM2_LINK_TOOLS) only set to gm2m. (HAVE_STPCPY) removed. (m2/gm2config.h) removed debugging diagnostic. Removed commented out rules and tidied comments to use GNU style. (check_module-2) Removed redundant equivalence rule. * bnf/gm2m.bnf: (ParseArgs) use printf1 and use correct format specifier (%s). * gm2-compiler/M2GCCDeclare.mod: tidied up long comment. * m2/gm2-gcc/m2linemap.def: change definition module to definition for "C" and explicitly export qualified all identifiers. * gm2-libiberty/pexecute.def: change to definition module for "C". * patches/gcc/trunk/[01-22]-patches: (rebuilt). * Make-lang.in: (GM2_LINK_TOOLS_INSTALL) new definition. (GM2_LINK_TOOLS) defined to allow bootstrapping gm2tools. 2021-05-31 Gaius Mulley * Make-lang.in: renamed gm2-tools directory to gm2-ici. Updated all gm2-tool rules. * config-lang.in: mkdir gm2-ici and gm2-ici-boot. Remove mkdir gm2-tools and gm2-tools-boot. 2021-05-30 Gaius Mulley * gm2-gcc/gcc-consolidation.h: include realmpfr.h. remove include stdio.h. * gm2-gcc/init.c: remove include stdio.h. include config.h and system.h. * m2/gm2-lang.c: remove include mpfr.h. 2021-05-28 Gaius Mulley * patches/gcc/trunk/22-patches: rebuilt after tidying up the code. * gm2-gcc/m2decl.c: (m2decl_DeclareKnownVariable) tidied up safety checks with calls to gcc_assert. 2021-05-27 Gaius Mulley * patches/gcc/trunk/14-patches: (removed brig patch). * patches/gcc/trunk/23-patches: (renamed as 14-patches). * patches/gcc/trunk/{01-22}-patches: rebuilt. * Make-lang.in: removed reference to version.o * gm2-compiler/M2SSA.def: (New file). * gm2-compiler/M2SSA.mod: (New file). * patches/gcc/trunk/{01-22}-patches: rebuilt. 2021-05-26 Gaius Mulley * Make-lang.in: added entries for M2SSA.def and M2SSA.mod. * bnf/m2-2.bnf: (Qualident) pass tok to RequestSym. * bnf/m2-3.bnf: (Qualident) rewritten to generate a virtual token for the complete qualident. * bnf/m2-c.bnf: (Qualident) rewritten to generate a virtual token for the complete qualident. * bnf/m2-h.bnf: (Qualident) rewritten to generate a virtual token for the complete qualident. * gm2-compiler/M2Base.def: (IsNeededAtRunTime) introduce extra parameter, tok. * gm2-compiler/M2Base.mod: ImportFrom changed to include location position. RequestSym changed to include location position. FromModuleGetSym changed to include location position. (IsCompatible) short circuit the same types. * gm2-compiler/M2Code.mod: (DetermineSubExpTemporaries) New procedure. (Code) call DetermineSubExpTemporaries after dependant types have been created. * gm2-compiler/M2GCCDeclare.def: (DeclareLocalVariable) New procedure. * gm2-compiler/M2GCCDeclare.def: (DeclareLocalVariables) changed parameter names to be more informative. (DeclareLocalVariable) New procedure. Updated formatting to use GNU coding standard spacing. * gm2-compiler/M2GenGCC.mod: (Replace) New procedure. (CodeFunctValue) check for SSA variable and call Replace if necessary. (checkDeclare) New procedure. (CodeBinaryCheck) check if SSA variable needs to be replaced. (CodeUnaryCheck) check if SSA variable needs to be replaced. (CodeBecomes) check if SSA variable needs to be replaced. * gm2-compiler/M2Quads.mod: Updated some of the procedures to adhere to GNU coding standard spacing. Change all calls to RequestSym to pass location reference. (BuildCaseEquality) no longer use GetTokenNo but the location of the expression on the expression stack. * gm2-compiler/M2Scope.mod: added developer debugging information. * gm2-compiler/M2System.def: (InitSystem) pass location rather than tokenno. * gm2-compiler/P1SymBuild.mod: use tokenno on the expression stack rather than GetTokenNo when building import/export lists. * gm2-compiler/P2SymBuild.mod: (BuildImportOuterModule) (BuildImportInnerModule) change GetExported to pass token number stored on the expression stack. (BuildVarientSelector) pass token number on the expression stack rather than GetTokenNo. * gm2-compiler/P3SymBuild.mod: (StartBuildInnerModule) use expression stack tokenno when calling RequestSym. (CheckImportListOuterModule) use expression stack tokenno when calling RequestSym. (StartBuildProcedure) use expression stack tokenno when calling RequestSym. (BuildConst) use expression stack tokenno when calling RequestSym. (BuildVarAtAddress) use expression stack tokenno when calling RequestSym. * gm2-compiler/PCSymBuild.mod: (PCStartBuildInnerModule) use expression stack tokenno when calling RequestSym. (PCStartBuildProcedure) use expression stack tokenno when calling RequestSym. (BuildConst) use expression stack tokenno when calling RequestSym. (StartDesConst) use expression stack tokenno when calling RequestSym. * gm2-compiler/SymbolConversion.mod: (AddTemporaryKnown) New procedure. * gm2-compiler/SymbolTable.def: (PutVariableSSA) New procedure. (IsVariableSSA) New procedure function. (GetDeclareSym) introduce token position parameter. (FromModuleGetSym) introduce token position parameter. (RequestSym) introduce token position parameter. (PutExportQualified) introduce token position parameter. (PutExportUnQualified) introduce token position parameter. (PutExportUnImplemented) introduce token position parameter. (GetExported) introduce token position parameter. (GetFromOuterModule) introduce token position parameter. (UnknownReported) New procedure. * gm2-compiler/SymbolTable.mod: (PutVariableSSA) Implement new procedure. (IsVariableSSA) New procedure function. (GetDeclareSym) introduce token position parameter. (FromModuleGetSym) introduce token position parameter. (RequestSym) introduce token position parameter. (PutExportQualified) introduce token position parameter. (PutExportUnQualified) introduce token position parameter. (PutExportUnImplemented) introduce token position parameter. (GetExported) introduce token position parameter. (GetFromOuterModule) introduce token position parameter. (UnknownReported) Implement new procedure. * gm2-gcc/init.c: call M2_M2SSA_init before module compilation. * gm2-gcc/m2decl.c: attempt to create a nameless temporary if necessary. * gm2-gcc/m2statement.c: GNU coding standard formatting changes. * init/gm2-gccinit: add M2SSA to list of compiler modules. 2021-05-06 Gaius Mulley * gm2-compiler/M2GenGCC.mod: remove GetTokenNo from import. (UseBuiltin) introduce new parameter tokenno and use this instead of GetTokenNo (). Change all calls to UseBuiltin to pass the tokenno across. Fixes a bug (a bad error position) seen if a constant is created by a folded builtin procedure function. 2021-04-29 Gaius Mulley * NEWS: version 1.9.5. * gm2-libs/config-host.in: updated to 1.9.5. * version.c: 1.9.5. 2021-04-28 Gaius Mulley * Make-lang.in: added gmp.h header file include directories to the m2rte plugin compile rule. * mc-boot/GDynamicStrings.c: regenerated. * mc-boot/GEnvironment.c: regenerated. * mc-boot/GFIO.c: regenerated. * mc-boot/GFormatStrings.c: regenerated. * mc-boot/GIO.c: regenerated. * mc-boot/GIndexing.c: regenerated. * mc-boot/GM2EXCEPTION.c: regenerated. * mc-boot/GPushBackInput.c: regenerated. * mc-boot/GRTExceptions.c: regenerated. * mc-boot/GRTint.c: regenerated. * mc-boot/GSArgs.c: regenerated. * mc-boot/GSFIO.c: regenerated. * mc-boot/GStdIO.c: regenerated. * mc-boot/GStringConvert.c: regenerated. * mc-boot/GSysStorage.c: regenerated. * mc-boot/GTimeString.c: regenerated. * mc-boot/Galists.c: regenerated. * mc-boot/Gdecl.c: regenerated. * mc-boot/Gkeyc.c: regenerated. * mc-boot/Glists.c: regenerated. * mc-boot/GmcComment.c: regenerated. * mc-boot/GmcComp.c: regenerated. * mc-boot/GmcDebug.c: regenerated. * mc-boot/GmcError.c: regenerated. * mc-boot/GmcLexBuf.c: regenerated. * mc-boot/GmcMetaError.c: regenerated. * mc-boot/GmcOptions.c: regenerated. * mc-boot/GmcPretty.c: regenerated. * mc-boot/GmcPrintf.c: regenerated. * mc-boot/GmcSearch.c: regenerated. * mc-boot/GmcStack.c: regenerated. * mc-boot/GmcStream.c: regenerated. * mc-boot/Gmcp1.c: regenerated. * mc-boot/Gmcp2.c: regenerated. * mc-boot/Gmcp3.c: regenerated. * mc-boot/Gmcp4.c: regenerated. * mc-boot/Gmcp5.c: regenerated. * mc-boot/GnameKey.c: regenerated. * mc-boot/GsymbolKey.c: regenerated. * mc-boot/Gvarargs.c: regenerated. * mc-boot/Gwlists.c: regenerated. * mc/keyc.mod: redefine NULL for OpenBSD. * testsuite/gm2/analyzer/fail/callbyref3badreturn.mod: added dg-warning. * testsuite/gm2/analyzer/fail/testnoreturn.mod: added dg-warning. 2021-04-26 Gaius Mulley * gm2-compiler/M2Quads.mod: improve formatting. * gm2-compiler/SymbolTable.mod: improve formatting. * patches/gcc/trunk/19-patches: (New file). * patches/gcc/trunk/20-patches: (New file). * patches/gcc/trunk/21-patches: (New file). * patches/gcc/trunk/22-patches: (New file). * patches/gcc/trunk/23-patches: (New file). 2021-04-18 Gaius Mulley * patches/gcc/trunk/16-patch: (on_deallocator_call) defends against skip_reference returning NULL. 2021-04-17 Gaius Mulley * bnf/m2-1.bnf: calls to BuildNumber pass tokenpos. * bnf/m2-2.bnf: calls to BuildNumber pass tokenpos. * bnf/m2-3.bnf: calls to BuildNumber pass tokenpos. * bnf/m2-c.bnf: calls to BuildNumber pass tokenpos. * bnf/m2-h.bnf: calls to BuildNumber pass tokenpos. * bnf/m2.bnf: calls to BuildNumber pass tokenpos. * gm2-compiler/M2Base.mod: improved formatting. * gm2-compiler/M2GCCDeclare.def: (TryDeclareConstructor) removed unused quad parameter. * gm2-compiler/M2GCCDeclare.mod: (TryDeclareConstructor) removed unused quad parameter. * gm2-compiler/M2GenGCC.mod: Removed unused quad parameter to TryDeclareConstructor. * gm2-compiler/M2Quads.def: (BuildEndFor) use endpostok. Tightened up the accuracy of the tokens used in subexpressions. * gm2-compiler/M2Quads.mod: (BuildEndFor) use endpostok. Tightened up the accuracy of the tokens used in subexpressions. 2021-04-16 Gaius Mulley * patches/gcc/trunk/16-patch: (remade patch with ability to track SysStorage and Storage heaps). * testsuite/gm2/analyzer/fail: (new tests added). * gm2-compiler/M2Quads.mod: (BuildDesignatorPointer) use ptrtok position and check for NIL dereference. Create virtual token for resulting subexpression. * gm2-compiler/M2Quads.def: (BuildDesignatorPointer) pass ptrtok position. * bnf/m2-3.bnf: pass token number to BuildDesignatorPointer. 2021-04-14 Gaius Mulley * bnf/m2-3.bnf: cosmetic formatting changes. * gm2-compiler/M2Quads.mod: (BuildAssignmentWithoutBounds) introduce a tok position and use it. (MoveWithMode) use token position. (doBuildAssignment) use token position and use GenQuadO with the token position parameter. (AssignHighField) pass token position to BuildAssignmentWithoutBounds. Changed all calls to BuildAssignmentWithoutBounds passing in the becomes token position. (BuildReturn) use GenQuadO with the token position of the RETURN keyword. (BuildStaticArray) create virtual token position for subexpression. (BuildDynamicArray) create virtual token for subexpression. (ConvertBooleanToVariable) introduce token position and use it instead of GetTokenNo (). (BuildBooleanVariable) use token number on the stack associated with the operand. (PushTFADrwtok) replaces PushTFADrw. (PushTFDtok) replaces PushTFD. (PushTFDrwtok) replaces PushTFDrw. Changed all calls to replacement procedures. * patches/gcc/trunk/16-patch: (remade patch). * patches/gcc/trunk/17-patch: (remade patch). * patches/gcc/trunk/18-patch: (remade patch). * patches/gcc/trunk/19-patch: (New patch). * gm2-lang.c: (gm2_langhook_new_dispose_storage_substitution) New function. (LANG_HOOKS_NEW_DISPOSE_STORAGE_SUBSTITUTION) defined to gm2_langhook_new_dispose_storage_substitution. 2021-04-10 Gaius Mulley * gm2-libs/RTint.mod: guard against NEW (v) failing. * patches/gcc/trunk/16-patch: (remade patch). 2021-04-09 Gaius Mulley * patches/gcc/trunk/16-patch: (remade patch). 2021-04-08 Gaius Mulley * bnf/m2-3.bnf: (AssignmentOrProcedureCall) pass function token number to BuildProcedureCall. * gm2-compiler/M2Quads.mod: (BuildProcedureCall) use functok and generate combinedtok. (BuildNewProcedure) use functok and combinedtok for accurate token position for generated results. (BuildDisposeProcedure) use functok and combinedtok for accurate token position for generated results. (BuildRealFunctionCall) pass tokno to BuildRealFunctionCall. (BuildPseudoProcedureCall) pass tokno to lower level procedures. * gm2-lang.c: remove #if 1 debugging aids. * patches/gcc/trunk/{17,18}-patch: (New files). * patches/gcc/trunk/{16,17,18-patch}: (remade patches). 2021-04-07 Gaius Mulley * patches/gcc/trunk/16-patches: added analyzer patch. 2021-03-05 Gaius Mulley * Make-lang.in: invoke all shell scripts using sh. 2021-03-04 Gaius Mulley * gm2-tools/M2Emit.mod: (InternalError) call abort. * Make-lang.in: invoke all shell scripts with the appropriate interpreter. 2021-02-16 Gaius Mulley * gm2-compiler/M2ALU.mod: changed calls to InternalError to use a single parameter. * gm2-compiler/M2Base.mod: changed calls to InternalError to use a single parameter. * gm2-compiler/M2Check.mod: changed calls to InternalError to use a single parameter. * gm2-compiler/M2Error.mod: changed calls to InternalError to use a single parameter. * gm2-compiler/M2GCCDeclare.mod: changed calls to InternalError to use a single parameter. * gm2-compiler/M2GenGCC.mod: changed calls to InternalError to use a single parameter. * gm2-compiler/M2MetaError.mod: changed calls to InternalError to use a single parameter. * gm2-compiler/M2Quads.mod: changed calls to InternalError to use a single parameter. * gm2-compiler/M2Range.mod: changed calls to InternalError to use a single parameter. * gm2-compiler/P2SymBuild.mod: changed calls to InternalError to use a single parameter. * gm2-compiler/P3SymBuild.mod: changed calls to InternalError to use a single parameter. * gm2-compiler/PCSymBuild.mod: changed calls to InternalError to use a single parameter. * gm2-compiler/Sets.mod: changed calls to InternalError to use a single parameter. * gm2-compiler/SymbolConversion.mod: changed calls to InternalError to use a single parameter. * gm2-compiler/SymbolTable.mod: changed calls to InternalError to use a single parameter. * gm2-tools/M2Emit.mod: changed calls to InternalError to use a single parameter. 2021-02-15 Gaius Mulley * gm2-compiler/Lists.mod: all calls to InternalError changed to use single parameter. * gm2-compiler/M2ALU.mod: all calls to InternalError changed to use single parameter. * gm2-compiler/M2AsmUtil.mod: all calls to InternalError changed to use single parameter. * gm2-compiler/M2Base.mod: all calls to InternalError changed to use single parameter. * gm2-compiler/M2Batch.mod: all calls to InternalError changed to use single parameter. * gm2-compiler/M2CaseList.mod: all calls to InternalError changed to use single parameter. * gm2-compiler/M2Check.mod: all calls to InternalError changed to use single parameter. * gm2-compiler/M2Const.mod: all calls to InternalError changed to use single parameter. * gm2-compiler/M2Debug.mod: all calls to InternalError changed to use single parameter. * gm2-compiler/M2DebugStack.mod: all calls to InternalError changed to use single parameter. * gm2-compiler/M2Emit.def: all calls to InternalError changed to use single parameter. * gm2-compiler/M2Emit.mod: all calls to InternalError changed to use single parameter. * gm2-compiler/M2Error.def: all calls to InternalError changed to use single parameter. * gm2-compiler/M2Error.mod: all calls to InternalError changed to use single parameter. * gm2-compiler/M2GCCDeclare.mod: all calls to InternalError changed to use single parameter. * gm2-compiler/M2GenGCC.mod: all calls to InternalError changed to use single parameter. * gm2-compiler/M2MetaError.mod: all calls to InternalError changed to use single parameter. * gm2-compiler/M2Optimize.mod: all calls to InternalError changed to use single parameter. * gm2-compiler/M2Pass.mod: all calls to InternalError changed to use single parameter. * gm2-compiler/M2Quads.mod: all calls to InternalError changed to use single parameter. * gm2-compiler/M2Range.mod: all calls to InternalError changed to use single parameter. * gm2-compiler/M2StackAddress.mod: all calls to InternalError changed to use single parameter. * gm2-compiler/M2StackWord.mod: all calls to InternalError changed to use single parameter. * gm2-compiler/M2Swig.mod: all calls to InternalError changed to use single parameter. * gm2-compiler/M2System.mod: all calls to InternalError changed to use single parameter. * gm2-compiler/P2SymBuild.mod: all calls to InternalError changed to use single parameter. * gm2-compiler/PCSymBuild.mod: all calls to InternalError changed to use single parameter. * gm2-compiler/Sets.mod: all calls to InternalError changed to use single parameter. * gm2-compiler/SymbolConversion.mod: all calls to InternalErrorchanged to use single parameter. * gm2-compiler/SymbolTable.mod: all calls to InternalError changed to use single parameter. * gm2-tools/M2Emit.mod: all calls to InternalError changed to use single parameter. 2021-02-10 Gaius Mulley * mc-boot/Gmcp5.c: (SubDesignator) check to see if expression is NIL. * bnf/mc-5.bnf: (SubDesignator) check to see if expression is NIL. * gm2-gcc/rtegraph.c: (DEBUGGING) includes complete functions rather than just the body of a function. * gm2-compiler/M2Check.mod: (isTrue) commented out. (checkTypeEquivalence) completed comment. (checkTypeEquivalence) removed unused parameter tInfo and added comments. (checkSubrange) completed comment and check for result known at beginning. (checkGenericTypeEquivalence) completed comment. (checkSystemEquivalence) completed comment and removed unused tInfo parameter. (checkEnumerationEquivalence) removed unused tInfo parameter. (checkPointerType) completed comment and removed unused tInfo parameter. (checkValueEquivalence) completed comment and removed unused tInfo parameter. (visit) removed. (checkSkipEquivalence) removed unused parameter tInfo. (checkRecordEquivalence) removed unused parameter tInfo. (getCompatible) removed. 2021-01-29 Gaius Mulley * gm2-compiler/M2GenGCC.mod: (ToSubrange) removed unused export. * gm2-gcc/m2convert.c: (ToSubrange) removed. * gm2-gcc/m2convert.h: (ToSubrange) removed. * gm2-libs/SArgs.mod: Reverted change. 2021-01-27 Gaius Mulley * gm2-compiler/M2BasicBlock.def: (KillBasicBlock) use optional return. * gm2-compiler/M2BasicBlock.mod: (KillBasicBlock) parameter is VAR and the parameter is assigned to NIL. (FreeBasicBlocks) New procedure. (BasicBlock) declared without unnecessary forward type. (InitBasicBlocks) formatting. * gm2-compiler/M2Code.mod: (Percent) formatting. (SecondDeclareAndOptimize) remove unnecessary variable bb. Use FreeBasicBlocks on functional basic block evaluations. * gm2-compiler/M2GenGCC.mod: (IsExported) Reformatted. * gm2-compiler/M2LexBuf.mod: (GetToken) call GetToken without using the return result to advance token position. * gm2-compiler/m2flex.def: (GetToken) declared with optional return result. * gm2-gcc/gcc-consolidation.h: corrected dates. * gm2-gcc/init.c: corrected dates. * gm2-gcc/init.def: corrected dates. * gm2-gcc/init.h: corrected dates. * gm2-gcc/m2assert.c: corrected dates. * gm2-gcc/m2assert.h: corrected dates. * gm2-gcc/m2block.c: corrected dates. * gm2-gcc/m2block.def: corrected dates. * gm2-gcc/m2block.h: corrected dates. * gm2-gcc/m2builtins.c: corrected dates. * gm2-gcc/m2builtins.def: corrected dates. * gm2-gcc/m2builtins.h: corrected dates. * gm2-gcc/m2color.c: corrected dates. * gm2-gcc/m2color.def: corrected dates. * gm2-gcc/m2color.h: corrected dates. * gm2-gcc/m2convert.c: corrected dates. * gm2-gcc/m2convert.def: corrected dates. * gm2-gcc/m2convert.h: corrected dates. * gm2-gcc/m2decl.c: corrected dates. * gm2-gcc/m2decl.def: corrected dates. * gm2-gcc/m2decl.h: corrected dates. * gm2-gcc/m2except.c: corrected dates. * gm2-gcc/m2except.def: corrected dates. * gm2-gcc/m2except.h: corrected dates. * gm2-gcc/m2expr.c: corrected dates. * gm2-gcc/m2expr.def: corrected dates. * gm2-gcc/m2expr.h: corrected dates. * gm2-gcc/m2linemap.c: corrected dates. * gm2-gcc/m2linemap.def: corrected dates. * gm2-gcc/m2linemap.h: corrected dates. * gm2-gcc/m2misc.c: corrected dates. * gm2-gcc/m2misc.def: corrected dates. * gm2-gcc/m2misc.h: corrected dates. * gm2-gcc/m2options.h: corrected dates. * gm2-gcc/m2range.h: corrected dates. * gm2-gcc/m2search.h: corrected dates. * gm2-gcc/m2statement.c: corrected dates. * gm2-gcc/m2statement.def: corrected dates. * gm2-gcc/m2statement.h: corrected dates. * gm2-gcc/m2top.c: corrected dates. * gm2-gcc/m2top.def: corrected dates. * gm2-gcc/m2top.h: corrected dates. * gm2-gcc/m2tree.c: corrected dates. * gm2-gcc/m2tree.def: corrected dates. * gm2-gcc/m2tree.h: corrected dates. * gm2-gcc/m2treelib.c: corrected dates. * gm2-gcc/m2treelib.def: corrected dates. * gm2-gcc/m2treelib.h: corrected dates. * gm2-gcc/m2type.c: corrected dates. * gm2-gcc/m2type.def: corrected dates. * gm2-gcc/m2type.h: corrected dates. * gm2-gcc/rtegraph.c: corrected dates. * gm2-gcc/rtegraph.h: corrected dates. * patches/gcc/trunk: rebuilt all patches. * gm2-compiler/M2Base.mod: (InitBuiltins) check builtins to ensure source file was found. (GetBaseTypeMinMax) remove unused local variable. (GetBaseTypeMinMax) reformatted. (InitBaseProcedures): check rtexceptions to determine whether source file was found. * gm2-compiler/M2Code.mod: (CodeBlock) KillScopeBlock no longer returns a value. * gm2-compiler/M2GCCDeclare.mod: (DeclareTypesConstantsProcedures) KillScopeBlock no longer returns a value. * gm2-compiler/M2Scope.def: (KillScopeBlock) remove return result and pass sb by reference. * gm2-compiler/M2Scope.mod: assign parameter to NIL. * gm2-compiler/M2Swig.mod: (DetermineParameter) KillBasicBlock no longer returns a value. * gm2-gcc/m2type.c: (build_set_type) commented out. (convert_type_to_range) commented out. * gm2-libs/SArgs.mod: convert pointer to non void * pointer before performing arithmetic. * gcc/m2/gm2-compiler/M2Optimize.mod: (DisplayReachable) exported. * gcc/m2/gm2-compiler/M2Optimize.def: (DisplayReachable) exported. 2021-01-25 Gaius Mulley * gcc/m2/Make-lang.in: supply subdirectory parameter to makeversion. Invoke makeversion without changing into a subdirectory. * gcc/m2/tools-src/makeversion: added subdirectory argument. All output files are placed into the supplied subdirectory. * gcc/m2/patches/gcc/trunk/15-patches: (New file) git front end patch. 2021-01-16 Gaius Mulley * patches/gcc/trunk/02-patches: (corrected path depth). * gcc/m2/Make-lang.in: added dependancies $(PLUGIN_HEADERS) alongside $(TARGET_H). * gcc/m2/config-lang.in: corrected dates. * gcc/m2/configure.ac: corrected dates. * gcc/m2/gm2-internals.texi: corrected dates. * gcc/m2/gm2-lang.c: corrected dates. * gcc/m2/gm2-lang.h: corrected dates. * gcc/m2/gm2.texi: corrected dates. * gcc/m2/gnu.texi: corrected dates. * gcc/m2/lang-options.h: corrected dates. * gcc/m2/lang-specs.h: corrected dates. * gcc/m2/lang.opt: corrected dates. * gcc/m2/m2-link-support.h: corrected dates. * gcc/m2/m2-tree.def: corrected dates. * gcc/m2/m2.flex: corrected dates. * gcc/m2/mc-boot-ch/GRTco.c: corrected dates. * gcc/m2/mc/mc.flex: corrected dates. * gcc/m2/mc/mcComment.h: corrected dates. * gcc/m2/mc/mcLexBuf.h: corrected dates. * gcc/m2/mc/mcReserved.h: corrected dates. * gcc/m2/tools-src/array2index.py: corrected dates. * gcc/m2/tools-src/buildpg: corrected dates. * gcc/m2/tools-src/buildsyntax: corrected dates. * gcc/m2/tools-src/createUlmSys: corrected dates. * gcc/m2/tools-src/def2texi.py: corrected dates. * gcc/m2/tools-src/incfile: corrected dates. * gcc/m2/tools-src/makeSystem: corrected dates. * gcc/m2/tools-src/makeconfigure: corrected dates. * gcc/m2/tools-src/makeversion: corrected dates. * gcc/m2/tools-src/tidydates.py: corrected dates. * gcc/m2/www/gm2-logo.ms: corrected dates. * gcc/m2/www/tools/texi2tr/src/config.py: corrected dates. * gcc/m2/www/tools/texi2tr/src/navigation.py: corrected dates. * gcc/m2/www/tools/texi2tr/src/outputdev.py: corrected dates. * gcc/m2/www/tools/texi2tr/src/texi2tr.py: corrected dates. * gcc/m2/www/Makefile.in: regenerted. * libgm2/Makefile.in: regenerted. * libgm2/libm2cor/Makefile.in: regenerted. * libgm2/libm2iso/Makefile.in: regenerted. * libgm2/libm2log/Makefile.in: regenerted. * libgm2/libm2min/Makefile.in: regenerted. * libgm2/libm2pim/Makefile.in: regenerted. 2021-01-14 Gaius Mulley * bnf/gm2m.bnf: removed unused local variables. * gm2-compiler/M2CaseList.mod: removed unused local variables. * gm2-compiler/M2Check.mod: removed unused local variables. * gm2-compiler/M2DebugStack.mod: removed unused local variables. * gm2-compiler/M2Range.mod: removed unused local variables. * gm2-compiler/M2Students.mod: removed unused local variables. * gm2-compiler/Sets.mod: removed unused local variables. * gm2-libs/IO.mod: removed unused local variables. 2021-01-13 Gaius Mulley * gm2-compiler/M2CaseList.mod: (DisposeRanges) remove unused variable tag. (SubBitRange) remove dummy. Use MetaErrorT0. * gm2-compiler/M2GenGCC.mod: Use tokenno rather than CurrentQuadToken when passed as a parameter. (CodeMakeAdr) Initialize location before use. * bnf/gm2l.bnf: altered grammar to include <* noreturn *> attribute. * bnf/gm2m.bnf: altered grammar to include <* noreturn *> attribute. * Make-lang.in: updated dates and also the bootstrap path for mc. * bnf/m2-1.bnf: altered grammar to include <* noreturn *> attribute. * bnf/m2-2.bnf: altered grammar to include <* noreturn *> attribute. * bnf/m2-3.bnf: altered grammar to include <* noreturn *> attribute. * bnf/m2-c.bnf: altered grammar to include <* noreturn *> attribute. * bnf/m2-h.bnf: altered grammar to include <* noreturn *> attribute. * bnf/m2.bnf: altered grammar to include <* noreturn *> attribute. * bnf/mc-1.bnf: altered grammar to include <* noreturn *> attribute. * bnf/mc-2.bnf: altered grammar to include <* noreturn *> attribute. * bnf/mc-3.bnf: altered grammar to include <* noreturn *> attribute. * bnf/mc-4.bnf: altered grammar to include <* noreturn *> attribute. * bnf/mc-5.bnf: altered grammar to include <* noreturn *> attribute. * gm2-compiler/M2BasicBlock.mod: (ConvertQuads2BasicBlock) removed unused variable. * gm2-compiler/M2Error.def: (InternalError) added <* noreturn *>. * gm2-compiler/M2Error.mod: (InternalError) added <* noreturn *>. * gm2-compiler/M2Quads.mod: (CheckCompatibleWithBecomes) improved error messages and tidied up formatting. * gm2-compiler/M2StackAddress.mod: (PushAddress) removed unused variable. * gm2-compiler/P0SymBuild.mod: (pc) added comment. * gm2-compiler/P1SymBuild.mod: (CheckFileName) corrected type of basename. (P1StartBuildDefinitionModule) removed unused variable. (BuildImportInnerModule) removed unused variable. (BuildExportInnerModule) removed unused variable. * gm2-compiler/SymbolTable.mod: (IsLegal) removed useless comparison. * gm2-compiler/gm2lgen.mod: (GenExternals) removed unused variable. (GenInitializationCalls) removed unused variable. (GenFinalizationCalls) removed unused variable. * gm2-libs/M2RTS.def: (Terminate) added <* noreturn *>. (HALT) added <* noreturn *>. (Halt) added <* noreturn *>. (ErrorMessage) added <* noreturn *>. * gm2-libs/M2RTS.mod: (Terminate) added <* noreturn *>. (HALT) added <* noreturn *>. (Halt) added <* noreturn *>. (ErrorMessage) added <* noreturn *>. * gm2-libs/libc.def: (abort) <* noreturn *>. (exit) <* noreturn *>. * mc-boot/GASCII.c: (rebuilt). * mc-boot/GASCII.h: (rebuilt). * mc-boot/GArgs.c: (rebuilt). * mc-boot/GArgs.h: (rebuilt). * mc-boot/GAssertion.c: (rebuilt). * mc-boot/GAssertion.h: (rebuilt). * mc-boot/GBreak.c: (rebuilt). * mc-boot/GBreak.h: (rebuilt). * mc-boot/GCOROUTINES.h: (rebuilt). * mc-boot/GCmdArgs.c: (rebuilt). * mc-boot/GCmdArgs.h: (rebuilt). * mc-boot/GDebug.c: (rebuilt). * mc-boot/GDebug.h: (rebuilt). * mc-boot/GDynamicStrings.c: (rebuilt). * mc-boot/GDynamicStrings.h: (rebuilt). * mc-boot/GEnvironment.c: (rebuilt). * mc-boot/GEnvironment.h: (rebuilt). * mc-boot/GFIO.c: (rebuilt). * mc-boot/GFIO.h: (rebuilt). * mc-boot/GFormatStrings.c: (rebuilt). * mc-boot/GFormatStrings.h: (rebuilt). * mc-boot/GFpuIO.c: (rebuilt). * mc-boot/GFpuIO.h: (rebuilt). * mc-boot/GIO.c: (rebuilt). * mc-boot/GIO.h: (rebuilt). * mc-boot/GIndexing.c: (rebuilt). * mc-boot/GIndexing.h: (rebuilt). * mc-boot/GM2EXCEPTION.c: (rebuilt). * mc-boot/GM2EXCEPTION.h: (rebuilt). * mc-boot/GM2RTS.c: (rebuilt). * mc-boot/GM2RTS.h: (rebuilt). * mc-boot/GMemUtils.c: (rebuilt). * mc-boot/GMemUtils.h: (rebuilt). * mc-boot/GNumberIO.c: (rebuilt). * mc-boot/GNumberIO.h: (rebuilt). * mc-boot/GPushBackInput.c: (rebuilt). * mc-boot/GPushBackInput.h: (rebuilt). * mc-boot/GRTExceptions.c: (rebuilt). * mc-boot/GRTExceptions.h: (rebuilt). * mc-boot/GRTco.h: (rebuilt). * mc-boot/GRTint.c: (rebuilt). * mc-boot/GRTint.h: (rebuilt). * mc-boot/GSArgs.c: (rebuilt). * mc-boot/GSArgs.h: (rebuilt). * mc-boot/GSFIO.c: (rebuilt). * mc-boot/GSFIO.h: (rebuilt). * mc-boot/GSYSTEM.h: (rebuilt). * mc-boot/GSelective.h: (rebuilt). * mc-boot/GStdIO.c: (rebuilt). * mc-boot/GStdIO.h: (rebuilt). * mc-boot/GStorage.c: (rebuilt). * mc-boot/GStorage.h: (rebuilt). * mc-boot/GStrCase.c: (rebuilt). * mc-boot/GStrCase.h: (rebuilt). * mc-boot/GStrIO.c: (rebuilt). * mc-boot/GStrIO.h: (rebuilt). * mc-boot/GStrLib.c: (rebuilt). * mc-boot/GStrLib.h: (rebuilt). * mc-boot/GStringConvert.c: (rebuilt). * mc-boot/GStringConvert.h: (rebuilt). * mc-boot/GSysExceptions.h: (rebuilt). * mc-boot/GSysStorage.c: (rebuilt). * mc-boot/GSysStorage.h: (rebuilt). * mc-boot/GTimeString.c: (rebuilt). * mc-boot/GTimeString.h: (rebuilt). * mc-boot/GUnixArgs.h: (rebuilt). * mc-boot/Galists.c: (rebuilt). * mc-boot/Galists.h: (rebuilt). * mc-boot/Gdecl.c: (rebuilt). * mc-boot/Gdecl.h: (rebuilt). * mc-boot/Gdtoa.h: (rebuilt). * mc-boot/Gerrno.h: (rebuilt). * mc-boot/Gkeyc.c: (rebuilt). * mc-boot/Gkeyc.h: (rebuilt). * mc-boot/Gldtoa.h: (rebuilt). * mc-boot/Glibc.h: (rebuilt). * mc-boot/Glibm.h: (rebuilt). * mc-boot/Glists.h: (rebuilt). * mc-boot/GmcComment.c: (rebuilt). * mc-boot/GmcComment.h: (rebuilt). * mc-boot/GmcComp.c: (rebuilt). * mc-boot/GmcComp.h: (rebuilt). * mc-boot/GmcDebug.c: (rebuilt). * mc-boot/GmcDebug.h: (rebuilt). * mc-boot/GmcError.c: (rebuilt). * mc-boot/GmcError.h: (rebuilt). * mc-boot/GmcFileName.h: (rebuilt). * mc-boot/GmcLexBuf.c: (rebuilt). * mc-boot/GmcLexBuf.h: (rebuilt). * mc-boot/GmcMetaError.c: (rebuilt). * mc-boot/GmcMetaError.h: (rebuilt). * mc-boot/GmcOptions.h: (rebuilt). * mc-boot/GmcPreprocess.h: (rebuilt). * mc-boot/GmcPretty.h: (rebuilt). * mc-boot/GmcPrintf.h: (rebuilt). * mc-boot/GmcQuiet.h: (rebuilt). * mc-boot/GmcReserved.h: (rebuilt). * mc-boot/GmcSearch.h: (rebuilt). * mc-boot/GmcStack.c: (rebuilt). * mc-boot/GmcStack.h: (rebuilt). * mc-boot/GmcStream.c: (rebuilt). * mc-boot/GmcStream.h: (rebuilt). * mc-boot/Gmcflex.h: (rebuilt). * mc-boot/Gmcp1.c: (rebuilt). * mc-boot/Gmcp1.h: (rebuilt). * mc-boot/Gmcp2.c: (rebuilt). * mc-boot/Gmcp2.h: (rebuilt). * mc-boot/Gmcp3.c: (rebuilt). * mc-boot/Gmcp3.h: (rebuilt). * mc-boot/Gmcp4.c: (rebuilt). * mc-boot/Gmcp4.h: (rebuilt). * mc-boot/Gmcp5.c: (rebuilt). * mc-boot/Gmcp5.h: (rebuilt). * mc-boot/GnameKey.c: (rebuilt). * mc-boot/GnameKey.h: (rebuilt). * mc-boot/GsymbolKey.c: (rebuilt). * mc-boot/GsymbolKey.h: (rebuilt). * mc-boot/Gtermios.h: (rebuilt). * mc-boot/Gtop.c: (rebuilt). * mc-boot/Gvarargs.c: (rebuilt). * mc-boot/Gvarargs.h: (rebuilt). * mc-boot/Gwlists.c: (rebuilt). * mc-boot/Gwlists.h: (rebuilt). * mc-boot/Gwrapc.h: (rebuilt). * mc/decl.def: (setNoReturn) new procedure. * mc/decl.mod: (doProcedureHeadingC) added extra parameter for heading. (setNoReturn) new procedure. 2021-01-12 Gaius Mulley * gm2-compiler/M2Quads.mod: (BuildOddFunction) combinedok initialize before use during error case. (BuildMinFunction) rewritten to initialize all tokens before use when an error condition occurs. (BuildConstFunctionCall) initialize paramtok and combinedtok before use. * m2pp.c: (pl) renamed as ptcl and declared as external. * m2pp.h: (ptcl) declared as external. 2021-01-11 Gaius Mulley * configure.ac: avoid comparing SYSTEM.o between stages during bootstrap checks. 2021-01-09 Gaius Mulley * lang.opt: commented out descriptions for options which are used by C. * updated all dates for the New Year. * tools-src/boilerplate.py: detect GCC with runtime exceptions licence. * New year ChangeLog file. ----------------------------- New file: gcc/m2/gm2-lang.cc ----------------------------- /* gm2-lang.cc language-dependent hooks for GNU Modula-2. Copyright (C) 2002-2022 Free Software Foundation, Inc. Contributed by Gaius Mulley . This file is part of GNU Modula-2. GNU Modula-2 is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GNU Modula-2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License 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. */ #include "gm2-gcc/gcc-consolidation.h" #include "langhooks-def.h" /* FIXME: for lhd_set_decl_assembler_name. */ #include "tree-pass.h" /* FIXME: only for PROP_gimple_any. */ #include "toplev.h" #include "debug.h" #include "opts.h" #define GM2_LANG_C #include "gm2-lang.h" #include "m2block.h" #include "dynamicstrings.h" #include "m2options.h" #include "gm2version.h" #include "m2convert.h" #include "m2linemap.h" #include "init.h" #include "m2-tree.h" #include "convert.h" #include "rtegraph.h" static void write_globals (void); static int insideCppArgs = FALSE; #define EXPR_STMT_EXPR(NODE) TREE_OPERAND (EXPR_STMT_CHECK (NODE), 0) /* start of new stuff. */ /* Language-dependent contents of a type. */ struct GTY (()) lang_type { char dummy; }; /* Language-dependent contents of a decl. */ struct GTY (()) lang_decl { char dummy; }; /* Language-dependent contents of an identifier. This must include a tree_identifier. */ struct GTY (()) lang_identifier { struct tree_identifier common; }; /* The resulting tree type. */ union GTY ((desc ("TREE_CODE (&%h.generic) == IDENTIFIER_NODE"), chain_next ("CODE_CONTAINS_STRUCT (TREE_CODE (&%h.generic), " "TS_COMMON) ? ((union lang_tree_node *) TREE_CHAIN " "(&%h.generic)) : NULL"))) lang_tree_node { union tree_node GTY ((tag ("0"), desc ("tree_node_structure (&%h)"))) generic; struct lang_identifier GTY ((tag ("1"))) identifier; }; /* We don't use language_function. */ struct GTY (()) language_function { /* While we are parsing the function, this contains information about the statement-tree that we are building. */ /* struct stmt_tree_s stmt_tree; */ tree stmt_tree; }; /* end of new stuff. */ /* Language hooks. */ bool gm2_langhook_init (void) { build_common_tree_nodes (false); /* I don't know why this has to be done explicitly. */ void_list_node = build_tree_list (NULL_TREE, void_type_node); build_common_builtin_nodes (); /* The default precision for floating point numbers. This is used for floating point constants with abstract type. This may eventually be controllable by a command line option. */ mpfr_set_default_prec (256); /* GNU Modula-2 uses exceptions. */ using_eh_for_cleanups (); return true; } /* The option mask. */ static unsigned int gm2_langhook_option_lang_mask (void) { return CL_ModulaX2; } /* Initialize the options structure. */ static void gm2_langhook_init_options_struct (struct gcc_options *opts) { /* Default to avoiding range issues for complex multiply and divide. */ opts->x_flag_complex_method = 2; /* The builtin math functions should not set errno. */ opts->x_flag_errno_math = 0; opts->frontend_set_flag_errno_math = true; /* Exceptions are used to handle recovering from panics. */ opts->x_flag_exceptions = 1; opts->x_flag_non_call_exceptions = 1; init_FrontEndInit (); } /* Infrastructure for a VEC of bool values. */ /* This array determines whether the filename is associated with the C preprocessor. */ static vec filename_cpp; void gm2_langhook_init_options (unsigned int decoded_options_count, struct cl_decoded_option *decoded_options) { unsigned int i; bool in_cpp_args = false; // filename_cpp = ggc_vec_alloc (decoded_options_count); for (i = 1; i < decoded_options_count; i++) { switch (decoded_options[i].opt_index) { case OPT_fcppbegin: in_cpp_args = true; break; case OPT_fcppend: in_cpp_args = false; break; case OPT_SPECIAL_input_file: case OPT_SPECIAL_program_name: filename_cpp.safe_push (in_cpp_args); } } filename_cpp.safe_push (false); } static bool is_cpp_filename (unsigned int i) { gcc_assert (i < filename_cpp.length ()); return filename_cpp[i]; } /* Handle gm2 specific options. Return 0 if we didn't do anything. */ bool gm2_langhook_handle_option ( size_t scode, const char *arg, HOST_WIDE_INT value, int kind ATTRIBUTE_UNUSED, location_t loc ATTRIBUTE_UNUSED, const struct cl_option_handlers *handlers ATTRIBUTE_UNUSED) { enum opt_code code = (enum opt_code)scode; /* ignore file names. */ if (code == N_OPTS) return 1; switch (code) { case OPT_I: if (insideCppArgs) { const struct cl_option *option = &cl_options[scode]; const char *opt = (const char *)option->opt_text; M2Options_CppArg (opt, arg, TRUE); } else M2Options_SetSearchPath (arg); return 1; case OPT_fiso: M2Options_SetISO (value); return 1; case OPT_fpim: M2Options_SetPIM (value); return 1; case OPT_fpim2: M2Options_SetPIM2 (value); return 1; case OPT_fpim3: M2Options_SetPIM3 (value); return 1; case OPT_fpim4: M2Options_SetPIM4 (value); return 1; case OPT_fpositive_mod_floor_div: M2Options_SetPositiveModFloor (value); return 1; case OPT_flibs_: /* handled in the gm2 driver. */ return 1; case OPT_fnil: M2Options_SetNilCheck (value); return 1; case OPT_fwholediv: M2Options_SetWholeDiv (value); return 1; case OPT_findex: M2Options_SetIndex (value); return 1; case OPT_frange: M2Options_SetRange (value); return 1; case OPT_ffloatvalue: M2Options_SetFloatValueCheck (value); return 1; case OPT_fwholevalue: M2Options_SetWholeValueCheck (value); return 1; case OPT_freturn: M2Options_SetReturnCheck (value); return 1; case OPT_fcase: M2Options_SetCaseCheck (value); return 1; case OPT_fd: M2Options_SetCompilerDebugging (value); return 1; case OPT_fdebug_trace_quad: M2Options_SetDebugTraceQuad (value); return 1; case OPT_fdebug_trace_api: M2Options_SetDebugTraceAPI (value); return 1; case OPT_fdebug_function_line_numbers: M2Options_SetDebugFunctionLineNumbers (value); return 1; case OPT_fauto_init: M2Options_SetAutoInit (value); return 1; case OPT_fsoft_check_all: M2Options_SetCheckAll (value); return 1; case OPT_fexceptions: M2Options_SetExceptions (value); return 1; case OPT_Wstudents: M2Options_SetStudents (value); return 1; case OPT_Wpedantic: M2Options_SetPedantic (value); return 1; case OPT_Wpedantic_param_names: M2Options_SetPedanticParamNames (value); return 1; case OPT_Wpedantic_cast: M2Options_SetPedanticCast (value); return 1; case OPT_fextended_opaque: M2Options_SetExtendedOpaque (value); return 1; case OPT_Wverbose_unbounded: M2Options_SetVerboseUnbounded (value); return 1; case OPT_Wunused_variable: M2Options_SetUnusedVariableChecking (value); return 1; case OPT_Wunused_parameter: M2Options_SetUnusedParameterChecking (value); return 1; case OPT_fm2_strict_type: M2Options_SetStrictTypeChecking (value); return 1; case OPT_Wall: M2Options_SetWall (value); return 1; case OPT_fxcode: M2Options_SetXCode (value); return 1; case OPT_fm2_lower_case: M2Options_SetLowerCaseKeywords (value); return 1; case OPT_fuselist: /* handled in the driver. */ return 1; case OPT_fmakelist: /* handled in the driver. */ return 1; case OPT_fmodules: /* handled in the driver. */ return 1; case OPT_fruntime_modules_: /* handled in the driver. */ return 1; case OPT_fno_pthread: /* handled in the driver. */ return 1; case OPT_fno_m2_plugin: /* handled in the driver. */ return 1; case OPT_ftarget_ar_: /* handled in the driver. */ return 1; case OPT_ftarget_ranlib_: /* handled in the driver. */ return 1; case OPT_fcpp: M2Options_SetCpp (value); return 1; case OPT_fcppbegin: insideCppArgs = TRUE; return 1; case OPT_fcppend: insideCppArgs = FALSE; return 1; case OPT_fcppprog_: M2Options_CppProg (arg); return 1; case OPT_fq: M2Options_SetQuadDebugging (value); return 1; case OPT_fsources: M2Options_SetSources (value); return 1; case OPT_funbounded_by_reference: M2Options_SetUnboundedByReference (value); return 1; case OPT_fdef_: M2Options_setdefextension (arg); return 1; case OPT_fmod_: M2Options_setmodextension (arg); return 1; case OPT_fdump_system_exports: M2Options_SetDumpSystemExports (value); return 1; case OPT_fswig: M2Options_SetSwig (value); return 1; case OPT_fshared: /* handled by the linker. */ return 1; case OPT_fmakeinit: /* handled by the linker. */ return 1; case OPT_fm2_statistics: M2Options_SetStatistics (value); return 1; case OPT_fm2_g: M2Options_SetM2g (value); return 1; case OPT_fobject_path_: /* handled by the linker. */ return 1; case OPT_fonlylink: /* handled by the driver. */ return 1; case OPT_version: M2Options_DisplayVersion (FALSE); return 1; case OPT_fm2_version: M2Options_DisplayVersion (FALSE); return 1; case OPT_O: M2Options_SetOptimizing (value); return 1; case OPT_quiet: M2Options_SetQuiet (value); return 1; case OPT_fm2_whole_program: M2Options_SetWholeProgram (value); return 1; case OPT_flocation_: if (strcmp (arg, "builtins") == 0) { M2Options_SetForcedLocation (BUILTINS_LOCATION); return 1; } else if (strcmp (arg, "unknown") == 0) { M2Options_SetForcedLocation (UNKNOWN_LOCATION); return 1; } else if ((arg != NULL) && (ISDIGIT (arg[0]))) { M2Options_SetForcedLocation (atoi (arg)); return 1; } else return 0; case OPT_save_temps: M2Options_SetSaveTemps (value); return 1; case OPT_save_temps_: M2Options_SetSaveTempsDir (arg); return 1; default: if (insideCppArgs) { const struct cl_option *option = &cl_options[scode]; const char *opt = (const char *)option->opt_text; M2Options_CppArg (opt, arg, TRUE); return 1; } return 0; } return 0; } /* Run after parsing options. */ static bool gm2_langhook_post_options (const char **pfilename) { const char *filename = *pfilename; flag_excess_precision = EXCESS_PRECISION_FAST; M2Options_SetCC1Quiet (quiet_flag); M2Options_FinaliseOptions (); main_input_filename = filename; /* Returning false means that the backend should be used. */ return false; } /* Call the compiler for every source filename on the command line. */ static void gm2_parse_input_files (const char **filenames, unsigned int filename_count) { unsigned int i; gcc_assert (filename_count > 0); for (i = 0; i < filename_count; i++) if (!is_cpp_filename (i)) { main_input_filename = filenames[i]; init_PerCompilationInit (filenames[i]); } } static void gm2_langhook_parse_file (void) { gm2_parse_input_files (in_fnames, num_in_fnames); write_globals (); } static tree gm2_langhook_type_for_size (unsigned int bits, int unsignedp) { return gm2_type_for_size (bits, unsignedp); } static tree gm2_langhook_type_for_mode (machine_mode mode, int unsignedp) { tree type; if (VECTOR_MODE_P (mode)) { tree inner; inner = gm2_langhook_type_for_mode (GET_MODE_INNER (mode), unsignedp); if (inner != NULL_TREE) return build_vector_type_for_mode (inner, mode); return NULL_TREE; } scalar_int_mode imode; scalar_float_mode fmode; complex_mode cmode; if (is_int_mode (mode, &imode)) return gm2_langhook_type_for_size (GET_MODE_BITSIZE (imode), unsignedp); else if (is_float_mode (mode, &fmode)) { switch (GET_MODE_BITSIZE (fmode)) { case 32: return float_type_node; case 64: return double_type_node; default: // We have to check for long double in order to support // i386 excess precision. if (fmode == TYPE_MODE (long_double_type_node)) return long_double_type_node; } } else if (is_complex_float_mode (mode, &cmode)) { switch (GET_MODE_BITSIZE (cmode)) { case 64: return complex_float_type_node; case 128: return complex_double_type_node; default: // We have to check for long double in order to support // i386 excess precision. if (cmode == TYPE_MODE (complex_long_double_type_node)) return complex_long_double_type_node; } } #if HOST_BITS_PER_WIDE_INT >= 64 /* The middle-end and some backends rely on TImode being supported for 64-bit HWI. */ if (mode == TImode) { type = build_nonstandard_integer_type (GET_MODE_BITSIZE (TImode), unsignedp); if (type && TYPE_MODE (type) == TImode) return type; } #endif return NULL_TREE; } /* Record a builtin function. We just ignore builtin functions. */ static tree gm2_langhook_builtin_function (tree decl) { return decl; } /* Return true if we are in the global binding level. */ static bool gm2_langhook_global_bindings_p (void) { return current_function_decl == NULL_TREE; } /* Push a declaration into the current binding level. We can't usefully implement this since we don't want to convert from tree back to one of our internal data structures. I think the only way this is used is to record a decl which is to be returned by getdecls, and we could implement it for that purpose if necessary. */ static tree 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. */ static tree gm2_langhook_getdecls (void) { return NULL; } static void m2_write_global_declarations (tree globals) { tree decl = globals; int n = 0; while (decl != NULL) { n++; decl = TREE_CHAIN (decl); } if (n > 0) { int i = 0; tree vec[n]; decl = globals; while (decl != NULL) { vec[i] = decl; decl = TREE_CHAIN (decl); i++; } wrapup_global_declarations (vec, n); } } /* Write out globals. */ static void write_globals (void) { tree t; unsigned i; m2block_finishGlobals (); /* Process all file scopes in this compilation, and the external_scope, through wrapup_global_declarations and check_global_declarations. */ FOR_EACH_VEC_ELT (*all_translation_units, i, t) m2_write_global_declarations (BLOCK_VARS (DECL_INITIAL (t))); } /* Gimplify an EXPR_STMT node. */ static void gimplify_expr_stmt (tree *stmt_p) { gcc_assert (EXPR_STMT_EXPR (*stmt_p) != NULL_TREE); *stmt_p = EXPR_STMT_EXPR (*stmt_p); } /* Genericize a TRY_BLOCK. */ static void genericize_try_block (tree *stmt_p) { tree body = TRY_STMTS (*stmt_p); tree cleanup = TRY_HANDLERS (*stmt_p); *stmt_p = build2 (TRY_CATCH_EXPR, void_type_node, body, cleanup); } /* Genericize a HANDLER by converting to a CATCH_EXPR. */ static void genericize_catch_block (tree *stmt_p) { tree type = HANDLER_TYPE (*stmt_p); tree body = HANDLER_BODY (*stmt_p); /* FIXME should the caught type go in TREE_TYPE? */ *stmt_p = build2 (CATCH_EXPR, void_type_node, type, body); } /* Convert the tree representation of FNDECL from m2 frontend trees to GENERIC. */ extern void pf (tree); void gm2_genericize (tree fndecl) { tree t; struct cgraph_node *cgn; #if 0 pf (fndecl); #endif /* Fix up the types of parms passed by invisible reference. */ for (t = DECL_ARGUMENTS (fndecl); t; t = DECL_CHAIN (t)) if (TREE_ADDRESSABLE (TREE_TYPE (t))) { /* 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. */ gcc_assert (!DECL_BY_REFERENCE (t)); gcc_assert (DECL_ARG_TYPE (t) != TREE_TYPE (t)); TREE_TYPE (t) = DECL_ARG_TYPE (t); DECL_BY_REFERENCE (t) = 1; TREE_ADDRESSABLE (t) = 0; relayout_decl (t); } /* Dump all nested functions now. */ cgn = cgraph_node::get_create (fndecl); for (cgn = first_nested_function (cgn); cgn != NULL; cgn = next_nested_function (cgn)) gm2_genericize (cgn->decl); } /* gm2 gimplify expression, currently just change THROW in the same way as C++ */ static int gm2_langhook_gimplify_expr (tree *expr_p, gimple_seq *pre_p ATTRIBUTE_UNUSED, gimple_seq *post_p ATTRIBUTE_UNUSED) { enum tree_code code = TREE_CODE (*expr_p); switch (code) { case THROW_EXPR: /* FIXME communicate throw type to back end, probably by moving THROW_EXPR into ../tree.def. */ *expr_p = TREE_OPERAND (*expr_p, 0); return GS_OK; case EXPR_STMT: gimplify_expr_stmt (expr_p); return GS_OK; case TRY_BLOCK: genericize_try_block (expr_p); return GS_OK; case HANDLER: genericize_catch_block (expr_p); return GS_OK; default: return GS_UNHANDLED; } } /* FIXME: This is a hack to preserve trees that we create from the garbage collector. */ static GTY (()) tree gm2_gc_root; static tree personality_decl = NULL_TREE; static void gm2_preserve_from_gc (tree t) { gm2_gc_root = tree_cons (NULL_TREE, t, gm2_gc_root); } /* Return a decl for the exception personality function. */ static tree gm2_langhook_eh_personality (void) { if (personality_decl == NULL_TREE) { personality_decl = build_personality_function ("gxx"); gm2_preserve_from_gc (personality_decl); } return personality_decl; } /* Functions called directly by the generic backend. */ tree convert_loc (location_t location, tree type, tree expr) { if (type == error_mark_node || expr == error_mark_node || TREE_TYPE (expr) == error_mark_node) return error_mark_node; if (type == TREE_TYPE (expr)) return expr; gcc_assert (TYPE_MAIN_VARIANT (type) != NULL); if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (TREE_TYPE (expr))) return fold_convert (type, expr); expr = m2convert_GenericToType (location, type, expr); switch (TREE_CODE (type)) { case VOID_TYPE: case BOOLEAN_TYPE: return fold_convert (type, expr); case INTEGER_TYPE: return fold (convert_to_integer (type, expr)); case POINTER_TYPE: return fold (convert_to_pointer (type, expr)); case REAL_TYPE: return fold (convert_to_real (type, expr)); case COMPLEX_TYPE: return fold (convert_to_complex (type, expr)); case ENUMERAL_TYPE: return fold (convert_to_integer (type, expr)); default: error_at (location, "cannot convert expression, only base types can be converted"); break; } return error_mark_node; } /* Functions called directly by the generic backend. */ tree convert (tree type, tree expr) { return convert_loc (m2linemap_UnknownLocation (), type, expr); } /* Mark EXP saying that we need to be able to take the address of it; it should not be allocated in a register. Returns true if successful. */ bool gm2_mark_addressable (tree exp) { tree x = exp; while (TRUE) switch (TREE_CODE (x)) { case COMPONENT_REF: if (DECL_PACKED (TREE_OPERAND (x, 1))) return false; x = TREE_OPERAND (x, 0); break; case ADDR_EXPR: case ARRAY_REF: case REALPART_EXPR: case IMAGPART_EXPR: x = TREE_OPERAND (x, 0); break; case COMPOUND_LITERAL_EXPR: case CONSTRUCTOR: case STRING_CST: case VAR_DECL: case CONST_DECL: case PARM_DECL: case RESULT_DECL: case FUNCTION_DECL: TREE_ADDRESSABLE (x) = 1; return true; default: return true; } /* never reach here. */ gcc_unreachable (); } /* Return an integer type with BITS bits of precision, that is unsigned if UNSIGNEDP is nonzero, otherwise signed. */ tree gm2_type_for_size (unsigned int bits, int unsignedp) { tree type; if (unsignedp) { if (bits == INT_TYPE_SIZE) type = unsigned_type_node; else if (bits == CHAR_TYPE_SIZE) type = unsigned_char_type_node; else if (bits == SHORT_TYPE_SIZE) type = short_unsigned_type_node; else if (bits == LONG_TYPE_SIZE) type = long_unsigned_type_node; else if (bits == LONG_LONG_TYPE_SIZE) type = long_long_unsigned_type_node; else type = make_unsigned_type (bits); } else { if (bits == INT_TYPE_SIZE) type = integer_type_node; else if (bits == CHAR_TYPE_SIZE) type = signed_char_type_node; else if (bits == SHORT_TYPE_SIZE) type = short_integer_type_node; else if (bits == LONG_TYPE_SIZE) type = long_integer_type_node; else if (bits == LONG_LONG_TYPE_SIZE) type = long_long_integer_type_node; else type = make_signed_type (bits); } return type; } /* Allow the analyzer to understand Storage ALLOCATE/DEALLOCATE. */ bool gm2_langhook_new_dispose_storage_substitution (void) { return true; } #undef LANG_HOOKS_NAME #undef LANG_HOOKS_INIT #undef LANG_HOOKS_INIT_OPTIONS #undef LANG_HOOKS_OPTION_LANG_MASK #undef LANG_HOOKS_INIT_OPTIONS_STRUCT #undef LANG_HOOKS_HANDLE_OPTION #undef LANG_HOOKS_POST_OPTIONS #undef LANG_HOOKS_PARSE_FILE #undef LANG_HOOKS_TYPE_FOR_MODE #undef LANG_HOOKS_TYPE_FOR_SIZE #undef LANG_HOOKS_BUILTIN_FUNCTION #undef LANG_HOOKS_GLOBAL_BINDINGS_P #undef LANG_HOOKS_PUSHDECL #undef LANG_HOOKS_GETDECLS #undef LANG_HOOKS_GIMPLIFY_EXPR #undef LANG_HOOKS_EH_PERSONALITY #undef LANG_HOOKS_NEW_DISPOSE_STORAGE_SUBSTITUTION #define LANG_HOOKS_NAME "GNU Modula-2" #define LANG_HOOKS_INIT gm2_langhook_init #define LANG_HOOKS_INIT_OPTIONS gm2_langhook_init_options #define LANG_HOOKS_OPTION_LANG_MASK gm2_langhook_option_lang_mask #define LANG_HOOKS_INIT_OPTIONS_STRUCT gm2_langhook_init_options_struct #define LANG_HOOKS_HANDLE_OPTION gm2_langhook_handle_option #define LANG_HOOKS_POST_OPTIONS gm2_langhook_post_options #define LANG_HOOKS_PARSE_FILE gm2_langhook_parse_file #define LANG_HOOKS_TYPE_FOR_MODE gm2_langhook_type_for_mode #define LANG_HOOKS_TYPE_FOR_SIZE gm2_langhook_type_for_size #define LANG_HOOKS_BUILTIN_FUNCTION gm2_langhook_builtin_function #define LANG_HOOKS_GLOBAL_BINDINGS_P gm2_langhook_global_bindings_p #define LANG_HOOKS_PUSHDECL gm2_langhook_pushdecl #define LANG_HOOKS_GETDECLS gm2_langhook_getdecls #define LANG_HOOKS_GIMPLIFY_EXPR gm2_langhook_gimplify_expr #define LANG_HOOKS_EH_PERSONALITY gm2_langhook_eh_personality #define LANG_HOOKS_NEW_DISPOSE_STORAGE_SUBSTITUTION \ gm2_langhook_new_dispose_storage_substitution struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER; #include "gt-m2-gm2-lang.h" #include "gtype-m2.h" ----------------------------- New file: gcc/m2/gm2-lang.h ----------------------------- /* Language-dependent hooks for GNU Modula-2. Copyright (C) 2003-2022 Free Software Foundation, Inc. Contributed by Gaius Mulley This file is part of GNU CC. GNU CC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GNU CC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU CC; see the file COPYING. If not, write to the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #if !defined(GM2_LANG_H) # define GM2_LANG_H #if defined(GM2_LANG_C) # define EXTERN #else # define EXTERN extern #endif #include "config.h" #include "system.h" #include "ansidecl.h" #include "coretypes.h" #include "opts.h" #include "tree.h" #include "gimple.h" EXTERN enum gimplify_status gm2_gimplify_expr (tree *, tree *, tree *); EXTERN bool gm2_mark_addressable (tree); EXTERN tree gm2_type_for_size (unsigned int bits, int unsignedp); EXTERN tree gm2_type_for_mode (enum machine_mode mode, int unsignedp); EXTERN bool gm2_langhook_init (void); EXTERN bool gm2_langhook_handle_option (size_t scode, const char *arg, int value, int kind ATTRIBUTE_UNUSED, location_t loc ATTRIBUTE_UNUSED, const struct cl_option_handlers *handlers ATTRIBUTE_UNUSED); EXTERN void gm2_langhook_init_options (unsigned int decoded_options_count, struct cl_decoded_option *decoded_options); EXTERN void gm2_genericize (tree fndecl); EXTERN tree convert_loc (location_t location, tree type, tree expr); #undef EXTERN #endif ----------------------------- New file: gcc/m2/gm2spec.cc ----------------------------- /* gm2spec.cc specific flags and argument handling within GNU Modula-2. Copyright (C) 2007-2022 Free Software Foundation, Inc. Contributed by Gaius Mulley . This file is part of GNU Modula-2. GNU Modula-2 is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GNU Modula-2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Modula-2; see the file COPYING3. If not see . */ #include "config.h" #include "system.h" #include "coretypes.h" #include "tm.h" #include "xregex.h" #include "obstack.h" #include "intl.h" #include "prefix.h" #include "opt-suggestions.h" #include "gcc.h" #include "opts.h" #include "vec.h" #include "m2/gm2version.h" #include "m2/gm2config.h" #ifdef HAVE_DIRENT_H #include #else #ifdef HAVE_SYS_NDIR_H #include #endif #ifdef HAVE_SYS_DIR_H #include #endif #ifdef HAVE_NDIR_H #include #endif #endif #ifndef MATH_LIBRARY #define MATH_LIBRARY "m" #endif #ifndef LIBSTDCXX #define LIBSTDCXX "stdc++" #endif #ifndef DIR_SEPARATOR #define DIR_SEPARATOR '/' #endif /* Most every one is fine with LIBRARY_PATH. For some, it conflicts. */ #ifndef LIBRARY_PATH_ENV #define LIBRARY_PATH_ENV "LIBRARY_PATH" #endif #ifndef GM2_PREFIX_ENV #define GM2_PREFIX_ENV "GM2_PREFIX" #endif #ifndef GM2_LIBEXEC_ENV #define GM2_LIBEXEC_ENV "GM2_LIBEXEC" #endif #ifndef GM2IPATH_ENV #define GM2IPATH_ENV "GM2IPATH" #endif #ifndef GM2OPATH_ENV #define GM2OPATH_ENV "GM2OPATH" #endif int lang_specific_extra_outfiles = 0; /* DEBUGGING will print all the options at various stages with their error code, full name etc. */ #undef DEBUGGING /* LOCAL_DEBUGGING allows the compiler driver to automatically set a -B prefix (assuming one it not user supplied). It sets the -Bprefix with the given path to argv[0]. This allows subprograms to be found in the build tree (without having to be installed). It is only meant as an aid to development, not a user feature :-). It allows developers to lazily type: ./gm2 -c hello.c rather than ./gm2 -B./ -c hello.c or /somedirectory/development/build/gcc/gm2 -c hello.c. */ #undef LOCAL_DEBUGGING #define DEFAULT_DIALECT "pim" typedef enum { iso, pim, min, logitech, pimcoroutine, maxlib } libs; /* These are the library names which are installed as part of gm2 and reflect -flibs=name. The -flibs= option provides the user with a short cut to add libraries without having to know the include and link path. */ static const char *library_name[maxlib] = { "m2iso", "m2pim", "m2min", "m2log", "m2cor" }; /* They match the installed archive name for example libm2iso.a, libm2pim.a, libm2min.a, libm2log.a and libm2cor.a. They also match a subdirectory name where the definition modules are kept. The driver checks the argument to -flibs= for an entry in library_name or alternatively the existance of the subdirectory (to allow for third party libraries to coexist). */ static const char *library_abbrev[maxlib] = { "iso", "pim", "min", "log", "cor" }; /* Users may specifiy -flibs=pim,iso etc which are mapped onto -flibs=m2pim,m2iso respectively. This provides a match between the dialect of Modula-2 and the library set. */ int lang_specific_pre_link (void); static void add_exec_prefix (void); #if defined(LOCAL_DEBUGGING) static void add_B_prefix (unsigned int *in_decoded_options_count, struct cl_decoded_option **in_decoded_options); #endif static const char *get_objects (int argc, const char *argv[]); static const char *get_link_args (int argc, const char *argv[]); static const char *add_exec_dir (int argc, const char *argv[]); static const char *add_exec_name (int argc, const char *argv[]); static int is_object (const char *s); static void remember_object (const char *s); static void remember_link_arg (const char *opt, const char *s); static void scan_for_link_args (unsigned int *in_decoded_options_count, struct cl_decoded_option **in_decoded_options); static void add_link_from_include (struct cl_decoded_option **in_options, int include); static void add_lib (size_t opt_index, const char *lib, int joined); static void check_gm2_root (void); static const char *add_include (const char *libpath, const char *library); static const char *gen_gm2_prefix (const char *gm2_root); static const char *gen_gm2_libexec (const char *path); static const char *get_libexec (void); static void insert_option (unsigned int *in_decoded_options_count, struct cl_decoded_option **in_decoded_options, unsigned int position); static const char *gen_link_path (const char *libpath, const char *dialect); typedef struct object_list { char *name; struct object_list *next; } object_list; static object_list *head_objects = NULL; static object_list *head_link_args = NULL; static int inclPos = -1; static int linkPos = -1; static bool seen_fonlylink = false; static bool seen_fmakeall0 = false; static bool seen_fmakeall = false; static bool seen_B = false; static const char *B_path = NULL; static const char *multilib_dir = NULL; /* By default, the suffix for target object files is ".o". */ #ifdef TARGET_OBJECT_SUFFIX #define HAVE_TARGET_OBJECT_SUFFIX #else #define TARGET_OBJECT_SUFFIX ".o" #endif /* fe_generate_option, wrap up arg and pass it to fe_save_switch. */ static void fe_generate_option (size_t opt_index, const char *arg, bool joined) { const struct cl_option *option = &cl_options[opt_index]; char *opt; if (joined) { const char *old = option->opt_text; opt = (char *)xmalloc (strlen (old) + strlen (arg) + 1); strcpy (opt, old); strcat (opt, arg); } else opt = xstrdup (option->opt_text); if (arg == NULL || joined) fe_save_switch (opt, 0, NULL, true, false); else { const char **x = (const char **)XCNEWVEC (const char **, 2); x[0] = xstrdup (arg); x[1] = NULL; gcc_assert (opt_index != OPT_l); fe_save_switch (opt, 1, x, true, false); } } #if defined(LOCAL_DEBUGGING) /* Find_executable_path, if argv0 references an executable filename then use this path. */ static const char * find_executable_path (const char *argv0) { if (access (argv0, X_OK) == 0) { const char *n = strrchr (argv0, DIR_SEPARATOR); /* Strip off the program name from argv0, but leave the DIR_SEPARATOR. */ if (n != NULL) { char *copy = xstrdup (argv0); char *n = strrchr (copy, DIR_SEPARATOR); n[1] = (char)0; return copy; } } return NULL; } /* add_B_prefix, adds the -Bprefix option so that we can tell subcomponents of gm2 where to pick up its executables. But we can only do this if the user explicitly gives the path to argv[0]. */ static void add_B_prefix (unsigned int *in_decoded_options_count ATTRIBUTE_UNUSED, struct cl_decoded_option **in_decoded_options) { if ((*in_decoded_options)[0].arg != NULL) { const char *arg = (*in_decoded_options)[0].arg; const char *path = find_executable_path (arg); if (path == NULL || (strcmp (path, "") == 0)) path = gen_gm2_libexec (get_libexec ()); if (path != NULL && (strcmp (path, "") != 0)) { #if defined(DEBUGGING) unsigned int i; printf ("going to add -B%s\n", path); for (i = 0; i < *in_decoded_options_count; i++) print_option ("before add -B", i, *in_decoded_options); #endif fe_handle_opt_b (xstrdup (path)); fe_generate_option (OPT_B, xstrdup (path), 1); #if defined(DEBUGGING) for (i = 0; i < *in_decoded_options_count; i++) print_option ("after add -B", i, *in_decoded_options); #endif } } } #endif /* add_exec_prefix, adds the -ftarget-ar= option so that we can tell gm2lcc where to pick up the `ar' utility. */ static void add_exec_prefix (void) { const char *ar = AR_PATH; const char *ranlib = RANLIB_PATH; fe_generate_option (OPT_ftarget_ar_, ar, true); fe_generate_option (OPT_ftarget_ranlib_, ranlib, true); } static const char * get_libexec (void) { const char *libexec = getenv (GM2_LIBEXEC_ENV); if (libexec == NULL || (strcmp (libexec, "") == 0)) return STANDARD_LIBEXEC_PREFIX; else return libexec; } static int is_object (const char *s) { return (strlen (s) > strlen (TARGET_OBJECT_SUFFIX) && (strcmp (s + strlen (s) - strlen (TARGET_OBJECT_SUFFIX), TARGET_OBJECT_SUFFIX) == 0)); } static void remember_object (const char *s) { object_list *n = (object_list *)xmalloc (sizeof (object_list)); n->name = xstrdup (s); n->next = head_objects; head_objects = n; #if defined(DEBUGGING) fprintf (stderr, "remembering object: %s\n", s); #endif } static void remember_link_arg (const char *opt, const char *s) { object_list *n = (object_list *)xmalloc (sizeof (object_list)); n->name = (char *)xmalloc (strlen (opt) + strlen (s) + 1); strcpy (n->name, opt); strcat (n->name, s); n->next = head_link_args; head_link_args = n; } /* add_link_from_include, adds option to (**in_argv)[pos] using the include path. */ static void add_link_from_include (struct cl_decoded_option **in_options, int include) { struct cl_decoded_option *options = *in_options; const char *arg = options[include].arg; fe_generate_option (OPT_fobject_path_, arg, true); } /* add_lib, add lib to the end of the command line. */ static void add_lib (size_t opt_index, const char *lib, int joined) { if (lib == NULL || (strcmp (lib, "") == 0)) return; fe_generate_option (opt_index, lib, joined); } /* insert_option, inserts an option at position on the command line. */ static void insert_option (unsigned int *in_decoded_options_count, struct cl_decoded_option **in_decoded_options, unsigned int position) { struct cl_decoded_option *new_decoded_options; unsigned int i; (*in_decoded_options_count)++; gcc_assert (position <= (*in_decoded_options_count)); new_decoded_options = XNEWVEC (struct cl_decoded_option, (*in_decoded_options_count) + 1); for (i = 0; i < position; i++) new_decoded_options[i] = (*in_decoded_options)[i]; memset (&new_decoded_options[position], 0, sizeof (struct cl_decoded_option)); for (i = position; i < (*in_decoded_options_count) - 1; i++) new_decoded_options[i + 1] = (*in_decoded_options)[i]; *in_decoded_options = new_decoded_options; } /* add_library, adds a library to the command line at arg position. It returns the number of arguments added. If libraryname is NULL or empty then zero is returned. */ static int add_library (const char *libraryname, unsigned int *in_decoded_options_count, struct cl_decoded_option **in_decoded_options, unsigned int position) { if (libraryname == NULL || (strcmp (libraryname, "") == 0)) return 0; insert_option (in_decoded_options_count, in_decoded_options, position); #if defined(DEBUGGING) printf ("going to add -l%s at position=%d count=%d\n", libraryname, position, *in_decoded_options_count); print_options ("before add_library", *in_decoded_options_count, *in_decoded_options); #endif generate_option (OPT_l, libraryname, 1, CL_DRIVER, &(*in_decoded_options)[position]); #if defined(DEBUGGING) print_options ("after add_library", *in_decoded_options_count, *in_decoded_options); #endif return 1; } /* build_archive_path returns a string containing the a path to the archive defined by libpath and dialectLib. */ static const char * build_archive_path (const char *libpath, const char *library) { if (library != NULL) { const char *libdir = (const char *)library; if (libdir != NULL) { int machine_length = 0; char dir_sep[2]; dir_sep[0] = DIR_SEPARATOR; dir_sep[1] = (char)0; if (multilib_dir != NULL) { machine_length = strlen (multilib_dir); machine_length += strlen (dir_sep); } int l = strlen (libpath) + 1 + strlen ("m2") + 1 + strlen (libdir) + 1 + machine_length + 1; char *s = (char *)xmalloc (l); strcpy (s, libpath); strcat (s, dir_sep); if (machine_length > 0) { strcat (s, multilib_dir); strcat (s, dir_sep); } strcat (s, "m2"); strcat (s, dir_sep); strcat (s, libdir); return s; } } return NULL; } /* safe_strdup, safely duplicates a string. */ static char * safe_strdup (const char *s) { if (s != NULL) return xstrdup (s); return NULL; } /* add_default_combination, adds the correct link path and then the library name. */ static void add_default_combination (const char *libpath, const char *library, unsigned int *in_decoded_options_count, struct cl_decoded_option **in_decoded_options, unsigned int position) { if (library != NULL) { add_lib (OPT_L, build_archive_path (libpath, library), true); add_library (safe_strdup (library), in_decoded_options_count, in_decoded_options, position); } } /* gen_link_path, generates a link path for the chosen dialect. */ static const char * gen_link_path (const char *libpath, const char *dialect) { return add_include (libpath, dialect); } /* add_default_archives, adds the default archives to the end of the current command line. */ static int add_default_archives (const char *libpath, const char *libraries, unsigned int *in_decoded_options_count, struct cl_decoded_option **in_decoded_options, unsigned int position) { const char *prev; const char *l = libraries; const char *e; char *c; unsigned int libcount = 0; do { if (libpath == NULL) prev = NULL; else prev = xstrdup (libpath); e = index (l, ','); if (e == NULL) { c = xstrdup (l); l = NULL; } else { c = xstrndup (l, e - l); l = e + 1; } add_default_combination (libpath, c, in_decoded_options_count, in_decoded_options, position + libcount); libcount++; prev = gen_link_path (libpath, c); fe_generate_option (OPT_L, prev, true); free (c); } while ((l != NULL) && (l[0] != (char)0)); return libcount; } /* build_include_path, builds the component of the include path referenced by the, which, libs. */ static const char * build_include_path (const char *libpath, const char *library) { char dir_sep[2]; char *gm2libs; unsigned int machine_length = 0; dir_sep[0] = DIR_SEPARATOR; dir_sep[1] = (char)0; if (multilib_dir != NULL) { machine_length = strlen (multilib_dir); machine_length += strlen (dir_sep); } gm2libs = (char *)alloca (strlen (libpath) + strlen (dir_sep) + strlen ("m2") + strlen (dir_sep) + strlen (library) + 1 + machine_length + 1); strcpy (gm2libs, libpath); strcat (gm2libs, dir_sep); if (machine_length > 0) { strcat (gm2libs, multilib_dir); strcat (gm2libs, dir_sep); } strcat (gm2libs, "m2"); strcat (gm2libs, dir_sep); strcat (gm2libs, library); return xstrdup (gm2libs); } /* add_include add the correct include path given the libpath and library. The new path is returned. */ static const char * add_include (const char *libpath, const char *library) { if (library == NULL) return NULL; else return build_include_path (libpath, library); } /* add_default_includes, add the appropriate default include paths depending upon the style of libraries chosen. */ static void add_default_includes (const char *libpath, const char *libraries) { const char *l = libraries; const char *e; const char *c; const char *path; do { e = index (l, ','); if (e == NULL) { c = xstrdup (l); l = NULL; } else { c = xstrndup (l, e - l); l = e + 1; } path = add_include (libpath, c); fe_generate_option (OPT_I, path, true); } while ((l != NULL) && (l[0] != (char)0)); } /* build_fobject_path, returns a string containing the a path to the objects defined by libpath and dialectLib. */ static char * build_fobject_path (const char *prev, const char *libpath, const char *library) { char sepstr[2]; char *gm2objs; const char *libName = library; unsigned int machine_length = 0; sepstr[0] = DIR_SEPARATOR; sepstr[1] = (char)0; if (multilib_dir != NULL) { machine_length = strlen (multilib_dir); if (machine_length > 0) machine_length += strlen (sepstr); } if (prev == NULL) { gm2objs = (char *)alloca ( strlen (libpath) + strlen (sepstr) + machine_length + strlen ("m2") + strlen (sepstr) + strlen (libName) + 1 + strlen (libpath) + strlen (sepstr) + strlen ("m2") + strlen (sepstr) + strlen (libName) + 1); strcpy (gm2objs, ""); } else { gm2objs = (char *)alloca ( strlen (prev) + strlen (":") + strlen (libpath) + strlen (sepstr) + machine_length + strlen ("m2") + strlen (sepstr) + strlen (libName) + 1 + strlen (libpath) + strlen (sepstr) + strlen ("m2") + strlen (sepstr) + strlen (libName) + 1); strcpy (gm2objs, prev); strcat (gm2objs, ":"); } strcat (gm2objs, libpath); strcat (gm2objs, sepstr); if (machine_length > 0) { strcat (gm2objs, multilib_dir); strcat (gm2objs, sepstr); } strcat (gm2objs, "m2"); strcat (gm2objs, sepstr); strcat (gm2objs, libName); return xstrdup (gm2objs); } /* add_fobject_path, add all required path to satisfy the link for library. */ static void add_fobject_path (const char *prev, const char *libpath, const char *library) { if (library != NULL) fe_generate_option (OPT_fobject_path_, build_fobject_path (prev, libpath, library), true); } /* add_default_fobjects, add the appropriate default include paths depending upon the libraries chosen. */ static void add_default_fobjects (const char *prev, const char *libpath, const char *libraries) { const char *l = libraries; const char *e; const char *c; do { e = index (l, ','); if (e == NULL) { c = xstrdup (l); l = NULL; } else { c = xstrndup (l, e - l); l = e + 1; } add_fobject_path (prev, libpath, c); } while ((l != NULL) && (l[0] != (char)0)); } static void scan_for_link_args (unsigned int *in_decoded_options_count, struct cl_decoded_option **in_decoded_options) { struct cl_decoded_option *decoded_options = *in_decoded_options; unsigned int i; for (i = 0; i < *in_decoded_options_count; i++) { const char *arg = decoded_options[i].arg; size_t opt = decoded_options[i].opt_index; if (opt == OPT_l) remember_link_arg ("-l", arg); else if (opt == OPT_L) remember_link_arg ("-L", arg); } } /* purge_include_options, remove any -I option found from in_decoded_options. */ static void purge_include_options (unsigned int *in_decoded_options_count, struct cl_decoded_option **in_decoded_options) { struct cl_decoded_option *decoded_options = *in_decoded_options; unsigned int i, j; for (i = 0; i < *in_decoded_options_count; i++) { size_t opt = decoded_options[i].opt_index; if (opt == OPT_I) { for (j = i; j + 1 < *in_decoded_options_count; j++) decoded_options[j] = decoded_options[j + 1]; (*in_decoded_options_count)--; } } } /* convert_include_into_link, convert the include path options into link path options. */ static void convert_include_into_link (struct cl_decoded_option **in_decoded_options, unsigned int *in_decoded_options_count) { unsigned int i; for (i = 1; i < *in_decoded_options_count; i++) { size_t opt = (*in_decoded_options)[i].opt_index; if (opt == OPT_I) add_link_from_include (in_decoded_options, i); } } /* build_path, implements export PATH=$(prefix)/bin:$PATH. */ static void build_path (const char *prefix) { int l = strlen ("PATH=") + strlen (prefix) + 1 + strlen ("bin") + 1; char *s; char dir_sep[2]; const char *path; path = getenv ("PATH"); if (path != NULL && (strcmp (path, "") != 0)) l += strlen (":") + strlen (path); s = (char *)xmalloc (l); dir_sep[0] = DIR_SEPARATOR; dir_sep[1] = (char)0; strcpy (s, "PATH="); strcat (s, prefix); strcat (s, dir_sep); strcat (s, "bin"); if (path != NULL && (strcmp (path, "") != 0)) { strcat (s, ":"); strcat (s, path); } fe_putenv (s); } /* gen_gm2_prefix, return the prefix string. */ static const char * gen_gm2_prefix (const char *prefix) { int l = strlen (prefix) + 1 + strlen ("lib") + 1 + strlen ("gcc") + 1 + strlen (DEFAULT_TARGET_MACHINE) + 1 + strlen (DEFAULT_TARGET_VERSION) + 1; char *s = (char *)xmalloc (l); char dir_sep[2]; dir_sep[0] = DIR_SEPARATOR; dir_sep[1] = (char)0; strcpy (s, prefix); strcat (s, dir_sep); strcat (s, "lib"); strcat (s, dir_sep); strcat (s, "gcc"); strcat (s, dir_sep); strcat (s, DEFAULT_TARGET_MACHINE); strcat (s, dir_sep); strcat (s, DEFAULT_TARGET_VERSION); return s; } /* gen_gm2_libexec, return a libexec string. */ static const char * gen_gm2_libexec (const char *libexec) { int l = strlen (libexec) + 1 + strlen (DEFAULT_TARGET_MACHINE) + 1 + strlen (DEFAULT_TARGET_VERSION) + 1; char *s = (char *)xmalloc (l); char dir_sep[2]; dir_sep[0] = DIR_SEPARATOR; dir_sep[1] = (char)0; strcpy (s, libexec); strcat (s, dir_sep); strcat (s, DEFAULT_TARGET_MACHINE); strcat (s, dir_sep); strcat (s, DEFAULT_TARGET_VERSION); return s; } /* build_library_path, implements export LIBRARY_PATH=$(gm2_root)/lib/gcc/\ $(default_target_machine)/\ $(default_target_version) where gm2_root, default_target_machine and default_target_version are C strings. */ static void build_library_path (const char *prefix) { const char *path = gen_gm2_prefix (prefix); int l = strlen ("LIBRARY_PATH=") + strlen (prefix) + 1; char *s = (char *)xmalloc (l); strcpy (s, "LIBRARY_PATH="); strcat (s, path); fe_putenv (s); } /* build_compiler_path, implements export COMPILER_PATH=$(GM2_LIBEXEC)/libexec/gcc/\ $(default_target_machine)/\ $(default_target_version). */ static void build_compiler_path (const char *path) { const char *libexec = gen_gm2_libexec (path); int l = strlen ("COMPILER_PATH=") + strlen (libexec) + 1; char *s = (char *)xmalloc (l); strcpy (s, "COMPILER_PATH="); strcat (s, libexec); fe_putenv (s); } /* check_gm2_root, checks to see whether GM2_PREFIX or GM2_LIBEXEC has been defined, if it has and also COMPILER_PATH and LIBRARY_PATH are both unset then it sets COMPILER_PATH and LIBRARY_PATH using GM2_PREFIX and GM2_LIBEXEC as its prefix. */ static void check_gm2_root (void) { const char *library_path; const char *compiler_path; const char *gm2_prefix; const char *gm2_libexec; library_path = fe_getenv (LIBRARY_PATH_ENV); compiler_path = fe_getenv ("COMPILER_PATH"); gm2_prefix = fe_getenv (GM2_PREFIX_ENV); gm2_libexec = fe_getenv (GM2_LIBEXEC_ENV); if ((library_path == NULL || (strcmp (library_path, "") == 0)) && (compiler_path == NULL || (strcmp (compiler_path, "") == 0))) { #if defined(DEBUGGING) fprintf (stderr, "STANDARD_LIBEXEC_PREFIX = %s\n", STANDARD_LIBEXEC_PREFIX); fprintf (stderr, "STANDARD_BINDIR_PREFIX = %s\n", STANDARD_BINDIR_PREFIX); fprintf (stderr, "TOOLDIR_BASE_PREFIX = %s\n", TOOLDIR_BASE_PREFIX); fprintf (stderr, "DEFAULT_TARGET_VERSION = %s\n", DEFAULT_TARGET_VERSION); fprintf (stderr, "DEFAULT_TARGET_MACHINE = %s\n", DEFAULT_TARGET_MACHINE); #endif if (gm2_prefix != NULL && (strcmp (gm2_prefix, "") != 0)) { build_path (gm2_prefix); build_library_path (gm2_prefix); } if (gm2_libexec != NULL && (strcmp (gm2_libexec, "") != 0)) build_compiler_path (gm2_libexec); } else if (gm2_prefix != NULL && !seen_fmakeall0) /* No need to issue a warning if seen_fmakeall0 as the parent will have set COMPILER_PATH and LIBRARY_PATH because of GM2_ROOT. Also users should not be using -fmakeall0 as it is an internal option. */ error ("it is not advisible to set %qs as well as either %qs or %qs", GM2_PREFIX_ENV, LIBRARY_PATH_ENV, "COMPILER_PATH"); } /* library_installed returns true if directory library is found under libpath. */ static bool library_installed (const char *libpath, const char *library) { #if defined(HAVE_OPENDIR) && defined(HAVE_DIRENT_H) const char *complete = build_archive_path (libpath, library); DIR *directory = opendir (complete); if (directory == NULL || (errno == ENOENT)) return false; /* Directory exists and therefore the library also exists. */ closedir (directory); return true; #else return false; #endif } /* check_valid check to see that the library is valid. It check the library against the default library set in gm2 and also against any additional libraries installed in the prefix tree. */ static bool check_valid_library (const char *libpath, const char *library) { /* firstly check against the default libraries (which might not be installed yet). */ for (int i = 0; i < maxlib; i++) if (strcmp (library, library_name[i]) == 0) return true; /* secondly check whether it is installed (a third party library). */ return library_installed (libpath, library); } /* check_valid_list check to see that the libraries specified are valid. It checks against the default library set in gm2 and also against any additional libraries installed in the libpath tree. */ static bool check_valid_list (const char *libpath, const char *libraries) { const char *start = libraries; const char *end; const char *copy; do { end = index (start, ','); if (end == NULL) { copy = xstrdup (start); start = NULL; } else { copy = xstrndup (start, end - start); start = end + 1; } if (! check_valid_library (libpath, copy)) { error ("library specified %sq is either not installed or does not exist", copy); return false; } } while ((start != NULL) && (start[0] != (char)0)); return true; } /* add_env_option append multiple options, one for each element in the path. */ static void add_env_option (const char *path, size_t option) { if (path != NULL) { const char *p = path; const char *s = path; char *arg; int i, l, n; l = strlen (path); i = 0; n = 0; while (i < l) { if (path[i] == ':') { arg = (char *)xmalloc (n + 1); strncpy (arg, s, n); arg[n] = (char)0; fe_generate_option (option, arg, true); n++; s = &p[i]; n = 0; } else { n++; i++; } } if (n > 0) { arg = (char *)xmalloc (n + 1); strncpy (arg, s, n); arg[n] = (char)0; fe_generate_option (option, arg, true); } } } /* add_word returns a new string which has the contents of lib appended to list. If list is NULL then lib is duplicated and returned otherwise the list is appended by "," and the contents of lib. */ static const char * add_word (const char *list, const char *lib) { char *copy; if (list == NULL) return xstrdup (lib); copy = (char *) xmalloc (strlen (list) + strlen (lib) + 1 + 1); strcpy (copy, list); strcat (copy, ","); strcat (copy, lib); return copy; } /* convert_abbreviation checks abbreviation against known library abbreviations. If an abbreviation is found it converts the element to the full library name, otherwise the user supplied name is added to the full_libraries list. A new string is returned. */ static const char * convert_abbreviation (const char *full_libraries, const char *abbreviation) { for (int i = 0; i < maxlib; i++) if (strcmp (abbreviation, library_abbrev[i]) == 0) return add_word (full_libraries, library_name[i]); /* No abbreviation found therefore assume user specified full library name. */ return add_word (full_libraries, abbreviation); } /* convert_abbreviations checks each element in the library list to see if an a known library abbreviation was used. If found it converts the element to the full library name, otherwise the element is copied into the list. A new string is returned. */ static const char * convert_abbreviations (const char *libraries) { const char *start = libraries; const char *end; const char *full_libraries = NULL; do { end = index (start, ','); if (end == NULL) { full_libraries = convert_abbreviation (full_libraries, start); start = NULL; } else { full_libraries = convert_abbreviation (full_libraries, xstrndup (start, end - start)); start = end + 1; } } while ((start != NULL) && (start[0] != (char)0)); return full_libraries; } /* lang_specific_driver is invoked if we are compiling/linking a Modula-2 file. It checks for module paths and linking requirements which are language specific. */ void lang_specific_driver (struct cl_decoded_option **in_decoded_options, unsigned int *in_decoded_options_count, int *in_added_libraries) { unsigned int i; /* Nonzero if we saw a `-xfoo' language specification on the command line. This function will add a -xmodula-2 if the user has not already placed one onto the command line. */ bool seen_x_flag = false; const char *language = NULL; const char *libraries = NULL; const char *dialect = DEFAULT_DIALECT; bool seen_module_extension = -1; bool linking = true; bool seen_source = false; bool seen_fexceptions = true; const char *libpath; const char *gm2ipath; const char *gm2opath; /* By default, we add the math library if we have one. */ bool need_math = (strcmp (MATH_LIBRARY, "") == 0); /* True if we should add -lpthread to the command-line. */ bool need_pthread = true; /* True if we should add -fplugin=m2rte to the command-line. */ bool need_plugin = true; /* True if we should add -shared-libgcc to the command-line. */ bool shared_libgcc = true; /* The total number of arguments with the new stuff. */ unsigned int argc = *in_decoded_options_count; /* Initially scan the options for key values. */ for (i = 1; i < argc; i++) { if ((*in_decoded_options)[i].errors & CL_ERR_MISSING_ARG) continue; /* Avoid examining arguments of options missing them. */ switch ((*in_decoded_options)[i].opt_index) { case OPT_fuselist: /* Modula-2 link time option, which is used to direct the specs. */ (*in_decoded_options)[i].errors = 0; break; case OPT_fexceptions: seen_fexceptions = ((*in_decoded_options)[i].value); break; case OPT_fonlylink: seen_fonlylink = true; break; #if 0 case OPT_fmakeall: seen_fmakeall = true; break; case OPT_fmakeall0: seen_fmakeall0 = true; break; #endif case OPT_B: seen_B = true; B_path = (*in_decoded_options)[i].arg; break; case OPT_fno_pthread: need_pthread = false; break; case OPT_fno_m2_plugin: need_plugin = false; break; default: if (((*in_decoded_options)[i].orig_option_with_args_text != NULL) && (strncmp ((*in_decoded_options)[i].orig_option_with_args_text, "-m", 2) == 0)) multilib_dir = xstrdup ((*in_decoded_options)[i].orig_option_with_args_text + 2); } } /* -fmakeall implies that the first invoked driver only does the link and should leave all compiles to the makefile otherwise we will try and link two main applications. */ if (seen_fmakeall && (!seen_fonlylink)) fe_generate_option (OPT_fonlylink, NULL, false); check_gm2_root (); libpath = fe_getenv (LIBRARY_PATH_ENV); if (libpath == NULL || (strcmp (libpath, "") == 0)) libpath = LIBSUBDIR; gm2ipath = fe_getenv (GM2IPATH_ENV); gm2opath = fe_getenv (GM2OPATH_ENV); #if defined(DEBUGGING) print_options ("at beginning", *in_decoded_options_count, *in_decoded_options); #endif i = 1; for (i = 1; i < *in_decoded_options_count; i++) { const char *arg = (*in_decoded_options)[i].arg; size_t opt = (*in_decoded_options)[i].opt_index; #if defined(DEBUGGING) print_option ("in for", i, *in_decoded_options); printf ("argument: %s, %ld\n", arg, opt); #endif if ((opt == OPT_c) || (opt == OPT_S)) linking = false; if (opt == OPT_I) { fe_generate_option (OPT_I, arg, true); inclPos = i; } if (opt == OPT_fobject_path_) linkPos = i; if (opt == OPT_fiso) dialect = "iso"; if (opt == OPT_fpim2) dialect = "pim2"; if (opt == OPT_fpim3) dialect = "pim3"; if (opt == OPT_fpim4) dialect = "pim4"; if (opt == OPT_fpim) dialect = "pim"; if (opt == OPT_flibs_) libraries = xstrdup (arg); if (opt == OPT_fmod_) seen_module_extension = true; if (opt == OPT_version) gm2_version (true); if (opt == OPT_fm2_version) gm2_version (false); if (opt == OPT_x) { seen_x_flag = true; language = arg; } if (opt == OPT_SPECIAL_input_file) { if (is_object (arg)) remember_object (arg); else seen_source = true; } } if (linking && (!seen_source)) linking = false; if (language != NULL && (strcmp (language, "modula-2") != 0)) return; #if defined(DEBUGGING) print_options ("in the middle", *in_decoded_options_count, *in_decoded_options); #endif /* If the libraries have not been specified by the user and the dialect has been specified then select the appropriate libraries. */ if (libraries == NULL) { if (strncmp (dialect, "pim", 3) == 0) libraries = xstrdup ("m2pim"); else if (strcmp (dialect, "iso") == 0) libraries = xstrdup ("m2iso,m2pim"); } libraries = convert_abbreviations (libraries); if (! check_valid_list (libpath, libraries)) return; if (inclPos != -1 && linkPos == -1) { #if defined(DEBUGGING) printf ("inclPos = %d, linkPos = %d\n", inclPos, linkPos); #endif linkPos = 1; convert_include_into_link (in_decoded_options, in_decoded_options_count); } add_env_option (gm2ipath, OPT_I); add_default_includes (libpath, libraries); add_exec_prefix (); #if defined(LOCAL_DEBUGGING) if (!seen_B) add_B_prefix (in_decoded_options_count, in_decoded_options); #endif #if defined(DEBUGGING) print_options ("after B prefix", *in_decoded_options_count, *in_decoded_options); #endif if (linkPos == -1) { linkPos = 1; if (inclPos == -1) add_default_fobjects (NULL, libpath, libraries); else { struct cl_decoded_option *options = *in_decoded_options; const char *prev = options[inclPos].arg; add_default_fobjects (prev, libpath, libraries); } } if ((!seen_x_flag) && seen_module_extension) fe_generate_option (OPT_x, "modula-2", false); if (need_plugin) fe_generate_option (OPT_fplugin_, "m2rte", true); if (linking) { add_env_option (gm2opath, OPT_fobject_path_); (*in_added_libraries) += add_default_archives ( libpath, libraries, in_decoded_options_count, in_decoded_options, *in_decoded_options_count); if (need_math) (*in_added_libraries) += add_library (MATH_LIBRARY, in_decoded_options_count, in_decoded_options, *in_decoded_options_count); if (need_pthread) (*in_added_libraries) += add_library ("pthread", in_decoded_options_count, in_decoded_options, *in_decoded_options_count); if (seen_fexceptions) (*in_added_libraries) += add_library (LIBSTDCXX, in_decoded_options_count, in_decoded_options, *in_decoded_options_count); /* There is no point adding -shared-libgcc if we don't have a shared libgcc. */ #if !defined(ENABLE_SHARED_LIBGCC) shared_libgcc = false; #endif if (shared_libgcc) { fe_generate_option (OPT_shared_libgcc, NULL, false); (*in_added_libraries) += add_library ("gcc_eh", in_decoded_options_count, in_decoded_options, *in_decoded_options_count); } } scan_for_link_args (in_decoded_options_count, in_decoded_options); #if defined(DEBUGGING) print_options ("before include purge", *in_decoded_options_count, *in_decoded_options); #endif purge_include_options (in_decoded_options_count, in_decoded_options); #if defined(DEBUGGING) print_options ("after include purge", *in_decoded_options_count, *in_decoded_options); #endif } /* lang_specific_pre_link - does nothing. */ int lang_specific_pre_link (void) { return 0; } /* get_objects returns a string containing all objects specified on the command line. */ static const char * get_objects (int argc ATTRIBUTE_UNUSED, const char *argv[] ATTRIBUTE_UNUSED) { char *result = (char *)xmalloc (1); int len = 0; int flen; object_list *o; *result = (char)0; for (o = head_objects; o != NULL; o = o->next) { len = strlen (result); flen = strlen (o->name); result = (char *)xrealloc (result, len + flen + 1 + 1); strcat (result, o->name); strcat (result, " "); } return result; } /* remove_objects return an empty string, but also remove all objects from the command line. */ extern void fe_mark_compiled (const char *); static const char * remove_objects (int argc ATTRIBUTE_UNUSED, const char *argv[] ATTRIBUTE_UNUSED) { object_list *o; for (o = head_objects; o != NULL; o = o->next) fe_mark_compiled (o->name); return NULL; } /* get_link_args returns a string containing all arguments related to the link stage. */ static const char * get_link_args (int argc ATTRIBUTE_UNUSED, const char *argv[] ATTRIBUTE_UNUSED) { char *result = (char *)xmalloc (1); int len = 0; int alen; object_list *o; *result = (char)0; for (o = head_link_args; o != NULL; o = o->next) { len = strlen (result); alen = strlen (o->name); result = (char *)xrealloc (result, len + alen + 1 + 1); strcat (result, o->name); strcat (result, " "); } return result; } /* add_exec_dir prepends the exec path to the given executable filename. */ static const char * add_exec_dir (int argc, const char *argv[]) { if (argc == 1 && argv[0] != NULL) { const char *path; if (seen_B) path = xstrdup (B_path); else path = gen_gm2_libexec (get_libexec ()); if (path != NULL) { char *opt = (char *)xmalloc (strlen ("-fcppprog=") + strlen (path) + 1 + strlen (argv[0]) + 1); char *sep = (char *)alloca (2); sep[0] = DIR_SEPARATOR; sep[1] = (char)0; strcpy (opt, "-fcppprog="); strcat (opt, path); strcat (opt, sep); strcat (opt, argv[0]); return opt; } } return "-fcppprog=none"; } /* add_exec_name generate binary name. */ static const char * add_exec_name (int argc, const char *argv[]) { if (argc == 1 && argv[0] != NULL) return argv[0]; return xstrdup (""); } /* no_link tell gcc.c not to invoke its linker. */ static const char * no_link (int argc ATTRIBUTE_UNUSED, const char *argv[] ATTRIBUTE_UNUSED) { allow_linker = false; return xstrdup (""); } /* exit_callback invoke exit. */ static const char * exit_callback (int argc ATTRIBUTE_UNUSED, const char *argv[] ATTRIBUTE_UNUSED) { exit (0); } /* lang_register_spec_functions register the Modula-2 associated spec functions. */ void lang_register_spec_functions (void) { fe_add_spec_function ("objects", get_objects); fe_add_spec_function ("nolink", no_link); fe_add_spec_function ("noobjects", remove_objects); fe_add_spec_function ("linkargs", get_link_args); fe_add_spec_function ("exec_prefix", add_exec_dir); fe_add_spec_function ("exec_name", add_exec_name); fe_add_spec_function ("exit", exit_callback); } ----------------------------- New file: gcc/m2/gm2version.h ----------------------------- /* gm2version provides access to the gm2 front end version number. Copyright (C) 2008-2022 Free Software Foundation, Inc. Contributed by Gaius Mulley . This file is part of GNU Modula-2. GNU Modula-2 is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GNU Modula-2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Modula-2; see the file COPYING3. If not see . */ extern void gm2_version (int need_to_exit); ----------------------------- New file: gcc/m2/lang-specs.h ----------------------------- /* Definitions for specs for GNU Modula-2. Copyright (C) 2001-2022 Free Software Foundation, Inc. Contributed by Gaius Mulley. This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see . */ /* This is the contribution to the `default_compilers' array in gcc.c for GNU Modula-2. */ #include "m2-link-support.h" #if !defined(MODULA_PROJECT_SUPPORT) # define MODULA_PROJECT_SUPPORT " " #endif #if !defined(MODULA_LINK_SUPPORT) # define MODULA_LINK_SUPPORT " " #endif #if !defined(M2CPP) # define M2CPP " " #endif {".mod", "@modula-2", 0, 0, 0}, // {".m2l", "@modula-2-linker", 0, 0, 0}, {"@modula-2", "%{c:" MODULA_PROJECT_SUPPORT "}" "%{c|S:cc1gm2 " M2CPP " %(cc1_options) %{f*} %{+e*} %{I*} " " %{MD} %{MMD} %{M} %{MM} %{MA} %{MT*} %{MF*} %V" " %{save-temps*}" " %i %{!fsyntax-only:%(invoke_as)}}" MODULA_LINK_SUPPORT , 0, 0, 0}, ----------------------------- New file: gcc/m2/m2-link-support.h ----------------------------- /* Link support specs for GNU Modula-2. Copyright (C) 2019-2022 Free Software Foundation, Inc. Contributed by Gaius Mulley . This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see . */ /* The subprograms used by Modula-2 to facilitate linking are: gm2l - parses the top level module and all other dependent modules. It creates a dependency tree and emits a list of dependent modules. gm2lcc - generates a link command for all dependent modules or display module object filesystem location. gm2m - parses the top level module and all other dependent module and generates a Makefile from the import tree. gm2lgen - generate a C or C++ scaffold from the list of modules. gm2lorder - manipulate the dependent list of modules to force critcal runtime modules to be initialized at the beginning of the init sequence. */ /* AS run the assembler with default options. */ #define AS(INPUT,OUTPUT) "as %a %Y " INPUT " -o " OUTPUT /* GM2CC_OPTIONS a list of all CC options used by gm2 during the link scaffold generation. */ #define GM2CC_OPTIONS "%{i*} %{v*} %{m*} %{g*} %{O*} %{fPIC} %{fpic} \ %{+e*} %{I*} %{MD} %{MMD} %{M} %{MM} %{MA} \ %{MT*} %{MF*} -quiet " /* SCAFFOLDNAME is the basename of the scaffold C or C++ program which may be automatically generated by the linking process. */ #define SCAFFOLDNAME "%b_m2" /* RM_IF_NOSAVETEMP remove the next file if save-temps is absent. */ #define RM_IF_NOSAVETEMP "%{!save-temps*:%d}" /* GM2CC compile the link scaffold either with the C or C++ compiler. */ #define GM2CC(INPUT,OUTPUT) \ "%{!fno-exceptions:cc1plus;:cc1} %1" GM2CC_OPTIONS " " INPUT " \ -o " RM_IF_NOSAVETEMP SCAFFOLDNAME ".s \n\ " AS(SCAFFOLDNAME ".s",OUTPUT) " " /* GM2LCC invoke the sub program gm2lcc with the object path options and user supplied objects. It will search for Modula-2 object if they are not already present on the command line. The current module is contained in OBJECT and LST is a list of all the dependant modules. */ #define GM2LCC(OBJECT,LST) \ "gm2lcc %{fshared} %{fpic} %{fPIC} %{B*} %{L*} %{ftarget-ar=*} \ %{ftarget-ranlib=*} \ %{fobject-path=*} %{v} --exec --startup \ " SCAFFOLDNAME "%O \ %{!fshared:--ar %:objects() %:noobjects() -o " \ RM_IF_NOSAVETEMP "%w%g.a } \ " OBJECT " \ %{fshared:%w%{o:%{o*}}%:nolink() %:objects() %:noobjects() \ %:linkargs() } " LST " " /* GM2LORDER run the gm2lorder sub program. It generates a module list LST by parsing INPUT and all dependant modules. */ #define GM2LORDER(INPUT,LST) \ "gm2lorder %{fruntime-modules=*} " INPUT " -o " LST " \n" /* GM2LGEN run the gm2lgen sub program which generates a C or C++ scaffold (SCAFFOLDSRC). It then compiles SCAFFOLDSRC and links it with all dependant modules in LST. MAINOBJECT is the main module object name containing the scaffold. */ #define GM2LGEN(LST,SCAFFOLDSRC,MAINOBJECT) \ "gm2lgen %{fshared} %{fshared:--terminate --exit} \ %{!fno-exceptions:-fcpp} " LST " -o " SCAFFOLDSRC " \n\ " GM2L_COMBINE(LST,SCAFFOLDSRC,MAINOBJECT) /* GM2L_COMBINE compiles the scaffold SCAFFOLDSRC and links all dependant modules in LST. MAINOBJECT is the main module object containing the scaffold. */ #define GM2L_COMBINE(LST,SCAFFOLDSRC,MAINOBJECT) \ GM2CC(SCAFFOLDSRC,MAINOBJECT) " \n\ rm -f %w%d%g.a \n\ " GM2LCC("--mainobject " MAINOBJECT,LST) /* Pass the preprocessor options on the command line together with the exec prefix. */ #define M2CPP "%{fcpp:-fcppbegin %:exec_prefix(cc1)" \ " -E -lang-asm -traditional-cpp " \ " %(cpp_unique_options) -fcppend}" /* Generate a list of topologically sorted dependent modules. */ #define GM2L(INPUT,OUTPUT) \ "gm2l %{v} " M2CPP " %{I*} %{fdef=*} %{fmod=*} " OUTPUT " " INPUT " " /* General GNU options. */ #define GENERAL_OPTIONS "%{i*} %{f*} %{+e*} %{I*} %{MD} %{MMD} %{M} \ %{MM} %{MA} %{MT*} %{MF*} %V" /* Run the compiler using standard GNU options. */ #define CC1GM2 "cc1gm2 " M2CPP " %(cc1_options) " GENERAL_OPTIONS /* Generate a swig interface file and exit. */ #define SWIG "%{fswig:" CC1GM2 "%i \n\ %:exit()}" /* Generate a basename.lst containing a list of all dependent modules for the project and exit. */ #define MAKELIST "%{fmakelist:" GM2L("%i","%{!pipe:-o %g.l}") " |\n\ gm2lorder %{fruntime-modules=*} %{!pipe:%g.l} \ -o %b.lst \n\ %:exit()}" /* Generate a scaffold from basename.lst and store the output source into SCAFFOLDNAME.cpp and exit. */ #define MAKEINIT "%{fmakeinit:gm2lgen %{fshared} \ %{fshared:--terminate --exit} \ %{!fno-exceptions:-fcpp} %b.lst -o " \ SCAFFOLDNAME ".cpp \n\ %:exit()}" /* Display the filesystem location of the all object files in the project list. */ #define REPORT_OBJECTS "gm2lcc %{fshared} %{fpic} %{fPIC} %{B*} %{L*} \ %{ftarget-ar=*} %{ftarget-ranlib=*} \ %{fobject-path=*} %{v} -c " /* Generate a list of modules used within a project and report the object file location and exit. */ #define MODULES \ "%{fmodules:%{fuselist:" REPORT_OBJECTS " %b.lst}" \ "%{!fuselist:" GM2L("%i","%{!pipe:-o %g.l}") " |\n\ gm2lorder %{fruntime-modules=*} \ %{!pipe:%g.l} -o %g.lst \n\ " REPORT_OBJECTS " %g.lst} \n\ %:exit()}" /* MODULA_PROJECT_SUPPORT contains a list of all project support sub components. */ #define MODULA_PROJECT_SUPPORT SWIG MAKELIST MAKEINIT MODULES /* GM2 invoke cc1gm2 placing assembler output into OUTPUT given source file, INPUT. */ #define GM2(INPUT,OUTPUT) CC1GM2 " -o " OUTPUT " " INPUT /* GEN_SCAFFOLD_SRC generates the string SCAFFOLDNAME ".cpp" marking it for deletion if -fmakeinit is absent. */ #define GEN_SCAFFOLD_SRC \ "%{fmakeinit:" SCAFFOLDNAME ".cpp;:" \ RM_IF_NOSAVETEMP SCAFFOLDNAME ".cpp}" /* M2LINK compile main module (providing absense of -fonlylink) and link all project dependent modules. */ #define M2LINK \ "%{!S:%{!gm2gcc:%{!fonlylink:" GM2("%i",RM_IF_NOSAVETEMP "%g.s") " \n\ " AS("%g.s","%w%b%O") " } \n\ %{!fuselist:" GM2L("%i"," -o %g.l ") " \n\ " GM2LORDER("%g.l","%g.lst") " \n\ " GM2LGEN("%{fuselist:%b.lst;:%g.lst}",\ GEN_SCAFFOLD_SRC,\ RM_IF_NOSAVETEMP SCAFFOLDNAME "%O") "}}\n\ }" /* MODULA_LINK_SUPPORT only invoke link subprocesses if no -c option. */ #define MODULA_LINK_SUPPORT "%{!c:" M2LINK "}" ----------------------------- New file: gcc/m2/m2pp.cc ----------------------------- /* m2pp.c pretty print trees, output in Modula-2 where possible. Copyright (C) 2007-2022 Free Software Foundation, Inc. Contributed by Gaius Mulley . This file is part of GNU Modula-2. GNU Modula-2 is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GNU Modula-2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Modula-2; see the file COPYING3. If not see . */ #if defined(GM2) #include "gm2-gcc/gcc-consolidation.h" #include "m2-tree.h" #include "gm2-lang.h" #include "gm2-gcc/m2tree.h" #include "gm2-gcc/m2expr.h" #include "gm2-gcc/m2type.h" #include "gm2-gcc/m2decl.h" #else #include "config.h" #include "system.h" #include "coretypes.h" #include "cp/cp-tree.h" #include "stringpool.h" #include "gm2-gcc/gcc-consolidation.h" #include "../cp/cp-tree.h" #endif #define M2PP_C #include "m2/m2pp.h" #undef DEBUGGING typedef struct pretty_t { int needs_space; int needs_indent; int curpos; int indent; int issued_begin; int in_vars; int in_types; tree block; int bits; } pretty; typedef struct m2stack_t { tree value; struct m2stack_t *next; } stack; /* Prototypes. */ static pretty *initPretty (int bits); static pretty *dupPretty (pretty *s); static int getindent (pretty *s); static void setindent (pretty *s, int n); static int getcurpos (pretty *s); static void m2pp_identifier (pretty *s, tree t); static void m2pp_needspace (pretty *s); static void m2pp_function (pretty *s, tree t); static void m2pp_function_header (pretty *s, tree t); static void m2pp_function_vars (pretty *s, tree t); static void m2pp_statement_sequence (pretty *s, tree t); static void m2pp_print (pretty *s, const char *p); static void m2pp_print_char (pretty *s, char ch); static void m2pp_parameter (pretty *s, tree t); static void m2pp_type (pretty *s, tree t); static void m2pp_ident_pointer (pretty *s, tree t); static void m2pp_set_type (pretty *s, tree t); static void m2pp_enum (pretty *s, tree t); static void m2pp_array (pretty *s, tree t); static void m2pp_subrange (pretty *s, tree t); static void m2pp_gimpified (pretty *s, tree t); static void m2pp_pointer_type (pretty *s, tree t); static void m2pp_record_type (pretty *s, tree t); static void m2pp_union_type (pretty *s, tree t); static void m2pp_simple_type (pretty *s, tree t); static void m2pp_expression (pretty *s, tree t); static void m2pp_relop (pretty *s, tree t, const char *p); static void m2pp_simple_expression (pretty *s, tree t); static void m2pp_statement_sequence (pretty *s, tree t); static void m2pp_unknown (pretty *s, const char *s1, const char *s2); static void m2pp_statement (pretty *s, tree t); static void m2pp_assignment (pretty *s, tree t); static void m2pp_designator (pretty *s, tree t); static void m2pp_conditional (pretty *s, tree t); static void m2pp_label_expr (pretty *s, tree t); static void m2pp_label_decl (pretty *s, tree t); static void m2pp_goto (pretty *s, tree t); static void m2pp_list (pretty *s, tree t); static void m2pp_offset (pretty *s, tree t); static void m2pp_indirect_ref (pretty *s, tree t); static void m2pp_integer_cst (pretty *s, tree t); static void m2pp_real_cst (pretty *s, tree t); static void m2pp_string_cst (pretty *s, tree t); static void m2pp_integer (pretty *s, tree t); static void m2pp_addr_expr (pretty *s, tree t); static void m2pp_nop (pretty *s, tree t); static void m2pp_convert (pretty *s, tree t); static void m2pp_var_decl (pretty *s, tree t); static void m2pp_binary (pretty *s, tree t, const char *p); static void m2pp_unary (pretty *s, tree t, const char *p); static void m2pp_call_expr (pretty *s, tree t); static void m2pp_procedure_call (pretty *s, tree t); static void m2pp_ssa (pretty *s, tree t); static void m2pp_block (pretty *s, tree t); static void m2pp_block_list (pretty *s, tree t); static void m2pp_var_list (pretty *s, tree t); static void m2pp_bind_expr (pretty *s, tree t); static void m2pp_return_expr (pretty *s, tree t); static void m2pp_result_decl (pretty *s, tree t); static void m2pp_try_block (pretty *s, tree t); static void m2pp_cleanup_point_expr (pretty *s, tree t); static void m2pp_handler (pretty *s, tree t); static void m2pp_component_ref (pretty *s, tree t); static void m2pp_array_ref (pretty *s, tree t); static void m2pp_begin (pretty *s); static void m2pp_var (pretty *s); static void m2pp_types (pretty *s); static void m2pp_decl_expr (pretty *s, tree t); static void m2pp_var_type_decl (pretty *s, tree t); static void m2pp_non_lvalue_expr (pretty *s, tree t); static void m2pp_procedure_type (pretty *s, tree t); static void m2pp_param_type (pretty *s, tree t); static void m2pp_type_lowlevel (pretty *s, tree t); static void m2pp_try_catch_expr (pretty *s, tree t); static void m2pp_throw (pretty *s, tree t); static void m2pp_catch_expr (pretty *s, tree t); static void m2pp_try_finally_expr (pretty *s, tree t); static void m2pp_complex (pretty *s, tree t); static void killPretty (pretty *s); static void m2pp_compound_expression (pretty *s, tree t); static void m2pp_target_expression (pretty *s, tree t); static void m2pp_constructor (pretty *s, tree t); static void m2pp_translation (pretty *s, tree t); static void m2pp_module_block (pretty *s, tree t); static void push (tree t); static void pop (void); static int begin_printed (tree t); static void m2pp_decl_list (pretty *s, tree t); static void m2pp_loc (pretty *s, tree t); void pet (tree t); void m2pp_integer (pretty *s, tree t); extern void stop (void); static stack *stackPtr = NULL; /* do_pf helper function for pf. */ void do_pf (tree t, int bits) { pretty *state = initPretty (bits); if (TREE_CODE (t) == TRANSLATION_UNIT_DECL) m2pp_translation (state, t); else if (TREE_CODE (t) == BLOCK) m2pp_module_block (state, t); else if (TREE_CODE (t) == FUNCTION_DECL) m2pp_function (state, t); else m2pp_statement_sequence (state, t); killPretty (state); } /* pf - print function. Expected to be printed interactively from the debugger: print pf(func), or to be called from code. */ void pf (tree t) { do_pf (t, FALSE); } /* pe - print expression. Expected to be printed interactively from the debugger: print pe(expr), or to be called from code. */ void pe (tree t) { pretty *state = initPretty (FALSE); m2pp_expression (state, t); m2pp_needspace (state); m2pp_print (state, ";\n"); killPretty (state); } /* pet - print expression and its type. Expected to be printed interactively from the debugger: print pet(expr), or to be called from code. */ void pet (tree t) { pretty *state = initPretty (FALSE); m2pp_expression (state, t); m2pp_needspace (state); m2pp_print (state, ":"); m2pp_type (state, TREE_TYPE (t)); m2pp_print (state, ";\n"); killPretty (state); } /* pt - print type. Expected to be printed interactively from the debugger: print pt(expr), or to be called from code. */ void pt (tree t) { pretty *state = initPretty (FALSE); m2pp_type (state, t); m2pp_needspace (state); m2pp_print (state, ";\n"); killPretty (state); } /* ptl - print type low level. Expected to be printed interactively from the debugger: print ptl(type), or to be called from code. */ void ptl (tree t) { pretty *state = initPretty (FALSE); m2pp_type_lowlevel (state, t); m2pp_needspace (state); m2pp_print (state, ";\n"); killPretty (state); } /* ptcl - print TREE_CHAINed list. */ void ptcl (tree t) { pretty *state = initPretty (FALSE); m2pp_decl_list (state, t); m2pp_print (state, "\n"); killPretty (state); } /* loc - if tree has a location then display it within a comment. */ static void m2pp_loc (pretty *s, tree t) { if (CAN_HAVE_LOCATION_P (t)) { if (EXPR_HAS_LOCATION (t)) { if (EXPR_LOCATION (t) == UNKNOWN_LOCATION) m2pp_print (s, "(* missing location1 *)\n"); else { expanded_location l = expand_location (EXPR_LOCATION (t)); m2pp_print (s, "(* "); m2pp_print (s, l.file); m2pp_print (s, ":"); printf ("%d", l.line); m2pp_print (s, " *)"); m2pp_print (s, "\n"); } } else { m2pp_print (s, "(* missing location2 *)\n"); } } } /* m2pp_decl_list - prints a TREE_CHAINed list for a decl node. */ static void m2pp_decl_list (pretty *s, tree t) { tree u = t; m2pp_print (s, "("); m2pp_needspace (s); while (t != NULL_TREE) { m2pp_identifier (s, t); t = TREE_CHAIN (t); if (t == u || t == NULL_TREE) break; m2pp_print (s, ","); m2pp_needspace (s); } m2pp_needspace (s); m2pp_print (s, ")"); } static void m2pp_decl_bool (pretty *s, tree t) { if (TREE_STATIC (t)) m2pp_print (s, "static, "); if (DECL_EXTERNAL (t)) m2pp_print (s, "external, "); if (DECL_SEEN_IN_BIND_EXPR_P (t)) m2pp_print (s, "in bind expr, "); } void pv (tree t) { if (t) { enum tree_code code = TREE_CODE (t); if (code == PARM_DECL) { pretty *state = initPretty (FALSE); m2pp_identifier (state, t); m2pp_needspace (state); m2pp_print (state, "\n"); else { m2pp_print (state, ", abstract origin = "); m2pp_identifier (state, DECL_ABSTRACT_ORIGIN (t)); m2pp_print (state, ">\n"); pv (DECL_ABSTRACT_ORIGIN (t)); } killPretty (state); } if (code == VAR_DECL) { pretty *state = initPretty (FALSE); m2pp_identifier (state, t); m2pp_needspace (state); m2pp_print (state, "(* *)\n"); else { m2pp_print (state, ", abstract origin = "); m2pp_identifier (state, DECL_ABSTRACT_ORIGIN (t)); m2pp_print (state, "> *)\n"); pv (DECL_ABSTRACT_ORIGIN (t)); } killPretty (state); } } } /* */ #if defined(GM2_MAINTAINER) static tree rememberF = NULL; static void remember (tree t) { rememberF = t; printf ("type: watch *((tree *) %p) != %p\n", (void *)&DECL_SAVED_TREE (t), (void *)DECL_SAVED_TREE (t)); } #endif /* push - pushes tree, t, onto stack. */ static void push (tree t) { stack *s = (stack *)xmalloc (sizeof (stack)); s->value = t; s->next = stackPtr; stackPtr = s; } /* pop - pops a tree, from the stack. */ static void pop (void) { stack *s = stackPtr; stackPtr = stackPtr->next; free (s); } /* being_printed - returns TRUE if, t, is held on the stack. */ static int begin_printed (tree t) { stack *s = stackPtr; while (s != NULL) { if (s->value == t) return TRUE; else s = s->next; } return FALSE; } /* dupPretty - duplicate and return a copy of state, s. */ static pretty * dupPretty (pretty *s) { pretty *p = initPretty (s->bits); *p = *s; return p; } /* initPretty - initialise the state of the pretty printer. */ static pretty * initPretty (int bits) { pretty *state = (pretty *)xmalloc (sizeof (pretty)); state->needs_space = FALSE; state->needs_indent = FALSE; state->curpos = 0; state->indent = 0; state->issued_begin = FALSE; state->in_vars = FALSE; state->in_types = FALSE; state->block = NULL_TREE; state->bits = bits; return state; } /* killPretty - cleans up the state. */ static void killPretty (pretty *s) { free (s); fflush (stdout); } /* getindent - returns the current indent value. */ static int getindent (pretty *s) { return s->indent; } /* setindent - sets the current indent to, n. */ static void setindent (pretty *s, int n) { s->indent = n; } /* getcurpos - returns the current cursor position. */ static int getcurpos (pretty *s) { if (s->needs_space) return s->curpos + 1; else return s->curpos; } /* m2pp_type_lowlevel - prints out the low level details of a fundamental type. */ static void m2pp_type_lowlevel (pretty *s, tree t) { if (TREE_CODE (t) == INTEGER_TYPE) { m2pp_print (s, "min"); m2pp_needspace (s); m2pp_integer_cst (s, TYPE_MIN_VALUE (t)); m2pp_print (s, ", max"); m2pp_needspace (s); m2pp_integer_cst (s, TYPE_MAX_VALUE (t)); m2pp_print (s, ", type size unit"); m2pp_needspace (s); m2pp_integer_cst (s, TYPE_SIZE_UNIT (t)); m2pp_print (s, ", type size"); m2pp_needspace (s); m2pp_integer_cst (s, TYPE_SIZE (t)); printf (", precision %d, mode %d, align %d, user align %d", TYPE_PRECISION (t), TYPE_MODE (t), TYPE_ALIGN (t), TYPE_USER_ALIGN (t)); m2pp_needspace (s); if (TYPE_UNSIGNED (t)) m2pp_print (s, "unsigned\n"); else m2pp_print (s, "signed\n"); } } /* m2pp_var - emit a VAR if necessary. */ static void m2pp_var (pretty *s) { if (!s->in_vars) { s->in_vars = TRUE; m2pp_print (s, "VAR\n"); setindent (s, getindent (s) + 3); } } /* m2pp_types - emit a TYPE if necessary. */ static void m2pp_types (pretty *s) { if (!s->in_types) { s->in_types = TRUE; m2pp_print (s, "TYPE\n"); setindent (s, getindent (s) + 3); } } /* hextree - displays the critical fields for function, block and bind_expr trees in raw hex. */ static void hextree (tree t) { if (t == NULL_TREE) return; if (TREE_CODE (t) == BLOCK) { printf ("(* BLOCK %p *)\n", (void *)t); printf ("BLOCK_VARS (t) = %p\n", (void *)BLOCK_VARS (t)); printf ("BLOCK_SUPERCONTEXT (t) = %p\n", (void *)BLOCK_SUPERCONTEXT (t)); } if (TREE_CODE (t) == BIND_EXPR) { printf ("(* BIND_EXPR %p *)\n", (void *)t); printf ("BIND_EXPR_VARS (t) = %p\n", (void *)BIND_EXPR_VARS (t)); printf ("BIND_EXPR_BLOCK (t) = %p\n", (void *)BIND_EXPR_BLOCK (t)); printf ("BIND_EXPR_BODY (t) = %p\n", (void *)BIND_EXPR_BODY (t)); } if (TREE_CODE (t) == FUNCTION_DECL) { printf ("(* FUNCTION_DECL %p *)\n", (void *)t); printf ("DECL_INITIAL (t) = %p\n", (void *)DECL_INITIAL (t)); printf ("DECL_SAVED_TREE (t) = %p\n", (void *)DECL_SAVED_TREE (t)); hextree (DECL_INITIAL (t)); hextree (DECL_SAVED_TREE (t)); } if (TREE_CODE (t) == VAR_DECL) { pretty *state = initPretty (FALSE); printf ("(* VAR_DECL %p <", (void *)t); if (DECL_SEEN_IN_BIND_EXPR_P (t)) printf ("b"); if (DECL_EXTERNAL (t)) printf ("e"); if (TREE_STATIC (t)) printf ("s"); printf ("> context = %p*)\n", (void *)decl_function_context (t)); m2pp_type (state, TREE_TYPE (t)); m2pp_needspace (state); m2pp_print (state, ";\n"); killPretty (state); } if (TREE_CODE (t) == PARM_DECL) { pretty *state = initPretty (FALSE); printf ("(* PARM_DECL %p <", (void *)t); printf ("> context = %p*)\n", (void *)decl_function_context (t)); m2pp_type (state, TREE_TYPE (t)); m2pp_needspace (state); m2pp_print (state, ";\n"); killPretty (state); } } /* translation produce a pseudo implementation module from the tree t. */ static void m2pp_translation (pretty *s, tree t) { tree block = DECL_INITIAL (t); m2pp_print (s, "IMPLEMENTATION MODULE "); m2pp_identifier (s, t); m2pp_print (s, "\n\n"); if (block != NULL) { m2pp_module_block (s, block); m2pp_print (s, "\n"); } m2pp_print (s, "\n"); m2pp_print (s, "END "); m2pp_identifier (s, t); m2pp_print (s, ".\n"); } static void m2pp_module_block (pretty *s, tree t) { t = BLOCK_VARS (t); if (t != NULL_TREE) for (; t != NULL_TREE; t = TREE_CHAIN (t)) { switch (TREE_CODE (t)) { case FUNCTION_DECL: if (!DECL_EXTERNAL (t)) { pretty *p = dupPretty (s); printf ("\n"); p->in_vars = FALSE; p->in_types = FALSE; m2pp_function (p, t); killPretty (p); printf ("\n"); s->in_vars = FALSE; s->in_types = FALSE; } break; case TYPE_DECL: { int o = getindent (s); int p; m2pp_print (s, "\n"); m2pp_types (s); setindent (s, o + 3); m2pp_identifier (s, t); m2pp_print (s, " = "); p = getcurpos (s); setindent (s, p); m2pp_type (s, TREE_TYPE (t)); setindent (s, o); m2pp_needspace (s); m2pp_print (s, ";\n"); s->in_vars = FALSE; } break; case VAR_DECL: m2pp_var (s); m2pp_identifier (s, t); m2pp_needspace (s); m2pp_print (s, ":"); m2pp_needspace (s); m2pp_type (s, TREE_TYPE (t)); m2pp_needspace (s); m2pp_print (s, ";\n"); s->in_types = FALSE; break; case DECL_EXPR: printf ("is this node legal here? \n"); m2pp_decl_expr (s, t); break; default: m2pp_unknown (s, __FUNCTION__, get_tree_code_name (TREE_CODE (t))); } } } /* m2pp_begin - emit a BEGIN if necessary. */ static void m2pp_begin (pretty *s) { if (!s->issued_begin) { if (s->in_vars || s->in_types) { setindent (s, getindent (s) - 3); m2pp_print (s, "BEGIN\n"); setindent (s, getindent (s) + 3); } else { m2pp_print (s, "BEGIN\n"); setindent (s, getindent (s) + 3); } s->issued_begin = TRUE; s->in_vars = FALSE; s->in_types = FALSE; } } /* m2pp_function - walk over the function. */ static void m2pp_function (pretty *s, tree t) { m2pp_function_header (s, t); m2pp_function_vars (s, t); m2pp_statement_sequence (s, DECL_SAVED_TREE (t)); if (TREE_CODE (t) == FUNCTION_DECL) { m2pp_begin (s); setindent (s, getindent (s) - 3); m2pp_print (s, "END"); m2pp_needspace (s); m2pp_identifier (s, t); m2pp_needspace (s); m2pp_print (s, ";\n"); } } /* m2pp_bind_expr - displays the bind expr tree node. */ static void m2pp_bind_expr (pretty *s, tree t) { if (TREE_CODE (t) == BIND_EXPR) { if (BIND_EXPR_VARS (t)) { m2pp_print (s, "(* variables in bind_expr *)\n"); m2pp_var (s); m2pp_var_list (s, BIND_EXPR_VARS (t)); } if (BIND_EXPR_BLOCK (t)) { m2pp_print (s, "(* bind_expr_block *)\n"); m2pp_statement_sequence (s, BIND_EXPR_BLOCK (t)); m2pp_needspace (s); m2pp_print (s, "; \n"); } m2pp_statement_sequence (s, BIND_EXPR_BODY (t)); } } /* m2pp_block_list - iterates over the list of blocks. */ static void m2pp_block_list (pretty *s, tree t) { for (; t; t = BLOCK_CHAIN (t)) m2pp_block (s, t); } /* m2pp_block - prints the VARiables and the TYPEs inside a block. */ static void m2pp_block (pretty *s, tree t) { if ((BLOCK_VARS (t) != NULL_TREE) && (s->block != BLOCK_VARS (t))) { s->block = BLOCK_VARS (t); m2pp_print (s, "(* block variables *)\n"); m2pp_var (s); m2pp_var_list (s, BLOCK_VARS (t)); } } /* m2pp_var_type_decl - displays the variable and type declaration. */ static void m2pp_var_type_decl (pretty *s, tree t) { m2pp_identifier (s, t); m2pp_needspace (s); m2pp_print (s, ":"); m2pp_needspace (s); m2pp_type (s, TREE_TYPE (t)); m2pp_needspace (s); m2pp_print (s, ";\n"); } /* m2pp_var_list - print a variable list. */ static void m2pp_var_list (pretty *s, tree t) { if (t != NULL_TREE) for (; t; t = TREE_CHAIN (t)) { if (TREE_CODE (t) == FUNCTION_DECL) { pretty *p = dupPretty (s); printf ("\n"); p->in_vars = FALSE; p->in_types = FALSE; m2pp_function (p, t); killPretty (p); printf ("\n"); } else if (TREE_CODE (t) == TYPE_DECL) m2pp_identifier (s, t); else if (TREE_CODE (t) == DECL_EXPR) { printf ("is this node legal here? \n"); // is it legal to have a DECL_EXPR here ? m2pp_var_type_decl (s, DECL_EXPR_DECL (t)); } else m2pp_var_type_decl (s, t); } } #if 0 /* m2pp_type_list - print a variable list. */ static void m2pp_type_list (pretty *s, tree t) { if (t != NULL_TREE) for (; t; t = TREE_CHAIN (t)) { m2pp_identifier (s, t); m2pp_needspace (s); m2pp_print (s, "="); m2pp_needspace (s); m2pp_type (s, TREE_TYPE (t)); m2pp_needspace (s); m2pp_print (s, ";\n"); } } #endif /* m2pp_needspace - sets appropriate flag to TRUE. */ static void m2pp_needspace (pretty *s) { s->needs_space = TRUE; } /* m2pp_identifer - prints an identifier. */ static void m2pp_identifier (pretty *s, tree t) { if (t) { if (TREE_CODE (t) == COMPONENT_REF) m2pp_component_ref (s, t); else if (DECL_NAME (t) && IDENTIFIER_POINTER (DECL_NAME (t))) m2pp_ident_pointer (s, DECL_NAME (t)); else { char name[100]; if (TREE_CODE (t) == CONST_DECL) snprintf (name, 100, "C_%u", DECL_UID (t)); else snprintf (name, 100, "D_%u", DECL_UID (t)); m2pp_print (s, name); } } } /* m2pp_ident_pointer - displays an ident pointer. */ static void m2pp_ident_pointer (pretty *s, tree t) { if (t) m2pp_print (s, IDENTIFIER_POINTER (t)); } /* m2pp_parameter - prints out a param decl tree. */ static void m2pp_parameter (pretty *s, tree t) { if (TREE_CODE (t) == PARM_DECL) { if (TREE_TYPE (t) && (TREE_CODE (TREE_TYPE (t)) == REFERENCE_TYPE)) { m2pp_print (s, "VAR"); m2pp_needspace (s); m2pp_identifier (s, t); m2pp_print (s, ":"); m2pp_needspace (s); m2pp_simple_type (s, TREE_TYPE (TREE_TYPE (t))); } else { m2pp_identifier (s, t); m2pp_print (s, ":"); m2pp_needspace (s); m2pp_simple_type (s, TREE_TYPE (t)); } } } /* m2pp_param_type - prints out the type of parameter. */ static void m2pp_param_type (pretty *s, tree t) { if (t && (TREE_CODE (t) == REFERENCE_TYPE)) { m2pp_print (s, "VAR"); m2pp_needspace (s); m2pp_simple_type (s, TREE_TYPE (t)); } else m2pp_simple_type (s, t); } /* m2pp_procedure_type - displays a procedure type. */ static void m2pp_procedure_type (pretty *s, tree t) { push (t); if (TREE_CODE (t) == FUNCTION_TYPE) { tree i = TYPE_ARG_TYPES (t); tree returnType = TREE_TYPE (TREE_TYPE (t)); m2pp_needspace (s); m2pp_print (s, "PROCEDURE"); m2pp_needspace (s); if (i != NULL_TREE) { int o = getindent (s); int p; int first = TRUE; m2pp_print (s, "("); p = getcurpos (s); setindent (s, p); while (i != NULL_TREE) { if (TREE_CHAIN (i) == NULL_TREE) { if (TREE_VALUE (i) == void_type_node) /* ignore void_type_node at the end. */ ; else { m2pp_param_type (s, TREE_VALUE (i)); m2pp_print (s, ", ..."); } break; } else { if (!first) { m2pp_print (s, ","); m2pp_needspace (s); } m2pp_param_type (s, TREE_VALUE (i)); } i = TREE_CHAIN (i); first = FALSE; } m2pp_print (s, ")"); setindent (s, o); } else if (returnType != NULL_TREE) { m2pp_needspace (s); m2pp_print (s, "()"); } if (returnType != NULL_TREE) { m2pp_needspace (s); m2pp_print (s, ": "); m2pp_simple_type (s, returnType); } } pop (); } /* m2pp_comment_header - displays a simple header with some critical tree info. */ static void m2pp_comment_header (pretty *s, tree t) { int o = getindent (s); m2pp_print (s, "(*\n"); setindent (s, o + 3); m2pp_identifier (s, t); m2pp_needspace (s); m2pp_print (s, "-"); m2pp_needspace (s); if (TREE_PUBLIC (t)) { m2pp_needspace (s); m2pp_print (s, "public,"); } if (TREE_STATIC (t)) { m2pp_needspace (s); m2pp_print (s, "static,"); } if (DECL_EXTERNAL (t)) { m2pp_needspace (s); m2pp_print (s, "extern"); } m2pp_print (s, "\n"); setindent (s, o); m2pp_print (s, "*)\n\n"); } /* m2pp_function_header - displays the function header. */ static void m2pp_function_header (pretty *s, tree t) { push (t); if (TREE_CODE (t) == FUNCTION_DECL) { tree i = DECL_ARGUMENTS (t); tree returnType = TREE_TYPE (TREE_TYPE (t)); m2pp_comment_header (s, t); m2pp_print (s, "PROCEDURE "); m2pp_identifier (s, t); m2pp_needspace (s); if (i != NULL_TREE) { int o = getindent (s); int p; m2pp_print (s, "("); p = getcurpos (s); setindent (s, p); while (i != NULL_TREE) { m2pp_parameter (s, i); i = TREE_CHAIN (i); if (i != NULL_TREE) m2pp_print (s, ";\n"); } m2pp_print (s, ")"); m2pp_needspace (s); setindent (s, o); } else if (returnType != void_type_node) { m2pp_print (s, "()"); m2pp_needspace (s); } if (returnType != void_type_node) { m2pp_print (s, ": "); m2pp_simple_type (s, returnType); m2pp_needspace (s); } m2pp_print (s, "; "); m2pp_loc (s, t); m2pp_print (s, "\n"); } pop (); } /* 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) { tree t = *tp; pretty *s = (pretty *)data; enum tree_code code = TREE_CODE (t); if (code == VAR_DECL) { m2pp_var (s); m2pp_identifier (s, t); m2pp_needspace (s); m2pp_print (s, ":"); m2pp_needspace (s); m2pp_type (s, TREE_TYPE (t)); m2pp_needspace (s); m2pp_print (s, ";\n"); } if (code == SSA_NAME) { m2pp_var (s); m2pp_ssa (s, t); m2pp_identifier (s, SSA_NAME_VAR (t)); m2pp_needspace (s); m2pp_print (s, ":"); m2pp_needspace (s); m2pp_type (s, TREE_TYPE (t)); m2pp_needspace (s); m2pp_print (s, ";\n"); } *walk_subtrees = 1; return NULL_TREE; } /* m2pp_function_vars - displays variables as defined by the function tree. */ static void m2pp_function_vars (pretty *s, tree t) { walk_tree_without_duplicates (&t, m2pp_add_var, s); if (TREE_CODE (t) == FUNCTION_DECL && DECL_INITIAL (t)) { m2pp_print (s, "(* variables in function_decl (decl_initial) *)\n"); m2pp_var (s); m2pp_statement_sequence (s, DECL_INITIAL (t)); } } /* 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) { if (p) { int l = strlen (p); int i = 0; if (s->needs_space) { printf (" "); s->needs_space = FALSE; s->curpos++; } while (i < l) { if (p[i] == '\n') { s->needs_indent = TRUE; s->curpos = 0; printf ("\n"); } else { if (s->needs_indent) { if (s->indent > 0) printf ("%*c", s->indent, ' '); s->needs_indent = FALSE; s->curpos += s->indent; } s->curpos++; putchar (p[i]); } i++; } } } /* m2pp_print_char - prints out a character, ch, obeying needs_space and needs_indent. */ static void m2pp_print_char (pretty *s, char ch) { if (s->needs_space) { printf (" "); s->needs_space = FALSE; s->curpos++; } if (s->needs_indent) { if (s->indent > 0) printf ("%*c", s->indent, ' '); s->needs_indent = FALSE; s->curpos += s->indent; } if (ch == '\n') { s->curpos++; putchar ('\\'); putchar ('n'); } else putchar (ch); s->curpos++; } /* m2pp_integer - display the appropriate integer type. */ #if defined(GM2) void m2pp_integer (pretty *s, tree t) { if (t == m2type_GetM2ZType ()) m2pp_print (s, "M2ZTYPE"); else if (t == m2type_GetM2LongIntType ()) m2pp_print (s, "LONGINT"); else if (t == m2type_GetM2IntegerType ()) m2pp_print (s, "INTEGER"); else if (t == m2type_GetM2ShortIntType ()) m2pp_print (s, "SHORTINT"); else if (t == m2type_GetLongIntType ()) m2pp_print (s, "long int"); else if (t == m2type_GetIntegerType ()) m2pp_print (s, "int"); else if (t == m2type_GetShortIntType ()) m2pp_print (s, "short"); else if (t == m2type_GetM2LongCardType ()) m2pp_print (s, "LONGCARD"); else if (t == m2type_GetM2CardinalType ()) m2pp_print (s, "CARDINAL"); else if (t == m2type_GetM2ShortCardType ()) m2pp_print (s, "SHORTCARD"); else if (t == m2type_GetCardinalType ()) m2pp_print (s, "CARDINAL"); else if (t == m2type_GetPointerType ()) m2pp_print (s, "ADDRESS"); else if (t == m2type_GetByteType ()) m2pp_print (s, "BYTE"); else if (t == m2type_GetCharType ()) m2pp_print (s, "CHAR"); else if (t == m2type_GetBitsetType ()) m2pp_print (s, "BITSET"); else if (t == m2type_GetBitnumType ()) m2pp_print (s, "BITNUM"); else { if (TYPE_UNSIGNED (t)) m2pp_print (s, "CARDINAL"); else m2pp_print (s, "INTEGER"); m2pp_integer_cst (s, TYPE_SIZE (t)); } } #else void m2pp_integer (pretty *s, tree t ATTRIBUTE_UNUSED) { m2pp_print (s, "INTEGER"); } #endif /* m2pp_complex - display the actual complex type. */ #if defined(GM2) static void m2pp_complex (pretty *s, tree t) { if (t == m2type_GetM2ComplexType ()) m2pp_print (s, "COMPLEX"); else if (t == m2type_GetM2LongComplexType ()) m2pp_print (s, "LONGCOMPLEX"); else if (t == m2type_GetM2ShortComplexType ()) m2pp_print (s, "SHORTCOMPLEX"); else if (t == m2type_GetM2CType ()) m2pp_print (s, "C'omplex' type"); else if (t == m2type_GetM2Complex32 ()) m2pp_print (s, "COMPLEX32"); else if (t == m2type_GetM2Complex64 ()) m2pp_print (s, "COMPLEX64"); else if (t == m2type_GetM2Complex96 ()) m2pp_print (s, "COMPLEX96"); else if (t == m2type_GetM2Complex128 ()) m2pp_print (s, "COMPLEX128"); else m2pp_print (s, "unknown COMPLEX type"); } #else static void m2pp_complex (pretty *s, tree t ATTRIBUTE_UNUSED) { m2pp_print (s, "a COMPLEX type"); } #endif /* m2pp_type - prints a full type. */ void m2pp_type (pretty *s, tree t) { if (begin_printed (t)) { m2pp_print (s, "<...>"); return; } if ((TREE_CODE (t) != FIELD_DECL) && (TREE_CODE (t) != TYPE_DECL)) m2pp_gimpified (s, t); switch (TREE_CODE (t)) { case INTEGER_TYPE: m2pp_integer (s, t); break; case REAL_TYPE: m2pp_print (s, "REAL"); break; case ENUMERAL_TYPE: m2pp_enum (s, t); break; case UNION_TYPE: m2pp_union_type (s, t); break; case RECORD_TYPE: m2pp_record_type (s, t); break; case ARRAY_TYPE: m2pp_array (s, t); break; #if 0 case FUNCTION_TYPE: m2pp_function_type (s, t); break; #endif case TYPE_DECL: m2pp_identifier (s, t); break; case POINTER_TYPE: m2pp_pointer_type (s, t); break; #if defined(GM2) case SET_TYPE: m2pp_set_type (s, t); break; #endif case VOID_TYPE: m2pp_print (s, "ADDRESS"); break; case COMPLEX_TYPE: m2pp_complex (s, t); break; default: m2pp_unknown (s, __FUNCTION__, get_tree_code_name (TREE_CODE (t))); } } /* m2pp_set_type - prints out the set type. */ static void m2pp_set_type (pretty *s, tree t) { push (t); m2pp_print (s, "SET OF"); m2pp_needspace (s); m2pp_type (s, TREE_TYPE (t)); pop (); } /* m2pp_enum - print out the enumeration type. */ static void m2pp_enum (pretty *s, tree t) { tree chain_p = TYPE_VALUES (t); push (t); m2pp_print (s, "("); while (chain_p) { m2pp_ident_pointer (s, TREE_PURPOSE (chain_p)); chain_p = TREE_CHAIN (chain_p); if (chain_p) m2pp_print (s, ", "); } m2pp_print (s, ")"); pop (); } /* m2pp_array - prints out the array type. */ static void m2pp_array (pretty *s, tree t) { push (t); m2pp_print (s, "ARRAY"); m2pp_needspace (s); m2pp_subrange (s, TYPE_DOMAIN (t)); m2pp_needspace (s); m2pp_print (s, "OF"); m2pp_needspace (s); m2pp_type (s, TREE_TYPE (t)); pop (); } /* m2pp_subrange - prints out the subrange, but probably the lower bound will always be zero. */ static void m2pp_subrange (pretty *s, tree t) { tree min = TYPE_MIN_VALUE (t); tree max = TYPE_MAX_VALUE (t); m2pp_print (s, "["); m2pp_expression (s, min); m2pp_print (s, ".."); m2pp_expression (s, max); m2pp_print (s, "]"); } /* m2pp_gimplified - print out a gimplified comment. */ static void m2pp_gimpified (pretty *s, tree t) { if (!TYPE_SIZES_GIMPLIFIED (t)) { m2pp_print (s, "(* *)"); m2pp_needspace (s); } } /* m2pp_printer_type - display the pointer type. */ static void m2pp_pointer_type (pretty *s, tree t) { push (t); if (TREE_CODE (t) == POINTER_TYPE) { if (TREE_CODE (TREE_TYPE (t)) == FUNCTION_TYPE) m2pp_procedure_type (s, TREE_TYPE (t)); else if (t == ptr_type_node) m2pp_print (s, "ADDRESS"); else { m2pp_print (s, "POINTER TO"); m2pp_needspace (s); m2pp_type (s, TREE_TYPE (t)); } } pop (); } /* m2pp_record_alignment - prints out whether this record is aligned (packed). */ static void m2pp_record_alignment (pretty *s, tree t) { if (TYPE_PACKED (t)) m2pp_print (s, "<* bytealignment (0) *>\n"); } static unsigned int m2pp_getaligned (tree t) { if (DECL_P (t)) { if (DECL_USER_ALIGN (t)) return DECL_ALIGN (t); } else if (TYPE_P (t)) { if (TYPE_USER_ALIGN (t)) return TYPE_ALIGN (t); } return 0; } static void m2pp_recordfield_alignment (pretty *s, tree t) { unsigned int aligned = m2pp_getaligned (t); if (aligned != 0) { int o = getindent (s); int p = getcurpos (s); m2pp_needspace (s); m2pp_print (s, "<* bytealignment ("); setindent (s, p + 18); printf ("%d", aligned / BITS_PER_UNIT); m2pp_print (s, ")"); m2pp_needspace (s); setindent (s, p); m2pp_print (s, "*>"); setindent (s, o); } } static void m2pp_recordfield_bitfield (pretty *s, tree t) { if ((TREE_CODE (t) == FIELD_DECL) && DECL_PACKED (t)) { m2pp_print (s, " (* packed"); if (DECL_NONADDRESSABLE_P (t)) m2pp_print (s, ", non-addressible"); if (DECL_BIT_FIELD (t)) m2pp_print (s, ", bit-field"); m2pp_print (s, ", offset: "); m2pp_expression (s, DECL_FIELD_OFFSET (t)); m2pp_print (s, ", bit offset:"); m2pp_expression (s, DECL_FIELD_BIT_OFFSET (t)); m2pp_print (s, " *) "); } } /* m2pp_record_type - displays the record type. */ static void m2pp_record_type (pretty *s, tree t) { push (t); if (TREE_CODE (t) == RECORD_TYPE) { tree i; int o = getindent (s); int p = getcurpos (s); m2pp_print (s, "RECORD\n"); setindent (s, p + 3); m2pp_record_alignment (s, t); for (i = TYPE_FIELDS (t); i != NULL_TREE; i = TREE_CHAIN (i)) { m2pp_identifier (s, i); m2pp_print (s, " : "); m2pp_type (s, TREE_TYPE (i)); m2pp_recordfield_bitfield (s, i); m2pp_recordfield_alignment (s, i); m2pp_print (s, ";\n"); } setindent (s, p); m2pp_print (s, "END"); setindent (s, o); } pop (); } /* m2pp_record_type - displays the record type. */ static void m2pp_union_type (pretty *s, tree t) { push (t); if (TREE_CODE (t) == UNION_TYPE) { tree i; int o = getindent (s); int p = getcurpos (s); m2pp_print (s, "CASE .. OF\n"); setindent (s, p + 3); m2pp_record_alignment (s, t); for (i = TYPE_FIELDS (t); i != NULL_TREE; i = TREE_CHAIN (i)) { m2pp_identifier (s, i); m2pp_print (s, " : "); m2pp_type (s, TREE_TYPE (i)); m2pp_recordfield_bitfield (s, i); m2pp_print (s, ";\n"); } setindent (s, p); m2pp_print (s, "END"); setindent (s, o); } pop (); } /* m2pp_simple_type. */ static void m2pp_simple_type (pretty *s, tree t) { if (begin_printed (t)) { m2pp_print (s, "<...>"); return; } m2pp_gimpified (s, t); switch (TREE_CODE (t)) { case INTEGER_TYPE: m2pp_integer (s, t); break; case REAL_TYPE: m2pp_print (s, "REAL"); break; case BOOLEAN_TYPE: m2pp_print (s, "BOOLEAN"); break; case VOID_TYPE: m2pp_print (s, "ADDRESS"); break; case TYPE_DECL: m2pp_identifier (s, t); break; case POINTER_TYPE: m2pp_pointer_type (s, t); break; case RECORD_TYPE: m2pp_record_type (s, t); break; case UNION_TYPE: m2pp_union_type (s, t); break; case ENUMERAL_TYPE: m2pp_enum (s, t); break; case COMPLEX_TYPE: m2pp_complex (s, t); break; default: m2pp_unknown (s, __FUNCTION__, get_tree_code_name (TREE_CODE (t))); } } /* m2pp_expression - */ static void m2pp_expression (pretty *s, tree t) { enum tree_code code = TREE_CODE (t); switch (code) { case EQ_EXPR: m2pp_relop (s, t, "="); break; case NE_EXPR: m2pp_relop (s, t, "#"); break; case LE_EXPR: m2pp_relop (s, t, "<="); break; case GE_EXPR: m2pp_relop (s, t, ">="); break; case LT_EXPR: m2pp_relop (s, t, "<"); break; case GT_EXPR: m2pp_relop (s, t, ">"); break; default: m2pp_simple_expression (s, t); } } /* m2pp_relop - displays the lhs relop rhs. */ static void m2pp_relop (pretty *s, tree t, const char *p) { m2pp_expression (s, TREE_OPERAND (t, 0)); m2pp_needspace (s); m2pp_print (s, p); m2pp_needspace (s); m2pp_expression (s, TREE_OPERAND (t, 1)); } /* m2pp_compound_expression - handle compound expression tree. */ static void m2pp_compound_expression (pretty *s, tree t) { m2pp_print (s, "compound expression {"); m2pp_expression (s, TREE_OPERAND (t, 0)); m2pp_print (s, " (* result ignored *), "); m2pp_expression (s, TREE_OPERAND (t, 1)); m2pp_print (s, "}"); m2pp_needspace (s); } /* m2pp_target_expression - handle target expression tree. */ static void m2pp_target_expression (pretty *s, tree t) { m2pp_print (s, "{"); m2pp_needspace (s); if (TREE_OPERAND (t, 0) != NULL_TREE) { m2pp_print (s, "(* target *) "); m2pp_expression (s, TREE_OPERAND (t, 0)); m2pp_print (s, ","); m2pp_needspace (s); } if (TREE_OPERAND (t, 1) != NULL_TREE) { m2pp_print (s, "(* initializer *) "); m2pp_expression (s, TREE_OPERAND (t, 1)); m2pp_print (s, ","); m2pp_needspace (s); } if (TREE_OPERAND (t, 2) != NULL_TREE) { m2pp_print (s, "(* cleanup *) "); m2pp_expression (s, TREE_OPERAND (t, 2)); m2pp_print (s, ","); m2pp_needspace (s); } if (TREE_OPERAND (t, 3) != NULL_TREE) { m2pp_print (s, "(* saved initializer *) "); m2pp_expression (s, TREE_OPERAND (t, 3)); m2pp_print (s, ","); m2pp_needspace (s); } m2pp_print (s, "}"); m2pp_needspace (s); } /* m2pp_constructor - print out a constructor. */ static void m2pp_constructor (pretty *s, tree t) { tree purpose, value; unsigned HOST_WIDE_INT ix; m2pp_print (s, "{ "); FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (t), ix, purpose, value) { m2pp_print (s, "(index: "); m2pp_simple_expression (s, purpose); m2pp_print (s, ") "); m2pp_simple_expression (s, value); m2pp_print (s, ", "); } m2pp_print (s, "}"); m2pp_print (s, "(* type: "); setindent (s, getindent (s) + 8); m2pp_type (s, TREE_TYPE (t)); setindent (s, getindent (s) - 8); m2pp_print (s, " *)\n"); } /* m2pp_complex_expr - handle GCC complex_expr tree. */ static void m2pp_complex_expr (pretty *s, tree t) { if (TREE_CODE (t) == COMPLEX_CST) { m2pp_print (s, "CMPLX("); m2pp_needspace (s); m2pp_expression (s, TREE_REALPART (t)); m2pp_print (s, ","); m2pp_needspace (s); m2pp_expression (s, TREE_IMAGPART (t)); m2pp_print (s, ")"); } else { m2pp_print (s, "CMPLX("); m2pp_needspace (s); m2pp_expression (s, TREE_OPERAND (t, 0)); m2pp_print (s, ","); m2pp_needspace (s); m2pp_expression (s, TREE_OPERAND (t, 1)); m2pp_print (s, ")"); } } /* m2pp_imagpart_expr - handle imagpart_expr tree. */ static void m2pp_imagpart_expr (pretty *s, tree t) { m2pp_print (s, "IM("); m2pp_needspace (s); if (TREE_CODE (t) == IMAGPART_EXPR) m2pp_expression (s, TREE_OPERAND (t, 0)); else if (TREE_CODE (t) == COMPLEX_CST) m2pp_expression (s, TREE_IMAGPART (t)); m2pp_needspace (s); m2pp_print (s, ")"); } /* m2pp_realpart_expr - handle imagpart_expr tree. */ static void m2pp_realpart_expr (pretty *s, tree t) { m2pp_print (s, "RE("); m2pp_needspace (s); if (TREE_CODE (t) == REALPART_EXPR) m2pp_expression (s, TREE_OPERAND (t, 0)); else if (TREE_CODE (t) == COMPLEX_CST) m2pp_expression (s, TREE_REALPART (t)); m2pp_needspace (s); m2pp_print (s, ")"); } /* m2pp_bit_ior_expr - */ static void m2pp_bit_ior_expr (pretty *s, tree t) { m2pp_binary (s, t, "|"); } /* m2pp_truth_expr. */ static void m2pp_truth_expr (pretty *s, tree t, const char *op) { m2pp_print (s, "("); m2pp_expression (s, TREE_OPERAND (t, 0)); m2pp_print (s, ")"); m2pp_needspace (s); m2pp_print (s, op); m2pp_needspace (s); m2pp_print (s, "("); m2pp_expression (s, TREE_OPERAND (t, 1)); m2pp_print (s, ")"); } /* m2pp_simple_expression - handle GCC expression tree. */ static void m2pp_simple_expression (pretty *s, tree t) { enum tree_code code = TREE_CODE (t); switch (code) { case ERROR_MARK: m2pp_print (s, "(* !!! ERROR NODE !!! *)"); break; case CONSTRUCTOR: m2pp_constructor (s, t); break; case IDENTIFIER_NODE: m2pp_ident_pointer (s, t); break; case PARM_DECL: m2pp_identifier (s, t); break; case FIELD_DECL: m2pp_identifier (s, t); break; case TREE_LIST: m2pp_list (s, t); break; case BLOCK: m2pp_print (s, "(* BLOCK NODE *)"); break; case OFFSET_TYPE: m2pp_offset (s, t); break; case INTEGER_CST: m2pp_integer_cst (s, t); break; case REAL_CST: m2pp_real_cst (s, t); break; case STRING_CST: m2pp_string_cst (s, t); break; case INDIRECT_REF: m2pp_indirect_ref (s, t); break; case ADDR_EXPR: m2pp_addr_expr (s, t); break; case NOP_EXPR: m2pp_nop (s, t); break; case CONVERT_EXPR: m2pp_convert (s, t); break; case VAR_DECL: m2pp_var_decl (s, t); break; case RESULT_DECL: m2pp_result_decl (s, t); break; case PLUS_EXPR: m2pp_binary (s, t, "+"); break; case MINUS_EXPR: m2pp_binary (s, t, "-"); break; case MULT_EXPR: m2pp_binary (s, t, "*"); break; case FLOOR_DIV_EXPR: case CEIL_DIV_EXPR: case TRUNC_DIV_EXPR: case ROUND_DIV_EXPR: m2pp_binary (s, t, "DIV"); break; case FLOOR_MOD_EXPR: case CEIL_MOD_EXPR: case TRUNC_MOD_EXPR: case ROUND_MOD_EXPR: m2pp_binary (s, t, "MOD"); break; case NEGATE_EXPR: m2pp_unary (s, t, "-"); break; case CALL_EXPR: m2pp_call_expr (s, t); break; case SSA_NAME: m2pp_ssa (s, t); break; case COMPONENT_REF: m2pp_component_ref (s, t); break; case RETURN_EXPR: m2pp_return_expr (s, t); break; case ARRAY_REF: m2pp_array_ref (s, t); break; case NON_LVALUE_EXPR: m2pp_non_lvalue_expr (s, t); break; case EXPR_STMT: m2pp_expression (s, EXPR_STMT_EXPR (t)); break; #if 0 case EXC_PTR_EXPR: m2pp_print (s, "GCC_EXCEPTION_OBJECT"); break; #endif case INIT_EXPR: case MODIFY_EXPR: m2pp_assignment (s, t); break; case COMPOUND_EXPR: m2pp_compound_expression (s, t); break; case TARGET_EXPR: m2pp_target_expression (s, t); break; case THROW_EXPR: m2pp_throw (s, t); break; case FUNCTION_DECL: m2pp_identifier (s, t); break; case COMPLEX_EXPR: m2pp_complex_expr (s, t); break; case REALPART_EXPR: m2pp_realpart_expr (s, t); break; case IMAGPART_EXPR: m2pp_imagpart_expr (s, t); break; case CONST_DECL: m2pp_identifier (s, t); break; case POINTER_PLUS_EXPR: m2pp_binary (s, t, "+"); break; case CLEANUP_POINT_EXPR: m2pp_cleanup_point_expr (s, t); break; case BIT_IOR_EXPR: m2pp_bit_ior_expr (s, t); break; case TRUTH_ANDIF_EXPR: m2pp_truth_expr (s, t, "AND"); break; case TRUTH_ORIF_EXPR: m2pp_truth_expr (s, t, "OR"); break; default: m2pp_unknown (s, __FUNCTION__, get_tree_code_name (code)); } } /* non_lvalue_expr - indicates that operand 0 is not an lvalue. */ static void m2pp_non_lvalue_expr (pretty *s, tree t) { m2pp_needspace (s); m2pp_print (s, "assert_non_lvalue("); m2pp_needspace (s); m2pp_expression (s, TREE_OPERAND (t, 0)); m2pp_needspace (s); m2pp_print (s, ")"); } /* m2pp_array_ref - prints out the array reference. */ static void m2pp_array_ref (pretty *s, tree t) { m2pp_expression (s, TREE_OPERAND (t, 0)); m2pp_print (s, "["); m2pp_expression (s, TREE_OPERAND (t, 1)); m2pp_print (s, "]"); } /* m2pp_ssa - prints out the ssa variable name. */ static void m2pp_ssa (pretty *s, tree t) { m2pp_identifier (s, SSA_NAME_VAR (t)); } /* m2pp_binary - print the binary operator, p, and lhs, rhs. */ static void m2pp_binary (pretty *s, tree t, const char *p) { tree left = TREE_OPERAND (t, 0); tree right = TREE_OPERAND (t, 1); m2pp_expression (s, left); m2pp_needspace (s); m2pp_print (s, p); m2pp_needspace (s); m2pp_expression (s, right); } /* m2pp_unary - print the unary operator, p, and expression. */ static void m2pp_unary (pretty *s, tree t, const char *p) { tree expr = TREE_OPERAND (t, 0); m2pp_needspace (s); m2pp_print (s, p); m2pp_expression (s, expr); } /* m2pp_integer_cst - displays the integer constant. */ static void m2pp_integer_cst (pretty *s, tree t) { char val[100]; snprintf (val, 100, "%lud", TREE_INT_CST_LOW (t)); m2pp_print (s, val); } /* m2pp_real_cst - displays the real constant. */ static void m2pp_real_cst (pretty *s, tree t ATTRIBUTE_UNUSED) { m2pp_print (s, ""); } /* m2pp_string_cst - displays the real constant. */ static void m2pp_string_cst (pretty *s, tree t) { const char *p = TREE_STRING_POINTER (t); int i = 0; m2pp_print (s, "\""); while (p[i] != '\0') { m2pp_print_char (s, p[i]); i++; } m2pp_print (s, "\""); } /* m2pp_statement_sequence - iterates over a statement list displaying each statement in turn. */ static void m2pp_statement_sequence (pretty *s, tree t) { if (t != NULL_TREE) { if (TREE_CODE (t) == STATEMENT_LIST) { tree_stmt_iterator i; m2pp_print (s, "(* statement list *)\n"); for (i = tsi_start (t); !tsi_end_p (i); tsi_next (&i)) m2pp_statement (s, *tsi_stmt_ptr (i)); } else m2pp_statement (s, t); } } /* m2pp_unknown - displays an error message. */ static void m2pp_unknown (pretty *s, const char *s1, const char *s2) { m2pp_begin (s); m2pp_print (s, s1); m2pp_needspace (s); m2pp_print (s, s2); m2pp_needspace (s); } /* m2pp_throw - displays a throw statement. */ static void m2pp_throw (pretty *s, tree t) { tree expr = TREE_OPERAND (t, 0); m2pp_begin (s); if (expr == NULL_TREE) m2pp_print (s, "THROW ;\n"); else { m2pp_print (s, "THROW ("); m2pp_expression (s, TREE_OPERAND (t, 0)); m2pp_print (s, ")\n"); } } /* m2pp_catch_expr - attempts to reconstruct a catch expr. */ static void m2pp_catch_expr (pretty *s, tree t) { tree types = CATCH_TYPES (t); tree body = CATCH_BODY (t); m2pp_print (s, "(* CATCH expression "); if (types != NULL_TREE) { m2pp_print (s, "("); m2pp_expression (s, types); m2pp_print (s, ")"); } m2pp_print (s, "*)\n"); m2pp_print (s, "(* catch body *)\n"); m2pp_statement_sequence (s, body); m2pp_print (s, "(* end catch body *)\n"); } /* m2pp_try_finally_expr - attemts to reconstruct a try finally expr. */ static void m2pp_try_finally_expr (pretty *s, tree t) { m2pp_begin (s); m2pp_print (s, "(* try_finally_expr *)\n"); setindent (s, getindent (s) + 3); m2pp_statement_sequence (s, TREE_OPERAND (t, 0)); setindent (s, getindent (s) - 3); m2pp_print (s, "(* finally (cleanup which is executed after the above) *)\n"); setindent (s, getindent (s) + 3); m2pp_statement_sequence (s, TREE_OPERAND (t, 1)); setindent (s, getindent (s) - 3); m2pp_print (s, "(* end try_finally_expr *)\n"); } #if !defined(GM2) /* m2pp_if_stmt - pretty print a C++ if_stmt. */ static void m2pp_if_stmt (pretty *s, tree t) { m2pp_print (s, "(* only C++ uses if_stmt nodes *)\n"); m2pp_print (s, "IF "); m2pp_expression (s, TREE_OPERAND (t, 0)); m2pp_print (s, "\n"); m2pp_print (s, "THEN\n"); setindent (s, getindent (s) + 3); m2pp_statement_sequence (s, TREE_OPERAND (t, 1)); setindent (s, getindent (s) - 3); m2pp_print (s, "ELSE\n"); setindent (s, getindent (s) + 3); m2pp_statement_sequence (s, TREE_OPERAND (t, 2)); setindent (s, getindent (s) - 3); m2pp_print (s, "END\n"); } #endif /* m2pp_statement - attempts to reconstruct a statement. */ static void m2pp_statement (pretty *s, tree t) { enum tree_code code = TREE_CODE (t); m2pp_loc (s, t); switch (code) { case COND_EXPR: m2pp_conditional (s, t); break; case LABEL_EXPR: m2pp_label_expr (s, t); break; case LABEL_DECL: m2pp_label_decl (s, t); break; case GOTO_EXPR: m2pp_goto (s, t); break; case INIT_EXPR: case MODIFY_EXPR: m2pp_assignment (s, t); break; case CALL_EXPR: m2pp_procedure_call (s, t); break; case BLOCK: m2pp_block_list (s, t); break; case BIND_EXPR: m2pp_bind_expr (s, t); break; case RETURN_EXPR: m2pp_return_expr (s, t); break; case DECL_EXPR: m2pp_decl_expr (s, t); break; case TRY_BLOCK: m2pp_try_block (s, t); break; case HANDLER: m2pp_handler (s, t); break; case CLEANUP_POINT_EXPR: m2pp_cleanup_point_expr (s, t); break; case THROW_EXPR: m2pp_throw (s, t); break; case TRY_CATCH_EXPR: m2pp_try_catch_expr (s, t); break; case TRY_FINALLY_EXPR: m2pp_try_finally_expr (s, t); break; case CATCH_EXPR: m2pp_catch_expr (s, t); break; #if defined(CPP) case IF_STMT: m2pp_if_stmt (s, t); break; #endif case ERROR_MARK: m2pp_print (s, "\n"); break; default: m2pp_unknown (s, __FUNCTION__, get_tree_code_name (TREE_CODE (t))); } } /* m2pp_try_catch_expr - is used after gimplification. */ static void m2pp_try_catch_expr (pretty *s, tree t) { m2pp_print (s, "(* try_catch_expr begins *)\n"); m2pp_statement_sequence (s, TREE_OPERAND (t, 0)); setindent (s, 0); m2pp_print (s, "EXCEPT\n"); setindent (s, 3); m2pp_statement_sequence (s, TREE_OPERAND (t, 1)); m2pp_print (s, "(* try_catch_expr ends *)\n"); } /* m2pp_cleanup_point_expr - emits a comment indicating a GCC cleanup_point_expr is present. */ static void m2pp_cleanup_point_expr (pretty *s, tree t) { m2pp_begin (s); m2pp_print (s, "(* cleanup point begins *)\n"); m2pp_expression (s, TREE_OPERAND (t, 0)); m2pp_print (s, "(* cleanup point ends *)\n"); } /* m2pp_decl_expr - displays a local declaration. */ static void m2pp_decl_expr (pretty *s, tree t) { m2pp_var (s); m2pp_print (s, "(* variable in decl_expr *)\n"); m2pp_var_type_decl (s, DECL_EXPR_DECL (t)); } /* m2pp_procedure_call - print a call to a procedure. */ static void m2pp_procedure_call (pretty *s, tree t) { m2pp_begin (s); m2pp_call_expr (s, t); m2pp_needspace (s); m2pp_print (s, ";\n"); } /* args displays each argument in an iter list by calling expression. */ static void m2pp_args (pretty *s, tree e) { call_expr_arg_iterator iter; tree arg; m2pp_print (s, "("); m2pp_needspace (s); FOR_EACH_CALL_EXPR_ARG (arg, iter, e) { m2pp_expression (s, arg); if (more_call_expr_args_p (&iter)) { m2pp_print (s, ","); m2pp_needspace (s); } } m2pp_print (s, ")"); } /* m2pp_call_expr - print a call to a procedure or function. */ static void m2pp_call_expr (pretty *s, tree t) { tree call = CALL_EXPR_FN (t); tree args = TREE_OPERAND (t, 1); tree type = TREE_TYPE (t); int has_return_type = TRUE; tree proc; if (type && (TREE_CODE (type) == VOID_TYPE)) has_return_type = FALSE; if (TREE_CODE (call) == ADDR_EXPR || TREE_CODE (call) == NON_LVALUE_EXPR) proc = TREE_OPERAND (call, 0); else proc = call; m2pp_expression (s, proc); /* m2pp_identifier (s, proc); */ if (args || has_return_type) m2pp_args (s, t); } /* m2pp_return_expr - displays the return statement. */ static void m2pp_return_expr (pretty *s, tree t) { tree e = TREE_OPERAND (t, 0); m2pp_begin (s); if (e == NULL_TREE) { m2pp_print (s, "RETURN"); } else if (TREE_CODE (e) == MODIFY_EXPR || (TREE_CODE (e) == INIT_EXPR)) { m2pp_assignment (s, e); m2pp_print (s, "RETURN"); m2pp_needspace (s); m2pp_expression (s, TREE_OPERAND (e, 0)); } else { m2pp_print (s, "RETURN"); m2pp_needspace (s); m2pp_expression (s, e); } m2pp_needspace (s); m2pp_print (s, ";\n"); } /* m2pp_try_block - displays the try block. */ static void m2pp_try_block (pretty *s, tree t) { tree stmts = TRY_STMTS (t); tree handlers = TRY_HANDLERS (t); m2pp_begin (s); m2pp_print (s, "(* TRY *)\n"); m2pp_statement_sequence (s, stmts); setindent (s, 0); m2pp_print (s, "EXCEPT\n"); setindent (s, 3); m2pp_statement_sequence (s, handlers); m2pp_print (s, "(* END TRY *)\n"); } /* m2pp_try_block - displays the handler block. */ static void m2pp_handler (pretty *s, tree t) { tree parms = HANDLER_PARMS (t); tree body = HANDLER_BODY (t); tree type = HANDLER_TYPE (t); m2pp_print (s, "(* handler *)\n"); if (parms != NULL_TREE) { m2pp_print (s, "(* handler parameter has a type (should be NULL_TREE) " "in Modula-2 *)\n"); m2pp_print (s, "CATCH ("); m2pp_expression (s, parms); m2pp_print (s, ")\n"); } if (type != NULL_TREE) m2pp_print (s, "(* handler type (should be NULL_TREE) in Modula-2 *)\n"); m2pp_statement_sequence (s, body); } /* m2pp_assignment - prints out the assignment statement. */ static void m2pp_assignment (pretty *s, tree t) { int o; m2pp_begin (s); m2pp_designator (s, TREE_OPERAND (t, 0)); m2pp_needspace (s); m2pp_print (s, ":="); m2pp_needspace (s); o = getindent (s); setindent (s, getcurpos (s) + 1); m2pp_expression (s, TREE_OPERAND (t, 1)); m2pp_needspace (s); m2pp_print (s, ";\n"); setindent (s, o); } /* m2pp_designator - displays the lhs of an assignment. */ static void m2pp_designator (pretty *s, tree t) { m2pp_expression (s, t); } /* m2pp_indirect_ref - displays the indirect operator. */ static void m2pp_indirect_ref (pretty *s, tree t) { m2pp_print (s, "("); m2pp_expression (s, TREE_OPERAND (t, 0)); m2pp_print (s, ")^"); } /* 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. */ static void m2pp_conditional (pretty *s, tree t) { int o; m2pp_begin (s); m2pp_print (s, "IF"); m2pp_needspace (s); m2pp_expression (s, TREE_OPERAND (t, 0)); m2pp_print (s, "\nTHEN\n"); o = getindent (s); setindent (s, o + 3); m2pp_statement_sequence (s, TREE_OPERAND (t, 1)); setindent (s, o); if (TREE_OPERAND (t, 2) != NULL_TREE) { m2pp_print (s, "ELSE\n"); setindent (s, o + 3); m2pp_statement_sequence (s, TREE_OPERAND (t, 2)); setindent (s, o); } m2pp_print (s, "END ;\n"); } /* m2pp_label_decl - displays a label. Again should be moved into statement sequence to determine proper loop constructs. */ static void m2pp_label_decl (pretty *s, tree t) { m2pp_begin (s); m2pp_print (s, "(* label "); m2pp_identifier (s, t); m2pp_print (s, ": *)\n"); } /* m2pp_label_expr - skips the LABEL_EXPR to find the LABEL_DECL. */ static void m2pp_label_expr (pretty *s, tree t) { m2pp_begin (s); m2pp_statement (s, TREE_OPERAND (t, 0)); } /* m2pp_goto - displays a goto statement. Again should be moved into statement sequence to determine proper loop constructs. */ static void m2pp_goto (pretty *s, tree t) { m2pp_begin (s); m2pp_print (s, "(* goto "); m2pp_identifier (s, TREE_OPERAND (t, 0)); m2pp_print (s, " *)\n"); } /* m2pp_list - prints a TREE_CHAINed list. */ static void m2pp_list (pretty *s, tree t) { tree u = t; m2pp_print (s, "("); m2pp_needspace (s); while (t != NULL_TREE) { m2pp_expression (s, TREE_VALUE (t)); t = TREE_CHAIN (t); if (t == u || t == NULL_TREE) break; m2pp_print (s, ","); m2pp_needspace (s); } m2pp_needspace (s); m2pp_print (s, ")"); } /* m2pp_offset - displays the offset operator. */ static void m2pp_offset (pretty *s, tree t) { tree type = TREE_TYPE (t); tree base = TYPE_OFFSET_BASETYPE (t); m2pp_print (s, "OFFSET ("); m2pp_type (s, base); m2pp_print (s, "."); m2pp_type (s, type); m2pp_print (s, ")"); } /* m2pp_addr_expr - */ static void m2pp_addr_expr (pretty *s, tree t) { m2pp_needspace (s); m2pp_print (s, "ADR ("); m2pp_expression (s, TREE_OPERAND (t, 0)); m2pp_print (s, ")"); } /* m2pp_nop - */ static void m2pp_nop (pretty *s, tree t) { m2pp_needspace (s); m2pp_print (s, "CAST ("); m2pp_simple_type (s, TREE_TYPE (t)); m2pp_print (s, ", "); m2pp_expression (s, TREE_OPERAND (t, 0)); m2pp_print (s, ")"); } /* m2pp_convert - */ static void m2pp_convert (pretty *s, tree t) { m2pp_needspace (s); m2pp_print (s, "CONVERT ("); m2pp_simple_type (s, TREE_TYPE (t)); m2pp_print (s, ", "); m2pp_expression (s, TREE_OPERAND (t, 0)); m2pp_print (s, ")"); } /* m2pp_var_decl - */ static void m2pp_var_decl (pretty *s, tree t) { m2pp_identifier (s, t); } /* m2pp_result_decl - */ static void m2pp_result_decl (pretty *s, tree t) { m2pp_identifier (s, t); } /* m2pp_component_ref - */ static void m2pp_component_ref (pretty *s, tree t) { m2pp_simple_expression (s, TREE_OPERAND (t, 0)); m2pp_print (s, "."); m2pp_simple_expression (s, TREE_OPERAND (t, 1)); } ----------------------------- New file: gcc/m2/m2pp.h ----------------------------- /* m2pp.h pretty print trees, output in Modula-2 where possible. Copyright (C) 2007-2022 Free Software Foundation, Inc. Contributed by Gaius Mulley . This file is part of GNU Modula-2. GNU Modula-2 is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GNU Modula-2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Modula-2; see the file COPYING3. If not see . */ #if !defined(M2PP_H) # define M2PP_H # if defined(M2PP_C) # define EXTERN # else # define EXTERN extern # endif EXTERN void pf (tree t); EXTERN void pe (tree t); EXTERN void pt (tree t); EXTERN void ptl (tree t); EXTERN void pv (tree t); EXTERN void ptcl (tree t); # undef EXTERN #endif ----------------------------- New file: gcc/m2/m2-tree.h ----------------------------- /* m2-tree.h create language specific tree nodes for Modula-2. Copyright (C) 2001-2022 Free Software Foundation, Inc. Contributed by Gaius Mulley . This file is part of GNU Modula-2. GNU Modula-2 is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GNU Modula-2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Modula-2; see the file COPYING3. If not see . */ #ifndef GCC_GM2_TREE_H #define GCC_GM2_TREE_H #include "ggc.h" #include "function.h" #include "hashtab.h" #include "vec.h" /* Currently disabled, as Modula-2 uses WORD (unsigned int) for a set type. */ #if 0 /* Modula-2 language-specific tree codes. */ #define DEFTREECODE(SYM, NAME, TYPE, LENGTH) SYM, enum m2_tree_code { M2_DUMMY_TREE_CODE = LAST_C_TREE_CODE, #include "gm2-tree.def" LAST_M2_TREE_CODE }; #undef DEFTREECODE #endif /* These macros provide convenient access to the various _STMT nodes created when parsing template declarations. */ #define TRY_STMTS(NODE) TREE_OPERAND (TRY_BLOCK_CHECK (NODE), 0) #define TRY_HANDLERS(NODE) TREE_OPERAND (TRY_BLOCK_CHECK (NODE), 1) /* Nonzero if this try block is a function try block. */ #define FN_TRY_BLOCK_P(NODE) TREE_LANG_FLAG_3 (TRY_BLOCK_CHECK (NODE)) #define HANDLER_PARMS(NODE) TREE_OPERAND (HANDLER_CHECK (NODE), 0) #define HANDLER_BODY(NODE) TREE_OPERAND (HANDLER_CHECK (NODE), 1) #define HANDLER_TYPE(NODE) TREE_TYPE (HANDLER_CHECK (NODE)) /* 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 expression statement. */ #define EXPR_STMT_EXPR(NODE) TREE_OPERAND (EXPR_STMT_CHECK (NODE), 0) #endif ----------------------------- New file: gcc/m2/lang.opt ----------------------------- ; Options for the Modula-2 front end. ; ; Copyright (C) 2016-2022 Free Software Foundation, Inc. ; Contributed by Gaius Mulley . ; ; This file is part of GNU Modula-2. ; ; GNU Modula-2 is free software; you can redistribute it and/or modify ; it under the terms of the GNU General Public License as published by ; the Free Software Foundation; either version 3, or (at your option) ; any later version. ; ; GNU Modula-2 is distributed in the hope that it will be useful, but ; WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ; General Public License for more details. ; ; You should have received a copy of the GNU General Public License ; along with GNU Modula-2; see the file COPYING. If not, ; see . *) ; See the GCC internals manual for a description of this file's format. ; Please try to keep this file in ASCII collating order. Language Modula-2 I Modula-2 Joined Separate ; Documented in c.opt L Modula-2 Joined Separate ; Not documented M Modula-2 ; Documented in c.opt O Modula-2 ; Documented in c.opt fiso Modula-2 use ISO dialect of Modula-2 fpim Modula-2 use PIM [234] dialect of Modula-2 fpim2 Modula-2 use PIM 2 dialect of Modula-2 fpim3 Modula-2 use PIM 3 dialect of Modula-2 fpim4 Modula-2 use PIM 4 dialect of Modula-2 fpositive-mod-floor-div Modula-2 force positive result from MOD and DIV result floor flibs= Modula-2 Joined specify the library order, currently legal entries include: log, min, pim, iso or their directory name equivalent m2log, m2min, m2pim, m2iso. fauto-init Modula-2 automatically initializes all pointers to NIL flocation= Modula-2 Joined set all location values to a specific value (internal) fbounds Modula-2 turns on runtime subrange, array index and indirection via NIL pointer checking freturn Modula-2 turns on runtime checking for functions which finish without executing a RETURN statement fnil Modula-2 turns on runtime checking to detect accessing data through a NIL value pointer fcase Modula-2 turns on runtime checking to check whether a CASE statement requires an ELSE clause when on was not specified ffloatvalue Modula-2 turns on runtime checking to check whether a floating point number is about to exceed range fwholevalue Modula-2 turns on runtime checking to check whether a whole number is about to exceed range fsoft-check-all Modula-2 turns on all software runtime checking (an abbreviation for -fnil -frange -findex -fwholediv -fcase -freturn -fwholediv -ffloatvalue) frange Modula-2 turns on all range checking for numerical values findex Modula-2 turns on all range checking for numerical values fwholediv Modula-2 turns on all division and modulus by zero checking for ordinal values fexceptions Modula-2 ; Documented in common.opt fextended-opaque Modula-2 allows opaque types to be implemented as any type (a GNU Modula-2 extension) fuselist Modula-2 use ordered list of modules when linking fmakelist Modula-2 create a topologically ordered list of modules fmodules Modula-2 display the list of modules and their location fno-pthread Modula-2 do not link against the pthread library fm2-plugin Modula-2 insert plugin to identify runtime errors at compiletime fno-m2-plugin Modula-2 do not insert plugin to identify runtime errors at compiletime fonlylink Modula-2 only link the module and do not compile module ftarget-ar= Modula-2 Joined full path to target archiver ftarget-ranlib= Modula-2 Joined full path to target ranlib fruntime-modules= Modula-2 Joined specify the list of runtime modules and their initialization order fcpp Modula-2 use cpp to preprocess the module fq Modula-2 internal compiler debugging information, dump the list of quadruples fsources Modula-2 display the location of module source files as they are compiled funbounded-by-reference Modula-2 optimize non var unbounded parameters by passing it by reference, providing it is not written to within the callee procedure. fdef= Modula-2 Joined recognise the specified suffix as a definition module filename fmod= Modula-2 Joined recognise the specified suffix as implementation and module filenames fxcode Modula-2 issue all errors and warnings in the Xcode format fdebug-builtins Modula-2 call a real function, rather than the builtin equivalent fdump-system-exports Modula-2 display all inbuilt system items fd Modula-2 turn on internal debugging of the compiler fdebug-trace-quad Modula-2 turn on quadruple tracing (internal switch) fdebug-trace-api Modula-2 turn on the Modula-2 api tracing (internal switch) fdebug-function-line-numbers Modula-2 turn on the Modula-2 function line number generation (internal switch) fm2-statistics Modula-2 display statistics about the amount of source lines compiled and symbols used fm2-g Modula-2 generate extra nops to improve debugging, producing an instruction for every code related keyword fm2-lower-case Modula-2 generate error messages which render keywords in lower case fm2-strict-type Modula-2 experimental flag to turn on the new strict type checker fswig Modula-2 create a swig interface file for the module fshared Modula-2 generate a shared library from the module fmakeinit Modula-2 generate the start up C code for the module, a file _m2_modulename.c is created fobject-path= Modula-2 Joined set the object path fm2-whole-program Modula-2 compile all implementation modules and program module at once fversion Modula-2 ; Documented in common.opt fm2-version Modula-2 display the GNU Modula-2 version Wstudents Modula-2 extra compile time semantic checking, typically tries to catch bad style Wpedantic Modula-2 ; Documented in common.opt Wpedantic-param-names Modula-2 compiler checks to force definition module procedure parameter names with their implementation module counterpart Wpedantic-cast Modula-2 compiler warns if a cast is being used on types of differing sizes Wverbose-unbounded Modula-2 inform user which parameters will be passed by reference Wall Modula-2 ; Documented in c.opt Wunused-variable Modula-2 ; Documented in c.opt Wunused-parameter Modula-2 ; Documented in c.opt version Modula-2 ; Documented in c.opt v Modula-2 ; Documented in c.opt lang-asm Modula-2 ; Documented in c.opt traditional-cpp Modula-2 ; Documented in c.opt iprefix Modula-2 ; Documented in c.opt isystem Modula-2 ; Documented in c.opt idirafter Modula-2 ; Documented in c.opt imultilib Modula-2 ; Documented in c.opt fobjc-std=objc1 Modula-2 ; Documented in c.opt fcppend Modula-2 passed to the preprocessor if -fcpp is used fcppbegin Modula-2 passed to the preprocessor if -fcpp is used fcppprog= Modula-2 Joined passed to the preprocessor if -fcpp is used E Modula-2 ; Documented in c.opt (passed to the preprocessor if -fcpp is used) D Modula-2 ; Documented in c.opt x Modula-2 Joined specify the language from the compiler driver -save-temps Modula-2 Alias(save-temps) save-temps Modula-2 save temporary preprocessed files save-temps= Modula-2 Joined save temporary preprocessed files ; This comment is to ensure we retain the blank line above. ----------------------------- New file: gcc/m2/config-lang.in ----------------------------- # Top level configure fragment for GNU Modula-2. # Copyright (C) 2000-2022 Free Software Foundation, Inc. # This file is part of GCC. # GCC is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # GCC is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with GCC; see the file COPYING3. If not see # . # Configure looks for the existence of this file to auto-config each language. # We define several parameters used by configure: # # language - name of language as it would appear in $(LANGUAGES) # compilers - value to add to $(COMPILERS) # stagestuff - files to add to $(STAGESTUFF) language="m2" compilers="cc1gm2\$(exeext) gm2l\$(exeext) gm2lcc\$(exeext) \ gm2lgen\$(exeext) gm2lsub\$(exeext) gm2cc\$(exeext) \ gm2lorder\$(exeext)" stagestuff="gm2\$(exeext) cc1gm2\$(exeext) gm2l\$(exeext) \ gm2lcc\$(exeext) gm2lgen\$(exeext) gm2lsub\$(exeext) cc1gm2-cross\$(exeext)" target_libs="target-libstdc++-v3 target-libgm2" # The Modula-2 frontend needs C++ to compile the main, so we need to build the C++ # compiler during stage 1. lang_requires_boot_languages=c++ # Do not build by default. build_by_default="no" gtfiles="\$(srcdir)/m2/gm2-lang.cc \ \$(srcdir)/m2/gm2-lang.h \ \$(srcdir)/m2/gm2-gcc/rtegraph.cc \ \$(srcdir)/m2/gm2-gcc/m2block.cc \ \$(srcdir)/m2/gm2-gcc/m2builtins.cc \ \$(srcdir)/m2/gm2-gcc/m2decl.cc \ \$(srcdir)/m2/gm2-gcc/m2except.cc \ \$(srcdir)/m2/gm2-gcc/m2expr.cc \ \$(srcdir)/m2/gm2-gcc/m2statement.cc \ \$(srcdir)/m2/gm2-gcc/m2type.cc" outputs=" \ m2/config-make \ m2/www/Makefile \ " mkdir -p m2/gm2-compiler-boot mkdir -p m2/gm2-libs-boot mkdir -p m2/gm2-ppg-boot mkdir -p m2/gm2-pge-boot mkdir -p m2/gm2-pg-boot mkdir -p m2/gm2-ici-boot mkdir -p m2/gm2-ici mkdir -p m2/gm2-libiberty mkdir -p m2/gm2-gcc mkdir -p m2/gm2-auto mkdir -p m2/gm2-compiler mkdir -p m2/gm2-libs mkdir -p m2/gm2-libs-iso mkdir -p m2/gm2-compiler-paranoid mkdir -p m2/gm2-libs-paranoid mkdir -p m2/gm2-compiler-verify mkdir -p m2/boot-bin mkdir -p m2/gm2-libs-pim mkdir -p m2/gm2-libs-coroutines mkdir -p m2/gm2-libs-min mkdir -p m2/mc-boot mkdir -p m2/mc-boot-ch mkdir -p m2/mc-boot-gen mkdir -p plugin mkdir -p stage1/m2 stage2/m2 stage3/m2 stage4/m2 ----------------------------- New file: gcc/m2/config-make.in ----------------------------- # Target libraries are put under this directory: TARGET_SUBDIR = @target_subdir@