summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2007-02-21 02:19:19 +0000
committerpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2007-02-21 02:19:19 +0000
commit3b6264b053c94e7fcc110aa7c9b88b829acadcd0 (patch)
tree99970ffd265837ba0a438605c929cff0b338b0ea
parentf693758096e0ade2b0dbe30327f825a29047554c (diff)
Eliminating SDCC compilation errors
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@17 7fd9a85b-ad96-42d3-883c-3090e2eb8679
-rw-r--r--nuttx/Documentation/NuttxUserGuide.html17
-rw-r--r--nuttx/include/nuttx/compiler.h8
-rw-r--r--nuttx/include/signal.h10
-rw-r--r--nuttx/include/sys/types.h1
-rw-r--r--nuttx/sched/clock_settime.c3
-rw-r--r--nuttx/sched/sched_processtimer.c4
-rw-r--r--nuttx/sched/sig_action.c9
-rw-r--r--nuttx/sched/sig_internal.h2
-rw-r--r--nuttx/sched/sig_queue.c16
9 files changed, 47 insertions, 23 deletions
diff --git a/nuttx/Documentation/NuttxUserGuide.html b/nuttx/Documentation/NuttxUserGuide.html
index c8e26278d3..213f75d751 100644
--- a/nuttx/Documentation/NuttxUserGuide.html
+++ b/nuttx/Documentation/NuttxUserGuide.html
@@ -4019,10 +4019,12 @@ between Nuttx and a MoBY application:
<P>
The following structure defines the action to take for given signal:
<PRE>
- struct sigaction {
- union {
- saHandType *_sa_handler;
- saVxHandType *_sa_sigaction;
+ struct sigaction
+ {
+ union
+ {
+ void (*_sa_handler)(int);
+ void (*_sa_sigaction)(int, siginfo_t *, void *);
} sa_u;
sigset_t sa_mask;
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
</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>
<P>
diff --git a/nuttx/include/nuttx/compiler.h b/nuttx/include/nuttx/compiler.h
index 1916d8b9c5..6f4e68baf5 100644
--- a/nuttx/include/nuttx/compiler.h
+++ b/nuttx/include/nuttx/compiler.h
@@ -50,11 +50,19 @@
# define weak_function __attribute__ ((weak))
# define weak_const_function __attribute__ ((weak, __const__))
# 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
# define weak_alias(name, aliasname)
# define weak_function
# define weak_const_function
# define noreturn_function
+# define reentrant_function
#endif
/************************************************************
diff --git a/nuttx/include/signal.h b/nuttx/include/signal.h
index 621a6d5f35..4ec153b519 100644
--- a/nuttx/include/signal.h
+++ b/nuttx/include/signal.h
@@ -118,14 +118,12 @@ typedef struct siginfo
/* 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
{
union
{
- saHandType *_sa_handler;
- saVxHandType *_sa_sigaction;
+ void (*_sa_handler)(int);
+ void (*_sa_sigaction)(int, siginfo_t *, void *);
} sa_u;
sigset_t sa_mask;
int sa_flags;
@@ -166,10 +164,10 @@ EXTERN int sigtimedwait(const sigset_t *set,
struct siginfo *value,
const struct timespec *timeout);
#ifdef CONFIG_CAN_PASS_STRUCTS
-EXTERN int sigqueue(int tid, int signo,
+EXTERN int sigqueue(int pid, int signo,
const union sigval value);
#else
-EXTERN int sigqueue(int tid, int signo, void *sival_ptr);
+EXTERN int sigqueue(int pid, int signo, void *sival_ptr);
#endif
#undef EXTERN
diff --git a/nuttx/include/sys/types.h b/nuttx/include/sys/types.h
index 82f7046d2c..37b206ee19 100644
--- a/nuttx/include/sys/types.h
+++ b/nuttx/include/sys/types.h
@@ -42,6 +42,7 @@
#include <nuttx/config.h>
#include <arch/types.h>
+#include <nuttx/compiler.h>
/************************************************************
* Definitions
diff --git a/nuttx/sched/clock_settime.c b/nuttx/sched/clock_settime.c
index 5f565ea36b..afd4005c59 100644
--- a/nuttx/sched/clock_settime.c
+++ b/nuttx/sched/clock_settime.c
@@ -101,7 +101,8 @@ int clock_settime(clockid_t clock_id, const struct timespec *tp)
{
/* 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
* as appropriate.
diff --git a/nuttx/sched/sched_processtimer.c b/nuttx/sched/sched_processtimer.c
index de066eb465..bb56dbacb6 100644
--- a/nuttx/sched/sched_processtimer.c
+++ b/nuttx/sched/sched_processtimer.c
@@ -161,14 +161,18 @@ void sched_process_timer(void)
{
/* Increment the system time (if in the link) */
+#ifdef CONFIG_HAVE_WEAKFUNCTIONS
if (clock_timer != NULL)
+#endif
{
clock_timer();
}
/* Process watchdogs (if in the link) */
+#ifdef CONFIG_HAVE_WEAKFUNCTIONS
if (wd_timer != NULL)
+#endif
{
wd_timer();
}
diff --git a/nuttx/sched/sig_action.c b/nuttx/sched/sig_action.c
index 14388c3d5b..7f9a1c343c 100644
--- a/nuttx/sched/sig_action.c
+++ b/nuttx/sched/sig_action.c
@@ -48,6 +48,11 @@
* 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
************************************************************/
@@ -190,7 +195,7 @@ int sigaction(int signo, const struct sigaction *act,
{
if (sigact)
{
- *oact = sigact->act;
+ COPY_SIGACTION(oact, &sigact->act);
}
else
{
@@ -236,7 +241,7 @@ int sigaction(int signo, const struct sigaction *act,
if (act->sa_u._sa_handler)
{
- sigact->act = *act;
+ COPY_SIGACTION(&sigact->act, act);
}
/* No.. It is a request to remove the old handler */
diff --git a/nuttx/sched/sig_internal.h b/nuttx/sched/sig_internal.h
index dcc4d3d255..b03b2ec0eb 100644
--- a/nuttx/sched/sig_internal.h
+++ b/nuttx/sched/sig_internal.h
@@ -104,7 +104,7 @@ struct sigq_s
struct sigq_s *flink; /* Forward link */
union
{
- saVxHandType *sighandler;
+ void (*sighandler)(int signo, siginfo_t *info, void *context);
} action; /* Signal action */
sigset_t mask; /* Additional signals to mask while the
* the signal-catching functin executes */
diff --git a/nuttx/sched/sig_queue.c b/nuttx/sched/sig_queue.c
index b9abf7f392..b9d71efcc6 100644
--- a/nuttx/sched/sig_queue.c
+++ b/nuttx/sched/sig_queue.c
@@ -37,6 +37,7 @@
* Included Files
************************************************************/
+#include <nuttx/config.h>
#include <sys/types.h>
#include <signal.h>
#include <debug.h>
@@ -96,7 +97,11 @@
*
************************************************************/
+#ifdef CONFIG_CAN_PASS_STRUCTS
int sigqueue (int pid, int signo, const union sigval value)
+#else
+int sigqueue(int pid, int signo, void *sival_ptr)
+#endif
{
_TCB *stcb;
siginfo_t info;
@@ -107,14 +112,21 @@ int sigqueue (int pid, int signo, const union sigval value)
/* Get the TCB of the receiving task */
stcb = sched_gettcb(pid);
- dbg("sigqueue: TCB=0x%08x signo=%d value=%d\n",
- stcb, signo, value.sival_int);
+#ifdef CONFIG_CAN_PASS_STRUCTS
+ 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 */
info.si_signo = signo;
info.si_code = SI_QUEUE;
+#ifdef CONFIG_CAN_PASS_STRUCTS
info.si_value = value;
+#else
+ info.si_value.sival_ptr = sival_ptr;
+#endif
/* Verify that we can perform the signalling operation */