PR modula2/114529 Avoid ODR violations in bootstrap translated sources

This patch changes the bootstrap tool mc to avoid redefining any data
types and therefore preventing ODR violations.  All exported opaque type
usages are implemented as void *.  Local opaque type usages (static
functions containing opaque type parameters) use the full declaration.
mc casts usages between void * and full opaque type as necessary.
The --extended-opaque option in mc has been disabled, as this generated
ODR violations.  The extended-opaque option inlined all declarations in
the translated implementation module.  As this is no longer used there
is now a .h file for each .def file and a .cc file for every .mod file.
This results in more Makefile rules for the ppg tool in Make-maintainer.in.

gcc/m2/ChangeLog:

	PR modula2/114529
	* Make-lang.in (MC_EXTENDED_OPAQUE): Assign to nothing.
	* Make-maintainer.in (mc-basetest): New rule.
	(mc-devel-basetest): New rule.
	(mc-clean): Remove mc.
	(m2/mc-boot-gen/$(SRC_PREFIX)decl.cc): Replace --extended-opaque
	with $(EXTENDED_OPAQUE).
	(PG-SRC): Move define before generic rules.
	(PGE-DEF): Ditto.
	(m2/gm2-ppg-boot/$(SRC_PREFIX)%.h): New rule.
	(m2/gm2-ppg-boot/$(SRC_PREFIX)libc.o): Ditto.
	(m2/gm2-ppg-boot/$(SRC_PREFIX)mcrts.o): Ditto.
	(m2/gm2-ppg-boot/$(SRC_PREFIX)UnixArgs.o): Ditto.
	(m2/gm2-ppg-boot/$(SRC_PREFIX)Selective.o): Ditto.
	(m2/gm2-ppg-boot/$(SRC_PREFIX)termios.o): Ditto.
	(m2/gm2-ppg-boot/$(SRC_PREFIX)SysExceptions.o): Ditto.
	(m2/gm2-ppg-boot/$(SRC_PREFIX)ldtoa.o): Ditto.
	(m2/gm2-ppg-boot/$(SRC_PREFIX)wrapc.o): Ditto.
	(m2/gm2-ppg-boot/$(SRC_PREFIX)SYSTEM.o): Ditto.
	(m2/gm2-ppg-boot/$(SRC_PREFIX)errno.o): Ditto.
	(m2/gm2-ppg-boot/$(SRC_PREFIX)M2RTS.o): Ditto.
	(m2/gm2-ppg-boot/$(SRC_PREFIX)SymbolKey.h): Ditto.
	(m2/gm2-ppg-boot/$(SRC_PREFIX)SymbolKey.o): Ditto.
	(m2/gm2-ppg-boot/$(SRC_PREFIX)NameKey.h): Ditto.
	(m2/gm2-ppg-boot/$(SRC_PREFIX)NameKey.o): Ditto.
	(m2/gm2-ppg-boot/$(SRC_PREFIX)Lists.h): Ditto.
	(m2/gm2-ppg-boot/$(SRC_PREFIX)Lists.o): Ditto.
	(m2/gm2-ppg-boot/$(SRC_PREFIX)Output.h): Ditto.
	(m2/gm2-ppg-boot/$(SRC_PREFIX)bnflex.h): Ditto.
	(m2/gm2-ppg-boot/$(SRC_PREFIX)bnflex.o): Ditto.
	(m2/gm2-ppg-boot/$(SRC_PREFIX)RTco.h): Ditto.
	(m2/gm2-ppg-boot/$(SRC_PREFIX)RTentity.h): Ditto.
	(m2/gm2-ppg-boot/$(SRC_PREFIX)RTco.o): Ditto.
	(m2/gm2-ppg-boot/$(SRC_PREFIX)RTentity.o): Ditto.
	(m2/gm2-ppg-boot/$(SRC_PREFIX)%.o): Ditto.
	(m2/ppg$(exeext)): Ditto.
	(m2/gm2-ppg-boot/main.o): Ditto.
	(m2/gm2-auto): Ditto.
	(c-family/m2pp.o): Ditto.
	(BUILD-BOOT-PG-H): Correct macro definition.
	(m2/gm2-pg-boot/$(SRC_PREFIX)%.h): New rule.
	(m2/gm2-pg-boot/$(SRC_PREFIX)NameKey.h): Ditto.
	(m2/gm2-pg-boot/$(SRC_PREFIX)NameKey.o): Ditto.
	(m2/gm2-pg-boot/$(SRC_PREFIX)Lists.h): Ditto.
	(m2/gm2-pg-boot/$(SRC_PREFIX)Lists.o): Ditto.
	(m2/gm2-pg-boot/$(SRC_PREFIX)Output.h): Ditto.
	(m2/gm2-pg-boot/$(SRC_PREFIX)Output.o): Ditto.
	(m2/gm2-pg-boot/$(SRC_PREFIX)bnflex.h): Ditto.
	(m2/gm2-pg-boot/$(SRC_PREFIX)bnflex.o): Ditto.
	(m2/gm2-pg-boot/$(SRC_PREFIX)RTco.h): Ditto.
	(m2/gm2-pg-boot/$(SRC_PREFIX)RTentity.h): Ditto.
	(m2/gm2-pg-boot/$(SRC_PREFIX)RTco.o): Ditto.
	(m2/gm2-pg-boot/$(SRC_PREFIX)RTentity.o): Ditto.
	(BUILD-BOOT-PGE-H): Correct macro definition.
	(m2/gm2-pge-boot/$(SRC_PREFIX)SymbolKey.h): Ditto.
	(m2/gm2-pge-boot/$(SRC_PREFIX)SymbolKey.o): Ditto.
	(m2/gm2-pge-boot/$(SRC_PREFIX)NameKey.h): Ditto.
	(m2/gm2-pge-boot/$(SRC_PREFIX)NameKey.o): Ditto.
	(m2/gm2-pge-boot/$(SRC_PREFIX)Lists.h): Ditto.
	(m2/gm2-pge-boot/$(SRC_PREFIX)Lists.o): Ditto.
	(m2/gm2-pge-boot/$(SRC_PREFIX)Output.h): Ditto.
	(m2/gm2-pge-boot/$(SRC_PREFIX)Output.o): Ditto.
	(m2/gm2-pge-boot/$(SRC_PREFIX)bnflex.h): Ditto.
	(m2/gm2-pge-boot/$(SRC_PREFIX)bnflex.o): Ditto.
	(m2/gm2-pge-boot/$(SRC_PREFIX)RTco.h): Ditto.
	(m2/gm2-pge-boot/$(SRC_PREFIX)RTentity.h): Ditto.
	(m2/gm2-pge-boot/$(SRC_PREFIX)RTco.o): Ditto.
	(m2/gm2-pge-boot/$(SRC_PREFIX)RTentity.o): Ditto.
	(mc-basetest): Ditto.
	(mc-devel-basetest): Ditto.
	* gm2-compiler/M2Options.def (SetM2Dump): Add BOOLEAN return.
	* gm2-compiler/M2Quads.def (BuildAlignment): Add tokno parameter.
	(BuildBitLength): Ditto.
	* gm2-compiler/P3Build.bnf (ByteAlignment): Move tokpos assignment
	to the start of the block.
	* gm2-compiler/PCBuild.bnf (ConstSetOrQualidentOrFunction): Ditto.
	(SetOrDesignatorOrFunction): Ditto.
	* gm2-compiler/PHBuild.bnf (ConstSetOrQualidentOrFunction): Ditto.
	(SetOrDesignatorOrFunction): Ditto.
	(ByteAlignment): Ditto.
	* gm2-libs/dtoa.def (dtoa): Change mode to INTEGER.
	* gm2-libs/ldtoa.def (ldtoa): Ditto.
	* mc-boot-ch/GSYSTEM.c (_M2_SYSTEM_init): Correct parameter list.
	(_M2_SYSTEM_fini): Ditto.
	* mc-boot-ch/Gdtoa.cc (dtoa_calcsign): Return bool.
	(dtoa_dtoa): Return void * and use bool in the fifth parameter.
	(_M2_dtoa_init): Correct parameter list.
	(_M2_dtoa_fini): Ditto.
	* mc-boot-ch/Gerrno.cc (_M2_errno_init): Ditto.
	(_M2_errno_fini): Ditto.
	* mc-boot-ch/Gldtoa.cc (dtoa_calcsign): Return bool.
	(ldtoa_ldtoa): Return void * and use bool in the fifth parameter.
	(_M2_ldtoa_init): Correct parameter list.
	(_M2_ldtoa_fini): Ditto.
	* mc-boot-ch/Glibc.c (tracedb_zresult): New function.
	(libc_read): Return size_t and use size_t in parameter three.
	(libc_write): Return size_t and use size_t in parameter three.
	(libc_printf): Add const to the format specifier.
	Change declaration of c to use const.
	(libc_snprintf): Add const to the format specifier.
	Change declaration of c to use const.
	(libc_malloc): Use size_t.
	(libc_memcpy): Ditto.
	* mc-boot/GASCII.cc: Regenerate.
	* mc-boot/GArgs.cc: Ditto.
	* mc-boot/GAssertion.cc: Ditto.
	* mc-boot/GBreak.cc: Ditto.
	* mc-boot/GCmdArgs.cc: Ditto.
	* mc-boot/GDebug.cc: Ditto.
	* mc-boot/GDynamicStrings.cc: Ditto.
	* mc-boot/GEnvironment.cc: Ditto.
	* mc-boot/GFIO.cc: Ditto.
	* mc-boot/GFormatStrings.cc: Ditto.
	* mc-boot/GFpuIO.cc: Ditto.
	* mc-boot/GIO.cc: Ditto.
	* mc-boot/GIndexing.cc: Ditto.
	* mc-boot/GM2Dependent.cc: Ditto.
	* mc-boot/GM2EXCEPTION.cc: Ditto.
	* mc-boot/GM2RTS.cc: Ditto.
	* mc-boot/GMemUtils.cc: Ditto.
	* mc-boot/GNumberIO.cc: Ditto.
	* mc-boot/GPushBackInput.cc: Ditto.
	* mc-boot/GRTExceptions.cc: Ditto.
	* mc-boot/GRTint.cc: Ditto.
	* mc-boot/GSArgs.cc: Ditto.
	* mc-boot/GSFIO.cc: Ditto.
	* mc-boot/GStdIO.cc: Ditto.
	* mc-boot/GStorage.cc: Ditto.
	* mc-boot/GStrCase.cc: Ditto.
	* mc-boot/GStrIO.cc: Ditto.
	* mc-boot/GStrLib.cc: Ditto.
	* mc-boot/GStringConvert.cc: Ditto.
	* mc-boot/GSysStorage.cc: Ditto.
	* mc-boot/GTimeString.cc: Ditto.
	* mc-boot/Galists.cc: Ditto.
	* mc-boot/Gdecl.cc: Ditto.
	* mc-boot/Gkeyc.cc: Ditto.
	* mc-boot/Glists.cc: Ditto.
	* mc-boot/GmcComment.cc: Ditto.
	* mc-boot/GmcComp.cc: Ditto.
	* mc-boot/GmcDebug.cc: Ditto.
	* mc-boot/GmcError.cc: Ditto.
	* mc-boot/GmcFileName.cc: Ditto.
	* mc-boot/GmcLexBuf.cc: Ditto.
	* mc-boot/GmcMetaError.cc: Ditto.
	* mc-boot/GmcOptions.cc: Ditto.
	* mc-boot/GmcPreprocess.cc: Ditto.
	* mc-boot/GmcPretty.cc: Ditto.
	* mc-boot/GmcPrintf.cc: Ditto.
	* mc-boot/GmcQuiet.cc: Ditto.
	* mc-boot/GmcReserved.cc: Ditto.
	* mc-boot/GmcSearch.cc: Ditto.
	* mc-boot/GmcStack.cc: Ditto.
	* mc-boot/GmcStream.cc: Ditto.
	* mc-boot/Gmcp1.cc: Ditto.
	* mc-boot/Gmcp2.cc: Ditto.
	* mc-boot/Gmcp3.cc: Ditto.
	* mc-boot/Gmcp4.cc: Ditto.
	* mc-boot/Gmcp5.cc: Ditto.
	* mc-boot/GnameKey.cc: Ditto.
	* mc-boot/GsymbolKey.cc: Ditto.
	* mc-boot/Gvarargs.cc: Ditto.
	* mc-boot/Gwlists.cc: Ditto.
	* mc-boot/Gdecl.h: Ditto.
	* mc-boot/Gldtoa.h: Ditto.
	* mc-boot/Glibc.h: Ditto.
	* mc/decl.def (putTypeOpaque): New procedure.
	(isTypeOpaque): New procedure function.
	* mc/decl.mod (debugOpaque): New constant.
	(nodeT): New enumeration field opaquecast.
	(node): New record field opaquecastF.
	(opaqueCastState): New record.
	(opaquecastT): New record.
	(typeT): New field isOpaque.
	(varT): New field opaqueState.
	(arrayT): Ditto.
	(varparamT): Ditto.
	(paramT): Ditto.
	(pointerT): Ditto.
	(recordfieldT): Ditto.
	(componentrefT): Ditto.
	(pointerrefT): Ditto.
	(arrayrefT): Ditto.
	(procedureT): Ditto.
	(proctypeT): Ditto.
	(makeType): Initialize field isOpaque.
	(makeTypeImp): Initialize field isOpaque.
	(putVar): Call initNodeOpaqueCastState.
	(putReturnType): Ditto.
	(makeProcType): Ditto.
	(putProcTypeReturn): Ditto.
	(makeVarParameter): Ditto.
	(makeNonVarParameter): Ditto.
	(makeFuncCall): Ditto.
	(putTypeOpaque): New procedure.
	(isTypeOpaque): New procedure function.
	(doMakeComponentRef): Call initNodeOpaqueCastState.
	(makePointerRef): Call initNodeOpaqueCastState.
	(doGetFuncType): Call initNodeOpaqueCastState.
	(doBinary): Add FALSE parameter to doExprCup.
	(doDeRefC): Rewrite.
	(doComponentRefC): Call flushOpaque.
	(doPointerRefC): Call flushOpaque.
	(doArrayRefC): Add const_cast for unbounded array.
	(doExprCup): Rewrite.
	(doTypeAliasC): Remove.
	(isDeclType): New procedure function.
	(doEnumerationC): New procedure function.
	(doParamTypeEmit): Ditto.
	(doParamTypeNameModifier): Ditto.
	(initOpaqueCastState): Ditto.
	(initNodeOpaqueCastState): Ditto.
	(setOpaqueCastState): Ditto.
	(setNodeOpaqueVoidStar): Ditto.
	(nodeUsesOpaque): Ditto.
	(getNodeOpaqueVoidStar): Ditto.
	(getOpaqueFlushNecessary): Ditto.
	(makeOpaqueCast): Ditto.
	(flushOpaque): Ditto.
	(castOpaque): Ditto.
	(isTypeOpaqueDefImp): Ditto.
	(isParamVoidStar): Ditto.
	(isRefVoidStar): Ditto.
	(isReturnVoidStar): Ditto.
	(isVarVoidStar): Ditto.
	(initNodeOpaqueState): Ditto.
	(assignNodeOpaqueCastState): Ditto.
	(assignNodeOpaqueCastFalse): Ditto.
	(dumpOpaqueState): Ditto.
	(doProcTypeC): Rewrite.
	(isDeclInImp): New procedure function.
	(doTypeNameModifier): Ditto.
	(doTypeC): Emit typedef if enum is declared in this module.
	(doCompletePartialProcType): Rewrite.
	(outputCompletePartialProcType): New procedure.
	(doOpaqueModifier): Ditto.
	(doVarC): Ditto.
	(doProcedureHeadingC): Add opaque modifier to return type if
	necessary.
	(doReturnC): Cast opaque type for return if necessary.
	(forceCastOpaque): New procedure.
	(forceReintCastOpaque): New procedure.
	(doUnConstCastUnbounded): New procedure.
	(doAssignmentC): Cast opaque for both des and expr if necessary.
	(doAdrExprC): Use static_cast for void * casting.
	(doFuncVarParam): New procedure.
	(doFuncParamC): Rewrite.
	(doAdrArgC): Rewrite.
	(getFunction): New procedure function.
	(stop): Rename to ...
	(localstop): ... this.
	(dupFunccall): Call assignNodeOpaqueCastState.
	(dbg): Rewrite.
	(addDone): Rewrite.
	(addDoneDef): Do not add opaque types to the doneQ when declared in
	the definition module.
	* mc/mc.flex (openSource): Return bool.
	(_M2_mcflex_init): Correct parameter list.
	(_M2_mcflex_fini): Ditto.
	* mc/mcComment.h (stdbool.h): Include.
	(mcComment_initComment): Change unsigned int to bool.
	* mc/mcOptions.mod (handleOption): Disable --extended-opaque
	and issue warning.
	* mc/mcp1.bnf (DefTypeDeclaration): Call putTypeOpaque.

gcc/testsuite/ChangeLog:

	PR modula2/114529
	* gm2/base-lang/pass/SYSTEM.def: New test.
	* gm2/base-lang/pass/base-lang-test.sh: New test.
	* gm2/base-lang/pass/globalproctype.def: New test.
	* gm2/base-lang/pass/globalproctype.mod: New test.
	* gm2/base-lang/pass/globalvar.def: New test.
	* gm2/base-lang/pass/globalvar.mod: New test.
	* gm2/base-lang/pass/globalvarassign.def: New test.
	* gm2/base-lang/pass/globalvarassign.mod: New test.
	* gm2/base-lang/pass/localproctype.def: New test.
	* gm2/base-lang/pass/localproctype.mod: New test.
	* gm2/base-lang/pass/localvar.def: New test.
	* gm2/base-lang/pass/localvar.mod: New test.
	* gm2/base-lang/pass/localvarassign.def: New test.
	* gm2/base-lang/pass/localvarassign.mod: New test.
	* gm2/base-lang/pass/opaquefield.def: New test.
	* gm2/base-lang/pass/opaquefield.mod: New test.
	* gm2/base-lang/pass/opaquenew.def: New test.
	* gm2/base-lang/pass/opaquenew.mod: New test.
	* gm2/base-lang/pass/opaqueparam.def: New test.
	* gm2/base-lang/pass/opaqueparam.mod: New test.
	* gm2/base-lang/pass/opaquestr.def: New test.
	* gm2/base-lang/pass/opaqueuse.def: New test.
	* gm2/base-lang/pass/opaqueuse.mod: New test.
	* gm2/base-lang/pass/opaqueusestr.def: New test.
	* gm2/base-lang/pass/opaqueusestr.mod: New test.
	* gm2/base-lang/pass/opaquevariant.def: New test.
	* gm2/base-lang/pass/opaquevariant.mod: New test.
	* gm2/base-lang/pass/opaquevarparam.def: New test.
	* gm2/base-lang/pass/opaquevarparam.mod: New test.
	* gm2/base-lang/pass/simplelist.def: New test.
	* gm2/base-lang/pass/simplelist.mod: New test.
	* gm2/base-lang/pass/simplelistiter.def: New test.
	* gm2/base-lang/pass/simplelistiter.mod: New test.
	* gm2/base-lang/pass/simpleopaque.def: New test.
	* gm2/base-lang/pass/simpleopaque.mod: New test.
	* gm2/base-lang/pass/straddress.def: New test.
	* gm2/base-lang/pass/straddress.mod: New test.
	* gm2/base-lang/pass/straddressexport.def: New test.
	* gm2/base-lang/pass/straddressexport.mod: New test.
	* gm2/base-lang/pass/unboundedarray.def: New test.
	* gm2/base-lang/pass/unboundedarray.mod: New test.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
This commit is contained in:
Gaius Mulley 2024-06-11 10:01:12 +01:00
parent a797398cfb
commit a0004feb87
124 changed files with 8061 additions and 5609 deletions

View File

@ -505,7 +505,7 @@ MC_ARGS= --olang=c++ \
$(MC_COPYRIGHT) \
--gcc-config-system
MC_EXTENDED_OPAQUE=--extended-opaque
MC_EXTENDED_OPAQUE=
MCDEPS=m2/boot-bin/mc$(exeext)
MC=m2/boot-bin/mc$(exeext) $(MC_ARGS)

View File

