
PR108612 - m2/gm2-libs-iso/ClientSocket.mod:229:1: error: control reaches end of non-void function [-Werror=return-type] PR108551 - gcc/m2/gm2-libs-pim/Termbase.mod:128:1: error: control reaches end of non-void function [-Werror=return-type] This patch adds missing return values to the procedure functions mentioned in PR108612 and PR108551. It corrects the noreturn attribute to throw and rethrow in the modula2 frontend. The patch also changes HALT, Halt, Raise procedures in the libraries to use the <* noreturn *> attribute. Finally the patch includes rebuilt bootstrap tools mc and pge. gcc/m2/ChangeLog: * Make-lang.in (GM2_FLAGS): Add -fno-return -Wreturn-type. (GM2_ISO_FLAGS): Add -fno-return -Wreturn-type. * Make-maintainer.in (GM2PATH): Split into separate -I components. (MC-LIB-DEFS): Add RTentity.def. (m2/boot-bin/mc-devel$(exeext)): Changed -I$(GM2PATH) to $(GM2PATH). (m2/boot-bin/mc-opt$(exeext)): Separate -I paths. (m2/mc/decl.o): Separate -I paths. (gm2-bootstrap): Separate -I paths. (m2/mc-boot-gen/$(SRC_PREFIX)%.h): Separate -I paths. (m2/mc-boot-gen/$(SRC_PREFIX)decl.c): Separate -I paths. (m2/mc-boot-gen/$(SRC_PREFIX)%.c): Separate -I paths. (gm2.verifyparanoid): Separate -I paths. (gm2.verifystage12): Separate -I paths. * gm2-compiler/M2ALU.mod (GetConstructorElement): Add default Return NulSym. Remove return from the error case. * gm2-compiler/M2Base.mod (ComplexToScalar): Return RType from the error case. (MixMetaTypes): Return MakeError as a default. * gm2-compiler/M2GCCDeclare.mod (GetTypeMin): Return NulSym from the error case. (GetTypeMax): Return NulSym from the error case. * gm2-compiler/M2GenGCC.mod (IsExportedGcc): Replace Assert by InternalError. * gm2-compiler/M2Quads.mod (GetItemPointedTo): Add InternalError. (GetTypeMin): Add InternalError. (GetTypeMax): Add InternalError. * gm2-compiler/M2System.mod (InitSystem): Call PutProcedureNoReturn on Throw. * gm2-gcc/m2except.cc (m2except_InitExceptions): fn_throw_tree declare as noreturn. fn_rethrow_tree declare as noreturn. * gm2-libs-coroutines/Debug.def (Halt): Add noreturn attribute. * gm2-libs-coroutines/SYSTEM.def (THROW): Add noreturn attribute. * gm2-libs-iso/ClientSocket.mod (dorbytes): Add return FALSE. * gm2-libs-iso/EXCEPTIONS.def (RAISE): Add noreturn attribute. * gm2-libs-iso/IOLink.def (RAISEdevException): Add noreturn attribute. * gm2-libs-iso/M2RTS.def (HALT): Add noreturn attribute. (Halt): Ditto. (HaltC): Ditto. (ErrorMessage): Ditto. (AssignmentException): Ditto. (ReturnException): Ditto. (IncException): Ditto. (DecException): Ditto. (InclException): Ditto. (ExclException): Ditto. (ShiftException): Ditto. (RotateException): Ditto. (StaticArraySubscriptException): Ditto. (DynamicArraySubscriptException): Ditto. (ForLoopBeginException): Ditto. (ForLoopToException): Ditto. (ForLoopEndException): Ditto. (PointerNilException): Ditto. (NoReturnException): Ditto. (CaseException): Ditto. (WholeNonPosDivException): Ditto. (WholeNonPosModException): Ditto. (WholeZeroDivException): Ditto. (WholeZeroRemException): Ditto. (WholeValueException): Ditto. (RealValueException): Ditto. (ParameterException): Ditto. (NoException): Ditto. * gm2-libs-iso/SYSTEM.def (THROW): Ditto. * gm2-libs-iso/TermFile.mod (dorbytes): Add default return FALSE. * gm2-libs-min/M2RTS.def: Add noreturn attribute. * gm2-libs/FIO.mod (BufferedRead): Return -1. (getFileName): Return NIL. (getFileNameLength): Return 0. * gm2-libs/M2RTS.def (HaltC): Add noreturn attribute. (AssignmentException): Ditto. (ReturnException): Ditto. (IncException): Ditto. (DecException): Ditto. (InclException): Ditto. (ExclException): Ditto. (ShiftException): Ditto. (RotateException): Ditto. (StaticArraySubscriptException): Ditto. (DynamicArraySubscriptException): Ditto. (ForLoopBeginException): Ditto. (ForLoopToException): Ditto. (ForLoopEndException): Ditto. (PointerNilException): Ditto. (NoReturnException): Ditto. (CaseException): Ditto. (WholeNonPosDivException): Ditto. (WholeNonPosModException): Ditto. (WholeZeroDivException): Ditto. (WholeZeroRemException): Ditto. (WholeValueException): Ditto. (RealValueException): Ditto. (ParameterException): Ditto. (NoException): Ditto. * gm2-libs/RTExceptions.def (Raise): Ditto. * gm2-libs/RTExceptions.mod (InvokeHandler): Ditto. * gm2-libs/SYSTEM.def (THROW): Ditto. * m2.flex (_M2_m2flex_fini): Remamed to... (_M2_m2flex_finish): ...here. * mc-boot-ch/GBuiltins.c (_M2_Builtins_finish): Remamed to... (_M2_Builtins_fini): ...this. * mc-boot-ch/GRTco.c (_M2_RTco_finish): Remamed to... (_M2_RTco_fini): ...this. * mc-boot-ch/GSYSTEM.c (_M2_SYSTEM_finish): Remamed to... (_M2_SYSTEM_fini): ...this. * mc-boot-ch/GSelective.c (_M2_Selective_finish): Remamed to... (_M2_Selective_fini): ...this. * mc-boot-ch/GSysExceptions.c (_M2_SysExceptions_init): Add parameters. (_M2_SysExceptions_finish): Remamed to... (_M2_SysExceptions_fini): ...this. * mc-boot-ch/GUnixArgs.cc (_M2_UnixArgs_finish): Remamed to... (_M2_UnixArgs_fini): ...this. (_M2_UnixArgs_ctor::_M2_UnixArgs_ctor): Change parameter to _M2_UnixArgs_fini. * mc-boot-ch/Gdtoa.c (_M2_dtoa_finish): Remamed to... (_M2_dtoa_fini): ...this. * mc-boot-ch/Gerrno.c (_M2_errno_finish): Remamed to... (_M2_errno_fini): ...this. * mc-boot-ch/Gldtoa.c (_M2_ldtoa_finish): Remamed to... (_M2_ldtoa_fini): ...this. * mc-boot-ch/Gtermios.cc (_M2_termios_init): Add parameters. (_M2_termios_finish): Remamed to... (_M2_termios_fini): ...this. * mc-boot-ch/Gwrapc.c (_M2_wrapc_init): Add parameters. (_M2_wrapc_finish): Remamed to... (_M2_wrapc_fini): ...this. * mc-boot/GASCII.c: Rebuild. * mc-boot/GArgs.c: Rebuild. * mc-boot/GAssertion.c: Rebuild. * mc-boot/GBreak.c: Rebuild. * mc-boot/GCmdArgs.c: Rebuild. * mc-boot/GDebug.c: Rebuild. * mc-boot/GDynamicStrings.c: Rebuild. * mc-boot/GEnvironment.c: Rebuild. * mc-boot/GFIO.c: Rebuild. * mc-boot/GFormatStrings.c: Rebuild. * mc-boot/GFpuIO.c: Rebuild. * mc-boot/GIO.c: Rebuild. * mc-boot/GIndexing.c: Rebuild. * mc-boot/GM2Dependent.c: Rebuild. * mc-boot/GM2EXCEPTION.c: Rebuild. * mc-boot/GM2RTS.c: Rebuild. * mc-boot/GM2RTS.h: Rebuild. * mc-boot/GMemUtils.c: Rebuild. * mc-boot/GNumberIO.c: Rebuild. * mc-boot/GPushBackInput.c: Rebuild. * mc-boot/GRTExceptions.c: Rebuild. * mc-boot/GRTExceptions.h: Rebuild. * mc-boot/GRTco.h: Rebuild. * mc-boot/GRTint.c: Rebuild. * mc-boot/GSArgs.c: Rebuild. * mc-boot/GSFIO.c: Rebuild. * mc-boot/GStdIO.c: Rebuild. * mc-boot/GStorage.c: Rebuild. * mc-boot/GStrCase.c: Rebuild. * mc-boot/GStrIO.c: Rebuild. * mc-boot/GStrLib.c: Rebuild. * mc-boot/GStringConvert.c: Rebuild. * mc-boot/GSysStorage.c: Rebuild. * mc-boot/GTimeString.c: Rebuild. * mc-boot/Galists.c: Rebuild. * mc-boot/Gdecl.c: Rebuild. * mc-boot/Gkeyc.c: Rebuild. * mc-boot/Glists.c: Rebuild. * mc-boot/GmcComment.c: Rebuild. * mc-boot/GmcComp.c: Rebuild. * mc-boot/GmcDebug.c: Rebuild. * mc-boot/GmcError.c: Rebuild. * mc-boot/GmcFileName.c: Rebuild. * mc-boot/GmcLexBuf.c: Rebuild. * mc-boot/GmcMetaError.c: Rebuild. * mc-boot/GmcOptions.c: Rebuild. * mc-boot/GmcPreprocess.c: Rebuild. * mc-boot/GmcPretty.c: Rebuild. * mc-boot/GmcPrintf.c: Rebuild. * mc-boot/GmcQuiet.c: Rebuild. * mc-boot/GmcReserved.c: Rebuild. * mc-boot/GmcSearch.c: Rebuild. * mc-boot/GmcStack.c: Rebuild. * mc-boot/GmcStream.c: Rebuild. * mc-boot/Gmcp1.c: Rebuild. * mc-boot/Gmcp2.c: Rebuild. * mc-boot/Gmcp3.c: Rebuild. * mc-boot/Gmcp4.c: Rebuild. * mc-boot/Gmcp5.c: Rebuild. * mc-boot/GnameKey.c: Rebuild. * mc-boot/GsymbolKey.c: Rebuild. * mc-boot/Gtop.c: Rebuild. * mc-boot/Gvarargs.c: Rebuild. * mc-boot/Gwlists.c: Rebuild. * mc-boot/GRTentity.h: New file. * mc/decl.mod (scaffoldStatic): Change _finish to _fini. * mc/mc.flex (_M2_mcflex_fini): New function. (_M2_mcflex_finish): Remove function. * tools-src/mklink.c (GenerateFinishCalls): Change _finish to _fini. (GeneratePrototypes): Change _finish to _fini. libgm2/ChangeLog: * libm2cor/Makefile.am (libm2cor_la_M2FLAGS): Add -Wreturn-type -fcase. * libm2cor/Makefile.in: Rebuild. * libm2iso/Makefile.am (libm2iso_la_M2FLAGS): Add -Wreturn-type -fcase. * libm2iso/Makefile.in: Rebuild. * libm2log/Makefile.am (libm2log_la_M2FLAGS): Add -Wreturn-type -fcase. * libm2log/Makefile.in: Rebuild. * libm2pim/Makefile.am (libm2pim_la_M2FLAGS): Add -Wreturn-type -fcase. * libm2pim/Makefile.in: Rebuild. PR modula2/108612 PR modula2/108551 Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
156 lines
5.3 KiB
Makefile
156 lines
5.3 KiB
Makefile
# Makefile for libm2cor.
|
|
# Copyright 2013-2022 Free Software Foundation, Inc.
|
|
#
|
|
# This file 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 this program; see the file COPYING3. If not see
|
|
# <http://www.gnu.org/licenses/>.
|
|
|
|
SUFFIXES = .c .cc .mod .def .o .obj .lo .a .la
|
|
|
|
ACLOCAL_AMFLAGS = -I . -I .. -I ../config
|
|
|
|
VPATH = . @srcdir@ @srcdir@/../../gcc/m2/gm2-libs-coroutines
|
|
|
|
# Multilib support.
|
|
MAKEOVERRIDES=
|
|
|
|
gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER)
|
|
|
|
# Directory in which the compiler finds libraries etc.
|
|
libsubdir = $(libdir)/gcc/$(target_alias)/$(gcc_version)
|
|
# Used to install the shared libgcc.
|
|
slibdir = @slibdir@
|
|
|
|
toolexeclibdir=@toolexeclibdir@
|
|
toolexecdir=@toolexecdir@
|
|
GM2_FOR_TARGET=@GM2_FOR_TARGET@
|
|
|
|
MULTIDIR := $(shell $(CC) $(CFLAGS) -print-multi-directory)
|
|
MULTIOSDIR := $(shell $(CC) $(CFLAGS) -print-multi-os-directory)
|
|
|
|
MULTIOSSUBDIR := $(shell if test x$(MULTIOSDIR) != x.; then echo /$(MULTIOSDIR); fi)
|
|
inst_libdir = $(libsubdir)$(MULTISUBDIR)
|
|
inst_slibdir = $(slibdir)$(MULTIOSSUBDIR)
|
|
|
|
|
|
# Work around what appears to be a GNU make bug handling MAKEFLAGS
|
|
# values defined in terms of make variables, as is the case for CC and
|
|
# friends when we are called from the top level Makefile.
|
|
AM_MAKEFLAGS = \
|
|
"GCC_DIR=$(GCC_DIR)" \
|
|
"GM2_SRC=$(GM2_SRC)" \
|
|
"AR_FLAGS=$(AR_FLAGS)" \
|
|
"CC_FOR_BUILD=$(CC_FOR_BUILD)" \
|
|
"CC_FOR_TARGET=$(CC_FOR_TARGET)" \
|
|
"GM2_FOR_TARGET=$(GM2_FOR_TARGET)" \
|
|
"CFLAGS=$(CFLAGS)" \
|
|
"CXXFLAGS=$(CXXFLAGS)" \
|
|
"CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
|
|
"CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \
|
|
"INSTALL=$(INSTALL)" \
|
|
"INSTALL_DATA=$(INSTALL_DATA)" \
|
|
"INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
|
|
"INSTALL_SCRIPT=$(INSTALL_SCRIPT)" \
|
|
"LDFLAGS=$(LDFLAGS)" \
|
|
"LIBCFLAGS=$(LIBCFLAGS)" \
|
|
"LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \
|
|
"MAKE=$(MAKE)" \
|
|
"MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \
|
|
"MULTIBUILDTOP=$(MULTIBUILDTOP)" \
|
|
"MULTISUBDIR=$(MULTISUBDIR)" \
|
|
"MULTIOSDIR=$(MULTIOSDIR)" \
|
|
"MULTIFLAGS=$(MULTIFLAGS)" \
|
|
"PICFLAG=$(PICFLAG)" \
|
|
"PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \
|
|
"SHELL=$(SHELL)" \
|
|
"RUNTESTFLAGS=$(RUNTESTFLAGS)" \
|
|
"exec_prefix=$(exec_prefix)" \
|
|
"infodir=$(infodir)" \
|
|
"libdir=$(libdir)" \
|
|
"includedir=$(includedir)" \
|
|
"prefix=$(prefix)" \
|
|
"tooldir=$(tooldir)" \
|
|
"gxx_include_dir=$(gxx_include_dir)" \
|
|
"AR=$(AR)" \
|
|
"AS=$(AS)" \
|
|
"LD=$(LD)" \
|
|
"RANLIB=$(RANLIB)" \
|
|
"NM=$(NM)" \
|
|
"NM_FOR_BUILD=$(NM_FOR_BUILD)" \
|
|
"NM_FOR_TARGET=$(NM_FOR_TARGET)" \
|
|
"DESTDIR=$(DESTDIR)" \
|
|
"WERROR=$(WERROR)" \
|
|
"TARGET_LIB_PATH_libgm2=$(TARGET_LIB_PATH_libgm2)"
|
|
|
|
# Subdir rules rely on $(FLAGS_TO_PASS)
|
|
FLAGS_TO_PASS = $(AM_MAKEFLAGS)
|
|
|
|
|
|
if BUILD_CORLIB
|
|
M2DEFS = Debug.def Executive.def \
|
|
KeyBoardLEDs.def SYSTEM.def \
|
|
TimerHandler.def
|
|
|
|
M2MODS = Debug.mod Executive.mod \
|
|
SYSTEM.mod TimerHandler.mod
|
|
|
|
toolexeclib_LTLIBRARIES = libm2cor.la
|
|
|
|
libm2cor_la_SOURCES = $(M2MODS) KeyBoardLEDs.cc
|
|
|
|
nodist_EXTRA_libm2cor_la_SOURCES = dummy.c ## forces automake to generate the LINK definition
|
|
|
|
libm2cordir = libm2cor
|
|
libm2cor_la_DEPENDENCIES = SYSTEM.def $(addsuffix .lo, $(basename $(libm2cor_la_SOURCES)))
|
|
libm2cor_la_CFLAGS = -I. -I.. -I$(GM2_SRC)/gm2-libs -I$(GM2_SRC)/gm2-libs-iso -DBUILD_GM2_LIBS -I@srcdir@/../ -I@srcdir@/../libm2iso
|
|
libm2cor_la_M2FLAGS = -I. -I$(GM2_SRC)/gm2-libs-coroutines -I$(GM2_SRC)/gm2-libs -I$(GM2_SRC)/gm2-libs-iso -fm2-g -g -Wreturn-type -fcase
|
|
if TARGET_DARWIN
|
|
libm2cor_la_link_flags = -Wl,-undefined,dynamic_lookup
|
|
else
|
|
libm2cor_la_link_flags =
|
|
endif
|
|
libm2cor_la_LINK = $(LINK) -version-info $(libtool_VERSION) $(libm2cor_la_link_flags)
|
|
BUILT_SOURCES = SYSTEM.def
|
|
CLEANFILES = SYSTEM.def
|
|
|
|
M2LIBDIR = /m2/m2cor/
|
|
|
|
SYSTEM.def: Makefile
|
|
bash $(GM2_SRC)/tools-src/makeSystem -fpim \
|
|
$(GM2_SRC)/gm2-libs-coroutines/SYSTEM.def \
|
|
$(GM2_SRC)/gm2-libs-coroutines/SYSTEM.mod \
|
|
-I$(GM2_SRC)/gm2-libs-coroutines -I$(GM2_SRC)/gm2-libs -I$(GM2_SRC)/gm2-libs-iso \
|
|
"$(GM2_FOR_TARGET)" $@
|
|
|
|
.mod.lo:
|
|
$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(GM2_FOR_TARGET) -c $(CFLAGS_FOR_TARGET) $(LIBCFLAGS) $(libm2cor_la_M2FLAGS) $< -o $@
|
|
|
|
.cc.lo:
|
|
$(LIBTOOL) --tag=CXX --mode=compile $(CXX) -c -I$(srcdir) $(CXXFLAGS) $(LIBCFLAGS) $(libm2cor_la_CFLAGS) $< -o $@
|
|
|
|
install-data-local: force
|
|
mkdir -p $(DESTDIR)$(inst_libdir)/$(M2LIBDIR)
|
|
for i in $(M2DEFS) $(M2MODS) ; do \
|
|
if [ -f $$i ] ; then \
|
|
$(INSTALL_DATA) $$i '$(DESTDIR)$(inst_libdir)/$(M2LIBDIR)'; \
|
|
elif [ -f @srcdir@/../../gcc/m2/gm2-libs-coroutines/$$i ] ; then \
|
|
$(INSTALL_DATA) @srcdir@/../../gcc/m2/gm2-libs-coroutines/$$i '$(DESTDIR)$(inst_libdir)/$(M2LIBDIR)'; \
|
|
else \
|
|
echo "cannot find $$i" ; exit 1 ; \
|
|
fi ; \
|
|
chmod 644 $(DESTDIR)$(inst_libdir)/$(M2LIBDIR)$$i ; \
|
|
done
|
|
|
|
force:
|
|
|
|
endif
|