From 59bd1d6954d31b2a3af23130601e55b274b3a9f7 Mon Sep 17 00:00:00 2001 From: patacongo Date: Tue, 20 Feb 2007 23:51:56 +0000 Subject: [PATCH] Fixes for STDCC compiler (more needed) git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@16 42af7a65-404d-4744-a932-0658087f49c3 --- arch/c5471/defconfig | 3 +++ arch/sim/defconfig | 3 +++ sched/Makefile | 2 +- sched/mq_internal.h | 4 +++- sched/os_start.c | 24 ++++++++++++++++++++++-- sched/sched_free.c | 4 ++-- sched/sig_internal.h | 9 +++++++-- 7 files changed, 41 insertions(+), 8 deletions(-) diff --git a/arch/c5471/defconfig b/arch/c5471/defconfig index 6f8f152c22..3871d7e149 100644 --- a/arch/c5471/defconfig +++ b/arch/c5471/defconfig @@ -140,11 +140,14 @@ CONFIG_ARCH_KFREE=n # long long types and if you plan to use them # CONFIG_CAN_PASS_STRUCTS - enable if your compiler supports # passing structures and unions as values +# CONFIG_HAVE_WEAKFUNCTIONS - enable if you compiler supports +# weak functions (see include/nuttx/comp # CONFIG_HAVE_INLINE=y CONFIG_HAVE_DOUBLE=y CONFIG_HAVE_LONG_LONG=n CONFIG_CAN_PASS_STRUCTS=y +CONFIG_HAVE_WEAKFUNCTIONS=y # # General build options diff --git a/arch/sim/defconfig b/arch/sim/defconfig index 18b15d7e0f..80de3cbdc6 100644 --- a/arch/sim/defconfig +++ b/arch/sim/defconfig @@ -107,11 +107,14 @@ CONFIG_ARCH_KFREE=n # long long types and if you plan to use them # CONFIG_CAN_PASS_STRUCTS - enable if your compiler supports # passing structures and unions as values +# CONFIG_HAVE_WEAKFUNCTIONS - enable if you compiler supports +# weak functions (see include/nuttx/comp # CONFIG_HAVE_INLINE=y CONFIG_HAVE_DOUBLE=y CONFIG_HAVE_LONG_LONG=n CONFIG_CAN_PASS_STRUCTS=y +CONFIG_HAVE_WEAKFUNCTIONS=y # # General build options diff --git a/sched/Makefile b/sched/Makefile index 9872c7f02b..bc144b797b 100644 --- a/sched/Makefile +++ b/sched/Makefile @@ -121,7 +121,7 @@ $(BIN): $(OBJS) depend: .depend clean: - rm -f $(BIN) *.o *~ + rm -f $(BIN) *.o *.asm *.lst *.sym *~ distclean: clean rm -f Make.dep .depend diff --git a/sched/mq_internal.h b/sched/mq_internal.h index 226835d21e..ba2368e43f 100644 --- a/sched/mq_internal.h +++ b/sched/mq_internal.h @@ -43,6 +43,7 @@ #include #include #include +#include #include /************************************************************ @@ -106,6 +107,8 @@ typedef struct mqmsg mqmsg_t; /* This structure defines a message queue */ +struct mq_des; /* forward reference */ + struct msgq_s { struct msgq_s *flink; /* Forward link to next message queue */ @@ -123,7 +126,6 @@ struct msgq_s union sigval ntvalue; /* Notification: Signal value */ char name[1]; /* Start of the queue name */ }; -typedef struct msgq_s msgq_t; #define SIZEOF_MQ_HEADER ((int)(((msgq_t*)NULL)->name)) diff --git a/sched/os_start.c b/sched/os_start.c index b96a650cbe..6381800821 100644 --- a/sched/os_start.c +++ b/sched/os_start.c @@ -260,7 +260,9 @@ void os_start(void) /* Initialize the interrupt handling subsystem (if included) */ +#ifdef CONFIG_HAVE_WEAKFUNCTIONS if (irq_initialize != NULL) +#endif { irq_initialize(); } @@ -270,56 +272,72 @@ void os_start(void) * is called only if it is provided in the link. */ +#ifdef CONFIG_HAVE_WEAKFUNCTIONS if (user_initialize != NULL) +#endif { user_initialize(); } /* Initialize the POSIX timer facility (if included in the link) */ +#ifdef CONFIG_HAVE_WEAKFUNCTIONS if (clock_initialize != NULL) +#endif { clock_initialize(); } /* Initialize the watchdog facility (if included in the link) */ +#ifdef CONFIG_HAVE_WEAKFUNCTIONS if (wd_initialize != NULL) +#endif { wd_initialize(); } /* Initialize the signal facility (if in link) */ +#ifdef CONFIG_HAVE_WEAKFUNCTIONS if (sig_initialize != NULL) +#endif { sig_initialize(); } /* Initialize the semaphore facility. (if in link) */ +#ifdef CONFIG_HAVE_WEAKFUNCTIONS if (sem_initialize != NULL) +#endif { sem_initialize(); } /* Initialize the named message queue facility (if in link) */ +#ifdef CONFIG_HAVE_WEAKFUNCTIONS if (mq_initialize != NULL) +#endif { mq_initialize(); } /* Initialize the thread-specific data facility (if in link) */ +#ifdef CONFIG_HAVE_WEAKFUNCTIONS if (pthread_initialize != NULL) +#endif { pthread_initialize(); } /* Initialize the file system (needed to support device drivers) */ +#ifdef CONFIG_HAVE_WEAKFUNCTIONS if (fs_initialize != NULL) +#endif { fs_initialize(); } @@ -336,7 +354,9 @@ void os_start(void) * is done last because the libraries may depend on the above. */ +#ifdef CONFIG_HAVE_WEAKFUNCTIONS if (lib_initialize != NULL) +#endif { lib_initialize(); } @@ -366,9 +386,9 @@ void os_start(void) { /* Remove the first delayed deallocation. */ - uint32 savedState = irqsave(); + uint32 saved_state = irqsave(); void *address = (void*)sq_remfirst(&g_delayeddeallocations); - irqrestore(savedState); + irqrestore(saved_state); /* Then deallocate it */ diff --git a/sched/sched_free.c b/sched/sched_free.c index 205da0a465..9fc2a261d3 100644 --- a/sched/sched_free.c +++ b/sched/sched_free.c @@ -90,9 +90,9 @@ void sched_free(void *address) { /* Yes.. Delay the deallocation until a more appropriate time. */ - uint32 savedState = irqsave(); + uint32 saved_state = irqsave(); sq_addlast((sq_entry_t*)address, &g_delayeddeallocations); - irqrestore(savedState); + irqrestore(saved_state); } else { diff --git a/sched/sig_internal.h b/sched/sig_internal.h index fd8390cfed..dcc4d3d255 100644 --- a/sched/sig_internal.h +++ b/sched/sig_internal.h @@ -175,8 +175,13 @@ extern void sig_cleanup(_TCB *stcb); extern void sig_deliver(_TCB *stcb); extern sigactq_t *sig_findaction(_TCB *stcb, int signo); extern int sig_lowest(sigset_t *set); -extern int sig_mqnotempty (int tid, int signo, - const union sigval value); +#ifdef CONFIG_CAN_PASS_STRUCTS +extern int sig_mqnotempty(int tid, int signo, + const union sigval value); +#else +extern int sig_mqnotempty(int tid, int signo, + void *sival_ptr); +#endif extern int sig_received(_TCB *stcb, siginfo_t *info); extern void sig_releasependingsigaction(sigq_t *sigq); extern void sig_releasependingsignal(sigpendq_t *sigpend);