@ -77,90 +77,14 @@ PPG-LIB-MODS = ASCII.mod \
PPG-SRC = ppg.mod
BUILD-PPG-O = $(PPG-INTERFACE-C:%.c=m2/gm2-ppg-boot/$(SRC_PREFIX)%.o) \
$(PPG-INTERFACE-CC:%.cc=m2/gm2-ppg-boot/$(SRC_PREFIX)%.o) \
$(PPG-MODS:%.mod=m2/gm2-ppg-boot/$(SRC_PREFIX)%.o) \
$(PPG-LIB-MODS:%.mod=m2/gm2-ppg-boot/$(SRC_PREFIX)%.o) \
$(PPG-SRC:%.mod=m2/gm2-ppg-boot/$(SRC_PREFIX)%.o)
MCC_ARGS= --olang=c++ \
--quiet \
--h-file-prefix=$(SRC_PREFIX) \
-I$(srcdir)/m2/gm2-libs \
-I$(srcdir)/m2/gm2-compiler \
-I$(srcdir)/m2/gm2-libiberty \
-I$(srcdir)/m2/gm2-gcc
MCC=m2/boot-bin/mc$(exeext) $(MCC_ARGS)
BUILD-PPG-LIBS-H = $(PPG-LIB-DEFS:%.def=m2/gm2-ppg-boot/$(SRC_PREFIX)%.h)
BUILD-PPG-H = m2/boot-bin/mc$(exeext) $(BUILD-PPG-LIBS-H)
BUILD-BOOT-PPG-H: $(BUILD-BOOT-H) \
m2/gm2-ppg-boot/$(SRC_PREFIX)M2RTS.h \
m2/gm2-ppg-boot/$(SRC_PREFIX)M2Dependent.h \
$(PPG-DEFS:%.def=m2/gm2-ppg-boot/$(SRC_PREFIX)%.h)
m2/gm2-ppg-boot/$(SRC_PREFIX)%.h: $(srcdir)/m2/gm2-libs/%.def $(MCDEPS)
-test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
$(MCC) -o=$@ $(srcdir)/m2/gm2-libs/$*.def
m2/gm2-ppg-boot/$(SRC_PREFIX)%.o: m2/mc-boot-ch/$(SRC_PREFIX)%.c m2/gm2-libs/gm2-libs-host.h $(BUILD-BOOT-PPG-H)
-test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs $(INCLUDES) -g -c $< -o $@
m2/gm2-ppg-boot/$(SRC_PREFIX)%.o: m2/mc-boot-ch/$(SRC_PREFIX)%.cc m2/gm2-libs/gm2-libs-host.h $(BUILD-BOOT-PPG-H)
-test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs $(INCLUDES) -g -c $< -o $@
m2/gm2-ppg-boot/$(SRC_PREFIX)M2RTS.o: $(srcdir)/m2/gm2-libs/M2RTS.mod $(MCDEPS) $(BUILD-BOOT-PPG-H)
-test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
$(MCC) --suppress-noreturn -o=m2/gm2-ppg-boot/$(SRC_PREFIX)M2RTS.cc $(srcdir)/m2/gm2-libs/M2RTS.mod
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) \
-Im2/gm2-ppg-boot -I$(srcdir)/m2/mc-boot -Im2/gm2-libs-boot \
-I$(srcdir)/m2/mc-boot-ch $(INCLUDES) -g -c m2/gm2-ppg-boot/$(SRC_PREFIX)M2RTS.cc -o $@
m2/gm2-ppg-boot/$(SRC_PREFIX)%.o: $(srcdir)/m2/gm2-libs/%.mod $(MCDEPS) $(BUILD-BOOT-PPG-H)
-test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
$(MCC) -o=m2/gm2-ppg-boot/$(SRC_PREFIX)$*.cc $(srcdir)/m2/gm2-libs/$*.mod
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) \
-Im2/gm2-ppg-boot -I$(srcdir)/m2/mc-boot -Im2/gm2-libs-boot \
-I$(srcdir)/m2/mc-boot-ch $(INCLUDES) -g -c m2/gm2-ppg-boot/$(SRC_PREFIX)$*.cc -o $@
m2/gm2-ppg-boot/$(SRC_PREFIX)%.o: $(srcdir)/m2/gm2-compiler/%.mod $(MCDEPS) $(BUILD-BOOT-PPG-H)
-test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
$(MCC) -o=m2/gm2-ppg-boot/$(SRC_PREFIX)$*.cc $(srcdir)/m2/gm2-compiler/$*.mod
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) \
-Im2/mc-boot -Im2/gm2-compiler-boot -Im2/gm2-libs-boot \
-I$(srcdir)/m2/mc-boot-ch $(INCLUDES) -g -c m2/gm2-ppg-boot/$(SRC_PREFIX)$*.cc -o $@
m2/ppg$(exeext): m2/boot-bin/mc $(BUILD-PPG-O) $(BUILD-MC-INTERFACE-O) m2/gm2-ppg-boot/main.o \
m2/gm2-libs-boot/RTcodummy.o m2/mc-boot-ch/$(SRC_PREFIX)abort.o
-test -d m2 || $(mkinstalldirs) m2
+$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ $(BUILD-PPG-O) m2/gm2-ppg-boot/main.o \
m2/gm2-libs-boot/RTcodummy.o m2/mc-boot-ch/$(SRC_PREFIX)abort.o -lm
m2/gm2-ppg-boot/main.o: $(M2LINK) $(srcdir)/m2/init/mcinit
-test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
unset CC ; $(M2LINK) -s --langc++ --exit --name mainppginit.cc $(srcdir)/m2/init/ppginit
mv mainppginit.cc m2/gm2-ppg-boot/main.cc
$(CXX) $(INCLUDES) -g -c -o $@ m2/gm2-ppg-boot/main.cc
m2/gm2-auto:
-test -d $@ || $(mkinstalldirs) $@
c-family/m2pp.o : $(srcdir)/m2/m2pp.cc $(GCC_HEADER_DEPENDENCIES_FOR_M2)
$(COMPILER) -c -g $(ALL_COMPILERFLAGS) \
$(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
# m2/pg$(exext) is the 2nd generation parser generator built from ebnf
# without error recovery
# m2/pg$(exext) is the 2nd generation parser generator built from the
# ebnf src without error recovery
PG-SRC = pg.mod
PGE-DEF = ASCII.def \
Args.def \
Assertion.def \
bnflex.def \
Break.def \
COROUTINES.def \
CmdArgs.def \
@ -176,6 +100,7 @@ PGE-DEF = ASCII.def \
M2RTS.def \
MemUtils.def \
NumberIO.def \
Output.def \
PushBackInput.def \
RTExceptions.def \
RTco.def \
@ -191,6 +116,7 @@ PGE-DEF = ASCII.def \
StrIO.def \
StrLib.def \
StringConvert.def \
SymbolKey.def \
SysExceptions.def \
SysStorage.def \
TimeString.def \
@ -260,6 +186,9 @@ PGE-DEPS = Gabort.cc \
GPushBackInput.cc \
GPushBackInput.h \
GRTco.cc \
GRTco.h \
GRTentity.cc \
GRTentity.h \
GRTExceptions.cc \
GRTExceptions.h \
GSArgs.h \
@ -295,19 +224,320 @@ PGE-DEPS = Gabort.cc \
Gwrapc.cc \
Gwrapc.h
BUILD-PPG-O = $(PPG-INTERFACE-C:%.c=m2/gm2-ppg-boot/$(SRC_PREFIX)%.o) \
$(PPG-INTERFACE-CC:%.cc=m2/gm2-ppg-boot/$(SRC_PREFIX)%.o) \
$(PPG-MODS:%.mod=m2/gm2-ppg-boot/$(SRC_PREFIX)%.o) \
$(PPG-LIB-MODS:%.mod=m2/gm2-ppg-boot/$(SRC_PREFIX)%.o) \
$(PPG-SRC:%.mod=m2/gm2-ppg-boot/$(SRC_PREFIX)%.o)
MCC_ARGS= --olang=c++ \
--quiet \
--h-file-prefix=$(SRC_PREFIX) \
-I$(srcdir)/m2/gm2-libs \
-I$(srcdir)/m2/gm2-compiler \
-I$(srcdir)/m2/gm2-libiberty \
-I$(srcdir)/m2/gm2-gcc
MCC=m2/boot-bin/mc$(exeext) $(MCC_ARGS)
BUILD-PPG-LIBS-H = $(PPG-LIB-DEFS:%.def=m2/gm2-ppg-boot/$(SRC_PREFIX)%.h)
BUILD-PPG-H = m2/boot-bin/mc$(exeext) $(BUILD-PPG-LIBS-H)
BUILD-BOOT-PPG-H = $(BUILD-BOOT-H) \
m2/gm2-ppg-boot/$(SRC_PREFIX)M2RTS.h \
m2/gm2-ppg-boot/$(SRC_PREFIX)M2Dependent.h \
$(PGE-DEF:%.def=m2/gm2-ppg-boot/$(SRC_PREFIX)%.h) \
$(PPG-DEFS:%.def=m2/gm2-ppg-boot/$(SRC_PREFIX)%.h) \
$(PPG-LIB-DEFS:%.def=m2/gm2-ppg-boot/$(SRC_PREFIX)%.h)
# BUILD-BOOT-PPG-H = $(BUILD-BOOT-H) $(PGE-DEF:%.def=m2/gm2-ppg-boot/$(SRC_PREFIX)%.h)
m2/gm2-ppg-boot/$(SRC_PREFIX)%.h: $(srcdir)/m2/gm2-libs/%.def $(MCDEPS)
-test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
$(MCC) -o=$@ $(srcdir)/m2/gm2-libs/$*.def
m2/gm2-ppg-boot/$(SRC_PREFIX)libc.o: $(srcdir)/m2/mc-boot-ch/Glibc.c m2/gm2-libs/gm2-libs-host.h
-test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) $(INCLUDES) -I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs -g -c $< -o $@
m2/gm2-ppg-boot/$(SRC_PREFIX)mcrts.o: $(srcdir)/m2/mc-boot-ch/Gmcrts.c m2/gm2-libs/gm2-libs-host.h
-test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) $(INCLUDES) -I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs -g -c $< -o $@
m2/gm2-ppg-boot/$(SRC_PREFIX)UnixArgs.o: $(srcdir)/m2/mc-boot-ch/GUnixArgs.cc
-test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/mc-boot-ch $(INCLUDES) -g -c $< -o $@
m2/gm2-ppg-boot/$(SRC_PREFIX)Selective.o: $(srcdir)/m2/mc-boot-ch/GSelective.c m2/gm2-libs/gm2-libs-host.h
-test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/mc-boot-ch $(INCLUDES) -Im2/gm2-libs -g -c $< -o $@
m2/gm2-ppg-boot/$(SRC_PREFIX)termios.o: $(srcdir)/m2/mc-boot-ch/Gtermios.cc m2/gm2-libs/gm2-libs-host.h
-test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs $(INCLUDES) -g -c $< -o $@
m2/gm2-ppg-boot/$(SRC_PREFIX)SysExceptions.o: $(srcdir)/m2/mc-boot-ch/GSysExceptions.c m2/gm2-libs/gm2-libs-host.h
-test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs $(INCLUDES) -g -c $< -o $@
m2/gm2-ppg-boot/$(SRC_PREFIX)ldtoa.o: $(srcdir)/m2/mc-boot-ch/Gldtoa.cc m2/gm2-libs/gm2-libs-host.h
-test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs $(INCLUDES) -g -c $< -o $@
m2/gm2-ppg-boot/$(SRC_PREFIX)dtoa.o: $(srcdir)/m2/mc-boot-ch/Gdtoa.cc m2/gm2-libs/gm2-libs-host.h
-test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs $(INCLUDES) -g -c $< -o $@
m2/gm2-ppg-boot/$(SRC_PREFIX)wrapc.o: $(srcdir)/m2/mc-boot-ch/Gwrapc.c m2/gm2-libs/gm2-libs-host.h
-test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs $(INCLUDES) -g -c $< -o $@
m2/gm2-ppg-boot/$(SRC_PREFIX)SYSTEM.o: $(srcdir)/m2/mc-boot-ch/GSYSTEM.c $(BUILD-BOOT-PPG-H)
-test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/mc-boot-ch $(INCLUDES) -g -c $< -o $@
m2/gm2-ppg-boot/$(SRC_PREFIX)errno.o: $(srcdir)/m2/mc-boot-ch/Gerrno.cc
-test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/mc-boot-ch $(INCLUDES) -g -c $< -o $@
m2/gm2-ppg-boot/$(SRC_PREFIX)M2RTS.o: $(srcdir)/m2/gm2-libs/M2RTS.mod $(MCDEPS) $(BUILD-BOOT-PPG-H)
-test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
$(MCC) --suppress-noreturn -o=m2/gm2-ppg-boot/$(SRC_PREFIX)M2RTS.cc $(srcdir)/m2/gm2-libs/M2RTS.mod
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/gm2-ppg-boot -I$(srcdir)/m2/mc-boot \
-I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs-boot \
$(INCLUDES) -g -c m2/gm2-ppg-boot/$(SRC_PREFIX)M2RTS.cc -o $@
m2/gm2-ppg-boot/$(SRC_PREFIX)SymbolKey.h: $(srcdir)/m2/gm2-compiler/SymbolKey.def $(MCDEPS)
-test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
$(MCC) -o=$@ $(srcdir)/m2/gm2-compiler/SymbolKey.def
m2/gm2-ppg-boot/$(SRC_PREFIX)SymbolKey.o: $(srcdir)/m2/gm2-compiler/SymbolKey.mod \
$(MCDEPS) $(BUILD-BOOT-PPG-H) \
m2/gm2-ppg-boot/$(SRC_PREFIX)SymbolKey.h
-test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
$(MCC) --suppress-noreturn -o=m2/gm2-ppg-boot/$(SRC_PREFIX)SymbolKey.cc $(srcdir)/m2/gm2-compiler/SymbolKey.mod
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/gm2-ppg-boot -I$(srcdir)/m2/mc-boot \
-I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs-boot \
$(INCLUDES) -g -c m2/gm2-ppg-boot/$(SRC_PREFIX)SymbolKey.cc -o $@
m2/gm2-ppg-boot/$(SRC_PREFIX)NameKey.h: $(srcdir)/m2/gm2-compiler/NameKey.def $(MCDEPS)
-test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
$(MCC) -o=$@ $(srcdir)/m2/gm2-compiler/NameKey.def
m2/gm2-ppg-boot/$(SRC_PREFIX)NameKey.o: $(srcdir)/m2/gm2-compiler/NameKey.mod \
$(MCDEPS) $(BUILD-BOOT-PPG-H) \
m2/gm2-ppg-boot/$(SRC_PREFIX)NameKey.h
-test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
$(MCC) --suppress-noreturn -o=m2/gm2-ppg-boot/$(SRC_PREFIX)NameKey.cc $(srcdir)/m2/gm2-compiler/NameKey.mod
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/gm2-ppg-boot -I$(srcdir)/m2/mc-boot \
-I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs-boot \
$(INCLUDES) -g -c m2/gm2-ppg-boot/$(SRC_PREFIX)NameKey.cc -o $@
m2/gm2-ppg-boot/$(SRC_PREFIX)Lists.h: $(srcdir)/m2/gm2-compiler/Lists.def $(MCDEPS)
-test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
$(MCC) -o=$@ $(srcdir)/m2/gm2-compiler/Lists.def
m2/gm2-ppg-boot/$(SRC_PREFIX)Lists.o: $(srcdir)/m2/gm2-compiler/Lists.mod \
$(MCDEPS) $(BUILD-BOOT-PPG-H) \
m2/gm2-ppg-boot/$(SRC_PREFIX)Lists.h
-test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
$(MCC) --suppress-noreturn -o=m2/gm2-ppg-boot/$(SRC_PREFIX)Lists.cc $(srcdir)/m2/gm2-compiler/Lists.mod
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/gm2-ppg-boot -I$(srcdir)/m2/mc-boot \
-I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs-boot \
$(INCLUDES) -g -c m2/gm2-ppg-boot/$(SRC_PREFIX)Lists.cc -o $@
m2/gm2-ppg-boot/$(SRC_PREFIX)Output.h: $(srcdir)/m2/gm2-compiler/Output.def $(MCDEPS)
-test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
$(MCC) -o=$@ $(srcdir)/m2/gm2-compiler/Output.def
m2/gm2-ppg-boot/$(SRC_PREFIX)Output.o: $(srcdir)/m2/gm2-compiler/Output.mod \
$(MCDEPS) $(BUILD-BOOT-PPG-H) \
m2/gm2-ppg-boot/$(SRC_PREFIX)Output.h
-test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
$(MCC) --suppress-noreturn -o=m2/gm2-ppg-boot/$(SRC_PREFIX)Output.cc $(srcdir)/m2/gm2-compiler/Output.mod
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/gm2-ppg-boot -I$(srcdir)/m2/mc-boot \
-I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs-boot \
$(INCLUDES) -g -c m2/gm2-ppg-boot/$(SRC_PREFIX)Output.cc -o $@
m2/gm2-ppg-boot/$(SRC_PREFIX)bnflex.h: $(srcdir)/m2/gm2-compiler/bnflex.def $(MCDEPS)
-test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
$(MCC) -o=$@ $(srcdir)/m2/gm2-compiler/bnflex.def
m2/gm2-ppg-boot/$(SRC_PREFIX)bnflex.o: $(srcdir)/m2/gm2-compiler/bnflex.mod \
$(MCDEPS) $(BUILD-BOOT-PPG-H) \
m2/gm2-ppg-boot/$(SRC_PREFIX)bnflex.h
-test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
$(MCC) --suppress-noreturn -o=m2/gm2-ppg-boot/$(SRC_PREFIX)bnflex.cc $(srcdir)/m2/gm2-compiler/bnflex.mod
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/gm2-ppg-boot -I$(srcdir)/m2/mc-boot \
-I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs-boot \
$(INCLUDES) -g -c m2/gm2-ppg-boot/$(SRC_PREFIX)bnflex.cc -o $@
m2/gm2-ppg-boot/$(SRC_PREFIX)RTco.h: $(srcdir)/m2/gm2-libs-iso/RTco.def $(MCDEPS)
-test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
$(MCC) -o=$@ -I$(srcdir)/m2/gm2-libs-iso -I$(srcdir)/m2/gm2-libs $(srcdir)/m2/gm2-libs-iso/RTco.def
m2/gm2-ppg-boot/$(SRC_PREFIX)RTentity.h: $(srcdir)/m2/gm2-libs-iso/RTentity.def $(MCDEPS)
-test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
$(MCC) -o=$@ -I$(srcdir)/m2/gm2-libs-iso -I$(srcdir)/m2/gm2-libs $(srcdir)/m2/gm2-libs-iso/RTentity.def
m2/gm2-ppg-boot/$(SRC_PREFIX)RTco.o: $(srcdir)/m2/gm2-libs-iso/RTcodummy.c
-test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/gm2-ppg-boot -I$(srcdir)/m2/mc-boot \
-I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs-boot \
$(INCLUDES) -g -c $< -o $@
m2/gm2-ppg-boot/$(SRC_PREFIX)RTentity.o: $(srcdir)/m2/gm2-libs-iso/RTentity.mod \
$(MCDEPS) $(BUILD-BOOT-PPG-H) \
m2/gm2-ppg-boot/$(SRC_PREFIX)RTentity.h
-test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
$(MCC) --suppress-noreturn -o=m2/gm2-ppg-boot/$(SRC_PREFIX)RTentity.cc $(srcdir)/m2/gm2-libs-iso/RTentity.mod
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/gm2-ppg-boot -I$(srcdir)/m2/mc-boot \
-I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs-boot \
$(INCLUDES) -g -c m2/gm2-ppg-boot/$(SRC_PREFIX)RTentity.cc -o $@
m2/gm2-ppg-boot/$(SRC_PREFIX)%.o: $(srcdir)/m2/gm2-libs/%.mod $(MCDEPS) $(BUILD-BOOT-PPG-H)
-test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
$(MCC) -o=m2/gm2-ppg-boot/$(SRC_PREFIX)$*.cc $(srcdir)/m2/gm2-libs/$*.mod
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/gm2-ppg-boot -I$(srcdir)/m2/mc-boot \
-I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs-boot \
$(INCLUDES) -g -c m2/gm2-ppg-boot/$(SRC_PREFIX)$*.cc -o $@
m2/gm2-ppg-boot/$(SRC_PREFIX)%.o: $(srcdir)/m2/gm2-compiler/%.mod $(MCDEPS) $(BUILD-BOOT-PPG-H)
-test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
$(MCC) -o=m2/gm2-ppg-boot/$(SRC_PREFIX)$*.cc $(srcdir)/m2/gm2-compiler/$*.mod
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/mc-boot -Im2/gm2-compiler-boot \
-Im2/gm2-libs-boot -Im2/gm2-ppg-boot \
-I$(srcdir)/m2/mc-boot-ch $(INCLUDES) -g -c m2/gm2-ppg-boot/$(SRC_PREFIX)$*.cc -o $@
m2/ppg$(exeext): m2/boot-bin/mc $(BUILD-PPG-O) $(BUILD-MC-INTERFACE-O) m2/gm2-ppg-boot/main.o \
m2/gm2-libs-boot/RTcodummy.o m2/mc-boot-ch/$(SRC_PREFIX)abort.o
-test -d m2 || $(mkinstalldirs) m2
+$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ $(BUILD-PPG-O) m2/gm2-ppg-boot/main.o \
m2/gm2-libs-boot/RTcodummy.o m2/mc-boot-ch/$(SRC_PREFIX)abort.o -lm
m2/gm2-ppg-boot/main.o: $(M2LINK) $(srcdir)/m2/init/mcinit
-test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
unset CC ; $(M2LINK) -s --langc++ --exit --name mainppginit.cc $(srcdir)/m2/init/ppginit
mv mainppginit.cc m2/gm2-ppg-boot/main.cc
$(CXX) $(INCLUDES) -g -c -o $@ m2/gm2-ppg-boot/main.cc
m2/gm2-auto:
-test -d $@ || $(mkinstalldirs) $@
c-family/m2pp.o : $(srcdir)/m2/m2pp.cc $(GCC_HEADER_DEPENDENCIES_FOR_M2)
$(COMPILER) -c -g $(ALL_COMPILERFLAGS) \
$(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
BUILD-PG-O = $(PPG-INTERFACE-C:%.c=m2/gm2-pg-boot/$(SRC_PREFIX)%.o) \
$(PPG-INTERFACE-CC:%.cc=m2/gm2-pg-boot/$(SRC_PREFIX)%.o) \
$(PPG-MODS:%.mod=m2/gm2-pg-boot/$(SRC_PREFIX)%.o) \
$(PPG-LIB-MODS:%.mod=m2/gm2-pg-boot/$(SRC_PREFIX)%.o) \
$(PG-SRC:%.mod=m2/gm2-pg-boot/$(SRC_PREFIX)%.o)
BUILD-BOOT-PG-H: $(BUILD-BOOT-H) \
BUILD-BOOT-PG-H = $(BUILD-BOOT-H) \
m2/gm2-pg-boot/$(SRC_PREFIX)M2RTS.h \
m2/gm2-pg-boot/$(SRC_PREFIX)M2Dependent.h
m2/gm2-pg-boot/$(SRC_PREFIX)M2Dependent.h \
$(PGE-DEF:%.def=m2/gm2-pg-boot/$(SRC_PREFIX)%.h) \
$(PPG-DEFS:%.def=m2/gm2-pg-boot/$(SRC_PREFIX)%.h) \
$(PPG-LIB-DEFS:%.def=m2/gm2-pg-boot/$(SRC_PREFIX)%.h)
m2/gm2-pg-boot/$(SRC_PREFIX)%.h: $(srcdir)/m2/gm2-libs/%.def $(MCDEPS)
-test -d m2/gm2-pg-boot || $(mkinstalldirs) m2/gm2-pg-boot
$(MCC) -o=$@ $(srcdir)/m2/gm2-libs/$*.def
$(MCC) -o=$@ $(srcdir)/m2/gm2-libs/$*.def $<
m2/gm2-pg-boot/$(SRC_PREFIX)%.h: $(srcdir)/m2/gm2-compiler/%.def $(MCDEPS)
-test -d m2/gm2-pg-boot || $(mkinstalldirs) m2/gm2-pg-boot
$(MCC) -o=$@ -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-compiler $<
m2/gm2-pg-boot/$(SRC_PREFIX)SymbolKey.h: $(srcdir)/m2/gm2-compiler/SymbolKey.def $(MCDEPS)
-test -d m2/gm2-pg-boot || $(mkinstalldirs) m2/gm2-pg-boot
$(MCC) -o=$@ $(srcdir)/m2/gm2-compiler/SymbolKey.def
m2/gm2-pg-boot/$(SRC_PREFIX)SymbolKey.o: $(srcdir)/m2/gm2-compiler/SymbolKey.mod \
$(MCDEPS) $(BUILD-BOOT-PG-H) \
m2/gm2-pg-boot/$(SRC_PREFIX)SymbolKey.h
-test -d m2/gm2-pg-boot || $(mkinstalldirs) m2/gm2-pg-boot
$(MCC) --suppress-noreturn -o=m2/gm2-pg-boot/$(SRC_PREFIX)SymbolKey.cc $(srcdir)/m2/gm2-compiler/SymbolKey.mod
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/gm2-pg-boot -I$(srcdir)/m2/mc-boot \
-I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs-boot \
$(INCLUDES) -g -c m2/gm2-pg-boot/$(SRC_PREFIX)SymbolKey.cc -o $@
m2/gm2-pg-boot/$(SRC_PREFIX)NameKey.h: $(srcdir)/m2/gm2-compiler/NameKey.def $(MCDEPS)
-test -d m2/gm2-pg-boot || $(mkinstalldirs) m2/gm2-pg-boot
$(MCC) -o=$@ $(srcdir)/m2/gm2-compiler/NameKey.def
m2/gm2-pg-boot/$(SRC_PREFIX)NameKey.o: $(srcdir)/m2/gm2-compiler/NameKey.mod \
$(MCDEPS) $(BUILD-BOOT-PG-H) \
m2/gm2-pg-boot/$(SRC_PREFIX)NameKey.h
-test -d m2/gm2-pg-boot || $(mkinstalldirs) m2/gm2-pg-boot
$(MCC) --suppress-noreturn -o=m2/gm2-pg-boot/$(SRC_PREFIX)NameKey.cc $(srcdir)/m2/gm2-compiler/NameKey.mod
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/gm2-pg-boot -I$(srcdir)/m2/mc-boot \
-I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs-boot \
$(INCLUDES) -g -c m2/gm2-pg-boot/$(SRC_PREFIX)NameKey.cc -o $@
m2/gm2-pg-boot/$(SRC_PREFIX)Lists.h: $(srcdir)/m2/gm2-compiler/Lists.def $(MCDEPS)
-test -d m2/gm2-pg-boot || $(mkinstalldirs) m2/gm2-pg-boot
$(MCC) -o=$@ $(srcdir)/m2/gm2-compiler/Lists.def
m2/gm2-pg-boot/$(SRC_PREFIX)Lists.o: $(srcdir)/m2/gm2-compiler/Lists.mod \
$(MCDEPS) $(BUILD-BOOT-PG-H) \
m2/gm2-pg-boot/$(SRC_PREFIX)Lists.h
-test -d m2/gm2-pg-boot || $(mkinstalldirs) m2/gm2-pg-boot
$(MCC) --suppress-noreturn -o=m2/gm2-pg-boot/$(SRC_PREFIX)Lists.cc $(srcdir)/m2/gm2-compiler/Lists.mod
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/gm2-pg-boot -I$(srcdir)/m2/mc-boot \
-I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs-boot \
$(INCLUDES) -g -c m2/gm2-pg-boot/$(SRC_PREFIX)Lists.cc -o $@
m2/gm2-pg-boot/$(SRC_PREFIX)Output.h: $(srcdir)/m2/gm2-compiler/Output.def $(MCDEPS)
-test -d m2/gm2-pg-boot || $(mkinstalldirs) m2/gm2-pg-boot
$(MCC) -o=$@ $(srcdir)/m2/gm2-compiler/Output.def
m2/gm2-pg-boot/$(SRC_PREFIX)Output.o: $(srcdir)/m2/gm2-compiler/Output.mod \
$(MCDEPS) $(BUILD-BOOT-PG-H) \
m2/gm2-pg-boot/$(SRC_PREFIX)Output.h
-test -d m2/gm2-pg-boot || $(mkinstalldirs) m2/gm2-pg-boot
$(MCC) --suppress-noreturn -o=m2/gm2-pg-boot/$(SRC_PREFIX)Output.cc $(srcdir)/m2/gm2-compiler/Output.mod
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/gm2-pg-boot -I$(srcdir)/m2/mc-boot \
-I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs-boot \
$(INCLUDES) -g -c m2/gm2-pg-boot/$(SRC_PREFIX)Output.cc -o $@
m2/gm2-pg-boot/$(SRC_PREFIX)bnflex.h: $(srcdir)/m2/gm2-compiler/bnflex.def $(MCDEPS)
-test -d m2/gm2-pg-boot || $(mkinstalldirs) m2/gm2-pg-boot
$(MCC) -o=$@ $(srcdir)/m2/gm2-compiler/bnflex.def
m2/gm2-pg-boot/$(SRC_PREFIX)bnflex.o: $(srcdir)/m2/gm2-compiler/bnflex.mod \
$(MCDEPS) $(BUILD-BOOT-PG-H) \
m2/gm2-pg-boot/$(SRC_PREFIX)bnflex.h
-test -d m2/gm2-pg-boot || $(mkinstalldirs) m2/gm2-pg-boot
$(MCC) --suppress-noreturn -o=m2/gm2-pg-boot/$(SRC_PREFIX)bnflex.cc $(srcdir)/m2/gm2-compiler/bnflex.mod
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/gm2-pg-boot -I$(srcdir)/m2/mc-boot \
-I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs-boot \
$(INCLUDES) -g -c m2/gm2-pg-boot/$(SRC_PREFIX)bnflex.cc -o $@
m2/gm2-pg-boot/$(SRC_PREFIX)RTco.h: $(srcdir)/m2/gm2-libs-iso/RTco.def $(MCDEPS)
-test -d m2/gm2-pg-boot || $(mkinstalldirs) m2/gm2-pg-boot
$(MCC) -o=$@ -I$(srcdir)/m2/gm2-libs-iso -I$(srcdir)/m2/gm2-libs $(srcdir)/m2/gm2-libs-iso/RTco.def
m2/gm2-pg-boot/$(SRC_PREFIX)RTentity.h: $(srcdir)/m2/gm2-libs-iso/RTentity.def $(MCDEPS)
-test -d m2/gm2-pg-boot || $(mkinstalldirs) m2/gm2-pg-boot
$(MCC) -o=$@ -I$(srcdir)/m2/gm2-libs-iso -I$(srcdir)/m2/gm2-libs $(srcdir)/m2/gm2-libs-iso/RTentity.def
m2/gm2-pg-boot/$(SRC_PREFIX)RTco.o: $(srcdir)/m2/gm2-libs-iso/RTcodummy.c
-test -d m2/gm2-pg-boot || $(mkinstalldirs) m2/gm2-pg-boot
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/gm2-pg-boot -I$(srcdir)/m2/mc-boot \
-I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs-boot \
$(INCLUDES) -g -c $< -o $@
m2/gm2-pg-boot/$(SRC_PREFIX)RTentity.o: $(srcdir)/m2/gm2-libs-iso/RTentity.mod \
$(MCDEPS) $(BUILD-BOOT-PG-H) \
m2/gm2-pg-boot/$(SRC_PREFIX)RTentity.h
-test -d m2/gm2-pg-boot || $(mkinstalldirs) m2/gm2-pg-boot
$(MCC) --suppress-noreturn -o=m2/gm2-pg-boot/$(SRC_PREFIX)RTentity.cc $(srcdir)/m2/gm2-libs-iso/RTentity.mod
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/gm2-pg-boot -I$(srcdir)/m2/mc-boot \
-I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs-boot \
$(INCLUDES) -g -c m2/gm2-pg-boot/$(SRC_PREFIX)RTentity.cc -o $@
m2/gm2-pg-boot/$(SRC_PREFIX)%.o: m2/mc-boot-ch/$(SRC_PREFIX)%.c m2/gm2-libs/gm2-libs-host.h $(BUILD-BOOT-PG-H)
-test -d m2/gm2-pg-boot || $(mkinstalldirs) m2/gm2-pg-boot
@ -319,16 +549,15 @@ m2/gm2-pg-boot/$(SRC_PREFIX)%.o: m2/mc-boot-ch/$(SRC_PREFIX)%.cc m2/gm2-libs/gm2
m2/gm2-pg-boot/$(SRC_PREFIX)M2RTS.o: $(srcdir)/m2/gm2-libs/M2RTS.mod $(MCDEPS) $(BUILD-BOOT-PG-H)
-test -d m2/gm2-pg-boot || $(mkinstalldirs) m2/gm2-pg-boot
$(MCC) --suppress-noreturn -o=m2/gm2-pg-boot/$(SRC_PREFIX)M2RTS.c $(srcdir)/m2/gm2-libs/M2RTS.mod
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -Im2/gm2-pg-boot -I$(srcdir)/m2/mc-boot \
-I$(srcdir)/m2/mc-boot-ch \
-Im2/gm2-libs-boot $(INCLUDES) \
-g -c m2/gm2-pg-boot/$(SRC_PREFIX)M2RTS.c -o $@
$(MCC) --suppress-noreturn -o=m2/gm2-pg-boot/$(SRC_PREFIX)M2RTS.cc $(srcdir)/m2/gm2-libs/M2RTS.mod
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/gm2-pg-boot -I$(srcdir)/m2/mc-boot \
-I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs-boot \
$(INCLUDES) -g -c m2/gm2-pg-boot/$(SRC_PREFIX)M2RTS.cc -o $@
m2/gm2-pg-boot/$(SRC_PREFIX)%.o: $(srcdir)/m2/gm2-libs/%.mod $(MCDEPS) $(BUILD-BOOT-PG-H)
-test -d m2/gm2-pg-boot || $(mkinstalldirs) m2/gm2-pg-boot
$(MCC) -o=m2/gm2-pg-boot/$(SRC_PREFIX)$*.c $(srcdir)/m2/gm2-libs/$*.mod
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -Im2/gm2-pg-boot -I$(srcdir)/m2/mc-boot \
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -Im2/gm2-pg-boot -I$(srcdir)/m2/mc-boot \
-I$(srcdir)/m2/mc-boot-ch \
-Im2/gm2-libs-boot $(INCLUDES) \
-g -c m2/gm2-pg-boot/$(SRC_PREFIX)$*.c -o $@
@ -390,8 +619,7 @@ BUILD-PGE-O = $(PPG-INTERFACE-C:%.c=m2/gm2-pge-boot/$(SRC_PREFIX)%.o) \
$(PPG-LIB-MODS:%.mod=m2/gm2-pge-boot/$(SRC_PREFIX)%.o) \
$(PGE-SRC:%.mod=m2/gm2-pge-boot/$(SRC_PREFIX)%.o)
BUILD-BOOT-PGE-H: $(BUILD-BOOT-H) $(PGE-DEF:%.def=m2/gm2-pge-boot/$(SRC_PREFIX)%.h) \
m2/gm2-pge-boot/GM2RTS.h m2/gm2-pge-boot/GM2Dependent.h
BUILD-BOOT-PGE-H = $(BUILD-BOOT-H) $(PGE-DEF:%.def=m2/gm2-pge-boot/$(SRC_PREFIX)%.h)
m2/gm2-auto/pge.mod: m2/pg$(exeext)
-test -d m2/gm2-auto || $(mkinstalldirs) m2/gm2-auto
@ -453,6 +681,94 @@ m2/gm2-pge-boot/$(SRC_PREFIX)M2RTS.o: $(srcdir)/m2/gm2-libs/M2RTS.mod $(MCDEPS)
-I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs-boot \
$(INCLUDES) -g -c m2/gm2-pge-boot/$(SRC_PREFIX)M2RTS.cc -o $@
m2/gm2-pge-boot/$(SRC_PREFIX)SymbolKey.h: $(srcdir)/m2/gm2-compiler/SymbolKey.def $(MCDEPS)
-test -d m2/gm2-pge-boot || $(mkinstalldirs) m2/gm2-pge-boot
$(MCC) -o=$@ $(srcdir)/m2/gm2-compiler/SymbolKey.def
m2/gm2-pge-boot/$(SRC_PREFIX)SymbolKey.o: $(srcdir)/m2/gm2-compiler/SymbolKey.mod \
$(MCDEPS) $(BUILD-BOOT-PGE-H) \
m2/gm2-pge-boot/$(SRC_PREFIX)SymbolKey.h
-test -d m2/gm2-pge-boot || $(mkinstalldirs) m2/gm2-pge-boot
$(MCC) --suppress-noreturn -o=m2/gm2-pge-boot/$(SRC_PREFIX)SymbolKey.cc $(srcdir)/m2/gm2-compiler/SymbolKey.mod
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/gm2-pge-boot -I$(srcdir)/m2/mc-boot \
-I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs-boot \
$(INCLUDES) -g -c m2/gm2-pge-boot/$(SRC_PREFIX)SymbolKey.cc -o $@
m2/gm2-pge-boot/$(SRC_PREFIX)NameKey.h: $(srcdir)/m2/gm2-compiler/NameKey.def $(MCDEPS)
-test -d m2/gm2-pge-boot || $(mkinstalldirs) m2/gm2-pge-boot
$(MCC) -o=$@ $(srcdir)/m2/gm2-compiler/NameKey.def
m2/gm2-pge-boot/$(SRC_PREFIX)NameKey.o: $(srcdir)/m2/gm2-compiler/NameKey.mod \
$(MCDEPS) $(BUILD-BOOT-PGE-H) \
m2/gm2-pge-boot/$(SRC_PREFIX)NameKey.h
-test -d m2/gm2-pge-boot || $(mkinstalldirs) m2/gm2-pge-boot
$(MCC) --suppress-noreturn -o=m2/gm2-pge-boot/$(SRC_PREFIX)NameKey.cc $(srcdir)/m2/gm2-compiler/NameKey.mod
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/gm2-pge-boot -I$(srcdir)/m2/mc-boot \
-I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs-boot \
$(INCLUDES) -g -c m2/gm2-pge-boot/$(SRC_PREFIX)NameKey.cc -o $@
m2/gm2-pge-boot/$(SRC_PREFIX)Lists.h: $(srcdir)/m2/gm2-compiler/Lists.def $(MCDEPS)
-test -d m2/gm2-pge-boot || $(mkinstalldirs) m2/gm2-pge-boot
$(MCC) -o=$@ $(srcdir)/m2/gm2-compiler/Lists.def
m2/gm2-pge-boot/$(SRC_PREFIX)Lists.o: $(srcdir)/m2/gm2-compiler/Lists.mod \
$(MCDEPS) $(BUILD-BOOT-PGE-H) \
m2/gm2-pge-boot/$(SRC_PREFIX)Lists.h
-test -d m2/gm2-pge-boot || $(mkinstalldirs) m2/gm2-pge-boot
$(MCC) --suppress-noreturn -o=m2/gm2-pge-boot/$(SRC_PREFIX)Lists.cc $(srcdir)/m2/gm2-compiler/Lists.mod
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/gm2-pge-boot -I$(srcdir)/m2/mc-boot \
-I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs-boot \
$(INCLUDES) -g -c m2/gm2-pge-boot/$(SRC_PREFIX)Lists.cc -o $@
m2/gm2-pge-boot/$(SRC_PREFIX)Output.h: $(srcdir)/m2/gm2-compiler/Output.def $(MCDEPS)
-test -d m2/gm2-pge-boot || $(mkinstalldirs) m2/gm2-pge-boot
$(MCC) -o=$@ $(srcdir)/m2/gm2-compiler/Output.def
m2/gm2-pge-boot/$(SRC_PREFIX)Output.o: $(srcdir)/m2/gm2-compiler/Output.mod \
$(MCDEPS) $(BUILD-BOOT-PGE-H) \
m2/gm2-pge-boot/$(SRC_PREFIX)Output.h
-test -d m2/gm2-pge-boot || $(mkinstalldirs) m2/gm2-pge-boot
$(MCC) --suppress-noreturn -o=m2/gm2-pge-boot/$(SRC_PREFIX)Output.cc $(srcdir)/m2/gm2-compiler/Output.mod
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/gm2-pge-boot -I$(srcdir)/m2/mc-boot \
-I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs-boot \
$(INCLUDES) -g -c m2/gm2-pge-boot/$(SRC_PREFIX)Output.cc -o $@
m2/gm2-pge-boot/$(SRC_PREFIX)bnflex.h: $(srcdir)/m2/gm2-compiler/bnflex.def $(MCDEPS)
-test -d m2/gm2-pge-boot || $(mkinstalldirs) m2/gm2-pge-boot
$(MCC) -o=$@ $(srcdir)/m2/gm2-compiler/bnflex.def
m2/gm2-pge-boot/$(SRC_PREFIX)bnflex.o: $(srcdir)/m2/gm2-compiler/bnflex.mod \
$(MCDEPS) $(BUILD-BOOT-PGE-H) \
m2/gm2-pge-boot/$(SRC_PREFIX)bnflex.h
-test -d m2/gm2-pge-boot || $(mkinstalldirs) m2/gm2-pge-boot
$(MCC) --suppress-noreturn -o=m2/gm2-pge-boot/$(SRC_PREFIX)bnflex.cc $(srcdir)/m2/gm2-compiler/bnflex.mod
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/gm2-pge-boot -I$(srcdir)/m2/mc-boot \
-I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs-boot \
$(INCLUDES) -g -c m2/gm2-pge-boot/$(SRC_PREFIX)bnflex.cc -o $@
m2/gm2-pge-boot/$(SRC_PREFIX)RTco.h: $(srcdir)/m2/gm2-libs-iso/RTco.def $(MCDEPS)
-test -d m2/gm2-pge-boot || $(mkinstalldirs) m2/gm2-pge-boot
$(MCC) -o=$@ -I$(srcdir)/m2/gm2-libs-iso -I$(srcdir)/m2/gm2-libs $(srcdir)/m2/gm2-libs-iso/RTco.def
m2/gm2-pge-boot/$(SRC_PREFIX)RTentity.h: $(srcdir)/m2/gm2-libs-iso/RTentity.def $(MCDEPS)
-test -d m2/gm2-pge-boot || $(mkinstalldirs) m2/gm2-pge-boot
$(MCC) -o=$@ -I$(srcdir)/m2/gm2-libs-iso -I$(srcdir)/m2/gm2-libs $(srcdir)/m2/gm2-libs-iso/RTentity.def
m2/gm2-pge-boot/$(SRC_PREFIX)RTco.o: $(srcdir)/m2/gm2-libs-iso/RTcodummy.c
-test -d m2/gm2-pge-boot || $(mkinstalldirs) m2/gm2-pge-boot
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/gm2-pge-boot -I$(srcdir)/m2/mc-boot \
-I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs-boot \
$(INCLUDES) -g -c $< -o $@
m2/gm2-pge-boot/$(SRC_PREFIX)RTentity.o: $(srcdir)/m2/gm2-libs-iso/RTentity.mod \
$(MCDEPS) $(BUILD-BOOT-PGE-H) \
m2/gm2-pge-boot/$(SRC_PREFIX)RTentity.h
-test -d m2/gm2-pge-boot || $(mkinstalldirs) m2/gm2-pge-boot
$(MCC) --suppress-noreturn -o=m2/gm2-pge-boot/$(SRC_PREFIX)RTentity.cc $(srcdir)/m2/gm2-libs-iso/RTentity.mod
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/gm2-pge-boot -I$(srcdir)/m2/mc-boot \
-I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs-boot \
$(INCLUDES) -g -c m2/gm2-pge-boot/$(SRC_PREFIX)RTentity.cc -o $@
m2/gm2-pge-boot/$(SRC_PREFIX)%.o: $(srcdir)/m2/gm2-libs/%.mod $(MCDEPS) $(BUILD-BOOT-PGE-H)
-test -d m2/gm2-pge-boot || $(mkinstalldirs) m2/gm2-pge-boot
$(MCC) -o=m2/gm2-pge-boot/$(SRC_PREFIX)$*.cc $(srcdir)/m2/gm2-libs/$*.mod
@ -586,7 +902,6 @@ MCLINK=-g # use -g -fmodules -c if you are debugging and wish to see missing
# This is only needed in maintainer mode by 'make mc-maintainer' when regenerating the C
# version of mc. We need a working Modula-2 compiler to run mc-maintainer.
# GM2SYS=${HOME}/opt/lib/gcc/x86_64-pc-linux-gnu/13.0.0/m2/m2pim
GM2PATH=-I$(srcdir)/m2/mc \
-I$(srcdir)/m2 -Im2/gm2-auto \
-fm2-pathname=m2pim -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-libs-ch \
@ -594,12 +909,18 @@ GM2PATH=-I$(srcdir)/m2/mc \
mc: mc-clean mc-devel
mc-basetest: force
$(SHELL) $(srcdir)/testsuite/gm2/base-lang/pass/base-lang-test.sh ./mc $(srcdir) `pwd` $(COMPILER)
mc-devel-basetest: force
$(SHELL) $(srcdir)/testsuite/gm2/base-lang/pass/base-lang-test.sh m2/boot-bin/mc-devel$(exeext) $(srcdir) `pwd` $(COMPILER)
mc-push: force
cp -p m2/mc-boot-gen/*.cc $(srcdir)/m2/mc-boot/
cp -p m2/mc-boot-gen/*.h $(srcdir)/m2/mc-boot/
mc-clean: force m2/mc-obj
$(RM) m2/mc-boot-gen/*.{cc,h} m2/boot-bin/* m2/mc-boot/* m2/mc-boot-ch/*
$(RM) m2/mc-boot-gen/*.{cc,h} m2/boot-bin/* m2/mc-boot/* m2/mc-boot-ch/* mc
mc-maintainer: mc-clean mc-autogen mc-push mc-clean mc-bootstrap
@ -765,7 +1086,7 @@ m2/mc-boot-gen/$(SRC_PREFIX)%.h: $(srcdir)/m2/gm2-libs/%.def
m2/mc-boot-gen/$(SRC_PREFIX)decl.cc: $(srcdir)/m2/mc/decl.mod
-test -d m2/mc-boot-gen || $(mkinstalldirs) m2/mc-boot-gen
./mc $(MC_OPTIONS) --extended-opaque -I$(srcdir)/m2/mc -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-libs-iso --h-file-prefix=$(SRC_PREFIX) -o=$@ $<
./mc $(MC_OPTIONS) $(EXTENDED_OPAQUE) -I$(srcdir)/m2/mc -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-libs-iso --h-file-prefix=$(SRC_PREFIX) -o=$@ $<
m2/mc-boot-gen/$(SRC_PREFIX)%.cc: $(srcdir)/m2/mc/%.mod
-test -d m2/mc-boot-gen || $(mkinstalldirs) m2/mc-boot-gen

View File

@ -1061,7 +1061,7 @@ PROCEDURE GetM2DumpFilter () : ADDRESS ;
SetM2Dump - sets the dump via a comma separated list: quad,decl,gimple,all.
*)
PROCEDURE SetM2Dump (value: BOOLEAN; filter: ADDRESS) ;
PROCEDURE SetM2Dump (value: BOOLEAN; filter: ADDRESS) : BOOLEAN ;
(*

View File

@ -1012,7 +1012,7 @@ PROCEDURE BuildAssignConstant (equalsTokNo: CARDINAL) ;
|---------------| empty
*)
PROCEDURE BuildAlignment ;
PROCEDURE BuildAlignment (tokno: CARDINAL) ;
(*
@ -1030,7 +1030,7 @@ PROCEDURE BuildAlignment ;
|------------| empty
*)
PROCEDURE BuildBitLength ;
PROCEDURE BuildBitLength (tokno: CARDINAL) ;
(*

View File

@ -790,8 +790,10 @@ ConstAttributeExpression :=
">"
=:
ByteAlignment := '<*' % PushAutoOn %
AttributeExpression % BuildAlignment %
ByteAlignment := % VAR tokpos: CARDINAL ; %
'<*' % PushAutoOn %
% tokpos := GetTokenNo () %
AttributeExpression % BuildAlignment (tokpos) %
'*>' % PopAuto %
=:

View File

@ -704,7 +704,8 @@ ConstructorOrConstActualParameters := Constructor | ConstActualParameters % Pus
ConstSetOrQualidentOrFunction := % PushAutoOff %
% VAR tokpos: CARDINAL ; %
( % tokpos := GetTokenNo () %
% tokpos := GetTokenNo () %
(
PushQualident
( ConstructorOrConstActualParameters | % PushConstType %
% PopNothing %
@ -1008,8 +1009,8 @@ ConstructorOrSimpleDes := Constructor | % Pop
SetOrDesignatorOrFunction := % PushAutoOff %
% VAR tokpos: CARDINAL ; %
( % tokpos := GetTokenNo () %
% tokpos := GetTokenNo () %
(
PushQualident
( ConstructorOrSimpleDes | % PopNothing %
)

View File

@ -664,7 +664,8 @@ Constructor := % VAR
ConstSetOrQualidentOrFunction := % PushAutoOn %
% VAR tokpos: CARDINAL ; %
( % tokpos := GetTokenNo () %
% tokpos := GetTokenNo () %
(
Qualident
[ Constructor |
ConstActualParameters % BuildConstFunctionCall %
@ -678,8 +679,10 @@ ConstAttribute := "__ATTRIBUTE__" "__BUILTIN__" "(" "(" ConstAttributeExpression
ConstAttributeExpression := Ident | "<" Qualident ',' Ident ">" =:
ByteAlignment := '<*' % PushAutoOn %
AttributeExpression % BuildAlignment %
ByteAlignment := % VAR tokpos: CARDINAL ; %
'<*' % PushAutoOn %
% tokpos := GetTokenNo () %
AttributeExpression % BuildAlignment (tokpos) %
'*>' % PopAuto %
=:

View File

@ -50,7 +50,7 @@ PROCEDURE strtod (s: ADDRESS; VAR error: BOOLEAN) : REAL ;
*)
PROCEDURE dtoa (d : REAL;
mode : Mode;
mode : INTEGER;
ndigits : INTEGER;
VAR decpt: INTEGER;
VAR sign : BOOLEAN) : ADDRESS ;

View File

@ -50,7 +50,7 @@ PROCEDURE strtold (s: ADDRESS; VAR error: BOOLEAN) : LONGREAL ;
*)
PROCEDURE ldtoa (d : LONGREAL;
mode : Mode;
mode : INTEGER;
ndigits : INTEGER;
VAR decpt: INTEGER;
VAR sign : BOOLEAN) : ADDRESS ;

View File

@ -27,12 +27,12 @@ along with GNU Modula-2; see the file COPYING3. If not see
EXTERN
void
_M2_SYSTEM_init (int argc, char *p)
_M2_SYSTEM_init (int argc, char *argv[], char *envp[])
{
}
EXTERN
void
_M2_SYSTEM_fini (int argc, char *p)
_M2_SYSTEM_fini (int argc, char *argv[], char *envp[])
{
}

View File

@ -123,21 +123,21 @@ dtoa_calcdecimal (char *p, int str_size, int ndigits)
}
int
bool
dtoa_calcsign (char *p, int str_size)
{
if (p[0] == '-')
{
memmove (p, p + 1, str_size - 1);
return TRUE;
return true;
}
else
return FALSE;
return false;
}
char *
dtoa_dtoa (double d, int mode, int ndigits, int *decpt, int *sign)
void *
dtoa_dtoa (double d, int mode, int ndigits, int *decpt, bool *sign)
{
char format[50];
char *p;
@ -169,12 +169,12 @@ dtoa_dtoa (double d, int mode, int ndigits, int *decpt, int *sign)
/* GNU Modula-2 hooks */
void
_M2_dtoa_init (void)
_M2_dtoa_init (int argc, char *argv[], char *envp[])
{
}
void
_M2_dtoa_fini (void)
_M2_dtoa_fini (int argc, char *argv[], char *envp[])
{
}
#endif

View File

@ -38,14 +38,14 @@ errno_geterrno (void)
/* init constructor for the module. */
void
_M2_errno_init (int argc, char *p)
_M2_errno_init (int argc, char *argv[], char *envp[])
{
}
/* finish deconstructor for the module. */
void
_M2_errno_fini (int argc, char *p)
_M2_errno_fini (int argc, char *argv[], char *envp[])
{
}

View File

@ -34,7 +34,7 @@ typedef enum Mode { maxsignicant, decimaldigits } Mode;
extern int dtoa_calcmaxsig (char *p, int ndigits);
extern int dtoa_calcdecimal (char *p, int str_size, int ndigits);
extern int dtoa_calcsign (char *p, int str_size);
extern bool dtoa_calcsign (char *p, int str_size);
/* maxsignicant: return a string containing max(1,ndigits)
significant digits. The return string contains the string
@ -62,8 +62,8 @@ ldtoa_strtold (const char *s, int *error)
return d;
}
char *
ldtoa_ldtoa (long double d, int mode, int ndigits, int *decpt, int *sign)
void *
ldtoa_ldtoa (long double d, int mode, int ndigits, int *decpt, bool *sign)
{
char format[50];
char *p;
@ -94,12 +94,12 @@ ldtoa_ldtoa (long double d, int mode, int ndigits, int *decpt, int *sign)
/* GNU Modula-2 hooks */
void
_M2_ldtoa_init (void)
_M2_ldtoa_init (int argc, char *argv[], char *envp[])
{
}
void
_M2_ldtoa_fini (void)
_M2_ldtoa_fini (int argc, char *argv[], char *envp[])
{
}
# ifdef __cplusplus

View File

@ -110,23 +110,35 @@ tracedb_result (int result)
#endif
}
EXTERN
int
libc_read (int fd, void *a, int nbytes)
static
void
tracedb_zresult (size_t result)
{
tracedb ("libc_read (%d, %p, %d)\n", fd, a, nbytes);
int result = read (fd, a, nbytes);
tracedb_result (result);
#if defined(BUILD_MC_LIBC_TRACE)
tracedb (" result = %zd", result);
if (result == -1)
tracedb (", errno = %s", strerror (errno));
tracedb ("\n");
#endif
}
EXTERN
size_t
libc_read (int fd, void *a, size_t nbytes)
{
tracedb ("libc_read (%d, %p, %zd)\n", fd, a, nbytes);
size_t result = read (fd, a, nbytes);
tracedb_zresult (result);
return result;
}
EXTERN
int
libc_write (int fd, void *a, int nbytes)
size_t
libc_write (int fd, void *a, size_t nbytes)
{
tracedb ("libc_write (%d, %p, %d)\n", fd, a, nbytes);
int result = write (fd, a, nbytes);
tracedb_result (result);
tracedb ("libc_write (%d, %p, %zd)\n", fd, a, nbytes);
size_t result = write (fd, a, nbytes);
tracedb_zresult (result);
return result;
}
@ -162,7 +174,7 @@ libc_abort ()
}
EXTERN
int
size_t
libc_strlen (char *s)
{
return strlen (s);
@ -184,14 +196,14 @@ libc_localtime (time_t *epochtime)
EXTERN
int
libc_printf (char *_format, unsigned int _format_high, ...)
libc_printf (const char *_format, unsigned int _format_high, ...)
{
va_list arg;
int done;
char format[_format_high + 1];
unsigned int i = 0;
unsigned int j = 0;
char *c;
const char *c;
do
{
@ -221,14 +233,14 @@ libc_printf (char *_format, unsigned int _format_high, ...)
EXTERN
int
libc_snprintf (char *dest, size_t length, char *_format, unsigned int _format_high, ...)
libc_snprintf (char *dest, size_t length, const char *_format, unsigned int _format_high, ...)
{
va_list arg;
int done;
char format[_format_high + 1];
unsigned int i = 0;
unsigned int j = 0;
char *c;
const char *c;
do
{
@ -258,7 +270,7 @@ libc_snprintf (char *dest, size_t length, char *_format, unsigned int _format_hi
EXTERN
void *
libc_malloc (unsigned int size)
libc_malloc (size_t size)
{
return malloc (size);
}
@ -300,7 +312,7 @@ libc_system (char *command)
EXTERN
void *
libc_memcpy (void *dest, void *src, int n)
libc_memcpy (void *dest, void *src, size_t n)
{
return memcpy (dest, src, n);
}

View File

@ -34,9 +34,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
typedef struct { PROC_t proc; } PROC;
# endif
#define _ASCII_H
#define _ASCII_C
#include "GASCII.h"
# define ASCII_nul (char) 000
# define ASCII_soh (char) 001
@ -78,10 +78,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
# define ASCII_del (char) 0177
# define ASCII_EOL ASCII_nl
extern "C" void _M2_ASCII_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_ASCII_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}
extern "C" void _M2_ASCII_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_ASCII_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}

View File

@ -34,9 +34,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
typedef struct { PROC_t proc; } PROC;
# endif
#define _Args_H
#define _Args_C
#include "GArgs.h"
# include "GUnixArgs.h"
# include "GASCII.h"
@ -86,13 +86,13 @@ extern "C" bool Args_GetArg (char *a, unsigned int _a_high, unsigned int n)
Source = static_cast<Args__T1> (UnixArgs_GetArgV ());
while ((j < High) && ((*(*Source).array[i]).array[j] != ASCII_nul))
{
a[j] = (*(*Source).array[i]).array[j];
const_cast<char *>(a)[j] = (*(*Source).array[i]).array[j];
j += 1;
}
}
if (j <= High)
{
a[j] = ASCII_nul;
const_cast<char *>(a)[j] = ASCII_nul;
}
return i < (UnixArgs_GetArgC ());
/* static analysis guarentees a RETURN statement will be used before here. */
@ -112,10 +112,10 @@ extern "C" unsigned int Args_Narg (void)
__builtin_unreachable ();
}
extern "C" void _M2_Args_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_Args_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}
extern "C" void _M2_Args_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_Args_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}

