Eliminating SDCC compilation errors

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@17 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2007-02-21 02:19:19 +00:00
parent 59bd1d6954
commit 7207076a5d
9 changed files with 47 additions and 23 deletions

View File

@ -4019,10 +4019,12 @@ between Nuttx and a MoBY application:
<P> <P>
The following structure defines the action to take for given signal: The following structure defines the action to take for given signal:
<PRE> <PRE>
struct sigaction { struct sigaction
union { {
saHandType *_sa_handler; union
saVxHandType *_sa_sigaction; {
void (*_sa_handler)(int);
void (*_sa_sigaction)(int, siginfo_t *, void *);
} sa_u; } sa_u;
sigset_t sa_mask; sigset_t sa_mask;
int sa_flags; int sa_flags;
@ -4031,13 +4033,6 @@ The following structure defines the action to take for given signal:
#define sa_sigaction sa_u._sa_sigaction #define sa_sigaction sa_u._sa_sigaction
</PRE> </PRE>
<P>
where:
<PRE>
typedef void saHandType( int signo );
typedef void saVxHandType( int signo, siginfo_t *info, void *context );
</PRE>
<H3>3.4.6 struct siginfo/siginfo_t</H3> <H3>3.4.6 struct siginfo/siginfo_t</H3>
<P> <P>

View File

@ -50,11 +50,19 @@
# define weak_function __attribute__ ((weak)) # define weak_function __attribute__ ((weak))
# define weak_const_function __attribute__ ((weak, __const__)) # define weak_const_function __attribute__ ((weak, __const__))
# define noreturn_function __attribute__ ((noreturn)) # define noreturn_function __attribute__ ((noreturn))
# define reentrant_function
#elif defined(__SDCC__)
# define weak_alias(name, aliasname)
# define weak_function
# define weak_const_function
# define noreturn_function
# define reentrant_function __reentrant
#else #else
# define weak_alias(name, aliasname) # define weak_alias(name, aliasname)
# define weak_function # define weak_function
# define weak_const_function # define weak_const_function
# define noreturn_function # define noreturn_function
# define reentrant_function
#endif #endif
/************************************************************ /************************************************************

View File

@ -118,14 +118,12 @@ typedef struct siginfo
/* The following structure defines the action to take for given signal */ /* The following structure defines the action to take for given signal */
typedef void saHandType(int signo);
typedef void saVxHandType(int signo, siginfo_t *info, void *context);
struct sigaction struct sigaction
{ {
union union
{ {
saHandType *_sa_handler; void (*_sa_handler)(int);
saVxHandType *_sa_sigaction; void (*_sa_sigaction)(int, siginfo_t *, void *);
} sa_u; } sa_u;
sigset_t sa_mask; sigset_t sa_mask;
int sa_flags; int sa_flags;
@ -166,10 +164,10 @@ EXTERN int sigtimedwait(const sigset_t *set,
struct siginfo *value, struct siginfo *value,
const struct timespec *timeout); const struct timespec *timeout);
#ifdef CONFIG_CAN_PASS_STRUCTS #ifdef CONFIG_CAN_PASS_STRUCTS
EXTERN int sigqueue(int tid, int signo, EXTERN int sigqueue(int pid, int signo,
const union sigval value); const union sigval value);
#else #else
EXTERN int sigqueue(int tid, int signo, void *sival_ptr); EXTERN int sigqueue(int pid, int signo, void *sival_ptr);
#endif #endif
#undef EXTERN #undef EXTERN

View File

@ -42,6 +42,7 @@
#include <nuttx/config.h> #include <nuttx/config.h>
#include <arch/types.h> #include <arch/types.h>
#include <nuttx/compiler.h>
/************************************************************ /************************************************************
* Definitions * Definitions

View File

@ -101,7 +101,8 @@ int clock_settime(clockid_t clock_id, const struct timespec *tp)
{ {
/* Save the new base time. */ /* Save the new base time. */
g_basetime = *tp; g_basetime.tv_sec = tp->tv_sec;
g_basetime.tv_nsec = tp->tv_nsec;
/* Get the elapsed time since power up (in milliseconds) biased /* Get the elapsed time since power up (in milliseconds) biased
* as appropriate. * as appropriate.

View File

@ -161,14 +161,18 @@ void sched_process_timer(void)
{ {
/* Increment the system time (if in the link) */ /* Increment the system time (if in the link) */
#ifdef CONFIG_HAVE_WEAKFUNCTIONS
if (clock_timer != NULL) if (clock_timer != NULL)
#endif
{ {
clock_timer(); clock_timer();
} }
/* Process watchdogs (if in the link) */ /* Process watchdogs (if in the link) */
#ifdef CONFIG_HAVE_WEAKFUNCTIONS
if (wd_timer != NULL) if (wd_timer != NULL)
#endif
{ {
wd_timer(); wd_timer();
} }

View File

@ -48,6 +48,11 @@
* Definitions * Definitions
************************************************************/ ************************************************************/
#define COPY_SIGACTION(t,f) \
{ (t)->sa_sigaction = (f)->sa_sigaction; \
(t)->sa_mask = (f)->sa_mask; \
(t)->sa_flags = (f)->sa_flags; }
/************************************************************ /************************************************************
* Private Type Declarations * Private Type Declarations
************************************************************/ ************************************************************/
@ -190,7 +195,7 @@ int sigaction(int signo, const struct sigaction *act,
{ {
if (sigact) if (sigact)
{ {
*oact = sigact->act; COPY_SIGACTION(oact, &sigact->act);
} }
else else
{ {
@ -236,7 +241,7 @@ int sigaction(int signo, const struct sigaction *act,
if (act->sa_u._sa_handler) if (act->sa_u._sa_handler)
{ {
sigact->act = *act; COPY_SIGACTION(&sigact->act, act);
} }
/* No.. It is a request to remove the old handler */ /* No.. It is a request to remove the old handler */

View File

@ -104,7 +104,7 @@ struct sigq_s
struct sigq_s *flink; /* Forward link */ struct sigq_s *flink; /* Forward link */
union union
{ {
saVxHandType *sighandler; void (*sighandler)(int signo, siginfo_t *info, void *context);
} action; /* Signal action */ } action; /* Signal action */
sigset_t mask; /* Additional signals to mask while the sigset_t mask; /* Additional signals to mask while the
* the signal-catching functin executes */ * the signal-catching functin executes */

View File

@ -37,6 +37,7 @@
* Included Files * Included Files
************************************************************/ ************************************************************/
#include <nuttx/config.h>
#include <sys/types.h> #include <sys/types.h>
#include <signal.h> #include <signal.h>
#include <debug.h> #include <debug.h>
@ -96,7 +97,11 @@
* *
************************************************************/ ************************************************************/
#ifdef CONFIG_CAN_PASS_STRUCTS
int sigqueue (int pid, int signo, const union sigval value) int sigqueue (int pid, int signo, const union sigval value)
#else
int sigqueue(int pid, int signo, void *sival_ptr)
#endif
{ {
_TCB *stcb; _TCB *stcb;
siginfo_t info; siginfo_t info;
@ -107,14 +112,21 @@ int sigqueue (int pid, int signo, const union sigval value)
/* Get the TCB of the receiving task */ /* Get the TCB of the receiving task */
stcb = sched_gettcb(pid); stcb = sched_gettcb(pid);
dbg("sigqueue: TCB=0x%08x signo=%d value=%d\n", #ifdef CONFIG_CAN_PASS_STRUCTS
stcb, signo, value.sival_int); dbg("TCB=0x%08x signo=%d value=%d\n", stcb, signo, value.sival_int);
#else
dbg("TCB=0x%08x signo=%d value=%p\n", stcb, signo, sival_ptr);
#endif
/* Create the siginfo structure */ /* Create the siginfo structure */
info.si_signo = signo; info.si_signo = signo;
info.si_code = SI_QUEUE; info.si_code = SI_QUEUE;
#ifdef CONFIG_CAN_PASS_STRUCTS
info.si_value = value; info.si_value = value;
#else
info.si_value.sival_ptr = sival_ptr;
#endif
/* Verify that we can perform the signalling operation */ /* Verify that we can perform the signalling operation */