From 87ce8172f0bf649a8a79ef7481fb3bf35882083f Mon Sep 17 00:00:00 2001 From: Gaius Mulley Date: Fri, 30 Aug 2024 14:22:01 +0100 Subject: [PATCH] PR modula2/116181: m2rts fix -Wodr warning This patch fixes the -Wodr warning seen in pge-boot/m2rts.h when building pge. gcc/m2/ChangeLog: PR modula2/116181 * pge-boot/GM2RTS.h: Regenerate. * pge-boot/m2rts.h: Ditto. Signed-off-by: Gaius Mulley --- gcc/m2/pge-boot/GM2RTS.h | 10 +--------- gcc/m2/pge-boot/m2rts.h | 28 ++++++---------------------- 2 files changed, 7 insertions(+), 31 deletions(-) diff --git a/gcc/m2/pge-boot/GM2RTS.h b/gcc/m2/pge-boot/GM2RTS.h index 4186c8f25e4..055cc95675b 100644 --- a/gcc/m2/pge-boot/GM2RTS.h +++ b/gcc/m2/pge-boot/GM2RTS.h @@ -54,11 +54,6 @@ typedef struct M2RTS_ArgCVEnvP_p M2RTS_ArgCVEnvP; typedef void (*M2RTS_ArgCVEnvP_t) (int, void *, void *); struct M2RTS_ArgCVEnvP_p { M2RTS_ArgCVEnvP_t proc; }; -#define M2RTS_RegisterModule_Cstr(MODNAME,LIBNAME,init,fini,dep) \ - M2RTS_RegisterModule (reinterpret_cast (const_cast (MODNAME)), \ - reinterpret_cast (const_cast (LIBNAME)), \ - init, fini, dep) - EXTERN void M2RTS_ConstructModules (void * applicationmodule, void * libname, void * overrideliborder, int argc, void * argv, void * envp); EXTERN void M2RTS_DeconstructModules (void * applicationmodule, void * libname, int argc, void * argv, void * envp); @@ -68,10 +63,7 @@ EXTERN void M2RTS_DeconstructModules (void * applicationmodule, void * libname, explored to determine initialization order. */ -EXTERN void M2RTS_RegisterModule (void *name, void *libname, - M2RTS_ArgCVEnvP init, - M2RTS_ArgCVEnvP fini, - PROC dependencies); +EXTERN void M2RTS_RegisterModule (void * name, void * libname, M2RTS_ArgCVEnvP init, M2RTS_ArgCVEnvP fini, PROC dependencies); /* RequestDependant - used to specify that modulename is dependant upon diff --git a/gcc/m2/pge-boot/m2rts.h b/gcc/m2/pge-boot/m2rts.h index d8bac68fe6b..df6cbcb2c8d 100644 --- a/gcc/m2/pge-boot/m2rts.h +++ b/gcc/m2/pge-boot/m2rts.h @@ -24,31 +24,15 @@ a copy of the GCC Runtime Library Exception along with this program; see the files COPYING3 and COPYING.RUNTIME respectively. If not, see . */ -#ifdef M2_MC -/* These type definitions match those used by mc, they are defined differently - to satisfy -Wodr when building from the mc translated versions of m2 - source. */ #include "GM2RTS.h" -#else -/* These type definitions match those used by cc1gm2, they will be the same - sizeof as those above (and also for all their dependants). */ -typedef void (*M2RTS_ArgCVEnvP) (int, char **, char **); -typedef void (*PROC) (void); -#endif +#ifdef MC_M2 +/* mc sources do not register their init fini functions as they are + initialized by a static scaffold (called by main). */ +#define M2RTS_RegisterModule_Cstr(MODNAME,LIBNAME,init,fini,dep) +#else #define M2RTS_RegisterModule_Cstr(MODNAME,LIBNAME,init,fini,dep) \ M2RTS_RegisterModule (reinterpret_cast (const_cast (MODNAME)), \ reinterpret_cast (const_cast (LIBNAME)), \ init, fini, dep) - -extern "C" void M2RTS_RequestDependant (const void *modulename, const void *dependancy); -extern "C" void M2RTS_RegisterModule (void *modulename, void *libname, - M2RTS_ArgCVEnvP init, M2RTS_ArgCVEnvP fini, PROC dependencies); -extern "C" void _M2_M2RTS_init (void); - -extern "C" void M2RTS_ConstructModules (const void *, - int argc, char *argv[], char *envp[]); -extern "C" void M2RTS_Terminate (void); -extern "C" void M2RTS_DeconstructModules (void); - -extern "C" void M2RTS_Halt (const char *, const char *, const char *, int) __attribute__ ((noreturn)); +#endif