View File

@ -34,9 +34,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
typedef struct { PROC_t proc; } PROC;
# endif
#define _Assertion_H
#define _Assertion_C
#include "GAssertion.h"
# include "GStrIO.h"
# include "GM2RTS.h"
@ -63,10 +63,10 @@ extern "C" void Assertion_Assert (bool Condition)
}
}
extern "C" void _M2_Assertion_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_Assertion_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}
extern "C" void _M2_Assertion_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_Assertion_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}

View File

@ -34,15 +34,15 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
typedef struct { PROC_t proc; } PROC;
# endif
#define _Break_H
#define _Break_C
#include "GBreak.h"
extern "C" void _M2_Break_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_Break_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}
extern "C" void _M2_Break_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_Break_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}

View File

@ -34,9 +34,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
typedef struct { PROC_t proc; } PROC;
# endif
#define _CmdArgs_H
#define _CmdArgs_C
#include "GCmdArgs.h"
# include "GASCII.h"
# include "GStrLib.h"
@ -149,7 +149,7 @@ static bool GetNextArg (const char *CmdLine_, unsigned int _CmdLine_high, unsign
}
if (ArgIndex < HighA)
{
Arg[ArgIndex] = ASCII_nul;
const_cast<char *>(Arg)[ArgIndex] = ASCII_nul;
}
return (*CmdIndex) < HighC;
/* static analysis guarentees a RETURN statement will be used before here. */
@ -216,7 +216,7 @@ static void CopyChar (const char *From_, unsigned int _From_high, unsigned int *
if ((*FromIndex) < FromHigh)
{
/* Copy Normal Character */
To[(*ToIndex)] = From[(*FromIndex)];
const_cast<char *>(To)[(*ToIndex)] = From[(*FromIndex)];
(*ToIndex) += 1;
(*FromIndex) += 1;
}
@ -314,10 +314,10 @@ extern "C" unsigned int CmdArgs_Narg (const char *CmdLine_, unsigned int _CmdLin
__builtin_unreachable ();
}
extern "C" void _M2_CmdArgs_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_CmdArgs_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}
extern "C" void _M2_CmdArgs_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_CmdArgs_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}

View File

@ -34,9 +34,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
typedef struct { PROC_t proc; } PROC;
# endif
#define _Debug_H
#define _Debug_C
#include "GDebug.h"
# include "GASCII.h"
# include "GNumberIO.h"
# include "GStdIO.h"
@ -165,10 +165,10 @@ extern "C" void Debug_DebugString (const char *a_, unsigned int _a_high)
}
}
extern "C" void _M2_Debug_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_Debug_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}
extern "C" void _M2_Debug_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_Debug_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}

File diff suppressed because it is too large Load Diff

View File

@ -38,9 +38,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
# undef NULL
# define NULL 0
#endif
#define _Environment_H
#define _Environment_C
#include "GEnvironment.h"
# include "GSYSTEM.h"
# include "Glibc.h"
# include "GASCII.h"
@ -86,16 +86,16 @@ extern "C" bool Environment_GetEnvironment (const char *Env_, unsigned int _Env_
i = 0;
High = _dest_high;
Addr = static_cast<GetEnvironment__T1> (libc_getenv (&Env));
Addr = static_cast<GetEnvironment__T1> (libc_getenv (const_cast<void*> (static_cast<const void*>(Env))));
while (((i < High) && (Addr != NULL)) && ((*Addr) != ASCII_nul))
{
dest[i] = (*Addr);
const_cast<char *>(dest)[i] = (*Addr);
Addr += 1;
i += 1;
}
if (i < High)
{
dest[i] = ASCII_nul;
const_cast<char *>(dest)[i] = ASCII_nul;
}
return Addr != NULL;
/* static analysis guarentees a RETURN statement will be used before here. */
@ -116,15 +116,15 @@ extern "C" bool Environment_PutEnvironment (const char *EnvDef_, unsigned int _E
/* make a local copy of each unbounded array. */
memcpy (EnvDef, EnvDef_, _EnvDef_high+1);
return (libc_putenv (&EnvDef)) == 0;
return (libc_putenv (const_cast<void*> (static_cast<const void*>(EnvDef)))) == 0;
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
extern "C" void _M2_Environment_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_Environment_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}
extern "C" void _M2_Environment_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_Environment_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}

View File

@ -48,9 +48,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
# undef NULL
# define NULL 0
#endif
#define _FIO_H
#define _FIO_C
#include "GFIO.h"
# include "GSYSTEM.h"
# include "GASCII.h"
# include "GStrLib.h"
@ -63,9 +63,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
typedef unsigned int FIO_File;
FIO_File FIO_StdErr;
FIO_File FIO_StdOut;
FIO_File FIO_StdIn;
# define MaxBufferLength (1024*16)
# define MaxErrorString (1024*8)
# define CreatePermissions 0666
@ -88,7 +85,7 @@ typedef enum {FIO_successful, FIO_outofmemory, FIO_toomanyfilesopen, FIO_failed,
typedef enum {FIO_unused, FIO_openedforread, FIO_openedforwrite, FIO_openedforrandom} FIO_FileUsage;
struct FIO_NameInfo_r {
void *address;
void * address;
unsigned int size;
};
@ -96,11 +93,11 @@ struct FIO_buf_r {
bool valid;
long int bufstart;
unsigned int position;
void *address;
void * address;
unsigned int filled;
unsigned int size;
unsigned int left;
FIO__T7 *contents;
FIO__T7 * contents;
};
struct FIO__T7_a { char array[MaxBufferLength+1]; };
@ -639,7 +636,7 @@ static FIO_File InitializeFile (FIO_File f, void * fname, unsigned int flength,
{
fd->buffer->left = 0;
}
fd->buffer->contents = reinterpret_cast<FIO__T7 *> (fd->buffer->address); /* provides easy access for reading characters */
fd->buffer->contents = static_cast<FIO__T7 *> (fd->buffer->address); /* provides easy access for reading characters */
fd->state = fstate; /* provides easy access for reading characters */
}
}
@ -913,7 +910,7 @@ static void HandleEscape (char *dest, unsigned int _dest_high, const char *src_,
if (src[(*i)+1] == 'n')
{
/* requires a newline */
dest[(*j)] = ASCII_nl;
const_cast<char *>(dest)[(*j)] = ASCII_nl;
(*j) += 1;
(*i) += 2;
}
@ -921,7 +918,7 @@ static void HandleEscape (char *dest, unsigned int _dest_high, const char *src_,
{
/* avoid dangling else. */
/* requires a tab (yuck) tempted to fake this but I better not.. */
dest[(*j)] = ASCII_tab;
const_cast<char *>(dest)[(*j)] = ASCII_tab;
(*j) += 1;
(*i) += 2;
}
@ -930,7 +927,7 @@ static void HandleEscape (char *dest, unsigned int _dest_high, const char *src_,
/* avoid dangling else. */
/* copy escaped character */
(*i) += 1;
dest[(*j)] = src[(*i)];
const_cast<char *>(dest)[(*j)] = src[(*i)];
(*j) += 1;
(*i) += 1;
}
@ -954,7 +951,7 @@ static void Cast (unsigned char *a, unsigned int _a_high, const unsigned char *b
{
for (i=0; i<=_a_high; i++)
{
a[i] = b[i];
const_cast<unsigned char *>(a)[i] = b[i];
}
}
else
@ -1004,7 +1001,7 @@ static void StringFormat1 (char *dest, unsigned int _dest_high, const char *src_
}
else
{
dest[j] = src[i];
const_cast<char *>(dest)[j] = src[i];
i += 1;
j += 1;
}
@ -1017,13 +1014,13 @@ static void StringFormat1 (char *dest, unsigned int _dest_high, const char *src_
Cast ((unsigned char *) &p, (sizeof (p)-1), (const unsigned char *) w, _w_high);
while ((j < HighDest) && ((*p) != ASCII_nul))
{
dest[j] = (*p);
const_cast<char *>(dest)[j] = (*p);
j += 1;
p += 1;
}
if (j < HighDest)
{
dest[j] = ASCII_nul;
const_cast<char *>(dest)[j] = ASCII_nul;
}
j = StrLib_StrLen ((const char *) dest, _dest_high);
i += 2;
@ -1031,7 +1028,7 @@ static void StringFormat1 (char *dest, unsigned int _dest_high, const char *src_
else if (src[i+1] == 'd')
{
/* avoid dangling else. */
dest[j] = ASCII_nul;
const_cast<char *>(dest)[j] = ASCII_nul;
Cast ((unsigned char *) &c, (sizeof (c)-1), (const unsigned char *) w, _w_high);
NumberIO_CardToStr (c, 0, (char *) &str.array[0], MaxErrorString);
StrLib_StrConCat ((const char *) dest, _dest_high, (const char *) &str.array[0], MaxErrorString, (char *) dest, _dest_high);
@ -1041,7 +1038,7 @@ static void StringFormat1 (char *dest, unsigned int _dest_high, const char *src_
else
{
/* avoid dangling else. */
dest[j] = src[i];
const_cast<char *>(dest)[j] = src[i];
i += 1;
j += 1;
}
@ -1055,14 +1052,14 @@ static void StringFormat1 (char *dest, unsigned int _dest_high, const char *src_
}
else
{
dest[j] = src[i];
const_cast<char *>(dest)[j] = src[i];
i += 1;
j += 1;
}
}
if (j < HighDest)
{
dest[j] = ASCII_nul;
const_cast<char *>(dest)[j] = ASCII_nul;
}
}
@ -1312,7 +1309,7 @@ static void PreInitialize (FIO_File f, const char *fname_, unsigned int _fname_h
/* make a local copy of each unbounded array. */
memcpy (fname, fname_, _fname_high+1);
if ((InitializeFile (f, &fname, StrLib_StrLen ((const char *) fname, _fname_high), state, use, towrite, bufsize)) == f)
if ((InitializeFile (f, const_cast<void*> (static_cast<const void*>(fname)), StrLib_StrLen ((const char *) fname, _fname_high), state, use, towrite, bufsize)) == f)
{
fd = static_cast<FIO_FileDescriptor> (Indexing_GetIndice (FileInfo, f));
if (f == Error)
@ -1414,7 +1411,7 @@ extern "C" bool FIO_Exists (const char *fname_, unsigned int _fname_high)
/*
The following functions are wrappers for the above.
*/
return FIO_exists (&fname, StrLib_StrLen ((const char *) fname, _fname_high));
return FIO_exists (const_cast<void*> (static_cast<const void*>(fname)), StrLib_StrLen ((const char *) fname, _fname_high));
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
@ -1426,7 +1423,7 @@ extern "C" FIO_File FIO_OpenToRead (const char *fname_, unsigned int _fname_high
/* make a local copy of each unbounded array. */
memcpy (fname, fname_, _fname_high+1);
return FIO_openToRead (&fname, StrLib_StrLen ((const char *) fname, _fname_high));
return FIO_openToRead (const_cast<void*> (static_cast<const void*>(fname)), StrLib_StrLen ((const char *) fname, _fname_high));
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
@ -1438,7 +1435,7 @@ extern "C" FIO_File FIO_OpenToWrite (const char *fname_, unsigned int _fname_hig
/* make a local copy of each unbounded array. */
memcpy (fname, fname_, _fname_high+1);
return FIO_openToWrite (&fname, StrLib_StrLen ((const char *) fname, _fname_high));
return FIO_openToWrite (const_cast<void*> (static_cast<const void*>(fname)), StrLib_StrLen ((const char *) fname, _fname_high));
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
@ -1450,7 +1447,7 @@ extern "C" FIO_File FIO_OpenForRandom (const char *fname_, unsigned int _fname_h
/* make a local copy of each unbounded array. */
memcpy (fname, fname_, _fname_high+1);
return FIO_openForRandom (&fname, StrLib_StrLen ((const char *) fname, _fname_high), towrite, newfile);
return FIO_openForRandom (const_cast<void*> (static_cast<const void*>(fname)), StrLib_StrLen ((const char *) fname, _fname_high), towrite, newfile);
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
@ -1966,7 +1963,7 @@ extern "C" void FIO_WriteString (FIO_File f, const char *a_, unsigned int _a_hig
memcpy (a, a_, _a_high+1);
l = StrLib_StrLen ((const char *) a, _a_high);
if ((FIO_WriteNBytes (f, l, &a)) != l)
if ((FIO_WriteNBytes (f, l, const_cast<void*> (static_cast<const void*>(a)))) != l)
{} /* empty. */
}
@ -1993,12 +1990,12 @@ extern "C" void FIO_ReadString (FIO_File f, char *a, unsigned int _a_high)
/* avoid gcc warning by using compound statement even if not strictly necessary. */
if (((ch == ASCII_nl) || (! (FIO_IsNoError (f)))) || (FIO_EOF (f)))
{
a[i] = ASCII_nul;
const_cast<char *>(a)[i] = ASCII_nul;
i += 1;
}
else
{
a[i] = ch;
const_cast<char *>(a)[i] = ch;
i += 1;
}
}
@ -2222,7 +2219,7 @@ extern "C" void FIO_GetFileName (FIO_File f, char *a, unsigned int _a_high)
i = 0;
while (((*p) != ASCII_nul) && (i <= _a_high))
{
a[i] = (*p);
const_cast<char *>(a)[i] = (*p);
p += 1;
i += 1;
}
@ -2307,12 +2304,12 @@ extern "C" void FIO_FlushOutErr (void)
}
}
extern "C" void _M2_FIO_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_FIO_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
Init ();
}
extern "C" void _M2_FIO_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_FIO_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
FIO_FlushOutErr ();
}

View File

@ -46,9 +46,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
# undef NULL
# define NULL 0
#endif
#define _FormatStrings_H
#define _FormatStrings_C
#include "GFormatStrings.h"
# include "GDynamicStrings.h"
# include "GStringConvert.h"
# include "GSYSTEM.h"
@ -254,7 +254,7 @@ static void Cast (unsigned char *a, unsigned int _a_high, const unsigned char *b
{
for (i=0; i<=_a_high; i++)
{
a[i] = b[i];
const_cast<unsigned char *>(a)[i] = b[i];
}
}
else
@ -835,10 +835,10 @@ extern "C" DynamicStrings_String FormatStrings_HandleEscape (DynamicStrings_Stri
__builtin_unreachable ();
}
extern "C" void _M2_FormatStrings_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_FormatStrings_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}
extern "C" void _M2_FormatStrings_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_FormatStrings_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}

View File

@ -42,9 +42,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
# define FALSE (1==0)
# endif
#define _FpuIO_H
#define _FpuIO_C
#include "GFpuIO.h"
# include "GStrIO.h"
# include "GStrLib.h"
# include "GASCII.h"
@ -328,10 +328,10 @@ extern "C" void FpuIO_LongIntToStr (long int x, unsigned int n, char *a, unsigne
s = DynamicStrings_KillString (s);
}
extern "C" void _M2_FpuIO_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_FpuIO_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}
extern "C" void _M2_FpuIO_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_FpuIO_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}

View File

@ -42,9 +42,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
# define FALSE (1==0)
# endif
#define _IO_H
#define _IO_C
#include "GIO.h"
# include "GStrLib.h"
# include "GSYSTEM.h"
# include "Glibc.h"
@ -177,7 +177,7 @@ static void doWrite (int fd, FIO_File f, char ch)
r = static_cast<int> (libc_write (FIO_GetUnixFileDescriptor (f), &ch, static_cast<size_t> (1)));
if (r == 1)
{
return ;
return;
}
else if (r == -1)
{
@ -186,7 +186,7 @@ static void doWrite (int fd, FIO_File f, char ch)
if ((r != errno_EAGAIN) && (r != errno_EINTR))
{
fdState.array[fd].IsEof = true;
return ;
return;
}
}
}
@ -319,7 +319,7 @@ extern "C" void IO_Read (char *ch)
r = static_cast<int> (libc_read (FIO_GetUnixFileDescriptor (FIO_StdIn), ch, static_cast<size_t> (1)));
if (r == 1)
{
return ;
return;
}
else if (r == -1)
{
@ -329,7 +329,7 @@ extern "C" void IO_Read (char *ch)
{
fdState.array[0].IsEof = true;
(*ch) = ASCII_eof;
return ;
return;
}
}
}
@ -471,11 +471,11 @@ extern "C" void IO_EchoOff (int fd, bool input)
term = termios_KillTermios (term);
}
extern "C" void _M2_IO_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_IO_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
Init ();
}
extern "C" void _M2_IO_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_IO_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}

View File

@ -42,9 +42,9 @@ Boston, MA 02110-1301, USA. */
# undef NULL
# define NULL 0
#endif
#define _Indexing_H
#define _Indexing_C
#include "GIndexing.h"
# include "Glibc.h"
# include "GStorage.h"
# include "GSYSTEM.h"
@ -58,15 +58,12 @@ typedef struct Indexing__T2_r Indexing__T2;
typedef void * *Indexing_PtrToAddress;
typedef Indexing__T2 *Indexing_Index;
typedef Indexing__T2 *Indexing_Index__opaque;
typedef unsigned char *Indexing_PtrToByte;
typedef void (*Indexing_IndexProcedure_t) (void *);
struct Indexing_IndexProcedure_p { Indexing_IndexProcedure_t proc; };
struct Indexing__T2_r {
void *ArrayStart;
void * ArrayStart;
unsigned int ArraySize;
unsigned int Used;
unsigned int Low;
@ -163,7 +160,7 @@ extern "C" void Indexing_ForeachIndiceInIndexDo (Indexing_Index i, Indexing_Inde
extern "C" Indexing_Index Indexing_InitIndex (unsigned int low)
{
Indexing_Index i;
Indexing_Index__opaque i;
Storage_ALLOCATE ((void **) &i, sizeof (Indexing__T2));
i->Low = low;
@ -174,7 +171,7 @@ extern "C" Indexing_Index Indexing_InitIndex (unsigned int low)
i->Debug = false;
i->Used = 0;
i->Map = (unsigned int) 0;
return i;
return static_cast<Indexing_Index> (i);
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
@ -186,9 +183,9 @@ extern "C" Indexing_Index Indexing_InitIndex (unsigned int low)
extern "C" Indexing_Index Indexing_KillIndex (Indexing_Index i)
{
Storage_DEALLOCATE (&i->ArrayStart, i->ArraySize);
Storage_DEALLOCATE (&static_cast<Indexing_Index__opaque> (i)->ArrayStart, static_cast<Indexing_Index__opaque> (i)->ArraySize);
Storage_DEALLOCATE ((void **) &i, sizeof (Indexing__T2));
return NULL;
return static_cast<Indexing_Index> (NULL);
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
@ -200,7 +197,7 @@ extern "C" Indexing_Index Indexing_KillIndex (Indexing_Index i)
extern "C" Indexing_Index Indexing_DebugIndex (Indexing_Index i)
{
i->Debug = true;
static_cast<Indexing_Index__opaque> (i)->Debug = true;
return i;
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
@ -221,7 +218,7 @@ extern "C" bool Indexing_InBounds (Indexing_Index i, unsigned int n)
}
else
{
return (n >= i->Low) && (n <= i->High);
return (n >= static_cast<Indexing_Index__opaque> (i)->Low) && (n <= static_cast<Indexing_Index__opaque> (i)->High);
}
ReturnException ("../../gcc/m2/mc/Indexing.def", 20, 1);
__builtin_unreachable ();
@ -241,7 +238,7 @@ extern "C" unsigned int Indexing_HighIndice (Indexing_Index i)
}
else
{
return i->High;
return static_cast<Indexing_Index__opaque> (i)->High;
}
ReturnException ("../../gcc/m2/mc/Indexing.def", 20, 1);
__builtin_unreachable ();
@ -261,7 +258,7 @@ extern "C" unsigned int Indexing_LowIndice (Indexing_Index i)
}
else
{
return i->Low;
return static_cast<Indexing_Index__opaque> (i)->Low;
}
ReturnException ("../../gcc/m2/mc/Indexing.def", 20, 1);
__builtin_unreachable ();
@ -283,19 +280,19 @@ extern "C" void Indexing_PutIndice (Indexing_Index i, unsigned int n, void * a)
if (! (Indexing_InBounds (i, n)))
{
/* avoid gcc warning by using compound statement even if not strictly necessary. */
if (n < i->Low)
if (n < static_cast<Indexing_Index__opaque> (i)->Low)
{
M2RTS_HALT (-1);
__builtin_unreachable ();
}
else
{
oldSize = i->ArraySize;
while (((n-i->Low)*sizeof (void *)) >= i->ArraySize)
oldSize = static_cast<Indexing_Index__opaque> (i)->ArraySize;
while (((n-static_cast<Indexing_Index__opaque> (i)->Low)*sizeof (void *)) >= static_cast<Indexing_Index__opaque> (i)->ArraySize)
{
i->ArraySize = i->ArraySize*2;
static_cast<Indexing_Index__opaque> (i)->ArraySize = static_cast<Indexing_Index__opaque> (i)->ArraySize*2;
}
if (oldSize != i->ArraySize)
if (oldSize != static_cast<Indexing_Index__opaque> (i)->ArraySize)
{
/*
IF Debug
@ -305,25 +302,25 @@ extern "C" void Indexing_PutIndice (Indexing_Index i, unsigned int n, void * a)
oldSize, ArraySize)
END ;
*/
Storage_REALLOCATE (&i->ArrayStart, i->ArraySize);
Storage_REALLOCATE (&static_cast<Indexing_Index__opaque> (i)->ArrayStart, static_cast<Indexing_Index__opaque> (i)->ArraySize);
/* and initialize the remainder of the array to NIL */
b = i->ArrayStart;
b = static_cast<Indexing_Index__opaque> (i)->ArrayStart;
b = reinterpret_cast<void *> (reinterpret_cast<char *> (b)+oldSize);
b = libc_memset (b, 0, static_cast<size_t> (i->ArraySize-oldSize));
b = libc_memset (b, 0, static_cast<size_t> (static_cast<Indexing_Index__opaque> (i)->ArraySize-oldSize));
}
i->High = n;
static_cast<Indexing_Index__opaque> (i)->High = n;
}
}
b = i->ArrayStart;
b = reinterpret_cast<void *> (reinterpret_cast<char *> (b)+(n-i->Low)*sizeof (void *));
b = static_cast<Indexing_Index__opaque> (i)->ArrayStart;
b = reinterpret_cast<void *> (reinterpret_cast<char *> (b)+(n-static_cast<Indexing_Index__opaque> (i)->Low)*sizeof (void *));
p = static_cast<PutIndice__T1> (b);
(*p) = reinterpret_cast<unsigned int *> (a);
i->Used += 1;
if (i->Debug)
(*p) = static_cast<unsigned int *> (a);
static_cast<Indexing_Index__opaque> (i)->Used += 1;
if (static_cast<Indexing_Index__opaque> (i)->Debug)
{
if (n < 32)
{
i->Map |= (1 << (n ));
static_cast<Indexing_Index__opaque> (i)->Map |= (1 << (n ));
}
}
}
@ -343,12 +340,12 @@ extern "C" void * Indexing_GetIndice (Indexing_Index i, unsigned int n)
M2RTS_HALT (-1);
__builtin_unreachable ();
}
b = static_cast<Indexing_PtrToByte> (i->ArrayStart);
b += (n-i->Low)*sizeof (void *);
b = static_cast<Indexing_PtrToByte> (static_cast<Indexing_Index__opaque> (i)->ArrayStart);
b += (n-static_cast<Indexing_Index__opaque> (i)->Low)*sizeof (void *);
p = (Indexing_PtrToAddress) (b);
if (i->Debug)
if (static_cast<Indexing_Index__opaque> (i)->Debug)
{
if (((n < 32) && (! ((((1 << (n)) & (i->Map)) != 0)))) && ((*p) != NULL))
if (((n < 32) && (! ((((1 << (n)) & (static_cast<Indexing_Index__opaque> (i)->Map)) != 0)))) && ((*p) != NULL))
{
M2RTS_HALT (-1);
__builtin_unreachable ();
@ -370,9 +367,9 @@ extern "C" bool Indexing_IsIndiceInIndex (Indexing_Index i, void * a)
Indexing_PtrToByte b;
Indexing_PtrToAddress p;
j = i->Low;
b = static_cast<Indexing_PtrToByte> (i->ArrayStart);
while (j <= i->High)
j = static_cast<Indexing_Index__opaque> (i)->Low;
b = static_cast<Indexing_PtrToByte> (static_cast<Indexing_Index__opaque> (i)->ArrayStart);
while (j <= static_cast<Indexing_Index__opaque> (i)->High)
{
p = (Indexing_PtrToAddress) (b);
if ((*p) == a)
@ -400,9 +397,9 @@ extern "C" void Indexing_RemoveIndiceFromIndex (Indexing_Index i, void * a)
Indexing_PtrToAddress p;
Indexing_PtrToByte b;
j = i->Low;
b = static_cast<Indexing_PtrToByte> (i->ArrayStart);
while (j <= i->High)
j = static_cast<Indexing_Index__opaque> (i)->Low;
b = static_cast<Indexing_PtrToByte> (static_cast<Indexing_Index__opaque> (i)->ArrayStart);
while (j <= static_cast<Indexing_Index__opaque> (i)->High)
{
p = (Indexing_PtrToAddress) (b);
b += sizeof (void *);
@ -426,13 +423,13 @@ extern "C" void Indexing_DeleteIndice (Indexing_Index i, unsigned int j)
if (Indexing_InBounds (i, j))
{
b = static_cast<Indexing_PtrToByte> (i->ArrayStart);
b += sizeof (void *)*(j-i->Low);
b = static_cast<Indexing_PtrToByte> (static_cast<Indexing_Index__opaque> (i)->ArrayStart);
b += sizeof (void *)*(j-static_cast<Indexing_Index__opaque> (i)->Low);
p = (Indexing_PtrToAddress) (b);
b += sizeof (void *);
p = static_cast<Indexing_PtrToAddress> (libc_memmove (reinterpret_cast<void *> (p), reinterpret_cast<void *> (b), static_cast<size_t> ((i->High-j)*sizeof (void *))));
i->High -= 1;
i->Used -= 1;
p = static_cast<Indexing_PtrToAddress> (libc_memmove (reinterpret_cast<void *> (p), reinterpret_cast<void *> (b), static_cast<size_t> ((static_cast<Indexing_Index__opaque> (i)->High-j)*sizeof (void *))));
static_cast<Indexing_Index__opaque> (i)->High -= 1;
static_cast<Indexing_Index__opaque> (i)->Used -= 1;
}
else
{
@ -452,7 +449,7 @@ extern "C" void Indexing_IncludeIndiceIntoIndex (Indexing_Index i, void * a)
if (! (Indexing_IsIndiceInIndex (i, a)))
{
/* avoid gcc warning by using compound statement even if not strictly necessary. */
if (i->Used == 0)
if (static_cast<Indexing_Index__opaque> (i)->Used == 0)
{
Indexing_PutIndice (i, Indexing_LowIndice (i), a);
}
@ -483,10 +480,10 @@ extern "C" void Indexing_ForeachIndiceInIndexDo (Indexing_Index i, Indexing_Inde
}
}
extern "C" void _M2_Indexing_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_Indexing_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}
extern "C" void _M2_Indexing_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_Indexing_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}

View File

@ -47,9 +47,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
# undef NULL
# define NULL 0
#endif
#define _M2Dependent_H
#define _M2Dependent_C
#include "GM2Dependent.h"
# include "Glibc.h"
# include "GASCII.h"
# include "GSYSTEM.h"
@ -76,9 +76,6 @@ typedef struct M2Dependent__T4_a M2Dependent__T4;
typedef enum {M2Dependent_unregistered, M2Dependent_unordered, M2Dependent_started, M2Dependent_ordered, M2Dependent_user} M2Dependent_DependencyState;
typedef void (*M2Dependent_ArgCVEnvP_t) (int, void *, void *);
struct M2Dependent_ArgCVEnvP_p { M2Dependent_ArgCVEnvP_t proc; };
struct M2Dependent_DependencyList_r {
PROC proc;
bool forced;
@ -100,8 +97,8 @@ struct M2Dependent__T3_r {
struct M2Dependent__T4_a { M2Dependent_ModuleChain array[M2Dependent_user-M2Dependent_unregistered+1]; };
struct M2Dependent__T2_r {
void *name;
void *libname;
void * name;
void * libname;
M2Dependent_ArgCVEnvP init;
M2Dependent_ArgCVEnvP fini;
M2Dependent_DependencyList dependency;
@ -638,11 +635,11 @@ static void toCString (char *str, unsigned int _str_high)
{
if (str[i+1] == 'n')
{
str[i] = ASCII_nl;
const_cast<char *>(str)[i] = ASCII_nl;
j = i+1;
while (j < high)
{
str[j] = str[j+1];
const_cast<char *>(str)[j] = str[j+1];
j += 1;
}
}
@ -962,7 +959,7 @@ static void DisplayModuleInfo (M2Dependent_DependencyState state, const char *de
if (Modules.array[state-M2Dependent_unregistered] != NULL)
{
libc_printf ((const char *) "%s modules\\n", 12, &desc);
libc_printf ((const char *) "%s modules\\n", 12, const_cast<void*> (static_cast<const void*>(desc)));
mptr = Modules.array[state-M2Dependent_unregistered];
count = 0;
do {
@ -1211,7 +1208,7 @@ static bool equal (void * cstr, const char *str_, unsigned int _str_high)
/* make a local copy of each unbounded array. */
memcpy (str, str_, _str_high+1);
return (strncmp (reinterpret_cast<M2Dependent_PtrToChar> (cstr), reinterpret_cast<M2Dependent_PtrToChar> (&str), StrLib_StrLen ((const char *) str, _str_high))) == 0;
return (strncmp (reinterpret_cast<M2Dependent_PtrToChar> (cstr), reinterpret_cast<M2Dependent_PtrToChar> (const_cast<void*> (static_cast<const void*>(str))), StrLib_StrLen ((const char *) str, _str_high))) == 0;
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
@ -1249,7 +1246,7 @@ static void SetupDebugFlags (void)
ForceTrace = false;
HexTrace = false;
WarningTrace = false;
pc = static_cast<SetupDebugFlags__T1> (libc_getenv (const_cast<void*> (reinterpret_cast<const void*>("GCC_M2LINK_RTFLAG"))));
pc = static_cast<SetupDebugFlags__T1> (libc_getenv (const_cast<void*> (static_cast<const void*>("GCC_M2LINK_RTFLAG"))));
while ((pc != NULL) && ((*pc) != ASCII_nul))
{
if (equal (reinterpret_cast<void *> (pc), (const char *) "all", 3))
@ -1586,11 +1583,11 @@ extern "C" void M2Dependent_ExecuteTerminationProcedures (void)
ExecuteReverse (TerminateProc.tail);
}
extern "C" void _M2_M2Dependent_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_M2Dependent_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
CheckInitialized ();
}
extern "C" void _M2_M2Dependent_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_M2Dependent_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}

View File

@ -35,14 +35,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
# endif
# include "Gmcrts.h"
#define _M2EXCEPTION_H
#define _M2EXCEPTION_C
#include "GM2EXCEPTION.h"
# include "GSYSTEM.h"
# include "GRTExceptions.h"
typedef enum {M2EXCEPTION_indexException, M2EXCEPTION_rangeException, M2EXCEPTION_caseSelectException, M2EXCEPTION_invalidLocation, M2EXCEPTION_functionException, M2EXCEPTION_wholeValueException, M2EXCEPTION_wholeDivException, M2EXCEPTION_realValueException, M2EXCEPTION_realDivException, M2EXCEPTION_complexValueException, M2EXCEPTION_complexDivException, M2EXCEPTION_protException, M2EXCEPTION_sysException, M2EXCEPTION_coException, M2EXCEPTION_exException} M2EXCEPTION_M2Exceptions;
extern "C" M2EXCEPTION_M2Exceptions M2EXCEPTION_M2Exception (void);
extern "C" bool M2EXCEPTION_IsM2Exception (void);
@ -58,7 +56,7 @@ extern "C" M2EXCEPTION_M2Exceptions M2EXCEPTION_M2Exception (void)
n = RTExceptions_GetNumber (e);
if (n == (UINT_MAX))
{
RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_exException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc/m2/gm2-libs/M2EXCEPTION.mod")), 47, 6, const_cast<void*> (reinterpret_cast<const void*>("M2Exception")), const_cast<void*> (reinterpret_cast<const void*>("current coroutine is not in the exceptional execution state")));
RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_exException)), const_cast<void*> (static_cast<const void*>("../../gcc/m2/gm2-libs/M2EXCEPTION.mod")), 47, 6, const_cast<void*> (static_cast<const void*>("M2Exception")), const_cast<void*> (static_cast<const void*>("current coroutine is not in the exceptional execution state")));
}
else
{
@ -80,11 +78,11 @@ extern "C" bool M2EXCEPTION_IsM2Exception (void)
__builtin_unreachable ();
}
extern "C" void _M2_M2EXCEPTION_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_M2EXCEPTION_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
RTExceptions_SetExceptionBlock (RTExceptions_InitExceptionBlock ());
}
extern "C" void _M2_M2EXCEPTION_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_M2EXCEPTION_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}

View File

@ -42,9 +42,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
# define FALSE (1==0)
# endif
#define _M2RTS_H
#define _M2RTS_C
#include "GM2RTS.h"
# include "Glibc.h"
# include "GNumberIO.h"
# include "GStrLib.h"
@ -60,9 +60,6 @@ typedef struct M2RTS_ArgCVEnvP_p M2RTS_ArgCVEnvP;
# define stderrFd 2
typedef char *M2RTS_PtrToChar;
typedef void (*M2RTS_ArgCVEnvP_t) (int, void *, void *);
struct M2RTS_ArgCVEnvP_p { M2RTS_ArgCVEnvP_t proc; };
static int ExitValue;
static bool isHalting;
static bool CallExit;
@ -257,7 +254,7 @@ static void ErrorString (const char *a_, unsigned int _a_high)
/* make a local copy of each unbounded array. */
memcpy (a, a_, _a_high+1);
n = static_cast<int> (libc_write (stderrFd, &a, static_cast<size_t> (StrLib_StrLen ((const char *) a, _a_high))));
n = static_cast<int> (libc_write (stderrFd, const_cast<void*> (static_cast<const void*>(a)), static_cast<size_t> (StrLib_StrLen ((const char *) a, _a_high))));
}
@ -712,11 +709,11 @@ extern "C" void M2RTS_NoException (void * filename, unsigned int line, unsigned
RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_exException)), filename, line, column, scope, message);
}
extern "C" void _M2_M2RTS_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_M2RTS_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
CheckInitialized ();
}
extern "C" void _M2_M2RTS_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_M2RTS_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}

