From 5e160e6e0cdfae48ea120909e7febc62b6b56eb2 Mon Sep 17 00:00:00 2001 From: patacongo Date: Tue, 20 Feb 2007 23:16:24 +0000 Subject: Working toward compiler independence: Removed inline funcs git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@15 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/arch/README.txt | 10 ++++------ nuttx/arch/c5471/src/up_serial.c | 3 +-- nuttx/fs/fs_dup.c | 21 ++++++--------------- nuttx/fs/fs_files.c | 5 +---- nuttx/fs/fs_inode.c | 16 ++++++++-------- nuttx/fs/fs_internal.h | 4 ---- nuttx/include/nuttx/arch.h | 4 ---- nuttx/include/nuttx/irq.h | 4 ---- nuttx/include/stdio.h | 29 +++-------------------------- nuttx/lib/lib_init.c | 5 +---- nuttx/lib/lib_internal.h | 4 ---- nuttx/mm/mm_internal.h | 4 ---- nuttx/sched/clock_internal.h | 4 ---- nuttx/sched/mktime.c | 4 ++-- nuttx/sched/mq_close.c | 10 +++------- nuttx/sched/mq_descreate.c | 2 +- nuttx/sched/os_internal.h | 4 ---- nuttx/sched/sched_processtimer.c | 2 +- nuttx/sched/sig_internal.h | 4 ---- 19 files changed, 31 insertions(+), 108 deletions(-) (limited to 'nuttx') diff --git a/nuttx/arch/README.txt b/nuttx/arch/README.txt index 85175c6a0..ff0fd4f00 100644 --- a/nuttx/arch/README.txt +++ b/nuttx/arch/README.txt @@ -149,17 +149,15 @@ include/types.h include/irq.h This file needs to define some architecture specific functions (usually - inline) and structure. These include: + inline if the compiler supports inlining) and structure. These include: - struct xcptcontext. This structures represents the saved context of a thread. - - static inline uint32 irqsave(void) -- Used to disable - all interrupts. + - uint32 irqsave(void) -- Used to disable all interrupts. - - static inline void irqrestore(uint32 flags) -- Used to - restore interrupts enables to the same state as before irqsave - was called. + - void irqrestore(uint32 flags) -- Used to restore interrupt + enables to the same state as before irqsave was called. This file must also define NR_IRQS, the total number of IRQs supported by the board. diff --git a/nuttx/arch/c5471/src/up_serial.c b/nuttx/arch/c5471/src/up_serial.c index 25746da3f..df4927660 100644 --- a/nuttx/arch/c5471/src/up_serial.c +++ b/nuttx/arch/c5471/src/up_serial.c @@ -123,7 +123,6 @@ static int up_close(struct file *filep); static ssize_t up_read(struct file *filep, char *buffer, size_t buflen); static ssize_t up_write(struct file *filep, const char *buffer, size_t buflen); static int up_ioctl(struct file *filep, int cmd, unsigned long arg); -static void up_consoleinit(up_dev_t *dev); static void up_uartsetup(up_dev_t *dev); static void up_delay(int milliseconds); @@ -590,7 +589,7 @@ static void up_xmitchars(up_dev_t *dev) * serial driver. */ -static int up_interrupt(int irq, struct xcptcontext *xcp) +static int up_interrupt(int irq, void *context) { up_dev_t *dev; volatile uint32 cause; diff --git a/nuttx/fs/fs_dup.c b/nuttx/fs/fs_dup.c index 02a62daf6..114f4b951 100644 --- a/nuttx/fs/fs_dup.c +++ b/nuttx/fs/fs_dup.c @@ -55,23 +55,14 @@ * Definitions ************************************************************/ +#define DUP_ISOPEN(fd, list) \ + ((unsigned int)fd < CONFIG_NFILE_DESCRIPTORS && \ + list->fl_files[fd].f_inode != NULL) + /************************************************************ * Private Functions ************************************************************/ -static inline boolean dup_isopen(int fd, struct filelist *list) -{ - if ((unsigned int)fd >= CONFIG_NFILE_DESCRIPTORS || - list->fl_files[fd].f_inode == NULL) - { - return FALSE; - } - else - { - return TRUE; - } -} - /************************************************************ * Global Functions ************************************************************/ @@ -92,7 +83,7 @@ int dup(int fildes) /* Verify that fildes is a valid, open file descriptor */ - if (!dup_isopen(fildes, list)) + if (!DUP_ISOPEN(fildes, list)) { *get_errno_ptr() = EBADF; return ERROR; @@ -131,7 +122,7 @@ int dup2(int fildes1, int fildes2) /* Verify that fildes is a valid, open file descriptor */ - if (!dup_isopen(fildes1, list)) + if (!DUP_ISOPEN(fildes1, list)) { *get_errno_ptr() = EBADF; return ERROR; diff --git a/nuttx/fs/fs_files.c b/nuttx/fs/fs_files.c index 7ffede460..a280f9210 100644 --- a/nuttx/fs/fs_files.c +++ b/nuttx/fs/fs_files.c @@ -86,10 +86,7 @@ static void _files_semtake(struct filelist *list) } } -static inline void _files_semgive(struct filelist *list) -{ - sem_post(&list->fl_sem); -} +#define _files_semgive(list) sem_post(&list->fl_sem) /************************************************************ * Pulblic Functions diff --git a/nuttx/fs/fs_inode.c b/nuttx/fs/fs_inode.c index b080a4e43..db7451d30 100644 --- a/nuttx/fs/fs_inode.c +++ b/nuttx/fs/fs_inode.c @@ -53,9 +53,12 @@ #include "fs_internal.h" /************************************************************ - * Private types + * Definitions ************************************************************/ +#define INODE_SEMGIVE() \ + sem_post(&tree_sem) + /************************************************************ * Private Variables ************************************************************/ @@ -86,10 +89,7 @@ static void _inode_semtake(void) } } -static inline void _inode_semgive(void) -{ - sem_post(&tree_sem); -} +#define _inode_semgive(void) sem_post(&tree_sem) static int _inode_compare(const char *fname, struct inode *node) @@ -152,20 +152,20 @@ static int _inode_compare(const char *fname, } } -static inline int _inode_namelen(const char *name) +static int _inode_namelen(const char *name) { const char *tmp = name; while(*tmp && *tmp != '/') tmp++; return tmp - name; } -static inline void _inode_namecpy(char *dest, const char *src) +static void _inode_namecpy(char *dest, const char *src) { while(*src && *src != '/') *dest++ = *src++; *dest='\0'; } -static inline const char *_inode_nextname(const char *name) +static const char *_inode_nextname(const char *name) { while (*name && *name != '/') name++; if (*name) name++; diff --git a/nuttx/fs/fs_internal.h b/nuttx/fs/fs_internal.h index 14265895f..e8e8a33c9 100644 --- a/nuttx/fs/fs_internal.h +++ b/nuttx/fs/fs_internal.h @@ -63,10 +63,6 @@ extern struct file files[CONFIG_NFILE_DESCRIPTORS]; #endif extern struct inode *root_inode; -/************************************************************ - * Inline Functions - ************************************************************/ - /************************************************************ * Pulblic Function Prototypes ************************************************************/ diff --git a/nuttx/include/nuttx/arch.h b/nuttx/include/nuttx/arch.h index 1299b53f0..cc5ad3560 100644 --- a/nuttx/include/nuttx/arch.h +++ b/nuttx/include/nuttx/arch.h @@ -49,10 +49,6 @@ * Definitions ************************************************************/ -/************************************************************ - * Inline functions - ************************************************************/ - /************************************************************ * Public Types ************************************************************/ diff --git a/nuttx/include/nuttx/irq.h b/nuttx/include/nuttx/irq.h index 0e29e2476..ce3543404 100644 --- a/nuttx/include/nuttx/irq.h +++ b/nuttx/include/nuttx/irq.h @@ -69,10 +69,6 @@ typedef int (*swint_t)(uint32 code, uint32 parm2, uint32 parm3, #include -/************************************************************ - * Inline functions - ************************************************************/ - /************************************************************ * Public Variables ************************************************************/ diff --git a/nuttx/include/stdio.h b/nuttx/include/stdio.h index 0cc8639b4..883e32fc4 100644 --- a/nuttx/include/stdio.h +++ b/nuttx/include/stdio.h @@ -99,9 +99,9 @@ /* The first three _iob entries are reserved for standard I/O */ -#define stdin (__stdfile(0)) -#define stdout (__stdfile(1)) -#define stderr (__stdfile(2)) +#define stdin (&sched_getstreams()->sl_streams[0]) +#define stdout (&sched_getstreams()->sl_streams[1]) +#define stderr (&sched_getstreams()->sl_streams[2]) /* These APIs are not implemented and/or can be synthesized from * supported APIs. @@ -194,29 +194,6 @@ typedef void DIR; * Public Variables ************************************************************/ -/************************************************************ - * Inline Functions - ************************************************************/ - -/* Used to reference stdin, stdout, and stderr */ - -#ifdef CONFIG_HAVE_INLINE -static inline FILE *__stdfile(int fd) -{ - if ((unsigned int)fd < CONFIG_NFILE_DESCRIPTORS) - { - struct streamlist *streams = sched_getstreams(); - if (streams) - { - return &streams->sl_streams[fd]; - } - } - return NULL; -} -#else -extern FILE *__stdfile(int fd); -#endif - /************************************************************ * Public Function Prototypes ************************************************************/ diff --git a/nuttx/lib/lib_init.c b/nuttx/lib/lib_init.c index 216f7b780..a8195937f 100644 --- a/nuttx/lib/lib_init.c +++ b/nuttx/lib/lib_init.c @@ -71,10 +71,7 @@ static void _lib_semtake(struct streamlist *list) } } -static inline void _lib_semgive(struct streamlist *list) -{ - sem_post(&list->sl_sem); -} +#define _lib_semgive(list) sem_post(&list->sl_sem) /************************************************************ * Public Functions diff --git a/nuttx/lib/lib_internal.h b/nuttx/lib/lib_internal.h index 41d40d428..736aec54f 100644 --- a/nuttx/lib/lib_internal.h +++ b/nuttx/lib/lib_internal.h @@ -98,10 +98,6 @@ struct lib_rawstream_s * Public Variables ************************************************************/ -/************************************************************ - * Inline Functions - ************************************************************/ - /************************************************************ * Pulblic Function Prototypes ************************************************************/ diff --git a/nuttx/mm/mm_internal.h b/nuttx/mm/mm_internal.h index e171f2b60..fe519ab2e 100644 --- a/nuttx/mm/mm_internal.h +++ b/nuttx/mm/mm_internal.h @@ -152,10 +152,6 @@ extern struct mm_allocnode_s *g_heapend; extern struct mm_freenode_s g_nodelist[MM_NNODES]; -/************************************************************ - * Inline Functions - ************************************************************/ - /************************************************************ * Pulblic Function Prototypes ************************************************************/ diff --git a/nuttx/sched/clock_internal.h b/nuttx/sched/clock_internal.h index 18806d952..e97c468b7 100644 --- a/nuttx/sched/clock_internal.h +++ b/nuttx/sched/clock_internal.h @@ -85,10 +85,6 @@ extern volatile uint32 g_system_timer; extern struct timespec g_basetime; extern uint32 g_tickbias; -/************************************************************ - * Public Inline Functions - ************************************************************/ - /************************************************************ * Public Function Prototypes ************************************************************/ diff --git a/nuttx/sched/mktime.c b/nuttx/sched/mktime.c index a0ed379f1..1c58edc37 100644 --- a/nuttx/sched/mktime.c +++ b/nuttx/sched/mktime.c @@ -81,7 +81,7 @@ * ************************************************************/ -static inline time_t clock_gregorian2utc(int year, int month, int day) +static time_t clock_gregorian2utc(int year, int month, int day) { int temp; @@ -95,7 +95,7 @@ static inline time_t clock_gregorian2utc(int year, int month, int day) } #ifdef CONFIG_JULIAN_TIME -static inline time_t clock_julian2utc(int year, int month, int day) +static time_t clock_julian2utc(int year, int month, int day) { return 367*year - (7*(year + 5001 + (month-9)/7))/4 diff --git a/nuttx/sched/mq_close.c b/nuttx/sched/mq_close.c index b1625de73..c9817f994 100644 --- a/nuttx/sched/mq_close.c +++ b/nuttx/sched/mq_close.c @@ -67,19 +67,15 @@ * Function: mq_desfree * * Description: - * Deallocate a message queue descriptor + * Deallocate a message queue descriptor but returning it + * to the free liest * * Inputs: * mqdes - message queue descriptor to free * ************************************************************/ -static inline void mq_desfree(mqd_t mqdes) -{ - /* Just put it back on the free list */ - - sq_addlast((sq_entry_t*)mqdes, &g_desfree); -} +#define mq_desfree(mqdes) sq_addlast((sq_entry_t*)mqdes, &g_desfree) /************************************************************ * Public Functions diff --git a/nuttx/sched/mq_descreate.c b/nuttx/sched/mq_descreate.c index 5f68268d3..f631cfd2b 100644 --- a/nuttx/sched/mq_descreate.c +++ b/nuttx/sched/mq_descreate.c @@ -88,7 +88,7 @@ * ************************************************************/ -static inline mqd_t mq_desalloc(void) +static mqd_t mq_desalloc(void) { mqd_t mqdes; diff --git a/nuttx/sched/os_internal.h b/nuttx/sched/os_internal.h index 0be0bb5ac..4e4cdf7d6 100644 --- a/nuttx/sched/os_internal.h +++ b/nuttx/sched/os_internal.h @@ -228,10 +228,6 @@ extern pidhash_t g_pidhash[MAX_TASKS_ALLOWED]; extern const tasklist_t g_tasklisttable[NUM_TASK_STATES]; -/************************************************************ - * Public Inline Functions - ************************************************************/ - /************************************************************ * Public Function Prototypes ************************************************************/ diff --git a/nuttx/sched/sched_processtimer.c b/nuttx/sched/sched_processtimer.c index 2ab4c4bfa..de066eb46 100644 --- a/nuttx/sched/sched_processtimer.c +++ b/nuttx/sched/sched_processtimer.c @@ -72,7 +72,7 @@ * Private Functions ************************************************************/ -static inline void sched_process_timeslice(void) +static void sched_process_timeslice(void) { #if CONFIG_RR_INTERVAL > 0 _TCB *rtcb; diff --git a/nuttx/sched/sig_internal.h b/nuttx/sched/sig_internal.h index 8f3bebe1c..fd8390cfe 100644 --- a/nuttx/sched/sig_internal.h +++ b/nuttx/sched/sig_internal.h @@ -149,10 +149,6 @@ extern sq_queue_t g_sigpendingsignal; extern sq_queue_t g_sigpendingirqsignal; -/************************************************************ - * Public Inline Functions - ************************************************************/ - /************************************************************ * Public Function Prototypes ************************************************************/ -- cgit v1.2.3