With the release of gcc-3.1, the weak reference to iocshRegister is

overridden by the first non-weak declaration in the iocsh.h header.
This caused iocshRegister to be undefined when building the test
applications.  Fix the problem by adding a file which provides a
dummy version of iocshRegister if the real routine is not present.
This commit is contained in:
W. Eric Norum
2002-05-17 19:24:30 +00:00
parent cc1d067da0
commit 65efdb4c29
3 changed files with 17 additions and 13 deletions

View File

@@ -5,6 +5,7 @@ SRCS += rtems_init.c
SRCS += rtems_config.c
SRCS += rtems_netconfig.c
SRCS += rtems_util.c
SRCS += rtems_dummyreg.c
LIBRARY_RTEMS = rtemsCom
LIBRARY_SRCS = $(SRCS) $(BUILD_ARCHS)

View File

@@ -0,0 +1,11 @@
/*
* Provide a dummy version of iocshRegister to be used with test applications.
*/
#include <iocsh.h>
void
iocshRegister(const iocshFuncDef *piocshFuncDef, iocshCallFunc func)
{
printf ("No iocsh -- %s not registered\n", piocshFuncDef->name);
}

View File

@@ -145,21 +145,13 @@ static void stackCheckCallFunc(const iocshArgBuf *args)
Stack_check_Dump_usage ();
}
/*
* Register RTEMS-specific commands
*/
static void iocshRegisterRTEMS (void)
{
/*
* By using a weak reference this code will work with full IOC applications
* (where iocshRegister is present) and also with test applications
* (where iocshRegister is not present).
*/
extern void iocshRegister(const iocshFuncDef *piocshFuncDef,
iocshCallFunc func) __attribute__((weak)) ;
void (*rtemsEpicsIocshRegisterFunc)(const iocshFuncDef *piocshFuncDef,
iocshCallFunc func) = iocshRegister;
if (!rtemsEpicsIocshRegisterFunc)
return;
(*rtemsEpicsIocshRegisterFunc)(&netStatFuncDef, netStatCallFunc);
(*rtemsEpicsIocshRegisterFunc)(&stackCheckFuncDef, stackCheckCallFunc);
iocshRegister(&netStatFuncDef, netStatCallFunc);
iocshRegister(&stackCheckFuncDef, stackCheckCallFunc);
}
/*