View File

@ -34,9 +34,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
typedef struct { PROC_t proc; } PROC;
# endif
#define _MemUtils_H
#define _MemUtils_C
#include "GMemUtils.h"
# include "GSYSTEM.h"
@ -118,10 +118,10 @@ extern "C" void MemUtils_MemZero (void * a, unsigned int length)
}
}
extern "C" void _M2_MemUtils_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_MemUtils_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}
extern "C" void _M2_MemUtils_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_MemUtils_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}

View File

@ -42,9 +42,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
# define FALSE (1==0)
# endif
#define _NumberIO_H
#define _NumberIO_C
#include "GNumberIO.h"
# include "GASCII.h"
# include "GStrIO.h"
# include "GStrLib.h"
@ -172,19 +172,19 @@ extern "C" void NumberIO_CardToStr (unsigned int x, unsigned int n, char *a, uns
Higha = _a_high;
while ((n > i) && (j <= Higha))
{
a[j] = ' ';
const_cast<char *>(a)[j] = ' ';
j += 1;
n -= 1;
}
while ((i > 0) && (j <= Higha))
{
a[j] = ((char) (buf.array[i-1]+ ((unsigned int) ('0'))));
const_cast<char *>(a)[j] = ((char) (buf.array[i-1]+ ((unsigned int) ('0'))));
j += 1;
i -= 1;
}
if (j <= Higha)
{
a[j] = ASCII_nul;
const_cast<char *>(a)[j] = ASCII_nul;
}
}
@ -270,7 +270,7 @@ extern "C" void NumberIO_HexToStr (unsigned int x, unsigned int n, char *a, unsi
Higha = _a_high;
while ((n > i) && (j <= Higha))
{
a[j] = '0';
const_cast<char *>(a)[j] = '0';
j += 1;
n -= 1;
}
@ -278,18 +278,18 @@ extern "C" void NumberIO_HexToStr (unsigned int x, unsigned int n, char *a, unsi
{
if (buf.array[i-1] < 10)
{
a[j] = ((char) (buf.array[i-1]+ ((unsigned int) ('0'))));
const_cast<char *>(a)[j] = ((char) (buf.array[i-1]+ ((unsigned int) ('0'))));
}
else
{
a[j] = ((char) ((buf.array[i-1]+ ((unsigned int) ('A')))-10));
const_cast<char *>(a)[j] = ((char) ((buf.array[i-1]+ ((unsigned int) ('A')))-10));
}
j += 1;
i -= 1;
}
if (j <= Higha)
{
a[j] = ASCII_nul;
const_cast<char *>(a)[j] = ASCII_nul;
}
}
@ -349,24 +349,24 @@ extern "C" void NumberIO_IntToStr (int x, unsigned int n, char *a, unsigned int
Higha = _a_high;
while ((n > i) && (j <= Higha))
{
a[j] = ' ';
const_cast<char *>(a)[j] = ' ';
j += 1;
n -= 1;
}
if (Negative)
{
a[j] = '-';
const_cast<char *>(a)[j] = '-';
j += 1;
}
while ((i != 0) && (j <= Higha))
{
a[j] = ((char) (buf.array[i-1]+ ((unsigned int) ('0'))));
const_cast<char *>(a)[j] = ((char) (buf.array[i-1]+ ((unsigned int) ('0'))));
j += 1;
i -= 1;
}
if (j <= Higha)
{
a[j] = ASCII_nul;
const_cast<char *>(a)[j] = ASCII_nul;
}
}
@ -490,19 +490,19 @@ extern "C" void NumberIO_OctToStr (unsigned int x, unsigned int n, char *a, unsi
Higha = _a_high;
while ((n > i) && (j <= Higha))
{
a[j] = ' ';
const_cast<char *>(a)[j] = ' ';
j += 1;
n -= 1;
}
while ((i > 0) && (j <= Higha))
{
a[j] = ((char) (buf.array[i-1]+ ((unsigned int) ('0'))));
const_cast<char *>(a)[j] = ((char) (buf.array[i-1]+ ((unsigned int) ('0'))));
j += 1;
i -= 1;
}
if (j <= Higha)
{
a[j] = ASCII_nul;
const_cast<char *>(a)[j] = ASCII_nul;
}
}
@ -567,19 +567,19 @@ extern "C" void NumberIO_BinToStr (unsigned int x, unsigned int n, char *a, unsi
Higha = _a_high;
while ((n > i) && (j <= Higha))
{
a[j] = ' ';
const_cast<char *>(a)[j] = ' ';
j += 1;
n -= 1;
}
while ((i > 0) && (j <= Higha))
{
a[j] = ((char) (buf.array[i-1]+ ((unsigned int) ('0'))));
const_cast<char *>(a)[j] = ((char) (buf.array[i-1]+ ((unsigned int) ('0'))));
j += 1;
i -= 1;
}
if (j <= Higha)
{
a[j] = ASCII_nul;
const_cast<char *>(a)[j] = ASCII_nul;
}
}
@ -768,10 +768,10 @@ extern "C" void NumberIO_StrToOctInt (const char *a_, unsigned int _a_high, int
}
}
extern "C" void _M2_NumberIO_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_NumberIO_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}
extern "C" void _M2_NumberIO_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_NumberIO_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}

View File

@ -42,9 +42,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
# undef NULL
# define NULL 0
#endif
#define _PushBackInput_H
#define _PushBackInput_C
#include "GPushBackInput.h"
# include "GFIO.h"
# include "GDynamicStrings.h"
# include "GASCII.h"
@ -478,12 +478,12 @@ extern "C" unsigned int PushBackInput_GetCurrentLine (void)
__builtin_unreachable ();
}
extern "C" void _M2_PushBackInput_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_PushBackInput_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
PushBackInput_SetDebug (false);
Init ();
}
extern "C" void _M2_PushBackInput_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_PushBackInput_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}

View File

@ -47,9 +47,9 @@ extern void throw (unsigned int);
# undef NULL
# define NULL 0
#endif
#define _RTExceptions_H
#define _RTExceptions_C
#include "GRTExceptions.h"
# include "GASCII.h"
# include "GStrLib.h"
# include "GStorage.h"
@ -72,17 +72,14 @@ typedef struct RTExceptions__T3_r RTExceptions__T3;
typedef RTExceptions__T3 *RTExceptions_Handler;
typedef RTExceptions__T1 *RTExceptions_EHBlock;
typedef void (*RTExceptions_ProcedureHandler_t) (void);
struct RTExceptions_ProcedureHandler_p { RTExceptions_ProcedureHandler_t proc; };
typedef RTExceptions__T1 *RTExceptions_EHBlock__opaque;
struct RTExceptions__T2_a { char array[MaxBuffer+1]; };
struct RTExceptions__T1_r {
RTExceptions__T2 buffer;
unsigned int number;
RTExceptions_Handler handlers;
RTExceptions_EHBlock right;
RTExceptions_EHBlock__opaque right;
};
struct RTExceptions__T3_r {
@ -95,8 +92,8 @@ struct RTExceptions__T3_r {
static bool inException;
static RTExceptions_Handler freeHandler;
static RTExceptions_EHBlock freeEHB;
static RTExceptions_EHBlock currentEHB;
static RTExceptions_EHBlock__opaque freeEHB;
static RTExceptions_EHBlock__opaque currentEHB;
static void * currentSource;
/*
@ -233,7 +230,7 @@ static void ErrorString (const char *a_, unsigned int _a_high);
findHandler -
*/
static RTExceptions_Handler findHandler (RTExceptions_EHBlock e, unsigned int number);
static RTExceptions_Handler findHandler (RTExceptions_EHBlock__opaque e, unsigned int number);
/*
InvokeHandler - invokes the associated handler for the current
@ -286,7 +283,7 @@ static void addNum (unsigned int n, unsigned int *i);
New - returns a new EHBlock.
*/
static RTExceptions_EHBlock New (void);
static RTExceptions_EHBlock__opaque New (void);
/*
NewHandler - returns a new handler.
@ -322,7 +319,7 @@ static void SubHandler (RTExceptions_Handler h);
AddHandler - add, e, to the end of the list of handlers.
*/
static void AddHandler (RTExceptions_EHBlock e, RTExceptions_Handler h);
static void AddHandler (RTExceptions_EHBlock__opaque e, RTExceptions_Handler h);
/*
indexf - raise an index out of bounds exception.
@ -439,7 +436,7 @@ static void ErrorString (const char *a_, unsigned int _a_high)
/* make a local copy of each unbounded array. */
memcpy (a, a_, _a_high+1);
n = static_cast<int> (libc_write (2, &a, static_cast<size_t> (StrLib_StrLen ((const char *) a, _a_high))));
n = static_cast<int> (libc_write (2, const_cast<void*> (static_cast<const void*>(a)), static_cast<size_t> (StrLib_StrLen ((const char *) a, _a_high))));
}
@ -447,7 +444,7 @@ static void ErrorString (const char *a_, unsigned int _a_high)
findHandler -
*/
static RTExceptions_Handler findHandler (RTExceptions_EHBlock e, unsigned int number)
static RTExceptions_Handler findHandler (RTExceptions_EHBlock__opaque e, unsigned int number)
{
RTExceptions_Handler h;
@ -540,7 +537,7 @@ static void * stripPath (void * s)
p += 1;
}
}
return reinterpret_cast<void *> (f);
return static_cast<void *> (f);
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
@ -605,9 +602,9 @@ static void addNum (unsigned int n, unsigned int *i)
New - returns a new EHBlock.
*/
static RTExceptions_EHBlock New (void)
static RTExceptions_EHBlock__opaque New (void)
{
RTExceptions_EHBlock e;
RTExceptions_EHBlock__opaque e;
if (freeEHB == NULL)
{
@ -707,7 +704,7 @@ static void SubHandler (RTExceptions_Handler h)
AddHandler - add, e, to the end of the list of handlers.
*/
static void AddHandler (RTExceptions_EHBlock e, RTExceptions_Handler h)
static void AddHandler (RTExceptions_EHBlock__opaque e, RTExceptions_Handler h)
{
h->right = e->handlers;
h->left = e->handlers->left;
@ -722,7 +719,7 @@ static void AddHandler (RTExceptions_EHBlock e, RTExceptions_Handler h)
static void indexf (void * a)
{
RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_indexException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 614, 9, const_cast<void*> (reinterpret_cast<const void*>("indexf")), const_cast<void*> (reinterpret_cast<const void*>("array index out of bounds")));
RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_indexException)), const_cast<void*> (static_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 614, 9, const_cast<void*> (static_cast<const void*>("indexf")), const_cast<void*> (static_cast<const void*>("array index out of bounds")));
}
@ -732,7 +729,7 @@ static void indexf (void * a)
static void range (void * a)
{
RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_rangeException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 626, 9, const_cast<void*> (reinterpret_cast<const void*>("range")), const_cast<void*> (reinterpret_cast<const void*>("assignment out of range")));
RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_rangeException)), const_cast<void*> (static_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 626, 9, const_cast<void*> (static_cast<const void*>("range")), const_cast<void*> (static_cast<const void*>("assignment out of range")));
}
@ -742,7 +739,7 @@ static void range (void * a)
static void casef (void * a)
{
RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_caseSelectException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 638, 9, const_cast<void*> (reinterpret_cast<const void*>("casef")), const_cast<void*> (reinterpret_cast<const void*>("case selector out of range")));
RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_caseSelectException)), const_cast<void*> (static_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 638, 9, const_cast<void*> (static_cast<const void*>("casef")), const_cast<void*> (static_cast<const void*>("case selector out of range")));
}
@ -752,7 +749,7 @@ static void casef (void * a)
static void invalidloc (void * a)
{
RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_invalidLocation)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 650, 9, const_cast<void*> (reinterpret_cast<const void*>("invalidloc")), const_cast<void*> (reinterpret_cast<const void*>("invalid address referenced")));
RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_invalidLocation)), const_cast<void*> (static_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 650, 9, const_cast<void*> (static_cast<const void*>("invalidloc")), const_cast<void*> (static_cast<const void*>("invalid address referenced")));
}
@ -762,7 +759,7 @@ static void invalidloc (void * a)
static void function (void * a)
{
RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_functionException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 662, 9, const_cast<void*> (reinterpret_cast<const void*>("function")), const_cast<void*> (reinterpret_cast<const void*>("... function ... "))); /* --fixme-- what has happened ? */
RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_functionException)), const_cast<void*> (static_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 662, 9, const_cast<void*> (static_cast<const void*>("function")), const_cast<void*> (static_cast<const void*>("... function ... "))); /* --fixme-- what has happened ? */
}
@ -772,7 +769,7 @@ static void function (void * a)
static void wholevalue (void * a)
{
RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_wholeValueException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 674, 9, const_cast<void*> (reinterpret_cast<const void*>("wholevalue")), const_cast<void*> (reinterpret_cast<const void*>("illegal whole value exception")));
RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_wholeValueException)), const_cast<void*> (static_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 674, 9, const_cast<void*> (static_cast<const void*>("wholevalue")), const_cast<void*> (static_cast<const void*>("illegal whole value exception")));
}
@ -782,7 +779,7 @@ static void wholevalue (void * a)
static void wholediv (void * a)
{
RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_wholeDivException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 686, 9, const_cast<void*> (reinterpret_cast<const void*>("wholediv")), const_cast<void*> (reinterpret_cast<const void*>("illegal whole value exception")));
RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_wholeDivException)), const_cast<void*> (static_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 686, 9, const_cast<void*> (static_cast<const void*>("wholediv")), const_cast<void*> (static_cast<const void*>("illegal whole value exception")));
}
@ -792,7 +789,7 @@ static void wholediv (void * a)
static void realvalue (void * a)
{
RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_realValueException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 698, 9, const_cast<void*> (reinterpret_cast<const void*>("realvalue")), const_cast<void*> (reinterpret_cast<const void*>("illegal real value exception")));
RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_realValueException)), const_cast<void*> (static_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 698, 9, const_cast<void*> (static_cast<const void*>("realvalue")), const_cast<void*> (static_cast<const void*>("illegal real value exception")));
}
@ -802,7 +799,7 @@ static void realvalue (void * a)
static void realdiv (void * a)
{
RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_realDivException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 710, 9, const_cast<void*> (reinterpret_cast<const void*>("realdiv")), const_cast<void*> (reinterpret_cast<const void*>("real number division by zero exception")));
RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_realDivException)), const_cast<void*> (static_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 710, 9, const_cast<void*> (static_cast<const void*>("realdiv")), const_cast<void*> (static_cast<const void*>("real number division by zero exception")));
}
@ -812,7 +809,7 @@ static void realdiv (void * a)
static void complexvalue (void * a)
{
RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_complexValueException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 722, 9, const_cast<void*> (reinterpret_cast<const void*>("complexvalue")), const_cast<void*> (reinterpret_cast<const void*>("illegal complex value exception")));
RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_complexValueException)), const_cast<void*> (static_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 722, 9, const_cast<void*> (static_cast<const void*>("complexvalue")), const_cast<void*> (static_cast<const void*>("illegal complex value exception")));
}
@ -822,7 +819,7 @@ static void complexvalue (void * a)
static void complexdiv (void * a)
{
RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_complexDivException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 734, 9, const_cast<void*> (reinterpret_cast<const void*>("complexdiv")), const_cast<void*> (reinterpret_cast<const void*>("complex number division by zero exception")));
RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_complexDivException)), const_cast<void*> (static_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 734, 9, const_cast<void*> (static_cast<const void*>("complexdiv")), const_cast<void*> (static_cast<const void*>("complex number division by zero exception")));
}
@ -832,7 +829,7 @@ static void complexdiv (void * a)
static void protection (void * a)
{
RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_protException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 746, 9, const_cast<void*> (reinterpret_cast<const void*>("protection")), const_cast<void*> (reinterpret_cast<const void*>("protection exception")));
RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_protException)), const_cast<void*> (static_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 746, 9, const_cast<void*> (static_cast<const void*>("protection")), const_cast<void*> (static_cast<const void*>("protection exception")));
}
@ -842,7 +839,7 @@ static void protection (void * a)
static void systemf (void * a)
{
RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_sysException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 758, 9, const_cast<void*> (reinterpret_cast<const void*>("systemf")), const_cast<void*> (reinterpret_cast<const void*>("system exception")));
RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_sysException)), const_cast<void*> (static_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 758, 9, const_cast<void*> (static_cast<const void*>("systemf")), const_cast<void*> (static_cast<const void*>("system exception")));
}
@ -852,7 +849,7 @@ static void systemf (void * a)
static void coroutine (void * a)
{
RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_coException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 770, 9, const_cast<void*> (reinterpret_cast<const void*>("coroutine")), const_cast<void*> (reinterpret_cast<const void*>("coroutine exception")));
RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_coException)), const_cast<void*> (static_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 770, 9, const_cast<void*> (static_cast<const void*>("coroutine")), const_cast<void*> (static_cast<const void*>("coroutine exception")));
}
@ -862,7 +859,7 @@ static void coroutine (void * a)
static void exception (void * a)
{
RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_exException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 782, 9, const_cast<void*> (reinterpret_cast<const void*>("exception")), const_cast<void*> (reinterpret_cast<const void*>("exception exception")));
RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_exException)), const_cast<void*> (static_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 782, 9, const_cast<void*> (static_cast<const void*>("exception")), const_cast<void*> (static_cast<const void*>("exception exception")));
}
@ -874,8 +871,8 @@ static void Init (void)
{
inException = false;
freeHandler = NULL;
freeEHB = NULL;
currentEHB = RTExceptions_InitExceptionBlock ();
freeEHB = static_cast<RTExceptions_EHBlock__opaque> (NULL);
currentEHB = static_cast<RTExceptions_EHBlock__opaque> (RTExceptions_InitExceptionBlock ());
currentSource = NULL;
RTExceptions_BaseExceptionsThrow ();
SysExceptions_InitExceptionHandlers ((SysExceptions_PROCEXCEPTION) {(SysExceptions_PROCEXCEPTION_t) indexf}, (SysExceptions_PROCEXCEPTION) {(SysExceptions_PROCEXCEPTION_t) range}, (SysExceptions_PROCEXCEPTION) {(SysExceptions_PROCEXCEPTION_t) casef}, (SysExceptions_PROCEXCEPTION) {(SysExceptions_PROCEXCEPTION_t) invalidloc}, (SysExceptions_PROCEXCEPTION) {(SysExceptions_PROCEXCEPTION_t) function}, (SysExceptions_PROCEXCEPTION) {(SysExceptions_PROCEXCEPTION_t) wholevalue}, (SysExceptions_PROCEXCEPTION) {(SysExceptions_PROCEXCEPTION_t) wholediv}, (SysExceptions_PROCEXCEPTION) {(SysExceptions_PROCEXCEPTION_t) realvalue}, (SysExceptions_PROCEXCEPTION) {(SysExceptions_PROCEXCEPTION_t) realdiv}, (SysExceptions_PROCEXCEPTION) {(SysExceptions_PROCEXCEPTION_t) complexvalue}, (SysExceptions_PROCEXCEPTION) {(SysExceptions_PROCEXCEPTION_t) complexdiv}, (SysExceptions_PROCEXCEPTION) {(SysExceptions_PROCEXCEPTION_t) protection}, (SysExceptions_PROCEXCEPTION) {(SysExceptions_PROCEXCEPTION_t) systemf}, (SysExceptions_PROCEXCEPTION) {(SysExceptions_PROCEXCEPTION_t) coroutine}, (SysExceptions_PROCEXCEPTION) {(SysExceptions_PROCEXCEPTION_t) exception});
@ -889,11 +886,11 @@ static void Init (void)
static void TidyUp (void)
{
RTExceptions_Handler f;
RTExceptions_EHBlock e;
RTExceptions_EHBlock__opaque e;
if (currentEHB != NULL)
{
currentEHB = RTExceptions_KillExceptionBlock (currentEHB);
currentEHB = static_cast<RTExceptions_EHBlock__opaque> (RTExceptions_KillExceptionBlock (static_cast<RTExceptions_EHBlock> (currentEHB)));
}
while (freeHandler != NULL)
{
@ -953,7 +950,7 @@ extern "C" void RTExceptions_Raise (unsigned int number, void * file, unsigned i
extern "C" void RTExceptions_SetExceptionBlock (RTExceptions_EHBlock source)
{
currentEHB = source;
currentEHB = static_cast<RTExceptions_EHBlock__opaque> (source);
}
@ -963,7 +960,7 @@ extern "C" void RTExceptions_SetExceptionBlock (RTExceptions_EHBlock source)
extern "C" RTExceptions_EHBlock RTExceptions_GetExceptionBlock (void)
{
return currentEHB;
return static_cast<RTExceptions_EHBlock> (currentEHB);
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
@ -975,7 +972,7 @@ extern "C" RTExceptions_EHBlock RTExceptions_GetExceptionBlock (void)
extern "C" void * RTExceptions_GetTextBuffer (RTExceptions_EHBlock e)
{
return &e->buffer;
return &static_cast<RTExceptions_EHBlock__opaque> (e)->buffer;
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
@ -987,7 +984,7 @@ extern "C" void * RTExceptions_GetTextBuffer (RTExceptions_EHBlock e)
extern "C" unsigned int RTExceptions_GetTextBufferSize (RTExceptions_EHBlock e)
{
return sizeof (e->buffer);
return sizeof (static_cast<RTExceptions_EHBlock__opaque> (e)->buffer);
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
@ -1000,7 +997,7 @@ extern "C" unsigned int RTExceptions_GetTextBufferSize (RTExceptions_EHBlock e)
extern "C" unsigned int RTExceptions_GetNumber (RTExceptions_EHBlock source)
{
return source->number;
return static_cast<RTExceptions_EHBlock__opaque> (source)->number;
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
@ -1012,7 +1009,7 @@ extern "C" unsigned int RTExceptions_GetNumber (RTExceptions_EHBlock source)
extern "C" RTExceptions_EHBlock RTExceptions_InitExceptionBlock (void)
{
RTExceptions_EHBlock e;
RTExceptions_EHBlock__opaque e;
e = New ();
e->number = UINT_MAX;
@ -1020,7 +1017,7 @@ extern "C" RTExceptions_EHBlock RTExceptions_InitExceptionBlock (void)
e->handlers->right = e->handlers; /* add the dummy onto the head */
e->handlers->left = e->handlers;
e->right = e;
return e;
return static_cast<RTExceptions_EHBlock> (e);
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
@ -1032,10 +1029,10 @@ extern "C" RTExceptions_EHBlock RTExceptions_InitExceptionBlock (void)
extern "C" RTExceptions_EHBlock RTExceptions_KillExceptionBlock (RTExceptions_EHBlock e)
{
e->handlers = KillHandlers (e->handlers);
e->right = freeEHB;
freeEHB = e;
return NULL;
static_cast<RTExceptions_EHBlock__opaque> (e)->handlers = KillHandlers (static_cast<RTExceptions_EHBlock__opaque> (e)->handlers);
static_cast<RTExceptions_EHBlock__opaque> (e)->right = freeEHB;
freeEHB = static_cast<RTExceptions_EHBlock__opaque> (e);
return static_cast<RTExceptions_EHBlock> (NULL);
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
@ -1050,7 +1047,7 @@ extern "C" void RTExceptions_PushHandler (RTExceptions_EHBlock e, unsigned int n
RTExceptions_Handler h;
RTExceptions_Handler i;
h = findHandler (e, number);
h = findHandler (static_cast<RTExceptions_EHBlock__opaque> (e), number);
if (h == NULL)
{
i = InitHandler (NewHandler (), NULL, NULL, NULL, number, p);
@ -1063,7 +1060,7 @@ extern "C" void RTExceptions_PushHandler (RTExceptions_EHBlock e, unsigned int n
i = InitHandler (NewHandler (), NULL, NULL, h, number, p);
}
/* add new handler */
AddHandler (e, i);
AddHandler (static_cast<RTExceptions_EHBlock__opaque> (e), i);
}
@ -1076,14 +1073,14 @@ extern "C" void RTExceptions_PopHandler (RTExceptions_EHBlock e, unsigned int nu
{
RTExceptions_Handler h;
h = findHandler (e, number);
h = findHandler (static_cast<RTExceptions_EHBlock__opaque> (e), number);
if (h != NULL)
{
/* remove, h, */
SubHandler (h);
if (h->stack != NULL)
{
AddHandler (e, h->stack);
AddHandler (static_cast<RTExceptions_EHBlock__opaque> (e), h->stack);
}
h = KillHandler (h);
}
@ -1098,11 +1095,11 @@ extern "C" void RTExceptions_PopHandler (RTExceptions_EHBlock e, unsigned int nu
extern "C" void RTExceptions_DefaultErrorCatch (void)
{
RTExceptions_EHBlock e;
RTExceptions_EHBlock__opaque e;
int n;
e = RTExceptions_GetExceptionBlock ();
n = static_cast<int> (libc_write (2, RTExceptions_GetTextBuffer (e), libc_strlen (RTExceptions_GetTextBuffer (e))));
e = static_cast<RTExceptions_EHBlock__opaque> (RTExceptions_GetExceptionBlock ());
n = static_cast<int> (libc_write (2, RTExceptions_GetTextBuffer (static_cast<RTExceptions_EHBlock> (e)), libc_strlen (RTExceptions_GetTextBuffer (static_cast<RTExceptions_EHBlock> (e)))));
M2RTS_HALT (-1);
__builtin_unreachable ();
}
@ -1184,7 +1181,7 @@ extern "C" RTExceptions_EHBlock RTExceptions_GetBaseExceptionBlock (void)
}
else
{
return currentEHB;
return static_cast<RTExceptions_EHBlock> (currentEHB);
}
ReturnException ("../../gcc/m2/gm2-libs/RTExceptions.def", 25, 1);
__builtin_unreachable ();
@ -1212,12 +1209,12 @@ extern "C" void * RTExceptions_GetExceptionSource (void)
__builtin_unreachable ();
}
extern "C" void _M2_RTExceptions_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_RTExceptions_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
Init ();
}
extern "C" void _M2_RTExceptions_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_RTExceptions_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
TidyUp ();
}

View File

@ -48,9 +48,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
# undef NULL
# define NULL 0
#endif
#define _RTint_H
#define _RTint_C
#include "GRTint.h"
# include "GM2RTS.h"
# include "GStorage.h"
# include "GRTco.h"
@ -72,13 +72,10 @@ typedef struct RTint__T2_a RTint__T2;
typedef enum {RTint_input, RTint_output, RTint_time} RTint_VectorType;
typedef void (*RTint_DispatchVector_t) (unsigned int, unsigned int, void *);
struct RTint_DispatchVector_p { RTint_DispatchVector_t proc; };
struct RTint__T1_r {
RTint_VectorType type;
unsigned int priority;
void *arg;
void * arg;
RTint_Vector pending;
RTint_Vector exists;
unsigned int no;
@ -354,7 +351,7 @@ static void AddFd (Selective_SetOfFd *set, int *max, int fd)
{
if (fd < 0)
{
return ;
return;
}
(*max) = Max (fd, (*max));
if ((*set) == NULL)
@ -1011,7 +1008,7 @@ extern "C" void RTint_Listen (bool untilInterrupt, RTint_DispatchVector call, un
/* no file descriptors to be selected upon. */
timeval = Selective_KillTime (timeval);
RTco_signal (lock);
return ;
return;
}
else
{
@ -1140,11 +1137,11 @@ extern "C" void RTint_Init (void)
}
}
extern "C" void _M2_RTint_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_RTint_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
RTint_Init ();
}
extern "C" void _M2_RTint_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_RTint_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}

View File

@ -46,9 +46,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
# undef NULL
# define NULL 0
#endif
#define _SArgs_H
#define _SArgs_C
#include "GSArgs.h"
# include "GSYSTEM.h"
# include "GUnixArgs.h"
# include "GDynamicStrings.h"
@ -119,10 +119,10 @@ extern "C" unsigned int SArgs_Narg (void)
__builtin_unreachable ();
}
extern "C" void _M2_SArgs_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_SArgs_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}
extern "C" void _M2_SArgs_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_SArgs_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}

View File

@ -38,9 +38,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
# undef NULL
# define NULL 0
#endif
#define _SFIO_H
#define _SFIO_C
#include "GSFIO.h"
# include "GASCII.h"
# include "GDynamicStrings.h"
# include "GFIO.h"
@ -207,10 +207,10 @@ extern "C" DynamicStrings_String SFIO_ReadS (FIO_File file)
__builtin_unreachable ();
}
extern "C" void _M2_SFIO_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_SFIO_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}
extern "C" void _M2_SFIO_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_SFIO_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}

View File

@ -35,9 +35,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
# endif
# include "Gmcrts.h"
#define _StdIO_H
#define _StdIO_C
#include "GStdIO.h"
# include "GIO.h"
# include "GM2RTS.h"
@ -50,12 +50,6 @@ typedef struct StdIO__T1_a StdIO__T1;
typedef struct StdIO__T2_a StdIO__T2;
typedef void (*StdIO_ProcWrite_t) (char);
struct StdIO_ProcWrite_p { StdIO_ProcWrite_t proc; };
typedef void (*StdIO_ProcRead_t) (char *);
struct StdIO_ProcRead_p { StdIO_ProcRead_t proc; };
struct StdIO__T1_a { StdIO_ProcWrite array[MaxStack+1]; };
struct StdIO__T2_a { StdIO_ProcRead array[MaxStack+1]; };
static StdIO__T1 StackW;
@ -257,7 +251,7 @@ extern "C" StdIO_ProcRead StdIO_GetCurrentInput (void)
__builtin_unreachable ();
}
extern "C" void _M2_StdIO_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_StdIO_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
StackWPtr = 0;
StackRPtr = 0;
@ -265,6 +259,6 @@ extern "C" void _M2_StdIO_init (__attribute__((unused)) int argc,__attribute__((
StdIO_PushInput ((StdIO_ProcRead) {(StdIO_ProcRead_t) IO_Read});
}
extern "C" void _M2_StdIO_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_StdIO_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}

View File

@ -34,9 +34,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
typedef struct { PROC_t proc; } PROC;
# endif
#define _Storage_H
#define _Storage_C
#include "GStorage.h"
# include "GSysStorage.h"
extern "C" void Storage_ALLOCATE (void * *a, unsigned int Size);
@ -66,10 +66,10 @@ extern "C" bool Storage_Available (unsigned int Size)
__builtin_unreachable ();
}
extern "C" void _M2_Storage_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_Storage_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}
extern "C" void _M2_Storage_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_Storage_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}

View File

@ -34,9 +34,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
typedef struct { PROC_t proc; } PROC;
# endif
#define _StrCase_H
#define _StrCase_C
#include "GStrCase.h"
# include "GASCII.h"
# include "GStrLib.h"
@ -92,12 +92,12 @@ extern "C" void StrCase_StrToUpperCase (const char *a_, unsigned int _a_high, ch
i = 0;
while (((i < higha) && (a[i] != ASCII_nul)) && (i < highb))
{
b[i] = StrCase_Cap (a[i]);
const_cast<char *>(b)[i] = StrCase_Cap (a[i]);
i += 1;
}
if (i < highb)
{
b[i] = ASCII_nul;
const_cast<char *>(b)[i] = ASCII_nul;
}
}
@ -122,12 +122,12 @@ extern "C" void StrCase_StrToLowerCase (const char *a_, unsigned int _a_high, ch
i = 0;
while (((i < higha) && (a[i] != ASCII_nul)) && (i < highb))
{
b[i] = StrCase_Lower (a[i]);
const_cast<char *>(b)[i] = StrCase_Lower (a[i]);
i += 1;
}
if (i < highb)
{
b[i] = ASCII_nul;
const_cast<char *>(b)[i] = ASCII_nul;
}
}
@ -167,10 +167,10 @@ extern "C" char StrCase_Lower (char ch)
__builtin_unreachable ();
}
extern "C" void _M2_StrCase_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_StrCase_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}
extern "C" void _M2_StrCase_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_StrCase_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}

View File

@ -38,9 +38,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
# define FALSE (1==0)
# endif
#define _StrIO_H
#define _StrIO_C
#include "GStrIO.h"
# include "GASCII.h"
# include "GStdIO.h"
# include "Glibc.h"
@ -204,16 +204,16 @@ extern "C" void StrIO_ReadString (char *a, unsigned int _a_high)
/* avoid dangling else. */
if ((ch == ASCII_cr) || (ch == ASCII_lf))
{
a[n] = ASCII_nul;
const_cast<char *>(a)[n] = ASCII_nul;
n += 1;
}
else if (ch == ASCII_ff)
{
/* avoid dangling else. */
a[0] = ch;
const_cast<char *>(a)[0] = ch;
if (high > 0)
{
a[1] = ASCII_nul;
const_cast<char *>(a)[1] = ASCII_nul;
}
ch = ASCII_cr;
}
@ -221,18 +221,18 @@ extern "C" void StrIO_ReadString (char *a, unsigned int _a_high)
{
/* avoid dangling else. */
Echo (ch);
a[n] = ch;
const_cast<char *>(a)[n] = ch;
n += 1;
}
else if (ch == ASCII_eof)
{
/* avoid dangling else. */
a[n] = ch;
const_cast<char *>(a)[n] = ch;
n += 1;
ch = ASCII_cr;
if (n <= high)
{
a[n] = ASCII_nul;
const_cast<char *>(a)[n] = ASCII_nul;
}
}
}
@ -267,12 +267,12 @@ extern "C" void StrIO_WriteString (const char *a_, unsigned int _a_high)
}
}
extern "C" void _M2_StrIO_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_StrIO_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
/* IsATTY := isatty() */
IsATTY = false;
}
extern "C" void _M2_StrIO_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_StrIO_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}

View File

@ -42,9 +42,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
# define FALSE (1==0)
# endif
#define _StrLib_H
#define _StrLib_C
#include "GStrLib.h"
# include "GASCII.h"
@ -127,13 +127,13 @@ extern "C" void StrLib_StrConCat (const char *a_, unsigned int _a_high, const ch
j = 0;
while ((j < Highb) && (i <= Highc))
{
c[i] = b[j];
const_cast<char *>(c)[i] = b[j];
i += 1;
j += 1;
}
if (i <= Highc)
{
c[i] = ASCII_nul;
const_cast<char *>(c)[i] = ASCII_nul;
}
}
@ -247,12 +247,12 @@ extern "C" void StrLib_StrCopy (const char *src_, unsigned int _src_high, char *
HighDest = _dest_high;
while ((n < HighSrc) && (n <= HighDest))
{
dest[n] = src[n];
const_cast<char *>(dest)[n] = src[n];
n += 1;
}
if (n <= HighDest)
{
dest[n] = ASCII_nul;
const_cast<char *>(dest)[n] = ASCII_nul;
}
}
@ -328,20 +328,20 @@ extern "C" void StrLib_StrRemoveWhitePrefix (const char *a_, unsigned int _a_hig
}
while ((i < higha) && (j <= highb))
{
b[j] = a[i];
const_cast<char *>(b)[j] = a[i];
i += 1;
j += 1;
}
if (j <= highb)
{
b[j] = ASCII_nul;
const_cast<char *>(b)[j] = ASCII_nul;
}
}
extern "C" void _M2_StrLib_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_StrLib_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}
extern "C" void _M2_StrLib_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_StrLib_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}

View File

@ -46,9 +46,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
# undef NULL
# define NULL 0
#endif
#define _StringConvert_H
#define _StringConvert_C
#include "GStringConvert.h"
# include "GSYSTEM.h"
# include "Glibc.h"
# include "Glibm.h"
@ -1995,10 +1995,10 @@ extern "C" DynamicStrings_String StringConvert_ToDecimalPlaces (DynamicStrings_S
__builtin_unreachable ();
}
extern "C" void _M2_StringConvert_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_StringConvert_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}
extern "C" void _M2_StringConvert_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_StringConvert_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}

View File

@ -46,9 +46,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
# undef NULL
# define NULL 0
#endif
#define _SysStorage_H
#define _SysStorage_C
#include "GSysStorage.h"
# include "Glibc.h"
# include "GDebug.h"
# include "GSYSTEM.h"
@ -224,12 +224,12 @@ extern "C" void SysStorage_Init (void)
{
}
extern "C" void _M2_SysStorage_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_SysStorage_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
callno = 0;
if (enableTrace)
{
trace = (libc_getenv (const_cast<void*> (reinterpret_cast<const void*>("M2DEBUG_SYSSTORAGE_trace")))) != NULL;
trace = (libc_getenv (const_cast<void*> (static_cast<const void*>("M2DEBUG_SYSSTORAGE_trace")))) != NULL;
}
else
{
@ -237,7 +237,7 @@ extern "C" void _M2_SysStorage_init (__attribute__((unused)) int argc,__attribut
}
if (enableZero)
{
zero = (libc_getenv (const_cast<void*> (reinterpret_cast<const void*>("M2DEBUG_SYSSTORAGE_zero")))) != NULL;
zero = (libc_getenv (const_cast<void*> (static_cast<const void*>("M2DEBUG_SYSSTORAGE_zero")))) != NULL;
}
else
{
@ -245,6 +245,6 @@ extern "C" void _M2_SysStorage_init (__attribute__((unused)) int argc,__attribut
}
}
extern "C" void _M2_SysStorage_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_SysStorage_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}

View File

@ -38,9 +38,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
# undef NULL
# define NULL 0
#endif
#define _TimeString_H
#define _TimeString_C
#include "GTimeString.h"
# include "Gwrapc.h"
# include "GASCII.h"
# include "GSYSTEM.h"
@ -72,21 +72,21 @@ extern "C" void TimeString_GetTimeString (char *a, unsigned int _a_high)
{
while ((i < _a_high) && ((*Addr) != ASCII_nul))
{
a[i] = (*Addr);
const_cast<char *>(a)[i] = (*Addr);
i += 1;
Addr += 1;
}
}
if (i < _a_high)
{
a[i] = ASCII_nul;
const_cast<char *>(a)[i] = ASCII_nul;
}
}
extern "C" void _M2_TimeString_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_TimeString_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}
extern "C" void _M2_TimeString_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_TimeString_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}

View File

@ -42,9 +42,9 @@ along with GNU Modula-2; see the file COPYING3. If not see
# undef NULL
# define NULL 0
#endif
#define _alists_H
#define _alists_C
#include "Galists.h"
# include "GStorage.h"
typedef struct alists_performOperation_p alists_performOperation;
@ -54,16 +54,13 @@ typedef struct alists__T1_r alists__T1;
typedef struct alists__T2_a alists__T2;
typedef alists__T1 *alists_alist;
typedef void (*alists_performOperation_t) (void *);
struct alists_performOperation_p { alists_performOperation_t proc; };
typedef alists__T1 *alists_alist__opaque;
struct alists__T2_a { void * array[MaxnoOfelements-1+1]; };
struct alists__T1_r {
unsigned int noOfelements;
alists__T2 elements;
alists_alist next;
alists_alist__opaque next;
};
@ -147,14 +144,14 @@ extern "C" bool alists_equalList (alists_alist left, alists_alist right);
removeItem - remove an element at index, i, from the alist data type.
*/
static void removeItem (alists_alist p, alists_alist l, unsigned int i);
static void removeItem (alists_alist__opaque p, alists_alist__opaque l, unsigned int i);
/*
removeItem - remove an element at index, i, from the alist data type.
*/
static void removeItem (alists_alist p, alists_alist l, unsigned int i)
static void removeItem (alists_alist__opaque p, alists_alist__opaque l, unsigned int i)
{
l->noOfelements -= 1;
while (i <= l->noOfelements)
@ -176,12 +173,12 @@ static void removeItem (alists_alist p, alists_alist l, unsigned int i)
extern "C" alists_alist alists_initList (void)
{
alists_alist l;
alists_alist__opaque l;
Storage_ALLOCATE ((void **) &l, sizeof (alists__T1));
l->noOfelements = 0;
l->next = NULL;
return l;
l->next = static_cast<alists_alist__opaque> (NULL);
return static_cast<alists_alist> (l);
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
@ -195,9 +192,9 @@ extern "C" void alists_killList (alists_alist *l)
{
if ((*l) != NULL)
{
if ((*l)->next != NULL)
if (static_cast<alists_alist__opaque> ((*l))->next != NULL)
{
alists_killList (&(*l)->next);
alists_killList (reinterpret_cast<alists_alist *> (&static_cast<alists_alist__opaque> ((*l))->next));
}
Storage_DEALLOCATE ((void **) &(*l), sizeof (alists__T1));
}
@ -210,21 +207,21 @@ extern "C" void alists_killList (alists_alist *l)
extern "C" void alists_putItemIntoList (alists_alist l, void * c)
{
if (l->noOfelements < MaxnoOfelements)
if (static_cast<alists_alist__opaque> (l)->noOfelements < MaxnoOfelements)
{
l->noOfelements += 1;
l->elements.array[l->noOfelements-1] = c;
static_cast<alists_alist__opaque> (l)->noOfelements += 1;
static_cast<alists_alist__opaque> (l)->elements.array[static_cast<alists_alist__opaque> (l)->noOfelements-1] = c;
}
else if (l->next != NULL)
else if (static_cast<alists_alist__opaque> (l)->next != NULL)
{
/* avoid dangling else. */
alists_putItemIntoList (l->next, c);
alists_putItemIntoList (static_cast<alists_alist> (static_cast<alists_alist__opaque> (l)->next), c);
}
else
{
/* avoid dangling else. */
l->next = alists_initList ();
alists_putItemIntoList (l->next, c);
static_cast<alists_alist__opaque> (l)->next = static_cast<alists_alist__opaque> (alists_initList ());
alists_putItemIntoList (static_cast<alists_alist> (static_cast<alists_alist__opaque> (l)->next), c);
}
}
@ -237,17 +234,17 @@ extern "C" void * alists_getItemFromList (alists_alist l, unsigned int n)
{
while (l != NULL)
{
if (n <= l->noOfelements)
if (n <= static_cast<alists_alist__opaque> (l)->noOfelements)
{
return l->elements.array[n-1];
return static_cast<alists_alist__opaque> (l)->elements.array[n-1];
}
else
{
n -= l->noOfelements;
n -= static_cast<alists_alist__opaque> (l)->noOfelements;
}
l = l->next;
l = static_cast<alists_alist> (static_cast<alists_alist__opaque> (l)->next);
}
return reinterpret_cast<void *> (0);
return static_cast<void *> (0);
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
@ -270,9 +267,9 @@ extern "C" unsigned int alists_getIndexOfList (alists_alist l, void * c)
else
{
i = 1;
while (i <= l->noOfelements)
while (i <= static_cast<alists_alist__opaque> (l)->noOfelements)
{
if (l->elements.array[i-1] == c)
if (static_cast<alists_alist__opaque> (l)->elements.array[i-1] == c)
{
return i;
}
@ -281,7 +278,7 @@ extern "C" unsigned int alists_getIndexOfList (alists_alist l, void * c)
i += 1;
}
}
return l->noOfelements+(alists_getIndexOfList (l->next, c));
return static_cast<alists_alist__opaque> (l)->noOfelements+(alists_getIndexOfList (static_cast<alists_alist> (static_cast<alists_alist__opaque> (l)->next), c));
}
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
@ -304,8 +301,8 @@ extern "C" unsigned int alists_noOfItemsInList (alists_alist l)
{
t = 0;
do {
t += l->noOfelements;
l = l->next;
t += static_cast<alists_alist__opaque> (l)->noOfelements;
l = static_cast<alists_alist> (static_cast<alists_alist__opaque> (l)->next);
} while (! (l == NULL));
return t;
}
@ -335,33 +332,33 @@ extern "C" void alists_includeItemIntoList (alists_alist l, void * c)
extern "C" void alists_removeItemFromList (alists_alist l, void * c)
{
alists_alist p;
alists_alist__opaque p;
unsigned int i;
bool found;
if (l != NULL)
{
found = false;
p = NULL;
p = static_cast<alists_alist__opaque> (NULL);
do {
i = 1;
while ((i <= l->noOfelements) && (l->elements.array[i-1] != c))
while ((i <= static_cast<alists_alist__opaque> (l)->noOfelements) && (static_cast<alists_alist__opaque> (l)->elements.array[i-1] != c))
{
i += 1;
}
if ((i <= l->noOfelements) && (l->elements.array[i-1] == c))
if ((i <= static_cast<alists_alist__opaque> (l)->noOfelements) && (static_cast<alists_alist__opaque> (l)->elements.array[i-1] == c))
{
found = true;
}
else
{
p = l;
l = l->next;
p = static_cast<alists_alist__opaque> (l);
l = static_cast<alists_alist> (static_cast<alists_alist__opaque> (l)->next);
}
} while (! ((l == NULL) || found));
if (found)
{
removeItem (p, l, i);
removeItem (p, static_cast<alists_alist__opaque> (l), i);
}
}
}
@ -377,9 +374,9 @@ extern "C" bool alists_isItemInList (alists_alist l, void * c)
do {
i = 1;
while (i <= l->noOfelements)
while (i <= static_cast<alists_alist__opaque> (l)->noOfelements)
{
if (l->elements.array[i-1] == c)
if (static_cast<alists_alist__opaque> (l)->elements.array[i-1] == c)
{
return true;
}
@ -388,7 +385,7 @@ extern "C" bool alists_isItemInList (alists_alist l, void * c)
i += 1;
}
}
l = l->next;
l = static_cast<alists_alist> (static_cast<alists_alist__opaque> (l)->next);
} while (! (l == NULL));
return false;
/* static analysis guarentees a RETURN statement will be used before here. */
@ -421,19 +418,19 @@ extern "C" void alists_foreachItemInListDo (alists_alist l, alists_performOperat
extern "C" alists_alist alists_duplicateList (alists_alist l)
{
alists_alist m;
alists_alist__opaque m;
unsigned int n;
unsigned int i;
m = alists_initList ();
m = static_cast<alists_alist__opaque> (alists_initList ());
n = alists_noOfItemsInList (l);
i = 1;
while (i <= n)
{
alists_putItemIntoList (m, alists_getItemFromList (l, i));
alists_putItemIntoList (static_cast<alists_alist> (m), alists_getItemFromList (l, i));
i += 1;
}
return m;
return static_cast<alists_alist> (m);
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
@ -475,10 +472,10 @@ extern "C" bool alists_equalList (alists_alist left, alists_alist right)
__builtin_unreachable ();
}
extern "C" void _M2_alists_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_alists_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}
extern "C" void _M2_alists_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_alists_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}

File diff suppressed because it is too large Load Diff

View File

@ -246,6 +246,19 @@ EXTERN bool decl_isTypeHidden (decl_node n);
EXTERN bool decl_hasHidden (decl_node n);
/*
putTypeOpaque - marks type, des, as being an opaque type.
TYPE des ;
*/
EXTERN void decl_putTypeOpaque (decl_node des);
/*
isTypeOpaque - returns TRUE if type, n, is an opaque type.
*/
EXTERN bool decl_isTypeOpaque (decl_node n);
/*
isVar - returns TRUE if node, n, is a type.
*/

View File

@ -42,9 +42,9 @@ Boston, MA 02110-1301, USA. */
# undef NULL
# define NULL 0
#endif
#define _keyc_H
#define _keyc_C
#include "Gkeyc.h"
# include "GmcPretty.h"
# include "GStorage.h"
# include "GDynamicStrings.h"
@ -1630,11 +1630,11 @@ extern "C" void keyc_cp (void)
}
}
extern "C" void _M2_keyc_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_keyc_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
init ();
}
extern "C" void _M2_keyc_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_keyc_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}

View File

@ -68,7 +68,7 @@ EXTERN long double ldtoa_strtold (void * s, bool *error);
sign does the string have a sign?
*/
EXTERN void * ldtoa_ldtoa (long double d, ldtoa_Mode mode, int ndigits, int *decpt, bool *sign);
EXTERN void * ldtoa_ldtoa (long double d, int mode, int ndigits, int *decpt, bool *sign);
# ifdef __cplusplus
}
# endif

View File

@ -70,7 +70,7 @@ struct libc_tm_r {
int tm_yday;
int tm_isdst;
long int tm_gmtoff;
void *tm_zone;
void * tm_zone;
};
struct libc_timeb_r {

View File

@ -41,9 +41,9 @@ Boston, MA 02110-1301, USA. */
# undef NULL
# define NULL 0
#endif
#define _lists_H
#define _lists_C
#include "Glists.h"
# include "GStorage.h"
typedef struct symbolKey_performOperation_p symbolKey_performOperation;
@ -53,16 +53,13 @@ typedef struct lists__T1_r lists__T1;
typedef struct lists__T2_a lists__T2;
typedef lists__T1 *lists_list;
typedef void (*symbolKey_performOperation_t) (void *);
struct symbolKey_performOperation_p { symbolKey_performOperation_t proc; };
typedef lists__T1 *lists_list__opaque;
struct lists__T2_a { void * array[MaxnoOfelements-1+1]; };
struct lists__T1_r {
unsigned int noOfelements;
lists__T2 elements;
lists_list next;
lists_list__opaque next;
};
@ -140,14 +137,14 @@ extern "C" lists_list lists_duplicateList (lists_list l);
removeItem - remove an element at index, i, from the list data type.
*/
static void removeItem (lists_list p, lists_list l, unsigned int i);
static void removeItem (lists_list__opaque p, lists_list__opaque l, unsigned int i);
/*
removeItem - remove an element at index, i, from the list data type.
*/
static void removeItem (lists_list p, lists_list l, unsigned int i)
static void removeItem (lists_list__opaque p, lists_list__opaque l, unsigned int i)
{
l->noOfelements -= 1;
while (i <= l->noOfelements)
@ -169,12 +166,12 @@ static void removeItem (lists_list p, lists_list l, unsigned int i)
extern "C" lists_list lists_initList (void)
{
lists_list l;
lists_list__opaque l;
Storage_ALLOCATE ((void **) &l, sizeof (lists__T1));
l->noOfelements = 0;
l->next = NULL;
return l;
l->next = static_cast<lists_list__opaque> (NULL);
return static_cast<lists_list> (l);
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
@ -188,9 +185,9 @@ extern "C" void lists_killList (lists_list *l)
{
if ((*l) != NULL)
{
if ((*l)->next != NULL)
if (static_cast<lists_list__opaque> ((*l))->next != NULL)
{
lists_killList (&(*l)->next);
lists_killList (reinterpret_cast<lists_list *> (&static_cast<lists_list__opaque> ((*l))->next));
}
Storage_DEALLOCATE ((void **) &(*l), sizeof (lists__T1));
}
@ -203,21 +200,21 @@ extern "C" void lists_killList (lists_list *l)
extern "C" void lists_putItemIntoList (lists_list l, void * c)
{
if (l->noOfelements < MaxnoOfelements)
if (static_cast<lists_list__opaque> (l)->noOfelements < MaxnoOfelements)
{
l->noOfelements += 1;
l->elements.array[l->noOfelements-1] = c;
static_cast<lists_list__opaque> (l)->noOfelements += 1;
static_cast<lists_list__opaque> (l)->elements.array[static_cast<lists_list__opaque> (l)->noOfelements-1] = c;
}
else if (l->next != NULL)
else if (static_cast<lists_list__opaque> (l)->next != NULL)
{
/* avoid dangling else. */
lists_putItemIntoList (l->next, c);
lists_putItemIntoList (static_cast<lists_list> (static_cast<lists_list__opaque> (l)->next), c);
}
else
{
/* avoid dangling else. */
l->next = lists_initList ();
lists_putItemIntoList (l->next, c);
static_cast<lists_list__opaque> (l)->next = static_cast<lists_list__opaque> (lists_initList ());
lists_putItemIntoList (static_cast<lists_list> (static_cast<lists_list__opaque> (l)->next), c);
}
}
@ -230,17 +227,17 @@ extern "C" void * lists_getItemFromList (lists_list l, unsigned int n)
{
while (l != NULL)
{
if (n <= l->noOfelements)
if (n <= static_cast<lists_list__opaque> (l)->noOfelements)
{
return l->elements.array[n-1];
return static_cast<lists_list__opaque> (l)->elements.array[n-1];
}
else
{
n -= l->noOfelements;
n -= static_cast<lists_list__opaque> (l)->noOfelements;
}
l = l->next;
l = static_cast<lists_list> (static_cast<lists_list__opaque> (l)->next);
}
return reinterpret_cast<void *> (0);
return static_cast<void *> (0);
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
@ -263,9 +260,9 @@ extern "C" unsigned int lists_getIndexOfList (lists_list l, void * c)
else
{
i = 1;
while (i <= l->noOfelements)
while (i <= static_cast<lists_list__opaque> (l)->noOfelements)
{
if (l->elements.array[i-1] == c)
if (static_cast<lists_list__opaque> (l)->elements.array[i-1] == c)
{
return i;
}
@ -274,7 +271,7 @@ extern "C" unsigned int lists_getIndexOfList (lists_list l, void * c)
i += 1;
}
}
return l->noOfelements+(lists_getIndexOfList (l->next, c));
return static_cast<lists_list__opaque> (l)->noOfelements+(lists_getIndexOfList (static_cast<lists_list> (static_cast<lists_list__opaque> (l)->next), c));
}
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
@ -297,8 +294,8 @@ extern "C" unsigned int lists_noOfItemsInList (lists_list l)
{
t = 0;
do {
t += l->noOfelements;
l = l->next;
t += static_cast<lists_list__opaque> (l)->noOfelements;
l = static_cast<lists_list> (static_cast<lists_list__opaque> (l)->next);
} while (! (l == NULL));
return t;
}
@ -328,33 +325,33 @@ extern "C" void lists_includeItemIntoList (lists_list l, void * c)
extern "C" void lists_removeItemFromList (lists_list l, void * c)
{
lists_list p;
lists_list__opaque p;
unsigned int i;
bool found;
if (l != NULL)
{
found = false;
p = NULL;
p = static_cast<lists_list__opaque> (NULL);
do {
i = 1;
while ((i <= l->noOfelements) && (l->elements.array[i-1] != c))
while ((i <= static_cast<lists_list__opaque> (l)->noOfelements) && (static_cast<lists_list__opaque> (l)->elements.array[i-1] != c))
{
i += 1;
}
if ((i <= l->noOfelements) && (l->elements.array[i-1] == c))
if ((i <= static_cast<lists_list__opaque> (l)->noOfelements) && (static_cast<lists_list__opaque> (l)->elements.array[i-1] == c))
{
found = true;
}
else
{
p = l;
l = l->next;
p = static_cast<lists_list__opaque> (l);
l = static_cast<lists_list> (static_cast<lists_list__opaque> (l)->next);
}
} while (! ((l == NULL) || found));
if (found)
{
removeItem (p, l, i);
removeItem (p, static_cast<lists_list__opaque> (l), i);
}
}
}
@ -370,9 +367,9 @@ extern "C" bool lists_isItemInList (lists_list l, void * c)
do {
i = 1;
while (i <= l->noOfelements)
while (i <= static_cast<lists_list__opaque> (l)->noOfelements)
{
if (l->elements.array[i-1] == c)
if (static_cast<lists_list__opaque> (l)->elements.array[i-1] == c)
{
return true;
}
@ -381,7 +378,7 @@ extern "C" bool lists_isItemInList (lists_list l, void * c)
i += 1;
}
}
l = l->next;
l = static_cast<lists_list> (static_cast<lists_list__opaque> (l)->next);
} while (! (l == NULL));
return false;
/* static analysis guarentees a RETURN statement will be used before here. */
@ -414,27 +411,27 @@ extern "C" void lists_foreachItemInListDo (lists_list l, symbolKey_performOperat
extern "C" lists_list lists_duplicateList (lists_list l)
{
lists_list m;
lists_list__opaque m;
unsigned int n;
unsigned int i;
m = lists_initList ();
m = static_cast<lists_list__opaque> (lists_initList ());
n = lists_noOfItemsInList (l);
i = 1;
while (i <= n)
{
lists_putItemIntoList (m, lists_getItemFromList (l, i));
lists_putItemIntoList (static_cast<lists_list> (m), lists_getItemFromList (l, i));
i += 1;
}
return m;
return static_cast<lists_list> (m);
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
extern "C" void _M2_lists_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_lists_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}
extern "C" void _M2_lists_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_lists_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}

View File

@ -43,9 +43,9 @@ along with GNU Modula-2; see the file COPYING3. If not see
# undef NULL
# define NULL 0
#endif
#define _mcComment_H
#define _mcComment_C
#include "GmcComment.h"
# include "GDynamicStrings.h"
# include "GStorage.h"
# include "GnameKey.h"
@ -57,7 +57,7 @@ typedef struct mcComment__T1_r mcComment__T1;
typedef enum {mcComment_unknown, mcComment_procedureHeading, mcComment_inBody, mcComment_afterStatement} mcComment_commentType;
typedef mcComment__T1 *mcComment_commentDesc;
typedef mcComment__T1 *mcComment_commentDesc__opaque;
struct mcComment__T1_r {
mcComment_commentType type;
@ -156,13 +156,13 @@ static DynamicStrings_String RemoveNewlines (DynamicStrings_String s);
in the comment.
*/
static bool seenProcedure (mcComment_commentDesc cd, nameKey_Name procName);
static bool seenProcedure (mcComment_commentDesc__opaque cd, nameKey_Name procName);
/*
dumpComment -
*/
static void dumpComment (mcComment_commentDesc cd);
static void dumpComment (mcComment_commentDesc__opaque cd);
/*
@ -212,7 +212,7 @@ static DynamicStrings_String RemoveNewlines (DynamicStrings_String s)
in the comment.
*/
static bool seenProcedure (mcComment_commentDesc cd, nameKey_Name procName)
static bool seenProcedure (mcComment_commentDesc__opaque cd, nameKey_Name procName)
{
DynamicStrings_String s;
void * a;
@ -235,7 +235,7 @@ static bool seenProcedure (mcComment_commentDesc cd, nameKey_Name procName)
dumpComment -
*/
static void dumpComment (mcComment_commentDesc cd)
static void dumpComment (mcComment_commentDesc__opaque cd)
{
libc_printf ((const char *) "comment : ", 10);
switch (cd->type)
@ -282,7 +282,7 @@ static void dumpComment (mcComment_commentDesc cd)
extern "C" mcComment_commentDesc mcComment_initComment (bool onlySpaces)
{
mcComment_commentDesc cd;
mcComment_commentDesc__opaque cd;
Storage_ALLOCATE ((void **) &cd, sizeof (mcComment__T1));
mcDebug_assert (cd != NULL);
@ -297,7 +297,7 @@ extern "C" mcComment_commentDesc mcComment_initComment (bool onlySpaces)
cd->content = DynamicStrings_InitString ((const char *) "", 0);
cd->procName = nameKey_NulName;
cd->used = false;
return cd;
return static_cast<mcComment_commentDesc> (cd);
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
@ -312,7 +312,7 @@ extern "C" void mcComment_addText (mcComment_commentDesc cd, void * cs)
{
if (cd != NULL)
{
cd->content = DynamicStrings_ConCat (cd->content, DynamicStrings_InitStringCharStar (cs));
static_cast<mcComment_commentDesc__opaque> (cd)->content = DynamicStrings_ConCat (static_cast<mcComment_commentDesc__opaque> (cd)->content, DynamicStrings_InitStringCharStar (cs));
}
}
@ -325,7 +325,7 @@ extern "C" DynamicStrings_String mcComment_getContent (mcComment_commentDesc cd)
{
if (cd != NULL)
{
return cd->content;
return static_cast<mcComment_commentDesc__opaque> (cd)->content;
}
return static_cast<DynamicStrings_String> (NULL);
/* static analysis guarentees a RETURN statement will be used before here. */
@ -365,10 +365,10 @@ extern "C" void mcComment_setProcedureComment (mcComment_commentDesc cd, nameKey
{
if (cd != NULL)
{
if (seenProcedure (cd, procname))
if (seenProcedure (static_cast<mcComment_commentDesc__opaque> (cd), procname))
{
cd->type = mcComment_procedureHeading;
cd->procName = procname;
static_cast<mcComment_commentDesc__opaque> (cd)->type = mcComment_procedureHeading;
static_cast<mcComment_commentDesc__opaque> (cd)->procName = procname;
}
}
}
@ -380,10 +380,10 @@ extern "C" void mcComment_setProcedureComment (mcComment_commentDesc cd, nameKey
extern "C" DynamicStrings_String mcComment_getProcedureComment (mcComment_commentDesc cd)
{
if ((cd->type == mcComment_procedureHeading) && ! cd->used)
if ((static_cast<mcComment_commentDesc__opaque> (cd)->type == mcComment_procedureHeading) && ! static_cast<mcComment_commentDesc__opaque> (cd)->used)
{
cd->used = true;
return cd->content;
static_cast<mcComment_commentDesc__opaque> (cd)->used = true;
return static_cast<mcComment_commentDesc__opaque> (cd)->content;
}
return static_cast<DynamicStrings_String> (NULL);
/* static analysis guarentees a RETURN statement will be used before here. */
@ -397,10 +397,10 @@ extern "C" DynamicStrings_String mcComment_getProcedureComment (mcComment_commen
extern "C" DynamicStrings_String mcComment_getAfterStatementComment (mcComment_commentDesc cd)
{
if ((cd->type == mcComment_afterStatement) && ! cd->used)
if ((static_cast<mcComment_commentDesc__opaque> (cd)->type == mcComment_afterStatement) && ! static_cast<mcComment_commentDesc__opaque> (cd)->used)
{
cd->used = true;
return cd->content;
static_cast<mcComment_commentDesc__opaque> (cd)->used = true;
return static_cast<mcComment_commentDesc__opaque> (cd)->content;
}
return static_cast<DynamicStrings_String> (NULL);
/* static analysis guarentees a RETURN statement will be used before here. */
@ -414,10 +414,10 @@ extern "C" DynamicStrings_String mcComment_getAfterStatementComment (mcComment_c
extern "C" DynamicStrings_String mcComment_getInbodyStatementComment (mcComment_commentDesc cd)
{
if ((cd->type == mcComment_inBody) && ! cd->used)
if ((static_cast<mcComment_commentDesc__opaque> (cd)->type == mcComment_inBody) && ! static_cast<mcComment_commentDesc__opaque> (cd)->used)
{
cd->used = true;
return cd->content;
static_cast<mcComment_commentDesc__opaque> (cd)->used = true;
return static_cast<mcComment_commentDesc__opaque> (cd)->content;
}
return static_cast<DynamicStrings_String> (NULL);
/* static analysis guarentees a RETURN statement will be used before here. */
@ -431,7 +431,7 @@ extern "C" DynamicStrings_String mcComment_getInbodyStatementComment (mcComment_
extern "C" bool mcComment_isProcedureComment (mcComment_commentDesc cd)
{
return (cd != NULL) && (cd->type == mcComment_procedureHeading);
return (cd != NULL) && (static_cast<mcComment_commentDesc__opaque> (cd)->type == mcComment_procedureHeading);
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
@ -443,7 +443,7 @@ extern "C" bool mcComment_isProcedureComment (mcComment_commentDesc cd)
extern "C" bool mcComment_isBodyComment (mcComment_commentDesc cd)
{
return (cd != NULL) && (cd->type == mcComment_inBody);
return (cd != NULL) && (static_cast<mcComment_commentDesc__opaque> (cd)->type == mcComment_inBody);
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
@ -455,15 +455,15 @@ extern "C" bool mcComment_isBodyComment (mcComment_commentDesc cd)
extern "C" bool mcComment_isAfterComment (mcComment_commentDesc cd)
{
return (cd != NULL) && (cd->type == mcComment_afterStatement);
return (cd != NULL) && (static_cast<mcComment_commentDesc__opaque> (cd)->type == mcComment_afterStatement);
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
extern "C" void _M2_mcComment_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_mcComment_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}
extern "C" void _M2_mcComment_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_mcComment_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}

View File

@ -38,9 +38,9 @@ Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
# undef NULL
# define NULL 0
#endif
#define _mcComp_H
#define _mcComp_C
#include "GmcComp.h"
# include "GFIO.h"
# include "Glibc.h"
# include "Gdecl.h"
@ -562,7 +562,7 @@ static void pass (unsigned int no, decl_node n, mcComp_parserFunction f, decl_is
{
mcError_writeFormat0 ((const char *) "compilation failed", 18);
mcLexBuf_closeSource ();
return ;
return;
}
mcLexBuf_closeSource ();
}
@ -651,11 +651,11 @@ extern "C" unsigned int mcComp_getPassNo (void)
__builtin_unreachable ();
}
extern "C" void _M2_mcComp_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_mcComp_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
init ();
}
extern "C" void _M2_mcComp_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_mcComp_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}

View File

@ -24,9 +24,9 @@ Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
typedef struct { PROC_t proc; } PROC;
# endif
#define _mcDebug_H
#define _mcDebug_C
#include "GmcDebug.h"
# include "GStrIO.h"
# include "GmcOptions.h"
# include "GmcError.h"
@ -78,10 +78,10 @@ extern "C" void mcDebug_writeDebug (const char *a_, unsigned int _a_high)
}
}
extern "C" void _M2_mcDebug_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_mcDebug_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}
extern "C" void _M2_mcDebug_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_mcDebug_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}

View File

@ -42,9 +42,9 @@ along with GNU Modula-2; see the file COPYING3. If not see
# undef NULL
# define NULL 0
#endif
#define _mcError_H
#define _mcError_C
#include "GmcError.h"
# include "GASCII.h"
# include "GDynamicStrings.h"
# include "GFIO.h"
@ -63,18 +63,18 @@ along with GNU Modula-2; see the file COPYING3. If not see
# define Xcode true
typedef struct mcError__T2_r mcError__T2;
typedef mcError__T2 *mcError_error;
typedef mcError__T2 *mcError_error__opaque;
struct mcError__T2_r {
mcError_error parent;
mcError_error child;
mcError_error next;
mcError_error__opaque parent;
mcError_error__opaque child;
mcError_error__opaque next;
bool fatal;
DynamicStrings_String s;
unsigned int token;
};
static mcError_error head;
static mcError_error__opaque head;
static bool inInternal;
/*
@ -282,7 +282,7 @@ static void checkIncludes (unsigned int token, unsigned int depth);
flushAll - flushes all errors in list, e.
*/
static bool flushAll (mcError_error e, bool FatalStatus);
static bool flushAll (mcError_error__opaque e, bool FatalStatus);
/*
@ -301,7 +301,7 @@ static void cast (unsigned char *a, unsigned int _a_high, const unsigned char *b
{
for (i=0; i<=_a_high; i++)
{
a[i] = b[i];
const_cast<unsigned char *>(a)[i] = b[i];
}
}
}
@ -326,7 +326,7 @@ static bool translateNameToCharStar (char *a, unsigned int _a_high, unsigned int
{
if ((a[i+1] == 'a') && (argno == n))
{
a[i+1] = 's';
const_cast<char *>(a)[i+1] = 's';
return true;
}
argno += 1;
@ -600,7 +600,7 @@ static DynamicStrings_String doFormat3 (const char *a_, unsigned int _a_high, co
static void init (void)
{
head = NULL;
head = static_cast<mcError_error__opaque> (NULL);
inInternal = false;
}
@ -656,9 +656,9 @@ static void checkIncludes (unsigned int token, unsigned int depth)
flushAll - flushes all errors in list, e.
*/
static bool flushAll (mcError_error e, bool FatalStatus)
static bool flushAll (mcError_error__opaque e, bool FatalStatus)
{
mcError_error f;
mcError_error__opaque f;
bool written;
written = false;
@ -734,13 +734,13 @@ extern "C" void mcError_internalError (const char *a_, unsigned int _a_high, con
extern "C" void mcError_writeFormat0 (const char *a_, unsigned int _a_high)
{
mcError_error e;
mcError_error__opaque e;
char a[_a_high+1];
/* make a local copy of each unbounded array. */
memcpy (a, a_, _a_high+1);
e = mcError_newError (mcLexBuf_getTokenNo ());
e = static_cast<mcError_error__opaque> (mcError_newError (mcLexBuf_getTokenNo ()));
e->s = FormatStrings_Sprintf0 (DynamicStrings_Mark (DynamicStrings_InitString ((const char *) a, _a_high)));
}
@ -753,7 +753,7 @@ extern "C" void mcError_writeFormat0 (const char *a_, unsigned int _a_high)
extern "C" void mcError_writeFormat1 (const char *a_, unsigned int _a_high, const unsigned char *w_, unsigned int _w_high)
{
mcError_error e;
mcError_error__opaque e;
char a[_a_high+1];
unsigned char w[_w_high+1];
@ -761,7 +761,7 @@ extern "C" void mcError_writeFormat1 (const char *a_, unsigned int _a_high, cons
memcpy (a, a_, _a_high+1);
memcpy (w, w_, _w_high+1);
e = mcError_newError (mcLexBuf_getTokenNo ());
e = static_cast<mcError_error__opaque> (mcError_newError (mcLexBuf_getTokenNo ()));
e->s = doFormat1 ((const char *) a, _a_high, (const unsigned char *) w, _w_high);
}
@ -774,7 +774,7 @@ extern "C" void mcError_writeFormat1 (const char *a_, unsigned int _a_high, cons
extern "C" void mcError_writeFormat2 (const char *a_, unsigned int _a_high, const unsigned char *w1_, unsigned int _w1_high, const unsigned char *w2_, unsigned int _w2_high)
{
mcError_error e;
mcError_error__opaque e;
char a[_a_high+1];
unsigned char w1[_w1_high+1];
unsigned char w2[_w2_high+1];
@ -784,7 +784,7 @@ extern "C" void mcError_writeFormat2 (const char *a_, unsigned int _a_high, cons
memcpy (w1, w1_, _w1_high+1);
memcpy (w2, w2_, _w2_high+1);
e = mcError_newError (mcLexBuf_getTokenNo ());
e = static_cast<mcError_error__opaque> (mcError_newError (mcLexBuf_getTokenNo ()));
e->s = doFormat2 ((const char *) a, _a_high, (const unsigned char *) w1, _w1_high, (const unsigned char *) w2, _w2_high);
}
@ -797,7 +797,7 @@ extern "C" void mcError_writeFormat2 (const char *a_, unsigned int _a_high, cons
extern "C" void mcError_writeFormat3 (const char *a_, unsigned int _a_high, const unsigned char *w1_, unsigned int _w1_high, const unsigned char *w2_, unsigned int _w2_high, const unsigned char *w3_, unsigned int _w3_high)
{
mcError_error e;
mcError_error__opaque e;
char a[_a_high+1];
unsigned char w1[_w1_high+1];
unsigned char w2[_w2_high+1];
@ -809,7 +809,7 @@ extern "C" void mcError_writeFormat3 (const char *a_, unsigned int _a_high, cons
memcpy (w2, w2_, _w2_high+1);
memcpy (w3, w3_, _w3_high+1);
e = mcError_newError (mcLexBuf_getTokenNo ());
e = static_cast<mcError_error__opaque> (mcError_newError (mcLexBuf_getTokenNo ()));
e->s = doFormat3 ((const char *) a, _a_high, (const unsigned char *) w1, _w1_high, (const unsigned char *) w2, _w2_high, (const unsigned char *) w3, _w3_high);
}
@ -820,15 +820,15 @@ extern "C" void mcError_writeFormat3 (const char *a_, unsigned int _a_high, cons
extern "C" mcError_error mcError_newError (unsigned int atTokenNo)
{
mcError_error e;
mcError_error f;
mcError_error__opaque e;
mcError_error__opaque f;
Storage_ALLOCATE ((void **) &e, sizeof (mcError__T2));
e->s = static_cast<DynamicStrings_String> (NULL);
e->token = atTokenNo;
e->next = NULL;
e->parent = NULL;
e->child = NULL;
e->next = static_cast<mcError_error__opaque> (NULL);
e->parent = static_cast<mcError_error__opaque> (NULL);
e->child = static_cast<mcError_error__opaque> (NULL);
e->fatal = true;
if ((head == NULL) || (head->token > atTokenNo))
{
@ -845,7 +845,7 @@ extern "C" mcError_error mcError_newError (unsigned int atTokenNo)
e->next = f->next;
f->next = e;
}
return e;
return static_cast<mcError_error> (e);
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
@ -858,11 +858,11 @@ extern "C" mcError_error mcError_newError (unsigned int atTokenNo)
extern "C" mcError_error mcError_newWarning (unsigned int atTokenNo)
{
mcError_error e;
mcError_error__opaque e;
e = mcError_newError (atTokenNo);
e = static_cast<mcError_error__opaque> (mcError_newError (atTokenNo));
e->fatal = false;
return e;
return static_cast<mcError_error> (e);
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
@ -876,7 +876,7 @@ extern "C" mcError_error mcError_newWarning (unsigned int atTokenNo)
extern "C" mcError_error mcError_chainError (unsigned int atTokenNo, mcError_error e)
{
mcError_error f;
mcError_error__opaque f;
if (e == NULL)
{
@ -887,13 +887,13 @@ extern "C" mcError_error mcError_chainError (unsigned int atTokenNo, mcError_err
Storage_ALLOCATE ((void **) &f, sizeof (mcError__T2));
f->s = static_cast<DynamicStrings_String> (NULL);
f->token = atTokenNo;
f->next = e->child;
f->parent = e;
f->child = NULL;
f->fatal = e->fatal;
e->child = f;
f->next = static_cast<mcError_error__opaque> (e)->child;
f->parent = static_cast<mcError_error__opaque> (e);
f->child = static_cast<mcError_error__opaque> (NULL);
f->fatal = static_cast<mcError_error__opaque> (e)->fatal;
static_cast<mcError_error__opaque> (e)->child = f;
}
return f;
return static_cast<mcError_error> (f);
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
@ -908,13 +908,13 @@ extern "C" void mcError_errorFormat0 (mcError_error e, const char *a_, unsigned
/*
errorFormat routines provide a printf capability for the error handle.
*/
if (e->s == NULL)
if (static_cast<mcError_error__opaque> (e)->s == NULL)
{
e->s = FormatStrings_Sprintf0 (DynamicStrings_Mark (DynamicStrings_InitString ((const char *) a, _a_high)));
static_cast<mcError_error__opaque> (e)->s = FormatStrings_Sprintf0 (DynamicStrings_Mark (DynamicStrings_InitString ((const char *) a, _a_high)));
}
else
{
e->s = DynamicStrings_ConCat (e->s, DynamicStrings_Mark (FormatStrings_Sprintf0 (DynamicStrings_Mark (DynamicStrings_InitString ((const char *) a, _a_high)))));
static_cast<mcError_error__opaque> (e)->s = DynamicStrings_ConCat (static_cast<mcError_error__opaque> (e)->s, DynamicStrings_Mark (FormatStrings_Sprintf0 (DynamicStrings_Mark (DynamicStrings_InitString ((const char *) a, _a_high)))));
}
}
@ -929,13 +929,13 @@ extern "C" void mcError_errorFormat1 (mcError_error e, const char *a_, unsigned
memcpy (w, w_, _w_high+1);
s1 = doFormat1 ((const char *) a, _a_high, (const unsigned char *) w, _w_high);
if (e->s == NULL)
if (static_cast<mcError_error__opaque> (e)->s == NULL)
{
e->s = s1;
static_cast<mcError_error__opaque> (e)->s = s1;
}
else
{
e->s = DynamicStrings_ConCat (e->s, DynamicStrings_Mark (s1));
static_cast<mcError_error__opaque> (e)->s = DynamicStrings_ConCat (static_cast<mcError_error__opaque> (e)->s, DynamicStrings_Mark (s1));
}
}
@ -952,13 +952,13 @@ extern "C" void mcError_errorFormat2 (mcError_error e, const char *a_, unsigned
memcpy (w2, w2_, _w2_high+1);
s1 = doFormat2 ((const char *) a, _a_high, (const unsigned char *) w1, _w1_high, (const unsigned char *) w2, _w2_high);
if (e->s == NULL)
if (static_cast<mcError_error__opaque> (e)->s == NULL)
{
e->s = s1;
static_cast<mcError_error__opaque> (e)->s = s1;
}
else
{
e->s = DynamicStrings_ConCat (e->s, DynamicStrings_Mark (s1));
static_cast<mcError_error__opaque> (e)->s = DynamicStrings_ConCat (static_cast<mcError_error__opaque> (e)->s, DynamicStrings_Mark (s1));
}
}
@ -977,19 +977,19 @@ extern "C" void mcError_errorFormat3 (mcError_error e, const char *a_, unsigned
memcpy (w3, w3_, _w3_high+1);
s1 = doFormat3 ((const char *) a, _a_high, (const unsigned char *) w1, _w1_high, (const unsigned char *) w2, _w2_high, (const unsigned char *) w3, _w3_high);
if (e->s == NULL)
if (static_cast<mcError_error__opaque> (e)->s == NULL)
{
e->s = s1;
static_cast<mcError_error__opaque> (e)->s = s1;
}
else
{
e->s = DynamicStrings_ConCat (e->s, DynamicStrings_Mark (s1));
static_cast<mcError_error__opaque> (e)->s = DynamicStrings_ConCat (static_cast<mcError_error__opaque> (e)->s, DynamicStrings_Mark (s1));
}
}
extern "C" void mcError_errorString (mcError_error e, DynamicStrings_String str)
{
e->s = str;
static_cast<mcError_error__opaque> (e)->s = str;
}
@ -1001,10 +1001,10 @@ extern "C" void mcError_errorString (mcError_error e, DynamicStrings_String str)
extern "C" void mcError_errorStringAt (DynamicStrings_String s, unsigned int tok)
{
mcError_error e;
mcError_error__opaque e;
e = mcError_newError (tok);
mcError_errorString (e, s);
e = static_cast<mcError_error__opaque> (mcError_newError (tok));
mcError_errorString (static_cast<mcError_error> (e), s);
}
@ -1028,15 +1028,15 @@ extern "C" void mcError_errorStringAt2 (DynamicStrings_String s, unsigned int to
extern "C" void mcError_errorStringsAt2 (DynamicStrings_String s1, DynamicStrings_String s2, unsigned int tok1, unsigned int tok2)
{
mcError_error e;
mcError_error__opaque e;
if (s1 == s2)
{
s2 = DynamicStrings_Dup (s1);
}
e = mcError_newError (tok1);
mcError_errorString (e, s1);
mcError_errorString (mcError_chainError (tok2, e), s2);
e = static_cast<mcError_error__opaque> (mcError_newError (tok1));
mcError_errorString (static_cast<mcError_error> (e), s1);
mcError_errorString (mcError_chainError (tok2, static_cast<mcError_error> (e)), s2);
}
@ -1048,10 +1048,10 @@ extern "C" void mcError_errorStringsAt2 (DynamicStrings_String s1, DynamicString
extern "C" void mcError_warnStringAt (DynamicStrings_String s, unsigned int tok)
{
mcError_error e;
mcError_error__opaque e;
e = mcError_newWarning (tok);
mcError_errorString (e, s);
e = static_cast<mcError_error__opaque> (mcError_newWarning (tok));
mcError_errorString (static_cast<mcError_error> (e), s);
}
@ -1075,20 +1075,20 @@ extern "C" void mcError_warnStringAt2 (DynamicStrings_String s, unsigned int tok
extern "C" void mcError_warnStringsAt2 (DynamicStrings_String s1, DynamicStrings_String s2, unsigned int tok1, unsigned int tok2)
{
mcError_error e;
mcError_error__opaque e;
if (s1 == s2)
{
s2 = DynamicStrings_Dup (s1);
}
e = mcError_newWarning (tok1);
mcError_errorString (e, s1);
mcError_errorString (mcError_chainError (tok2, e), s2);
e = static_cast<mcError_error__opaque> (mcError_newWarning (tok1));
mcError_errorString (static_cast<mcError_error> (e), s1);
mcError_errorString (mcError_chainError (tok2, static_cast<mcError_error> (e)), s2);
}
extern "C" void mcError_warnFormat0 (const char *a_, unsigned int _a_high)
{
mcError_error e;
mcError_error__opaque e;
char a[_a_high+1];
/* make a local copy of each unbounded array. */
@ -1099,7 +1099,7 @@ extern "C" void mcError_warnFormat0 (const char *a_, unsigned int _a_high)
with the encapsulated format string.
Used for simple warning messages tied to the current token.
*/
e = mcError_newWarning (mcLexBuf_getTokenNo ());
e = static_cast<mcError_error__opaque> (mcError_newWarning (mcLexBuf_getTokenNo ()));
e->s = FormatStrings_Sprintf0 (DynamicStrings_Mark (DynamicStrings_InitString ((const char *) a, _a_high)));
}
@ -1112,7 +1112,7 @@ extern "C" void mcError_warnFormat0 (const char *a_, unsigned int _a_high)
extern "C" void mcError_warnFormat1 (const char *a_, unsigned int _a_high, const unsigned char *w_, unsigned int _w_high)
{
mcError_error e;
mcError_error__opaque e;
char a[_a_high+1];
unsigned char w[_w_high+1];
@ -1120,7 +1120,7 @@ extern "C" void mcError_warnFormat1 (const char *a_, unsigned int _a_high, const
memcpy (a, a_, _a_high+1);
memcpy (w, w_, _w_high+1);
e = mcError_newWarning (mcLexBuf_getTokenNo ());
e = static_cast<mcError_error__opaque> (mcError_newWarning (mcLexBuf_getTokenNo ()));
e->s = doFormat1 ((const char *) a, _a_high, (const unsigned char *) w, _w_high);
}
@ -1188,11 +1188,11 @@ extern "C" void mcError_errorAbort0 (const char *a_, unsigned int _a_high)
__builtin_unreachable ();
}
extern "C" void _M2_mcError_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_mcError_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
init ();
}
extern "C" void _M2_mcError_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_mcError_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}

View File

@ -24,9 +24,9 @@ Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
typedef struct { PROC_t proc; } PROC;
# endif
#define _mcFileName_H
#define _mcFileName_C
#include "GmcFileName.h"
# include "GASCII.h"
# include "GDynamicStrings.h"
@ -144,10 +144,10 @@ extern "C" DynamicStrings_String mcFileName_extractModule (DynamicStrings_String
__builtin_unreachable ();
}
extern "C" void _M2_mcFileName_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_mcFileName_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}
extern "C" void _M2_mcFileName_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_mcFileName_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}

View File

@ -42,9 +42,9 @@ along with GNU Modula-2; see the file COPYING3. If not see
# undef NULL
# define NULL 0
#endif
#define _mcLexBuf_H
#define _mcLexBuf_C
#include "GmcLexBuf.h"
# include "Gmcflex.h"
# include "Glibc.h"
# include "GSYSTEM.h"
@ -58,12 +58,6 @@ along with GNU Modula-2; see the file COPYING3. If not see
# include "GmcDebug.h"
# include "GM2RTS.h"
mcComment_commentDesc mcLexBuf_currentcomment;
mcComment_commentDesc mcLexBuf_lastcomment;
int mcLexBuf_currentinteger;
unsigned int mcLexBuf_currentcolumn;
void * mcLexBuf_currentstring;
mcReserved_toktype mcLexBuf_currenttoken;
# define MaxBucketSize 100
# define Debugging false
typedef struct mcLexBuf_tokenDesc_r mcLexBuf_tokenDesc;
@ -1152,7 +1146,7 @@ static void doGetToken (void)
/* call the lexical phase to place a new token into the last bucket. */
a = mcflex_getToken ();
mcLexBuf_getToken (); /* and call ourselves again to collect the token from bucket. */
return ; /* and call ourselves again to collect the token from bucket. */
return; /* and call ourselves again to collect the token from bucket. */
}
}
else
@ -1840,11 +1834,11 @@ extern "C" void mcLexBuf_popFile (void * filename)
/* source file list is empty, cannot pop an include.. */
}
extern "C" void _M2_mcLexBuf_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_mcLexBuf_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
init ();
}
extern "C" void _M2_mcLexBuf_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_mcLexBuf_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}

View File

@ -36,9 +36,9 @@ Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
# undef NULL
# define NULL 0
#endif
#define _mcMetaError_H
#define _mcMetaError_C
#include "GmcMetaError.h"
# include "GnameKey.h"
# include "GStrLib.h"
# include "GmcLexBuf.h"
@ -1270,7 +1270,7 @@ static void ebnf (mcError_error *e, mcMetaError_errorType *t, DynamicStrings_Str
break;
case '}':
return ;
return;
break;
@ -1872,10 +1872,10 @@ extern "C" void mcMetaError_metaErrorStringT4 (unsigned int tok, DynamicStrings_
varargs_end (&sym);
}
extern "C" void _M2_mcMetaError_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_mcMetaError_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}
extern "C" void _M2_mcMetaError_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_mcMetaError_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}

View File

@ -37,9 +37,9 @@ Boston, MA 02110-1301, USA. */
# undef NULL
# define NULL 0
#endif
#define _mcOptions_H
#define _mcOptions_C
#include "GmcOptions.h"
# include "GSArgs.h"
# include "GmcSearch.h"
# include "Glibc.h"
@ -885,7 +885,8 @@ static void handleOption (DynamicStrings_String arg)
else if (optionIs ((const char *) "--extended-opaque", 17, arg))
{
/* avoid dangling else. */
setExtendedOpaque (true);
/* setExtendedOpaque (TRUE) */
mcPrintf_printf0 ((const char *) "IGNORING --extended-opaque - this option is no longer implemented - please adjust the call to mc\\n", 98);
}
else if (optionIs ((const char *) "--debug-top", 11, arg))
{
@ -1258,7 +1259,7 @@ extern "C" DynamicStrings_String mcOptions_getCShortRealType (void)
__builtin_unreachable ();
}
extern "C" void _M2_mcOptions_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_mcOptions_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
langC = true;
langCPP = false;
@ -1293,6 +1294,6 @@ extern "C" void _M2_mcOptions_init (__attribute__((unused)) int argc,__attribute
CShortReal = DynamicStrings_InitString ((const char *) "float", 5);
}
extern "C" void _M2_mcOptions_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_mcOptions_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}

View File

@ -24,9 +24,9 @@ Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
typedef struct { PROC_t proc; } PROC;
# endif
#define _mcPreprocess_H
#define _mcPreprocess_C
#include "GmcPreprocess.h"
# include "GSYSTEM.h"
# include "GDynamicStrings.h"
# include "Glibc.h"
@ -167,7 +167,7 @@ extern "C" DynamicStrings_String mcPreprocess_preprocessModule (DynamicStrings_S
__builtin_unreachable ();
}
extern "C" void _M2_mcPreprocess_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_mcPreprocess_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
listOfFiles = alists_initList ();
if (! (M2RTS_InstallTerminationProcedure ((PROC ) {(PROC_t) removeFiles})))
@ -177,6 +177,6 @@ extern "C" void _M2_mcPreprocess_init (__attribute__((unused)) int argc,__attrib
}
}
extern "C" void _M2_mcPreprocess_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_mcPreprocess_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}

View File

@ -38,9 +38,9 @@ Boston, MA 02110-1301, USA. */
# undef NULL
# define NULL 0
#endif
#define _mcPretty_H
#define _mcPretty_C
#include "GmcPretty.h"
# include "GDynamicStrings.h"
# include "GStorage.h"
@ -50,13 +50,7 @@ typedef struct mcPretty_writeLnProc_p mcPretty_writeLnProc;
typedef struct mcPretty__T1_r mcPretty__T1;
typedef mcPretty__T1 *mcPretty_pretty;
typedef void (*mcPretty_writeProc_t) (char);
struct mcPretty_writeProc_p { mcPretty_writeProc_t proc; };
typedef void (*mcPretty_writeLnProc_t) (void);
struct mcPretty_writeLnProc_p { mcPretty_writeLnProc_t proc; };
typedef mcPretty__T1 *mcPretty_pretty__opaque;
struct mcPretty__T1_r {
mcPretty_writeProc write_;
@ -67,7 +61,7 @@ struct mcPretty__T1_r {
unsigned int curLine;
unsigned int curPos;
unsigned int indent;
mcPretty_pretty stacked;
mcPretty_pretty__opaque stacked;
};
@ -162,20 +156,20 @@ extern "C" void mcPretty_raw (mcPretty_pretty p, DynamicStrings_String s);
flushSpace -
*/
static void flushSpace (mcPretty_pretty p);
static void flushSpace (mcPretty_pretty__opaque p);
/*
flushIndent -
*/
static void flushIndent (mcPretty_pretty p);
static void flushIndent (mcPretty_pretty__opaque p);
/*
flushSpace -
*/
static void flushSpace (mcPretty_pretty p)
static void flushSpace (mcPretty_pretty__opaque p)
{
if (p->needsSpace)
{
@ -191,7 +185,7 @@ static void flushSpace (mcPretty_pretty p)
flushIndent -
*/
static void flushIndent (mcPretty_pretty p)
static void flushIndent (mcPretty_pretty__opaque p)
{
unsigned int i;
@ -215,7 +209,7 @@ static void flushIndent (mcPretty_pretty p)
extern "C" mcPretty_pretty mcPretty_initPretty (mcPretty_writeProc w, mcPretty_writeLnProc l)
{
mcPretty_pretty p;
mcPretty_pretty__opaque p;
Storage_ALLOCATE ((void **) &p, sizeof (mcPretty__T1));
p->write_ = w;
@ -226,8 +220,8 @@ extern "C" mcPretty_pretty mcPretty_initPretty (mcPretty_writeProc w, mcPretty_w
p->curLine = 0;
p->seekPos = 0;
p->indent = 0;
p->stacked = NULL;
return p;
p->stacked = static_cast<mcPretty_pretty__opaque> (NULL);
return static_cast<mcPretty_pretty> (p);
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
@ -239,11 +233,11 @@ extern "C" mcPretty_pretty mcPretty_initPretty (mcPretty_writeProc w, mcPretty_w
extern "C" mcPretty_pretty mcPretty_dupPretty (mcPretty_pretty p)
{
mcPretty_pretty q;
mcPretty_pretty__opaque q;
Storage_ALLOCATE ((void **) &q, sizeof (mcPretty__T1));
(*q) = (*p);
return q;
(*q) = (*static_cast<mcPretty_pretty__opaque> (p));
return static_cast<mcPretty_pretty> (q);
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
@ -256,10 +250,10 @@ extern "C" mcPretty_pretty mcPretty_dupPretty (mcPretty_pretty p)
extern "C" void mcPretty_killPretty (mcPretty_pretty *p)
{
(*p) = NULL;
return ;
(*p) = static_cast<mcPretty_pretty> (NULL);
return;
Storage_DEALLOCATE ((void **) &(*p), sizeof (mcPretty__T1));
(*p) = NULL;
(*p) = static_cast<mcPretty_pretty> (NULL);
}
@ -269,11 +263,11 @@ extern "C" void mcPretty_killPretty (mcPretty_pretty *p)
extern "C" mcPretty_pretty mcPretty_pushPretty (mcPretty_pretty p)
{
mcPretty_pretty q;
mcPretty_pretty__opaque q;
q = mcPretty_dupPretty (p);
q->stacked = p;
return q;
q = static_cast<mcPretty_pretty__opaque> (mcPretty_dupPretty (p));
q->stacked = static_cast<mcPretty_pretty__opaque> (p);
return static_cast<mcPretty_pretty> (q);
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
@ -285,16 +279,16 @@ extern "C" mcPretty_pretty mcPretty_pushPretty (mcPretty_pretty p)
extern "C" mcPretty_pretty mcPretty_popPretty (mcPretty_pretty p)
{
mcPretty_pretty q;
mcPretty_pretty__opaque q;
q = p->stacked;
q->needsIndent = p->needsIndent;
q->needsSpace = p->needsSpace;
q->curPos = p->curPos;
q->seekPos = p->seekPos;
q->curLine = p->curLine;
q = static_cast<mcPretty_pretty__opaque> (p)->stacked;
q->needsIndent = static_cast<mcPretty_pretty__opaque> (p)->needsIndent;
q->needsSpace = static_cast<mcPretty_pretty__opaque> (p)->needsSpace;
q->curPos = static_cast<mcPretty_pretty__opaque> (p)->curPos;
q->seekPos = static_cast<mcPretty_pretty__opaque> (p)->seekPos;
q->curLine = static_cast<mcPretty_pretty__opaque> (p)->curLine;
mcPretty_killPretty (&p);
return q;
return static_cast<mcPretty_pretty> (q);
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
@ -306,7 +300,7 @@ extern "C" mcPretty_pretty mcPretty_popPretty (mcPretty_pretty p)
extern "C" unsigned int mcPretty_getindent (mcPretty_pretty p)
{
return p->indent;
return static_cast<mcPretty_pretty__opaque> (p)->indent;
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
@ -318,7 +312,7 @@ extern "C" unsigned int mcPretty_getindent (mcPretty_pretty p)
extern "C" void mcPretty_setindent (mcPretty_pretty p, unsigned int n)
{
p->indent = n;
static_cast<mcPretty_pretty__opaque> (p)->indent = n;
}
@ -328,13 +322,13 @@ extern "C" void mcPretty_setindent (mcPretty_pretty p, unsigned int n)
extern "C" unsigned int mcPretty_getcurpos (mcPretty_pretty s)
{
if (s->needsSpace)
if (static_cast<mcPretty_pretty__opaque> (s)->needsSpace)
{
return s->curPos+1;
return static_cast<mcPretty_pretty__opaque> (s)->curPos+1;
}
else
{
return s->curPos;
return static_cast<mcPretty_pretty__opaque> (s)->curPos;
}
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
@ -347,7 +341,7 @@ extern "C" unsigned int mcPretty_getcurpos (mcPretty_pretty s)
extern "C" unsigned int mcPretty_getseekpos (mcPretty_pretty s)
{
return s->seekPos;
return static_cast<mcPretty_pretty__opaque> (s)->seekPos;
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
@ -359,7 +353,7 @@ extern "C" unsigned int mcPretty_getseekpos (mcPretty_pretty s)
extern "C" unsigned int mcPretty_getcurline (mcPretty_pretty s)
{
return s->curLine;
return static_cast<mcPretty_pretty__opaque> (s)->curLine;
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
@ -369,7 +363,7 @@ extern "C" void mcPretty_setNeedSpace (mcPretty_pretty s)
/*
setneedSpace - sets needSpace flag to TRUE.
*/
s->needsSpace = true;
static_cast<mcPretty_pretty__opaque> (s)->needsSpace = true;
}
@ -379,7 +373,7 @@ extern "C" void mcPretty_setNeedSpace (mcPretty_pretty s)
extern "C" void mcPretty_noSpace (mcPretty_pretty s)
{
s->needsSpace = false;
static_cast<mcPretty_pretty__opaque> (s)->needsSpace = false;
}
@ -412,25 +406,25 @@ extern "C" void mcPretty_prints (mcPretty_pretty p, DynamicStrings_String s)
l = DynamicStrings_Length (s);
i = 0;
flushSpace (p);
flushSpace (static_cast<mcPretty_pretty__opaque> (p));
while (i < l)
{
if ((((i+2) <= l) && ((DynamicStrings_char (s, static_cast<int> (i))) == '\\')) && ((DynamicStrings_char (s, static_cast<int> (i+1))) == 'n'))
{
p->needsIndent = true;
p->needsSpace = false;
p->curPos = 0;
(*p->writeln.proc) ();
p->seekPos += 1;
p->curLine += 1;
static_cast<mcPretty_pretty__opaque> (p)->needsIndent = true;
static_cast<mcPretty_pretty__opaque> (p)->needsSpace = false;
static_cast<mcPretty_pretty__opaque> (p)->curPos = 0;
(*static_cast<mcPretty_pretty__opaque> (p)->writeln.proc) ();
static_cast<mcPretty_pretty__opaque> (p)->seekPos += 1;
static_cast<mcPretty_pretty__opaque> (p)->curLine += 1;
i += 1;
}
else
{
flushIndent (p);
(*p->write_.proc) (DynamicStrings_char (s, static_cast<int> (i)));
p->curPos += 1;
p->seekPos += 1;
flushIndent (static_cast<mcPretty_pretty__opaque> (p));
(*static_cast<mcPretty_pretty__opaque> (p)->write_.proc) (DynamicStrings_char (s, static_cast<int> (i)));
static_cast<mcPretty_pretty__opaque> (p)->curPos += 1;
static_cast<mcPretty_pretty__opaque> (p)->seekPos += 1;
}
i += 1;
}
@ -449,21 +443,21 @@ extern "C" void mcPretty_raw (mcPretty_pretty p, DynamicStrings_String s)
l = DynamicStrings_Length (s);
i = 0;
flushSpace (p);
flushIndent (p);
flushSpace (static_cast<mcPretty_pretty__opaque> (p));
flushIndent (static_cast<mcPretty_pretty__opaque> (p));
while (i < l)
{
(*p->write_.proc) (DynamicStrings_char (s, static_cast<int> (i)));
p->curPos += 1;
p->seekPos += 1;
(*static_cast<mcPretty_pretty__opaque> (p)->write_.proc) (DynamicStrings_char (s, static_cast<int> (i)));
static_cast<mcPretty_pretty__opaque> (p)->curPos += 1;
static_cast<mcPretty_pretty__opaque> (p)->seekPos += 1;
i += 1;
}
}
extern "C" void _M2_mcPretty_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_mcPretty_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}
extern "C" void _M2_mcPretty_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_mcPretty_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}

View File

@ -36,9 +36,9 @@ Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
# undef NULL
# define NULL 0
#endif
#define _mcPrintf_H
#define _mcPrintf_C
#include "GmcPrintf.h"
# include "GSFIO.h"
# include "GFIO.h"
# include "GDynamicStrings.h"
@ -167,7 +167,7 @@ static void cast (unsigned char *a, unsigned int _a_high, const unsigned char *b
{
for (i=0; i<=_a_high; i++)
{
a[i] = b[i];
const_cast<unsigned char *>(a)[i] = b[i];
}
}
else
@ -199,7 +199,7 @@ static bool TranslateNameToCharStar (char *a, unsigned int _a_high, unsigned int
{
if ((a[i+1] == 'a') && (argno == n))
{
a[i+1] = 's';
const_cast<char *>(a)[i+1] = 's';
return true;
}
argno += 1;
@ -647,10 +647,10 @@ extern "C" void mcPrintf_fprintf4 (FIO_File file, const char *a_, unsigned int _
{} /* empty. */
}
extern "C" void _M2_mcPrintf_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_mcPrintf_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}
extern "C" void _M2_mcPrintf_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_mcPrintf_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}

View File

@ -24,9 +24,9 @@ Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
typedef struct { PROC_t proc; } PROC;
# endif
#define _mcQuiet_H
#define _mcQuiet_C
#include "GmcQuiet.h"
# include "GmcOptions.h"
# include "GmcPrintf.h"
@ -121,10 +121,10 @@ extern "C" void mcQuiet_qprintf4 (const char *a_, unsigned int _a_high, const un
}
}
extern "C" void _M2_mcQuiet_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_mcQuiet_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}
extern "C" void _M2_mcQuiet_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_mcQuiet_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}

View File

@ -25,17 +25,15 @@ Boston, MA 02110-1301, USA. */
typedef struct { PROC_t proc; } PROC;
# endif
#define _mcReserved_H
#define _mcReserved_C
typedef enum {mcReserved_eoftok, mcReserved_plustok, mcReserved_minustok, mcReserved_timestok, mcReserved_dividetok, mcReserved_becomestok, mcReserved_ambersandtok, mcReserved_periodtok, mcReserved_commatok, mcReserved_semicolontok, mcReserved_lparatok, mcReserved_rparatok, mcReserved_lsbratok, mcReserved_rsbratok, mcReserved_lcbratok, mcReserved_rcbratok, mcReserved_uparrowtok, mcReserved_singlequotetok, mcReserved_equaltok, mcReserved_hashtok, mcReserved_lesstok, mcReserved_greatertok, mcReserved_lessgreatertok, mcReserved_lessequaltok, mcReserved_greaterequaltok, mcReserved_ldirectivetok, mcReserved_rdirectivetok, mcReserved_periodperiodtok, mcReserved_colontok, mcReserved_doublequotestok, mcReserved_bartok, mcReserved_andtok, mcReserved_arraytok, mcReserved_begintok, mcReserved_bytok, mcReserved_casetok, mcReserved_consttok, mcReserved_definitiontok, mcReserved_divtok, mcReserved_dotok, mcReserved_elsetok, mcReserved_elsiftok, mcReserved_endtok, mcReserved_excepttok, mcReserved_exittok, mcReserved_exporttok, mcReserved_finallytok, mcReserved_fortok, mcReserved_fromtok, mcReserved_iftok, mcReserved_implementationtok, mcReserved_importtok, mcReserved_intok, mcReserved_looptok, mcReserved_modtok, mcReserved_moduletok, mcReserved_nottok, mcReserved_oftok, mcReserved_ortok, mcReserved_packedsettok, mcReserved_pointertok, mcReserved_proceduretok, mcReserved_qualifiedtok, mcReserved_unqualifiedtok, mcReserved_recordtok, mcReserved_remtok, mcReserved_repeattok, mcReserved_retrytok, mcReserved_returntok, mcReserved_settok, mcReserved_thentok, mcReserved_totok, mcReserved_typetok, mcReserved_untiltok, mcReserved_vartok, mcReserved_whiletok, mcReserved_withtok, mcReserved_asmtok, mcReserved_volatiletok, mcReserved_periodperiodperiodtok, mcReserved_datetok, mcReserved_linetok, mcReserved_filetok, mcReserved_attributetok, mcReserved_builtintok, mcReserved_inlinetok, mcReserved_integertok, mcReserved_identtok, mcReserved_realtok, mcReserved_stringtok, mcReserved_commenttok} mcReserved_toktype;
#include "GmcReserved.h"
extern "C" void _M2_mcReserved_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_mcReserved_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}
extern "C" void _M2_mcReserved_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_mcReserved_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}

View File

@ -36,9 +36,9 @@ Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
# undef NULL
# define NULL 0
#endif
#define _mcSearch_H
#define _mcSearch_C
#include "GmcSearch.h"
# include "GSFIO.h"
# include "GmcFileName.h"
# include "GDynamicStrings.h"
@ -399,11 +399,11 @@ extern "C" void mcSearch_setModExtension (DynamicStrings_String ext)
Mod = DynamicStrings_Dup (ext);
}
extern "C" void _M2_mcSearch_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_mcSearch_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
Init ();
}
extern "C" void _M2_mcSearch_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_mcSearch_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}

View File

@ -31,16 +31,16 @@ Boston, MA 02110-1301, USA. */
# undef NULL
# define NULL 0
#endif
#define _mcStack_H
#define _mcStack_C
#include "GmcStack.h"
# include "GStorage.h"
# include "GIndexing.h"
# include "GM2RTS.h"
typedef struct mcStack__T1_r mcStack__T1;
typedef mcStack__T1 *mcStack_stack;
typedef mcStack__T1 *mcStack_stack__opaque;
struct mcStack__T1_r {
Indexing_Index list;
@ -101,12 +101,12 @@ extern "C" void * mcStack_access (mcStack_stack s, unsigned int i);
extern "C" mcStack_stack mcStack_init (void)
{
mcStack_stack s;
mcStack_stack__opaque s;
Storage_ALLOCATE ((void **) &s, sizeof (mcStack__T1));
s->list = Indexing_InitIndex (1);
s->count = 0;
return s;
return static_cast<mcStack_stack> (s);
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
@ -118,9 +118,9 @@ extern "C" mcStack_stack mcStack_init (void)
extern "C" void mcStack_kill (mcStack_stack *s)
{
(*s)->list = Indexing_KillIndex ((*s)->list);
static_cast<mcStack_stack__opaque> ((*s))->list = Indexing_KillIndex (static_cast<mcStack_stack__opaque> ((*s))->list);
Storage_DEALLOCATE ((void **) &(*s), sizeof (mcStack__T1));
(*s) = NULL;
(*s) = static_cast<mcStack_stack> (NULL);
}
@ -131,15 +131,15 @@ extern "C" void mcStack_kill (mcStack_stack *s)
extern "C" void * mcStack_push (mcStack_stack s, void * a)
{
if (s->count == 0)
if (static_cast<mcStack_stack__opaque> (s)->count == 0)
{
Indexing_PutIndice (s->list, Indexing_LowIndice (s->list), a);
Indexing_PutIndice (static_cast<mcStack_stack__opaque> (s)->list, Indexing_LowIndice (static_cast<mcStack_stack__opaque> (s)->list), a);
}
else
{
Indexing_PutIndice (s->list, (Indexing_HighIndice (s->list))+1, a);
Indexing_PutIndice (static_cast<mcStack_stack__opaque> (s)->list, (Indexing_HighIndice (static_cast<mcStack_stack__opaque> (s)->list))+1, a);
}
s->count += 1;
static_cast<mcStack_stack__opaque> (s)->count += 1;
return a;
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
@ -154,16 +154,16 @@ extern "C" void * mcStack_pop (mcStack_stack s)
{
void * a;
if (s->count == 0)
if (static_cast<mcStack_stack__opaque> (s)->count == 0)
{
M2RTS_HALT (-1);
__builtin_unreachable ();
}
else
{
s->count -= 1;
a = Indexing_GetIndice (s->list, Indexing_HighIndice (s->list));
Indexing_DeleteIndice (s->list, Indexing_HighIndice (s->list));
static_cast<mcStack_stack__opaque> (s)->count -= 1;
a = Indexing_GetIndice (static_cast<mcStack_stack__opaque> (s)->list, Indexing_HighIndice (static_cast<mcStack_stack__opaque> (s)->list));
Indexing_DeleteIndice (static_cast<mcStack_stack__opaque> (s)->list, Indexing_HighIndice (static_cast<mcStack_stack__opaque> (s)->list));
return a;
}
ReturnException ("../../gcc/m2/mc/mcStack.def", 20, 1);
@ -192,7 +192,7 @@ extern "C" void * mcStack_replace (mcStack_stack s, void * a)
extern "C" unsigned int mcStack_depth (mcStack_stack s)
{
return s->count;
return static_cast<mcStack_stack__opaque> (s)->count;
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
@ -207,23 +207,23 @@ extern "C" unsigned int mcStack_depth (mcStack_stack s)
extern "C" void * mcStack_access (mcStack_stack s, unsigned int i)
{
if ((i > s->count) || (i == 0))
if ((i > static_cast<mcStack_stack__opaque> (s)->count) || (i == 0))
{
M2RTS_HALT (-1);
__builtin_unreachable ();
}
else
{
return Indexing_GetIndice (s->list, i);
return Indexing_GetIndice (static_cast<mcStack_stack__opaque> (s)->list, i);
}
ReturnException ("../../gcc/m2/mc/mcStack.def", 20, 1);
__builtin_unreachable ();
}
extern "C" void _M2_mcStack_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_mcStack_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}
extern "C" void _M2_mcStack_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_mcStack_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}

View File

@ -42,9 +42,9 @@ along with GNU Modula-2; see the file COPYING3. If not see
# undef NULL
# define NULL 0
#endif
#define _mcStream_H
#define _mcStream_C
#include "GmcStream.h"
# include "GFIO.h"
# include "Glibc.h"
# include "GIndexing.h"
@ -264,13 +264,13 @@ extern "C" void mcStream_removeFiles (void)
listOfFiles = alists_initList ();
}
extern "C" void _M2_mcStream_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_mcStream_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
listOfFiles = alists_initList ();
seenDest = false;
frag = Indexing_InitIndex (1);
}
extern "C" void _M2_mcStream_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_mcStream_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}

View File

@ -41,9 +41,9 @@ see <https://www.gnu.org/licenses/>. */
# undef NULL
# define NULL 0
#endif
#define _mcp1_H
#define _mcp1_C
#include "Gmcp1.h"
# include "GDynamicStrings.h"
# include "GmcError.h"
# include "GnameKey.h"
@ -1831,7 +1831,8 @@ static void DefinitionModule (mcp1_SetOfStop0 stopset0, mcp1_SetOfStop1 stopset1
% n := makeType (curident) %
( ';'
% putTypeHidden (n) %
% putTypeHidden (n) ;
putTypeOpaque (n) %
| '=' Type Alignment
';' ) }
@ -6955,7 +6956,8 @@ static void DefinitionModule (mcp1_SetOfStop0 stopset0, mcp1_SetOfStop1 stopset1
% n := makeType (curident) %
( ';'
% putTypeHidden (n) %
% putTypeHidden (n) ;
putTypeOpaque (n) %
| '=' Type Alignment
';' ) }
@ -6976,6 +6978,7 @@ static void DefTypeDeclaration (mcp1_SetOfStop0 stopset0, mcp1_SetOfStop1 stopse
{
Expect (mcReserved_semicolontok, stopset0, stopset1, stopset2|(mcp1_SetOfStop2) ((1 << (mcReserved_identtok-mcReserved_recordtok))));
decl_putTypeHidden (n);
decl_putTypeOpaque (n);
}
else if (mcLexBuf_currenttoken == mcReserved_equaltok)
{
@ -7257,10 +7260,10 @@ extern "C" bool mcp1_CompilationUnit (void)
__builtin_unreachable ();
}
extern "C" void _M2_mcp1_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_mcp1_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}
extern "C" void _M2_mcp1_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_mcp1_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}

View File

@ -41,9 +41,9 @@ see <https://www.gnu.org/licenses/>. */
# undef NULL
# define NULL 0
#endif
#define _mcp2_H
#define _mcp2_C
#include "Gmcp2.h"
# include "GDynamicStrings.h"
# include "GmcError.h"
# include "GnameKey.h"
@ -7629,10 +7629,10 @@ extern "C" bool mcp2_CompilationUnit (void)
__builtin_unreachable ();
}
extern "C" void _M2_mcp2_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_mcp2_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}
extern "C" void _M2_mcp2_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_mcp2_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}

View File

@ -41,9 +41,9 @@ see <https://www.gnu.org/licenses/>. */
# undef NULL
# define NULL 0
#endif
#define _mcp3_H
#define _mcp3_C
#include "Gmcp3.h"
# include "GDynamicStrings.h"
# include "GmcError.h"
# include "GnameKey.h"
@ -7846,10 +7846,10 @@ extern "C" bool mcp3_CompilationUnit (void)
__builtin_unreachable ();
}
extern "C" void _M2_mcp3_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_mcp3_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}
extern "C" void _M2_mcp3_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_mcp3_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}

View File

@ -41,9 +41,9 @@ see <https://www.gnu.org/licenses/>. */
# undef NULL
# define NULL 0
#endif
#define _mcp4_H
#define _mcp4_C
#include "Gmcp4.h"
# include "GDynamicStrings.h"
# include "GmcError.h"
# include "GnameKey.h"
@ -7709,10 +7709,10 @@ extern "C" bool mcp4_CompilationUnit (void)
__builtin_unreachable ();
}
extern "C" void _M2_mcp4_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_mcp4_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}
extern "C" void _M2_mcp4_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_mcp4_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}

View File

@ -41,9 +41,9 @@ see <https://www.gnu.org/licenses/>. */
# undef NULL
# define NULL 0
#endif
#define _mcp5_H
#define _mcp5_C
#include "Gmcp5.h"
# include "GDynamicStrings.h"
# include "GmcError.h"
# include "GnameKey.h"
@ -5553,7 +5553,7 @@ static void SubDesignator (mcp5_SetOfStop0 stopset0, mcp5_SetOfStop1 stopset1, m
{
ErrorArray ((const char *) "no expression found", 19);
mcError_flushErrors ();
return ;
return;
}
type = decl_skipType (decl_getType (n));
if (mcLexBuf_currenttoken == mcReserved_periodtok)
@ -8568,10 +8568,10 @@ extern "C" bool mcp5_CompilationUnit (void)
__builtin_unreachable ();
}
extern "C" void _M2_mcp5_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_mcp5_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}
extern "C" void _M2_mcp5_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_mcp5_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}

View File

@ -43,9 +43,9 @@ along with GNU Modula-2; see the file COPYING3. If not see
# undef NULL
# define NULL 0
#endif
#define _nameKey_H
#define _nameKey_C
#include "GnameKey.h"
# include "GSYSTEM.h"
# include "GStorage.h"
# include "GIndexing.h"
@ -394,13 +394,13 @@ extern "C" void nameKey_getKey (nameKey_Name key, char *a, unsigned int _a_high)
higha = _a_high;
while (((p != NULL) && (i <= higha)) && ((*p) != ASCII_nul))
{
a[i] = (*p);
const_cast<char *>(a)[i] = (*p);
p += 1;
i += 1;
}
if (i <= higha)
{
a[i] = ASCII_nul;
const_cast<char *>(a)[i] = ASCII_nul;
}
}
@ -572,7 +572,7 @@ extern "C" void * nameKey_keyToCharStar (nameKey_Name key)
__builtin_unreachable ();
}
extern "C" void _M2_nameKey_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_nameKey_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
lastIndice = 0;
keyIndex = Indexing_InitIndex (1);
@ -580,6 +580,6 @@ extern "C" void _M2_nameKey_init (__attribute__((unused)) int argc,__attribute__
binaryTree->left = NULL;
}
extern "C" void _M2_nameKey_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_nameKey_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}

View File

@ -38,9 +38,9 @@ along with GNU Modula-2; see the file COPYING3. If not see
# undef NULL
# define NULL 0
#endif
#define _symbolKey_H
#define _symbolKey_C
#include "GsymbolKey.h"
# include "GStorage.h"
# include "GStrIO.h"
# include "GNumberIO.h"
@ -54,19 +54,13 @@ typedef struct symbolKey_performOperation_p symbolKey_performOperation;
typedef struct symbolKey__T1_r symbolKey__T1;
typedef symbolKey__T1 *symbolKey_symbolTree;
typedef bool (*symbolKey_isSymbol_t) (void *);
struct symbolKey_isSymbol_p { symbolKey_isSymbol_t proc; };
typedef void (*symbolKey_performOperation_t) (void *);
struct symbolKey_performOperation_p { symbolKey_performOperation_t proc; };
typedef symbolKey__T1 *symbolKey_symbolTree__opaque;
struct symbolKey__T1_r {
nameKey_Name name;
void *key;
symbolKey_symbolTree left;
symbolKey_symbolTree right;
void * key;
symbolKey_symbolTree__opaque left;
symbolKey_symbolTree__opaque right;
};
extern "C" symbolKey_symbolTree symbolKey_initTree (void);
@ -113,7 +107,7 @@ extern "C" void symbolKey_foreachNodeDo (symbolKey_symbolTree t, symbolKey_perfo
if an entry is found, father is set to the node above child.
*/
static void findNodeAndParentInTree (symbolKey_symbolTree t, nameKey_Name n, symbolKey_symbolTree *child, symbolKey_symbolTree *father);
static void findNodeAndParentInTree (symbolKey_symbolTree__opaque t, nameKey_Name n, symbolKey_symbolTree__opaque *child, symbolKey_symbolTree__opaque *father);
/*
searchForAny - performs the search required for doesTreeContainAny.
@ -121,7 +115,7 @@ static void findNodeAndParentInTree (symbolKey_symbolTree t, nameKey_Name n, sym
therefore we must skip over it.
*/
static bool searchForAny (symbolKey_symbolTree t, symbolKey_isSymbol p);
static bool searchForAny (symbolKey_symbolTree__opaque t, symbolKey_isSymbol p);
/*
searchAndDo - searches all the nodes in symbolTree, t, and
@ -129,7 +123,7 @@ static bool searchForAny (symbolKey_symbolTree t, symbolKey_isSymbol p);
It traverse the tree in order.
*/
static void searchAndDo (symbolKey_symbolTree t, symbolKey_performOperation p);
static void searchAndDo (symbolKey_symbolTree__opaque t, symbolKey_performOperation p);
/*
@ -137,7 +131,7 @@ static void searchAndDo (symbolKey_symbolTree t, symbolKey_performOperation p);
if an entry is found, father is set to the node above child.
*/
static void findNodeAndParentInTree (symbolKey_symbolTree t, nameKey_Name n, symbolKey_symbolTree *child, symbolKey_symbolTree *father)
static void findNodeAndParentInTree (symbolKey_symbolTree__opaque t, nameKey_Name n, symbolKey_symbolTree__opaque *child, symbolKey_symbolTree__opaque *father)
{
/* remember to skip the sentinal value and assign father and child */
(*father) = t;
@ -171,7 +165,7 @@ static void findNodeAndParentInTree (symbolKey_symbolTree t, nameKey_Name n, sym
therefore we must skip over it.
*/
static bool searchForAny (symbolKey_symbolTree t, symbolKey_isSymbol p)
static bool searchForAny (symbolKey_symbolTree__opaque t, symbolKey_isSymbol p)
{
if (t == NULL)
{
@ -192,7 +186,7 @@ static bool searchForAny (symbolKey_symbolTree t, symbolKey_isSymbol p)
It traverse the tree in order.
*/
static void searchAndDo (symbolKey_symbolTree t, symbolKey_performOperation p)
static void searchAndDo (symbolKey_symbolTree__opaque t, symbolKey_performOperation p)
{
if (t != NULL)
{
@ -204,12 +198,12 @@ static void searchAndDo (symbolKey_symbolTree t, symbolKey_performOperation p)
extern "C" symbolKey_symbolTree symbolKey_initTree (void)
{
symbolKey_symbolTree t;
symbolKey_symbolTree__opaque t;
Storage_ALLOCATE ((void **) &t, sizeof (symbolKey__T1)); /* The value entity */
t->left = NULL;
t->right = NULL;
return t;
t->left = static_cast<symbolKey_symbolTree__opaque> (NULL);
t->right = static_cast<symbolKey_symbolTree__opaque> (NULL);
return static_cast<symbolKey_symbolTree> (t);
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
@ -218,17 +212,17 @@ extern "C" void symbolKey_killTree (symbolKey_symbolTree *t)
{
if ((*t) != NULL)
{
symbolKey_killTree (&(*t)->left);
symbolKey_killTree (&(*t)->right);
symbolKey_killTree (reinterpret_cast<symbolKey_symbolTree *> (&static_cast<symbolKey_symbolTree__opaque> ((*t))->left));
symbolKey_killTree (reinterpret_cast<symbolKey_symbolTree *> (&static_cast<symbolKey_symbolTree__opaque> ((*t))->right));
Storage_DEALLOCATE ((void **) &(*t), sizeof (symbolKey__T1));
(*t) = NULL;
(*t) = static_cast<symbolKey_symbolTree> (NULL);
}
}
extern "C" void * symbolKey_getSymKey (symbolKey_symbolTree t, nameKey_Name name)
{
symbolKey_symbolTree father;
symbolKey_symbolTree child;
symbolKey_symbolTree__opaque father;
symbolKey_symbolTree__opaque child;
if (t == NULL)
{
@ -236,7 +230,7 @@ extern "C" void * symbolKey_getSymKey (symbolKey_symbolTree t, nameKey_Name name
}
else
{
findNodeAndParentInTree (t, name, &child, &father);
findNodeAndParentInTree (static_cast<symbolKey_symbolTree__opaque> (t), name, &child, &father);
if (child == NULL)
{
return symbolKey_NulKey;
@ -252,10 +246,10 @@ extern "C" void * symbolKey_getSymKey (symbolKey_symbolTree t, nameKey_Name name
extern "C" void symbolKey_putSymKey (symbolKey_symbolTree t, nameKey_Name name, void * key)
{
symbolKey_symbolTree father;
symbolKey_symbolTree child;
symbolKey_symbolTree__opaque father;
symbolKey_symbolTree__opaque child;
findNodeAndParentInTree (t, name, &child, &father);
findNodeAndParentInTree (static_cast<symbolKey_symbolTree__opaque> (t), name, &child, &father);
if (child == NULL)
{
/* no child found, now is name less than father or greater? */
@ -279,8 +273,8 @@ extern "C" void symbolKey_putSymKey (symbolKey_symbolTree t, nameKey_Name name,
father->right = child;
}
}
child->right = NULL;
child->left = NULL;
child->right = static_cast<symbolKey_symbolTree__opaque> (NULL);
child->left = static_cast<symbolKey_symbolTree__opaque> (NULL);
child->key = key;
child->name = name;
}
@ -300,11 +294,11 @@ extern "C" void symbolKey_putSymKey (symbolKey_symbolTree t, nameKey_Name name,
extern "C" void symbolKey_delSymKey (symbolKey_symbolTree t, nameKey_Name name)
{
symbolKey_symbolTree i;
symbolKey_symbolTree child;
symbolKey_symbolTree father;
symbolKey_symbolTree__opaque i;
symbolKey_symbolTree__opaque child;
symbolKey_symbolTree__opaque father;
findNodeAndParentInTree (t, name, &child, &father); /* find father and child of the node */
findNodeAndParentInTree (static_cast<symbolKey_symbolTree__opaque> (t), name, &child, &father); /* find father and child of the node */
if ((child != NULL) && (child->name == name))
{
/* Have found the node to be deleted */
@ -364,7 +358,7 @@ extern "C" void symbolKey_delSymKey (symbolKey_symbolTree t, nameKey_Name name)
extern "C" bool symbolKey_isEmptyTree (symbolKey_symbolTree t)
{
return t->left == NULL;
return static_cast<symbolKey_symbolTree__opaque> (t)->left == NULL;
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
@ -380,7 +374,7 @@ extern "C" bool symbolKey_isEmptyTree (symbolKey_symbolTree t)
extern "C" bool symbolKey_doesTreeContainAny (symbolKey_symbolTree t, symbolKey_isSymbol p)
{
return searchForAny (t->left, p);
return searchForAny (static_cast<symbolKey_symbolTree__opaque> (t)->left, p);
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
@ -395,13 +389,13 @@ extern "C" bool symbolKey_doesTreeContainAny (symbolKey_symbolTree t, symbolKey_
extern "C" void symbolKey_foreachNodeDo (symbolKey_symbolTree t, symbolKey_performOperation p)
{
searchAndDo (t->left, p);
searchAndDo (static_cast<symbolKey_symbolTree__opaque> (t)->left, p);
}
extern "C" void _M2_symbolKey_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_symbolKey_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}
extern "C" void _M2_symbolKey_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_symbolKey_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}

View File

@ -34,9 +34,9 @@ along with GNU Modula-2; see the file COPYING3. If not see
# undef NULL
# define NULL 0
#endif
#define _varargs_H
#define _varargs_C
#include "Gvarargs.h"
# include "GStorage.h"
# include "Glibc.h"
# include "GSYSTEM.h"
@ -51,10 +51,10 @@ typedef unsigned char *varargs_ptrToByte;
typedef struct varargs__T7_a varargs__T7;
typedef varargs__T6 *varargs_vararg;
typedef varargs__T6 *varargs_vararg__opaque;
struct varargs_argDesc_r {
void *ptr;
void * ptr;
unsigned int len;
};
@ -62,7 +62,7 @@ struct varargs__T7_a { varargs_argDesc array[MaxArg+1]; };
struct varargs__T6_r {
unsigned int nArgs;
unsigned int i;
void *contents;
void * contents;
unsigned int size;
varargs__T7 arg;
};
@ -138,7 +138,7 @@ extern "C" varargs_vararg varargs_start4 (const unsigned char *a_, unsigned int
extern "C" unsigned int varargs_nargs (varargs_vararg v)
{
return v->nArgs;
return static_cast<varargs_vararg__opaque> (v)->nArgs;
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
@ -156,20 +156,20 @@ extern "C" void varargs_arg (varargs_vararg v, unsigned char *a, unsigned int _a
arg__T1 p;
unsigned int j;
if (v->i == v->nArgs)
if (static_cast<varargs_vararg__opaque> (v)->i == static_cast<varargs_vararg__opaque> (v)->nArgs)
{
M2RTS_HALT (-1); /* too many calls to arg. */
__builtin_unreachable ();
}
else
{
if ((_a_high+1) == v->arg.array[v->i].len)
if ((_a_high+1) == static_cast<varargs_vararg__opaque> (v)->arg.array[static_cast<varargs_vararg__opaque> (v)->i].len)
{
p = static_cast<arg__T1> (v->arg.array[v->i].ptr);
p = static_cast<arg__T1> (static_cast<varargs_vararg__opaque> (v)->arg.array[static_cast<varargs_vararg__opaque> (v)->i].ptr);
j = 0;
while (j <= _a_high)
{
a[j] = (*p);
const_cast<unsigned char *>(a)[j] = (*p);
p += 1;
j += 1;
}
@ -179,7 +179,7 @@ extern "C" void varargs_arg (varargs_vararg v, unsigned char *a, unsigned int _a
M2RTS_HALT (-1); /* parameter mismatch. */
__builtin_unreachable ();
}
v->i += 1;
static_cast<varargs_vararg__opaque> (v)->i += 1;
}
}
@ -190,7 +190,7 @@ extern "C" void varargs_arg (varargs_vararg v, unsigned char *a, unsigned int _a
extern "C" void varargs_next (varargs_vararg v, unsigned int i)
{
v->i = i;
static_cast<varargs_vararg__opaque> (v)->i = i;
}
@ -200,24 +200,24 @@ extern "C" void varargs_next (varargs_vararg v, unsigned int i)
extern "C" varargs_vararg varargs_copy (varargs_vararg v)
{
varargs_vararg c;
varargs_vararg__opaque c;
unsigned int j;
unsigned int offset;
Storage_ALLOCATE ((void **) &c, sizeof (varargs__T6));
c->i = v->i;
c->nArgs = v->nArgs;
c->size = v->size;
c->i = static_cast<varargs_vararg__opaque> (v)->i;
c->nArgs = static_cast<varargs_vararg__opaque> (v)->nArgs;
c->size = static_cast<varargs_vararg__opaque> (v)->size;
Storage_ALLOCATE (&c->contents, c->size);
c->contents = libc_memcpy (c->contents, v->contents, static_cast<size_t> (c->size));
c->contents = libc_memcpy (c->contents, static_cast<varargs_vararg__opaque> (v)->contents, static_cast<size_t> (c->size));
for (j=0; j<=c->nArgs; j++)
{
offset = (unsigned int ) (((varargs_ptrToByte) (v->contents))-((varargs_ptrToByte) (v->arg.array[j].ptr)));
c->arg.array[j].ptr = reinterpret_cast<void *> ((varargs_ptrToByte) (c->contents));
offset = (unsigned int ) (((varargs_ptrToByte) (static_cast<varargs_vararg__opaque> (v)->contents))-((varargs_ptrToByte) (static_cast<varargs_vararg__opaque> (v)->arg.array[j].ptr)));
c->arg.array[j].ptr = static_cast<void *> ((varargs_ptrToByte) (c->contents));
c->arg.array[j].ptr = reinterpret_cast<void *> (reinterpret_cast<char *> (c->arg.array[j].ptr)+offset);
c->arg.array[j].len = v->arg.array[j].len;
c->arg.array[j].len = static_cast<varargs_vararg__opaque> (v)->arg.array[j].len;
}
return c;
return static_cast<varargs_vararg> (c);
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
@ -236,16 +236,16 @@ extern "C" void varargs_replace (varargs_vararg v, unsigned char *a, unsigned in
replace__T2 p;
unsigned int j;
if (v->i == v->nArgs)
if (static_cast<varargs_vararg__opaque> (v)->i == static_cast<varargs_vararg__opaque> (v)->nArgs)
{
M2RTS_HALT (-1); /* too many calls to arg. */
__builtin_unreachable ();
}
else
{
if ((_a_high+1) == v->arg.array[v->i].len)
if ((_a_high+1) == static_cast<varargs_vararg__opaque> (v)->arg.array[static_cast<varargs_vararg__opaque> (v)->i].len)
{
p = static_cast<replace__T2> (v->arg.array[v->i].ptr);
p = static_cast<replace__T2> (static_cast<varargs_vararg__opaque> (v)->arg.array[static_cast<varargs_vararg__opaque> (v)->i].ptr);
j = 0;
while (j <= _a_high)
{
@ -271,7 +271,7 @@ extern "C" void varargs_end (varargs_vararg *v)
{
if ((*v) != NULL)
{
Storage_DEALLOCATE (&(*v)->contents, sizeof (varargs_vararg));
Storage_DEALLOCATE (&static_cast<varargs_vararg__opaque> ((*v))->contents, sizeof (varargs_vararg));
Storage_DEALLOCATE ((void **) &(*v), sizeof (varargs__T6));
}
}
@ -283,7 +283,7 @@ extern "C" void varargs_end (varargs_vararg *v)
extern "C" varargs_vararg varargs_start1 (const unsigned char *a_, unsigned int _a_high)
{
varargs_vararg v;
varargs_vararg__opaque v;
unsigned char a[_a_high+1];
/* make a local copy of each unbounded array. */
@ -294,10 +294,10 @@ extern "C" varargs_vararg varargs_start1 (const unsigned char *a_, unsigned int
v->nArgs = 1;
v->size = _a_high+1;
Storage_ALLOCATE (&v->contents, v->size);
v->contents = libc_memcpy (v->contents, &a, static_cast<size_t> (v->size));
v->contents = libc_memcpy (v->contents, const_cast<void*> (static_cast<const void*>(a)), static_cast<size_t> (v->size));
v->arg.array[0].ptr = v->contents;
v->arg.array[0].len = v->size;
return v;
return static_cast<varargs_vararg> (v);
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
@ -311,7 +311,7 @@ extern "C" varargs_vararg varargs_start2 (const unsigned char *a_, unsigned int
{
typedef unsigned char *start2__T3;
varargs_vararg v;
varargs_vararg__opaque v;
start2__T3 p;
unsigned char a[_a_high+1];
unsigned char b[_b_high+1];
@ -325,14 +325,14 @@ extern "C" varargs_vararg varargs_start2 (const unsigned char *a_, unsigned int
v->nArgs = 2;
v->size = (_a_high+_b_high)+2;
Storage_ALLOCATE (&v->contents, v->size);
p = static_cast<start2__T3> (libc_memcpy (v->contents, &a, static_cast<size_t> (_a_high+1)));
v->arg.array[0].ptr = reinterpret_cast<void *> (p);
p = static_cast<start2__T3> (libc_memcpy (v->contents, const_cast<void*> (static_cast<const void*>(a)), static_cast<size_t> (_a_high+1)));
v->arg.array[0].ptr = static_cast<void *> (p);
v->arg.array[0].len = _a_high+1;
p += v->arg.array[0].len;
p = static_cast<start2__T3> (libc_memcpy (reinterpret_cast<void *> (p), &b, static_cast<size_t> (_b_high+1)));
v->arg.array[1].ptr = reinterpret_cast<void *> (p);
p = static_cast<start2__T3> (libc_memcpy (reinterpret_cast<void *> (p), const_cast<void*> (static_cast<const void*>(b)), static_cast<size_t> (_b_high+1)));
v->arg.array[1].ptr = static_cast<void *> (p);
v->arg.array[1].len = _b_high+1;
return v;
return static_cast<varargs_vararg> (v);
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
@ -346,7 +346,7 @@ extern "C" varargs_vararg varargs_start3 (const unsigned char *a_, unsigned int
{
typedef unsigned char *start3__T4;
varargs_vararg v;
varargs_vararg__opaque v;
start3__T4 p;
unsigned char a[_a_high+1];
unsigned char b[_b_high+1];
@ -362,18 +362,18 @@ extern "C" varargs_vararg varargs_start3 (const unsigned char *a_, unsigned int
v->nArgs = 3;
v->size = ((_a_high+_b_high)+_c_high)+3;
Storage_ALLOCATE (&v->contents, v->size);
p = static_cast<start3__T4> (libc_memcpy (v->contents, &a, static_cast<size_t> (_a_high+1)));
v->arg.array[0].ptr = reinterpret_cast<void *> (p);
p = static_cast<start3__T4> (libc_memcpy (v->contents, const_cast<void*> (static_cast<const void*>(a)), static_cast<size_t> (_a_high+1)));
v->arg.array[0].ptr = static_cast<void *> (p);
v->arg.array[0].len = _a_high+1;
p += v->arg.array[0].len;
p = static_cast<start3__T4> (libc_memcpy (reinterpret_cast<void *> (p), &b, static_cast<size_t> (_b_high+1)));
v->arg.array[1].ptr = reinterpret_cast<void *> (p);
p = static_cast<start3__T4> (libc_memcpy (reinterpret_cast<void *> (p), const_cast<void*> (static_cast<const void*>(b)), static_cast<size_t> (_b_high+1)));
v->arg.array[1].ptr = static_cast<void *> (p);
v->arg.array[1].len = _b_high+1;
p += v->arg.array[1].len;
p = static_cast<start3__T4> (libc_memcpy (reinterpret_cast<void *> (p), &c, static_cast<size_t> (_c_high+1)));
v->arg.array[2].ptr = reinterpret_cast<void *> (p);
p = static_cast<start3__T4> (libc_memcpy (reinterpret_cast<void *> (p), const_cast<void*> (static_cast<const void*>(c)), static_cast<size_t> (_c_high+1)));
v->arg.array[2].ptr = static_cast<void *> (p);
v->arg.array[2].len = _c_high+1;
return v;
return static_cast<varargs_vararg> (v);
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
@ -387,7 +387,7 @@ extern "C" varargs_vararg varargs_start4 (const unsigned char *a_, unsigned int
{
typedef unsigned char *start4__T5;
varargs_vararg v;
varargs_vararg__opaque v;
start4__T5 p;
unsigned char a[_a_high+1];
unsigned char b[_b_high+1];
@ -405,29 +405,29 @@ extern "C" varargs_vararg varargs_start4 (const unsigned char *a_, unsigned int
v->nArgs = 4;
v->size = (((_a_high+_b_high)+_c_high)+_d_high)+4;
Storage_ALLOCATE (&v->contents, v->size);
p = static_cast<start4__T5> (libc_memcpy (v->contents, &a, static_cast<size_t> (_a_high+1)));
p = static_cast<start4__T5> (libc_memcpy (v->contents, const_cast<void*> (static_cast<const void*>(a)), static_cast<size_t> (_a_high+1)));
v->arg.array[0].len = _a_high+1;
p += v->arg.array[0].len;
p = static_cast<start4__T5> (libc_memcpy (reinterpret_cast<void *> (p), &b, static_cast<size_t> (_b_high+1)));
v->arg.array[1].ptr = reinterpret_cast<void *> (p);
p = static_cast<start4__T5> (libc_memcpy (reinterpret_cast<void *> (p), const_cast<void*> (static_cast<const void*>(b)), static_cast<size_t> (_b_high+1)));
v->arg.array[1].ptr = static_cast<void *> (p);
v->arg.array[1].len = _b_high+1;
p += v->arg.array[1].len;
p = static_cast<start4__T5> (libc_memcpy (reinterpret_cast<void *> (p), &c, static_cast<size_t> (_c_high+1)));
v->arg.array[2].ptr = reinterpret_cast<void *> (p);
p = static_cast<start4__T5> (libc_memcpy (reinterpret_cast<void *> (p), const_cast<void*> (static_cast<const void*>(c)), static_cast<size_t> (_c_high+1)));
v->arg.array[2].ptr = static_cast<void *> (p);
v->arg.array[2].len = _c_high+1;
p += v->arg.array[2].len;
p = static_cast<start4__T5> (libc_memcpy (reinterpret_cast<void *> (p), &c, static_cast<size_t> (_c_high+1)));
v->arg.array[3].ptr = reinterpret_cast<void *> (p);
p = static_cast<start4__T5> (libc_memcpy (reinterpret_cast<void *> (p), const_cast<void*> (static_cast<const void*>(c)), static_cast<size_t> (_c_high+1)));
v->arg.array[3].ptr = static_cast<void *> (p);
v->arg.array[3].len = _c_high+1;
return v;
return static_cast<varargs_vararg> (v);
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
extern "C" void _M2_varargs_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_varargs_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}
extern "C" void _M2_varargs_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_varargs_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}

View File

@ -42,9 +42,9 @@ along with GNU Modula-2; see the file COPYING3. If not see
# undef NULL
# define NULL 0
#endif
#define _wlists_H
#define _wlists_C
#include "Gwlists.h"
# include "GStorage.h"
typedef struct wlists_performOperation_p wlists_performOperation;
@ -54,16 +54,13 @@ typedef struct wlists__T1_r wlists__T1;
typedef struct wlists__T2_a wlists__T2;
typedef wlists__T1 *wlists_wlist;
typedef void (*wlists_performOperation_t) (unsigned int);
struct wlists_performOperation_p { wlists_performOperation_t proc; };
typedef wlists__T1 *wlists_wlist__opaque;
struct wlists__T2_a { unsigned int array[maxNoOfElements-1+1]; };
struct wlists__T1_r {
unsigned int noOfElements;
wlists__T2 elements;
wlists_wlist next;
wlists_wlist__opaque next;
};
@ -149,14 +146,14 @@ extern "C" wlists_wlist wlists_duplicateList (wlists_wlist l);
removeItem - remove an element at index, i, from the wlist data type.
*/
static void removeItem (wlists_wlist p, wlists_wlist l, unsigned int i);
static void removeItem (wlists_wlist__opaque p, wlists_wlist__opaque l, unsigned int i);
/*
removeItem - remove an element at index, i, from the wlist data type.
*/
static void removeItem (wlists_wlist p, wlists_wlist l, unsigned int i)
static void removeItem (wlists_wlist__opaque p, wlists_wlist__opaque l, unsigned int i)
{
l->noOfElements -= 1;
while (i <= l->noOfElements)
@ -178,12 +175,12 @@ static void removeItem (wlists_wlist p, wlists_wlist l, unsigned int i)
extern "C" wlists_wlist wlists_initList (void)
{
wlists_wlist l;
wlists_wlist__opaque l;
Storage_ALLOCATE ((void **) &l, sizeof (wlists__T1));
l->noOfElements = 0;
l->next = NULL;
return l;
l->next = static_cast<wlists_wlist__opaque> (NULL);
return static_cast<wlists_wlist> (l);
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
@ -197,9 +194,9 @@ extern "C" void wlists_killList (wlists_wlist *l)
{
if ((*l) != NULL)
{
if ((*l)->next != NULL)
if (static_cast<wlists_wlist__opaque> ((*l))->next != NULL)
{
wlists_killList (&(*l)->next);
wlists_killList (reinterpret_cast<wlists_wlist *> (&static_cast<wlists_wlist__opaque> ((*l))->next));
}
Storage_DEALLOCATE ((void **) &(*l), sizeof (wlists__T1));
}
@ -212,21 +209,21 @@ extern "C" void wlists_killList (wlists_wlist *l)
extern "C" void wlists_putItemIntoList (wlists_wlist l, unsigned int c)
{
if (l->noOfElements < maxNoOfElements)
if (static_cast<wlists_wlist__opaque> (l)->noOfElements < maxNoOfElements)
{
l->noOfElements += 1;
l->elements.array[l->noOfElements-1] = c;
static_cast<wlists_wlist__opaque> (l)->noOfElements += 1;
static_cast<wlists_wlist__opaque> (l)->elements.array[static_cast<wlists_wlist__opaque> (l)->noOfElements-1] = c;
}
else if (l->next != NULL)
else if (static_cast<wlists_wlist__opaque> (l)->next != NULL)
{
/* avoid dangling else. */
wlists_putItemIntoList (l->next, c);
wlists_putItemIntoList (static_cast<wlists_wlist> (static_cast<wlists_wlist__opaque> (l)->next), c);
}
else
{
/* avoid dangling else. */
l->next = wlists_initList ();
wlists_putItemIntoList (l->next, c);
static_cast<wlists_wlist__opaque> (l)->next = static_cast<wlists_wlist__opaque> (wlists_initList ());
wlists_putItemIntoList (static_cast<wlists_wlist> (static_cast<wlists_wlist__opaque> (l)->next), c);
}
}
@ -239,15 +236,15 @@ extern "C" unsigned int wlists_getItemFromList (wlists_wlist l, unsigned int n)
{
while (l != NULL)
{
if (n <= l->noOfElements)
if (n <= static_cast<wlists_wlist__opaque> (l)->noOfElements)
{
return l->elements.array[n-1];
return static_cast<wlists_wlist__opaque> (l)->elements.array[n-1];
}
else
{
n -= l->noOfElements;
n -= static_cast<wlists_wlist__opaque> (l)->noOfElements;
}
l = l->next;
l = static_cast<wlists_wlist> (static_cast<wlists_wlist__opaque> (l)->next);
}
return static_cast<unsigned int> (0);
/* static analysis guarentees a RETURN statement will be used before here. */
@ -272,9 +269,9 @@ extern "C" unsigned int wlists_getIndexOfList (wlists_wlist l, unsigned int c)
else
{
i = 1;
while (i <= l->noOfElements)
while (i <= static_cast<wlists_wlist__opaque> (l)->noOfElements)
{
if (l->elements.array[i-1] == c)
if (static_cast<wlists_wlist__opaque> (l)->elements.array[i-1] == c)
{
return i;
}
@ -283,7 +280,7 @@ extern "C" unsigned int wlists_getIndexOfList (wlists_wlist l, unsigned int c)
i += 1;
}
}
return l->noOfElements+(wlists_getIndexOfList (l->next, c));
return static_cast<wlists_wlist__opaque> (l)->noOfElements+(wlists_getIndexOfList (static_cast<wlists_wlist> (static_cast<wlists_wlist__opaque> (l)->next), c));
}
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
@ -306,8 +303,8 @@ extern "C" unsigned int wlists_noOfItemsInList (wlists_wlist l)
{
t = 0;
do {
t += l->noOfElements;
l = l->next;
t += static_cast<wlists_wlist__opaque> (l)->noOfElements;
l = static_cast<wlists_wlist> (static_cast<wlists_wlist__opaque> (l)->next);
} while (! (l == NULL));
return t;
}
@ -337,33 +334,33 @@ extern "C" void wlists_includeItemIntoList (wlists_wlist l, unsigned int c)
extern "C" void wlists_removeItemFromList (wlists_wlist l, unsigned int c)
{
wlists_wlist p;
wlists_wlist__opaque p;
unsigned int i;
bool found;
if (l != NULL)
{
found = false;
p = NULL;
p = static_cast<wlists_wlist__opaque> (NULL);
do {
i = 1;
while ((i <= l->noOfElements) && (l->elements.array[i-1] != c))
while ((i <= static_cast<wlists_wlist__opaque> (l)->noOfElements) && (static_cast<wlists_wlist__opaque> (l)->elements.array[i-1] != c))
{
i += 1;
}
if ((i <= l->noOfElements) && (l->elements.array[i-1] == c))
if ((i <= static_cast<wlists_wlist__opaque> (l)->noOfElements) && (static_cast<wlists_wlist__opaque> (l)->elements.array[i-1] == c))
{
found = true;
}
else
{
p = l;
l = l->next;
p = static_cast<wlists_wlist__opaque> (l);
l = static_cast<wlists_wlist> (static_cast<wlists_wlist__opaque> (l)->next);
}
} while (! ((l == NULL) || found));
if (found)
{
removeItem (p, l, i);
removeItem (p, static_cast<wlists_wlist__opaque> (l), i);
}
}
}
@ -379,15 +376,15 @@ extern "C" void wlists_replaceItemInList (wlists_wlist l, unsigned int n, unsign
{
while (l != NULL)
{
if (n <= l->noOfElements)
if (n <= static_cast<wlists_wlist__opaque> (l)->noOfElements)
{
l->elements.array[n-1] = w;
static_cast<wlists_wlist__opaque> (l)->elements.array[n-1] = w;
}
else
{
n -= l->noOfElements;
n -= static_cast<wlists_wlist__opaque> (l)->noOfElements;
}
l = l->next;
l = static_cast<wlists_wlist> (static_cast<wlists_wlist__opaque> (l)->next);
}
}
@ -402,9 +399,9 @@ extern "C" bool wlists_isItemInList (wlists_wlist l, unsigned int c)
do {
i = 1;
while (i <= l->noOfElements)
while (i <= static_cast<wlists_wlist__opaque> (l)->noOfElements)
{
if (l->elements.array[i-1] == c)
if (static_cast<wlists_wlist__opaque> (l)->elements.array[i-1] == c)
{
return true;
}
@ -413,7 +410,7 @@ extern "C" bool wlists_isItemInList (wlists_wlist l, unsigned int c)
i += 1;
}
}
l = l->next;
l = static_cast<wlists_wlist> (static_cast<wlists_wlist__opaque> (l)->next);
} while (! (l == NULL));
return false;
/* static analysis guarentees a RETURN statement will be used before here. */
@ -446,27 +443,27 @@ extern "C" void wlists_foreachItemInListDo (wlists_wlist l, wlists_performOperat
extern "C" wlists_wlist wlists_duplicateList (wlists_wlist l)
{
wlists_wlist m;
wlists_wlist__opaque m;
unsigned int n;
unsigned int i;
m = wlists_initList ();
m = static_cast<wlists_wlist__opaque> (wlists_initList ());
n = wlists_noOfItemsInList (l);
i = 1;
while (i <= n)
{
wlists_putItemIntoList (m, wlists_getItemFromList (l, i));
wlists_putItemIntoList (static_cast<wlists_wlist> (m), wlists_getItemFromList (l, i));
i += 1;
}
return m;
return static_cast<wlists_wlist> (m);
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
extern "C" void _M2_wlists_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_wlists_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}
extern "C" void _M2_wlists_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
extern "C" void _M2_wlists_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
{
}

View File

@ -249,6 +249,21 @@ PROCEDURE isTypeHidden (n: node) : BOOLEAN ;
PROCEDURE hasHidden (n: node) : BOOLEAN ;
(*
putTypeOpaque - marks type, des, as being an opaque type.
TYPE des ;
*)
PROCEDURE putTypeOpaque (des: node) ;
(*
isTypeOpaque - returns TRUE if type, n, is an opaque type.
*)
PROCEDURE isTypeOpaque (n: node) : BOOLEAN ;
(*
isVar - returns TRUE if node, n, is a type.
*)

File diff suppressed because it is too large Load Diff

View File

@ -27,6 +27,7 @@ along with GNU Modula-2; see the file COPYING3. If not see
#include <time.h>
#include <ctype.h>
#include <stdbool.h>
#ifndef alloca
#ifdef __GNUC__
@ -101,11 +102,11 @@ static void pushFunction (char *function, int module);
static void popFunction (void);
static void checkFunction (void);
int mcflex_getColumnNo (void);
int mcflex_openSource (char *s);
bool mcflex_openSource (char *s);
int mcflex_getLineNo (void);
void mcflex_closeSource (void);
char *mcflex_getToken (void);
void _M2_mcflex_init (void);
void _M2_mcflex_init (int argc, char *argv[], char *envp[]);
int mcflex_getTotalLines (void);
extern void yylex (void);
@ -659,13 +660,13 @@ mcflex_closeSource (void)
/* openSource returns TRUE if file s can be opened and
all tokens are taken from this file. */
int
bool
mcflex_openSource (char *s)
{
FILE *newInputFile = fopen (s, "r");
if (newInputFile == NULL)
return FALSE;
return false;
else
{
isDefinitionModule = FALSE;
@ -687,7 +688,7 @@ mcflex_openSource (char *s)
if (currentLine != NULL)
currentLine->actualline = lineno;
START_FILE (filename, lineno);
return TRUE;
return true;
}
}
@ -734,12 +735,12 @@ yywrap (void)
}
void
_M2_mcflex_init (void)
_M2_mcflex_init (int argc, char *argv[], char *envp[])
{
}
void
_M2_mcflex_fini (void)
_M2_mcflex_fini (int argc, char *argv[], char *envp[])
{
}

View File

@ -22,6 +22,8 @@ along with GNU Modula-2; see the file COPYING3. If not see
#ifndef mcCommentH
#define mcCommentH
#include <stdbool.h>
/* addText the text cs is appended to the current comment. */
extern void mcComment_addText (void *cd, char *cs);
@ -34,7 +36,7 @@ extern void mcComment_addText (void *cd, char *cs);
If onlySpaces is TRUE then an inbody comment is created.
If onlySpaces is FALSE then an after statement comment is created. */
extern void *mcComment_initComment (unsigned int onlySpaces);
extern void *mcComment_initComment (bool onlySpaces);
#endif

View File

@ -752,7 +752,8 @@ BEGIN
setOutputFile (Slice (arg, 3, 0))
ELSIF optionIs ("--extended-opaque", arg)
THEN
setExtendedOpaque (TRUE)
(* setExtendedOpaque (TRUE) *)
printf0 ("IGNORING --extended-opaque - this option is no longer implemented - please adjust the call to mc\n")
ELSIF optionIs ("--debug-top", arg)
THEN
setDebugTopological (TRUE)

View File

@ -59,7 +59,7 @@ FROM mcLexBuf IMPORT currentstring, currenttoken, getToken, insertToken,
FROM decl IMPORT node, lookupDef, lookupImp, lookupModule, getSymName,
lookupSym, putDefForC,
makeProcedure, makeType, makeTypeImp, makeVar, makeConst,
enterScope, leaveScope, putTypeHidden,
enterScope, leaveScope, putTypeHidden, putTypeOpaque,
addImportedModule, getCurrentModule,
putCommentDefProcedure, putCommentModProcedure ;
@ -1064,7 +1064,8 @@ DefinitionModule := % VAR c:
DefTypeDeclaration := { Ident % VAR n: node ; %
% n := makeType (curident) %
( ";" % putTypeHidden (n) %
( ";" % putTypeHidden (n) ;
putTypeOpaque (n) %
| "=" Type Alignment ";" ) }
=:

View File

@ -0,0 +1,197 @@
(* SYSTEM.def provides access to the SYSTEM dependent module.
Copyright (C) 2001-2024 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
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.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. *)
DEFINITION MODULE SYSTEM ;
EXPORT QUALIFIED BITSPERBYTE, BYTESPERWORD,
ADDRESS, WORD, BYTE, CSIZE_T, CSSIZE_T, (* @SYSTEM_DATATYPES@ *)
ADR, TSIZE, ROTATE, SHIFT, THROW, TBITSIZE ;
(* SIZE is also exported if -fpim2 is used. *)
CONST
BITSPERBYTE = __ATTRIBUTE__ __BUILTIN__ ((BITS_PER_UNIT)) ;
BYTESPERWORD = __ATTRIBUTE__ __BUILTIN__ ((UNITS_PER_WORD)) ;
(* Note that the full list of system and sized datatypes include:
LOC, WORD, BYTE, ADDRESS,
(and the non language standard target types)
INTEGER8, INTEGER16, INTEGER32, INTEGER64,
CARDINAL8, CARDINAL16, CARDINAL32, CARDINAL64,
WORD16, WORD32, WORD64, BITSET8, BITSET16,
BITSET32, REAL32, REAL64, REAL128, COMPLEX32,
COMPLEX64, COMPLEX128, CSIZE_T, CSSIZE_T.
Also note that the non-standard data types will
move into another module in the future. *)
(* The following types are supported on this target:
TYPE
@SYSTEM_TYPES@
*)
(*
all the functions below are declared internally to gm2
======================================================
PROCEDURE ADR (VAR v: <anytype>): ADDRESS;
(* Returns the address of variable v. *)
PROCEDURE SIZE (v: <type>) : ZType;
(* Returns the number of BYTES used to store a v of
any specified <type>. Only available if -fpim2 is used.
*)
PROCEDURE TSIZE (<type>) : CARDINAL;
(* Returns the number of BYTES used to store a value of the
specified <type>.
*)
PROCEDURE ROTATE (val: <a set type>;
num: INTEGER): <type of first parameter>;
(* Returns a bit sequence obtained from val by rotating up/right
or down/right by the absolute value of num. The direction is
down/right if the sign of num is negative, otherwise the direction
is up/left.
*)
PROCEDURE SHIFT (val: <a set type>;
num: INTEGER): <type of first parameter>;
(* Returns a bit sequence obtained from val by shifting up/left
or down/right by the absolute value of num, introducing
zeros as necessary. The direction is down/right if the sign of
num is negative, otherwise the direction is up/left.
*)
PROCEDURE THROW (i: INTEGER) <* noreturn *> ;
(*
THROW is a GNU extension and was not part of the PIM or ISO
standards. It throws an exception which will be caught by the
EXCEPT block (assuming it exists). This is a compiler builtin
function which interfaces to the GCC exception handling runtime
system.
GCC uses the term throw, hence the naming distinction between
the GCC builtin and the Modula-2 runtime library procedure Raise.
The later library procedure Raise will call SYSTEM.THROW after
performing various housekeeping activities.
*)
PROCEDURE TBITSIZE (<type>) : CARDINAL ;
(* Returns the minimum number of bits necessary to represent
<type>. This procedure function is only useful for determining
the number of bits used for any type field within a packed RECORD.
It is not particularly useful elsewhere since <type> might be
optimized for speed, for example a BOOLEAN could occupy a WORD.
*)
*)
(* The following procedures are invoked by GNU Modula-2 to
shift non word sized set types. They are not strictly part
of the core PIM Modula-2, however they are used
to implement the SHIFT procedure defined above,
which are in turn used by the Logitech compatible libraries.
Users will access these procedures by using the procedure
SHIFT above and GNU Modula-2 will map SHIFT onto one of
the following procedures.
*)
(*
ShiftVal - is a runtime procedure whose job is to implement
the SHIFT procedure of ISO SYSTEM. GNU Modula-2 will
inline a SHIFT of a single WORD sized set and will only
call this routine for larger sets.
*)
PROCEDURE ShiftVal (VAR s, d: ARRAY OF BITSET;
SetSizeInBits: CARDINAL;
ShiftCount: INTEGER) ;
(*
ShiftLeft - performs the shift left for a multi word set.
This procedure might be called by the back end of
GNU Modula-2 depending whether amount is known at
compile time.
*)
PROCEDURE ShiftLeft (VAR s, d: ARRAY OF BITSET;
SetSizeInBits: CARDINAL;
ShiftCount: CARDINAL) ;
(*
ShiftRight - performs the shift left for a multi word set.
This procedure might be called by the back end of
GNU Modula-2 depending whether amount is known at
compile time.
*)
PROCEDURE ShiftRight (VAR s, d: ARRAY OF BITSET;
SetSizeInBits: CARDINAL;
ShiftCount: CARDINAL) ;
(*
RotateVal - is a runtime procedure whose job is to implement
the ROTATE procedure of ISO SYSTEM. GNU Modula-2 will
inline a ROTATE of a single WORD (or less)
sized set and will only call this routine for larger
sets.
*)
PROCEDURE RotateVal (VAR s, d: ARRAY OF BITSET;
SetSizeInBits: CARDINAL;
RotateCount: INTEGER) ;
(*
RotateLeft - performs the rotate left for a multi word set.
This procedure might be called by the back end of
GNU Modula-2 depending whether amount is known at
compile time.
*)
PROCEDURE RotateLeft (VAR s, d: ARRAY OF BITSET;
SetSizeInBits: CARDINAL;
RotateCount: CARDINAL) ;
(*
RotateRight - performs the rotate right for a multi word set.
This procedure might be called by the back end of
GNU Modula-2 depending whether amount is known at
compile time.
*)
PROCEDURE RotateRight (VAR s, d: ARRAY OF BITSET;
SetSizeInBits: CARDINAL;
RotateCount: CARDINAL) ;
END SYSTEM.

View File

@ -0,0 +1,291 @@
#!/bin/sh
# Copyright (C) 2024 Free Software Foundation, Inc.
# This program 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 of the License, or
# (at your option) any later version.
#
# This program 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
# <http://www.gnu.org/licenses/>.
# This file was written by Gaius Mulley (gaiusmod2@gmail.com)
# This script performs base language translation tests with the bootstrap tool mc.
MC=$1
GCCSRCDIR=$2
GCCBUILDDIR=$3
GXX=$4
SCRATCHDIR=${GCCBUILDDIR}/m2/mc-base-lang-test
function compile () {
echo $*
if ! $* ; then
echo $*
echo "bootstrap compiler ${MC} failed: $*"
exit 1
fi
}
function compile_def () {
SRC=$1
compile ${MC} -o=${SCRATCHDIR}/G${SRC}.h --olang=c++ --h-file-prefix=G --quiet \
-I${GCCSRCDIR}/m2/gm2-libs -I${GCCSRCDIR}/testsuite/gm2/base-lang/pass \
${GCCSRCDIR}/testsuite/gm2/base-lang/pass/${SRC}.def
}
function compile_mod () {
SRC=$1
compile ${MC} -o=${SCRATCHDIR}/G${SRC}.cc --olang=c++ --h-file-prefix=G --quiet \
-I${GCCSRCDIR}/m2/gm2-libs -I${GCCSRCDIR}/testsuite/gm2/base-lang/pass \
${GCCSRCDIR}/testsuite/gm2/base-lang/pass/${SRC}.mod
}
#
# verify - check that the translated sources compile with -Wodr
#
function verify () {
SRC=$1
if ${GXX} -Wodr -Werror -I${SCRATCHDIR} -c ${SCRATCHDIR}/G${SRC}.cc -o ${SCRATCHDIR}/G${SRC}.o ; then
echo "${NAME}: Passed"
else
echo "${NAME}: Failed (${GXX} -Wodr -Werror -I${SCRATCHDIR} -c ${SCRATCHDIR}/G${SRC}.cc)"
exit 1
fi
}
function localvar () {
rm -rf ${SCRATCHDIR}
mkdir -p ${SCRATCHDIR}
NAME="local variable creation"
compile_def localvar
compile_mod localvar
verify localvar
}
function globalvar () {
rm -rf ${SCRATCHDIR}
mkdir -p ${SCRATCHDIR}
NAME="global variable creation"
compile_def globalvar
compile_mod globalvar
verify globalvar
}
function localvarassign () {
rm -rf ${SCRATCHDIR}
mkdir -p ${SCRATCHDIR}
NAME="local variable assignment"
compile_def localvarassign
compile_mod localvarassign
verify localvarassign
}
function globalvarassign () {
rm -rf ${SCRATCHDIR}
mkdir -p ${SCRATCHDIR}
NAME="global variable assignment"
compile_def globalvarassign
compile_mod globalvarassign
verify globalvarassign
}
function localproctype () {
rm -rf ${SCRATCHDIR}
mkdir -p ${SCRATCHDIR}
NAME="local proctype creation"
compile_def localproctype
compile_mod localproctype
verify localproctype
}
function globalproctype () {
rm -rf ${SCRATCHDIR}
mkdir -p ${SCRATCHDIR}
NAME="global proctype creation"
compile_def globalproctype
compile_mod globalproctype
verify globalproctype
}
function simpleopaque () {
rm -rf ${SCRATCHDIR}
mkdir -p ${SCRATCHDIR}
NAME="simple opaque type creation"
compile_def simpleopaque
compile_mod simpleopaque
verify simpleopaque
}
function simplelist () {
rm -rf ${SCRATCHDIR}
mkdir -p ${SCRATCHDIR}
NAME="simple list opaque type field manipulation"
compile_def simplelist
compile_mod simplelist
verify simplelist
}
function simplelistiter () {
rm -rf ${SCRATCHDIR}
mkdir -p ${SCRATCHDIR}
NAME="simple iteration using opaque type field"
compile_def simplelistiter
compile_mod simplelistiter
verify simplelistiter
}
function opaqueparam () {
rm -rf ${SCRATCHDIR}
mkdir -p ${SCRATCHDIR}
NAME="opaque parameter and field assignment"
compile_def opaqueparam
compile_mod opaqueparam
verify opaqueparam
}
function opaqueuse () {
rm -rf ${SCRATCHDIR}
mkdir -p ${SCRATCHDIR}
NAME="opaque use"
compile_def opaqueparam
compile_def opaqueuse
compile_mod opaqueuse
verify opaqueuse
}
function opaquestr () {
rm -rf ${SCRATCHDIR}
mkdir -p ${SCRATCHDIR}
NAME="opaque str"
compile_def opaquestr
compile_def opaqueusestr
compile_mod opaqueusestr
verify opaqueusestr
}
function opaquenew () {
rm -rf ${SCRATCHDIR}
mkdir -p ${SCRATCHDIR}
NAME="opaque new"
compile_def opaquenew
compile_mod opaquenew
verify opaquenew
}
function opaquefield () {
rm -rf ${SCRATCHDIR}
mkdir -p ${SCRATCHDIR}
NAME="opaque field"
compile_def opaquestr
compile_def opaquefield
compile_mod opaquefield
verify opaquefield
}
function opaquevariant () {
rm -rf ${SCRATCHDIR}
mkdir -p ${SCRATCHDIR}
NAME="opaque variant"
compile_def opaquevariant
compile_mod opaquevariant
verify opaquevariant
}
function opaquevarparam () {
rm -rf ${SCRATCHDIR}
mkdir -p ${SCRATCHDIR}
NAME="opaque variant"
compile_def opaquevarparam
compile_mod opaquevarparam
verify opaquevarparam
}
function straddress () {
rm -rf ${SCRATCHDIR}
mkdir -p ${SCRATCHDIR}
NAME="string address"
compile_def SYSTEM
compile_def straddress
compile_mod straddress
verify straddress
}
function straddressexport () {
rm -rf ${SCRATCHDIR}
mkdir -p ${SCRATCHDIR}
NAME="string address"
compile_def SYSTEM
compile_def straddressexport
compile_mod straddressexport
verify straddressexport
}
function unboundedarray () {
rm -rf ${SCRATCHDIR}
mkdir -p ${SCRATCHDIR}
NAME="string address"
compile_def unboundedarray
compile_mod unboundedarray
verify unboundedarray
}
function runall () {
localvar
globalvar
localvarassign
globalvarassign
localproctype
globalproctype
simpleopaque
simplelist
simplelistiter
opaqueparam
opaqueuse
opaquestr
opaquenew
opaquefield
opaquevariant
opaquevarparam
straddress
straddressexport
unboundedarray
echo "all base language boot strap tests pass -Wodr -Werror"
}
runall

View File

@ -0,0 +1,7 @@
DEFINITION MODULE globalproctype ; (*!m2pim*)
TYPE
myproc = PROCEDURE (CARDINAL) ;
END globalproctype.

View File

@ -0,0 +1,13 @@
IMPLEMENTATION MODULE globalproctype ; (*!m2pim*)
PROCEDURE foo (c: CARDINAL) ;
BEGIN
END foo ;
VAR
p: myproc ;
BEGIN
p := foo
END globalproctype.

View File

@ -0,0 +1,3 @@
DEFINITION MODULE globalvar ; (*!m2pim*)
END globalvar.

View File

@ -0,0 +1,6 @@
IMPLEMENTATION MODULE globalvar ; (*!m2pim*)
VAR
i: INTEGER ;
BEGIN
END globalvar.

View File

@ -0,0 +1,3 @@
DEFINITION MODULE globalvarassign ; (*!m2pim*)
END globalvarassign.

View File

@ -0,0 +1,8 @@
IMPLEMENTATION MODULE globalvarassign ; (*!m2pim*)
VAR
i: INTEGER ;
BEGIN
i := 1
END globalvarassign.

View File

@ -0,0 +1,3 @@
DEFINITION MODULE localproctype ; (*!m2pim*)
END localproctype.

View File

@ -0,0 +1,16 @@
IMPLEMENTATION MODULE localproctype ; (*!m2pim*)
TYPE
myproc = PROCEDURE (CARDINAL) ;
PROCEDURE foo (c: CARDINAL) ;
BEGIN
END foo ;
VAR
p: myproc ;
BEGIN
p := foo
END localproctype.

View File

@ -0,0 +1,3 @@
DEFINITION MODULE localvar ; (*!m2pim*)
END localvar.

View File

@ -0,0 +1,11 @@
IMPLEMENTATION MODULE localvar ; (*!m2pim*)
PROCEDURE foo ;
VAR
i: INTEGER ;
BEGIN
END foo ;
BEGIN
foo
END localvar.

View File

@ -0,0 +1,3 @@
DEFINITION MODULE localvarassign ; (*!m2pim*)
END localvarassign.

View File

@ -0,0 +1,14 @@
IMPLEMENTATION MODULE localvarassign ; (*!m2pim*)
PROCEDURE foo ;
VAR
i: INTEGER ;
BEGIN
i := 1
END foo ;
BEGIN
foo
END localvarassign.

View File

@ -0,0 +1,8 @@
DEFINITION MODULE opaquefield ; (*!m2pim*)
TYPE
Content ;
PROCEDURE create () : Content ;
END opaquefield.

View File

@ -0,0 +1,19 @@
IMPLEMENTATION MODULE opaquefield ; (*!m2pim*)
FROM opaquestr IMPORT String, initString ;
TYPE
Content = POINTER TO RECORD
next: String ;
END ;
PROCEDURE create () : Content ;
VAR
c: Content ;
BEGIN
c^.next := initString () ;
RETURN c
END create ;
END opaquefield.

View File

@ -0,0 +1,8 @@
DEFINITION MODULE opaquenew ; (*!m2pim*)
TYPE
List ;
PROCEDURE dupList (l: List) : List ;
END opaquenew.

Some files were not shown because too many files have changed in this diff Show More