diff --git a/sched/clock/clock_initialize.c b/sched/clock/clock_initialize.c index 8d770e388a1..3fba5d43921 100644 --- a/sched/clock/clock_initialize.c +++ b/sched/clock/clock_initialize.c @@ -178,6 +178,7 @@ static void clock_inittime(void) #ifndef CONFIG_RTC_HIRES clock_basetime(&g_basetime); #endif + #ifndef CONFIG_SCHED_TICKLESS g_system_timer = INITIAL_SYSTEM_TIMER_TICKS; if (g_system_timer > 0) @@ -197,6 +198,7 @@ static void clock_inittime(void) } } #endif /* !CONFIG_SCHED_TICKLESS */ + #else clock_inittimekeeping(); #endif diff --git a/sched/clock/clock_settime.c b/sched/clock/clock_settime.c index ec0c1d85be9..3c1c164c70b 100644 --- a/sched/clock/clock_settime.c +++ b/sched/clock/clock_settime.c @@ -122,6 +122,7 @@ int clock_settime(clockid_t clock_id, FAR const struct timespec *tp) up_rtc_settime(tp); } #endif + leave_critical_section(flags); sinfo("basetime=(%ld,%lu) bias=(%ld,%lu)\n", diff --git a/sched/group/group_childstatus.c b/sched/group/group_childstatus.c index 2867c3aae55..d7f92eeb0f7 100644 --- a/sched/group/group_childstatus.c +++ b/sched/group/group_childstatus.c @@ -51,6 +51,7 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* Note that there cannot be more that CONFIG_MAX_TASKS tasks in total. * However, the number of child status structures may need to be significantly * larger because this number includes the maximum number of tasks that are @@ -73,6 +74,7 @@ /**************************************************************************** * Private Types ****************************************************************************/ + /* Globals are maintained in a structure to minimize name collisions. */ struct child_pool_s diff --git a/sched/irq/irq_csection.c b/sched/irq/irq_csection.c index 66a9a1907b8..4de430be823 100644 --- a/sched/irq/irq_csection.c +++ b/sched/irq/irq_csection.c @@ -308,8 +308,9 @@ try_again: } else { - /* Normal tasking environment. */ - /* Get the TCB of the currently executing task on this CPU (avoid + /* Normal tasking environment. + * + * Get the TCB of the currently executing task on this CPU (avoid * using this_task() which can recurse. */ diff --git a/sched/pthread/pthread_create.c b/sched/pthread/pthread_create.c index a4bcb689718..884b389b754 100644 --- a/sched/pthread/pthread_create.c +++ b/sched/pthread/pthread_create.c @@ -615,6 +615,7 @@ errout_with_join: ptcb->joininfo = NULL; errout_with_tcb: + /* Clear group binding */ if (ptcb && !group_joined) diff --git a/sched/pthread/pthread_mutextrylock.c b/sched/pthread/pthread_mutextrylock.c index 8012e30570a..88c57d7d12a 100644 --- a/sched/pthread/pthread_mutextrylock.c +++ b/sched/pthread/pthread_mutextrylock.c @@ -117,6 +117,7 @@ int pthread_mutex_trylock(FAR pthread_mutex_t *mutex) mutex->nlocks = 1; } #endif + ret = OK; } diff --git a/sched/sched/sched_note.c b/sched/sched/sched_note.c index e98bc9dd445..02e82041c96 100644 --- a/sched/sched/sched_note.c +++ b/sched/sched/sched_note.c @@ -582,6 +582,7 @@ void sched_note_spinunlock(FAR struct tcb_s *tcb, FAR volatile void *spinlock) { note_spincommon(tcb, spinlock, NOTE_SPINLOCK_UNLOCK); } + void sched_note_spinabort(FAR struct tcb_s *tcb, FAR volatile void *spinlock) { note_spincommon(tcb, spinlock, NOTE_SPINLOCK_ABORT); diff --git a/sched/sched/sched_setscheduler.c b/sched/sched/sched_setscheduler.c index 204c28f944a..de091780cb3 100644 --- a/sched/sched/sched_setscheduler.c +++ b/sched/sched/sched_setscheduler.c @@ -153,6 +153,7 @@ int nxsched_setscheduler(pid_t pid, int policy, DEBUGVERIFY(sched_sporadic_stop(tcb)); } #endif + /* Save the FIFO scheduling parameters */ tcb->flags |= TCB_FLAG_SCHED_FIFO; @@ -173,6 +174,7 @@ int nxsched_setscheduler(pid_t pid, int policy, DEBUGVERIFY(sched_sporadic_stop(tcb)); } #endif + /* Save the round robin scheduling parameters */ tcb->flags |= TCB_FLAG_SCHED_RR; diff --git a/sched/semaphore/sem_holder.c b/sched/semaphore/sem_holder.c index e85e8d3e83d..36679b91ac0 100644 --- a/sched/semaphore/sem_holder.c +++ b/sched/semaphore/sem_holder.c @@ -676,7 +676,6 @@ static int nxsem_restoreholderprioB(FAR struct semholder_s *pholder, if (pholder->htcb == rtcb) { - /* The running task has given up a count on the semaphore */ #if CONFIG_SEM_PREALLOCHOLDERS == 0 diff --git a/sched/semaphore/sem_setprotocol.c b/sched/semaphore/sem_setprotocol.c index fdfb7f3bc12..0841d523ea0 100644 --- a/sched/semaphore/sem_setprotocol.c +++ b/sched/semaphore/sem_setprotocol.c @@ -96,6 +96,7 @@ int nxsem_setprotocol(FAR sem_t *sem, int protocol) switch (protocol) { case SEM_PRIO_NONE: + /* Disable priority inheritance */ sem->flags |= PRIOINHERIT_FLAGS_DISABLE; @@ -106,12 +107,14 @@ int nxsem_setprotocol(FAR sem_t *sem, int protocol) return OK; case SEM_PRIO_INHERIT: + /* Enable priority inheritance (dangerous) */ sem->flags &= ~PRIOINHERIT_FLAGS_DISABLE; return OK; case SEM_PRIO_PROTECT: + /* Not yet supported */ return -ENOSYS; diff --git a/sched/signal/sig_timedwait.c b/sched/signal/sig_timedwait.c index ff7ea3716b8..c01b6dad632 100644 --- a/sched/signal/sig_timedwait.c +++ b/sched/signal/sig_timedwait.c @@ -309,6 +309,7 @@ int nxsig_timedwait(FAR const sigset_t *set, FAR struct siginfo *info, return -ECANCELED; } #endif + /* Save the set of pending signals to wait for */ rtcb->sigwaitmask = *set; diff --git a/sched/task/task_execv.c b/sched/task/task_execv.c index bb947223f7c..61c315e3ad5 100644 --- a/sched/task/task_execv.c +++ b/sched/task/task_execv.c @@ -92,10 +92,12 @@ * (2) the number of symbols in that table. This information is currently * provided to 'exec()' from 'exec[l|v]()' via NuttX configuration settings: * - * CONFIG_LIBC_EXECFUNCS : Enable exec[l|v] support - * CONFIG_EXECFUNCS_HAVE_SYMTAB : Defined if there is a pre-defined symbol table - * CONFIG_EXECFUNCS_SYMTAB_ARRAY : Symbol table name used by exec[l|v] - * CONFIG_EXECFUNCS_NSYMBOLS_VAR : Variable holding number of symbols in the table + * CONFIG_LIBC_EXECFUNCS : Enable exec[l|v] support + * CONFIG_EXECFUNCS_HAVE_SYMTAB : Defined if there is a pre-defined + * symbol table + * CONFIG_EXECFUNCS_SYMTAB_ARRAY : Symbol table name used by exec[l|v] + * CONFIG_EXECFUNCS_NSYMBOLS_VAR : Variable holding number of symbols + * in the table * * As a result of the above, the current implementations of 'execl()' and * 'execv()' suffer from some incompatibilities that may or may not be diff --git a/sched/wdog/wd_start.c b/sched/wdog/wd_start.c index 1f7c3a849a5..f4235e94925 100644 --- a/sched/wdog/wd_start.c +++ b/sched/wdog/wd_start.c @@ -222,12 +222,14 @@ int wd_start(WDOG_ID wdog, int32_t delay, wdentry_t wdentry, int argc, ...) { wdog->parm[i] = va_arg(ap, wdparm_t); } + #ifdef CONFIG_DEBUG_FEATURES for (; i < CONFIG_MAX_WDOGPARMS; i++) { wdog->parm[i] = 0; } #endif + va_end(ap); /* Calculate delay+1, forcing the delay into a range that we can handle */ diff --git a/tools/nxstyle.c b/tools/nxstyle.c index 4b3c408a18f..ec93b2b6156 100644 --- a/tools/nxstyle.c +++ b/tools/nxstyle.c @@ -129,6 +129,7 @@ int main(int argc, char **argv, char **envp) int blank_lineno; /* Line number of the last blank line */ int noblank_lineno; /* A blank line is not needed after this line */ int lbrace_lineno; /* Line number of last left brace */ + int rbrace_lineno; /* Last line containing a right brace */ int externc_lineno; /* Last line where 'extern "C"' declared */ int linelen; /* Length of the line */ int maxline; /* Lines longer that this generate warnings */ @@ -213,6 +214,7 @@ int main(int argc, char **argv, char **envp) blank_lineno = -1; /* Line number of the last blank line */ noblank_lineno = -1; /* A blank line is not needed after this line */ lbrace_lineno = -1; /* Line number of last left brace */ + rbrace_lineno = -1; /* Last line containine a right brace */ externc_lineno = -1; /* Last line where 'extern "C"' declared */ /* Process each line in the input stream */ @@ -291,6 +293,47 @@ int main(int argc, char **argv, char **envp) fprintf(stderr, "Missing file header comment block at line 1\n"); } + + /* Check for a blank line following a right brace */ + + if (bfunctions && lineno == rbrace_lineno + 1) + { + /* Check if this line contains a right brace. A right brace + * must be followed by 'else', 'while', 'break', a blank line, + * another right brace, or a pre-processor directive like #endif + */ + + if (strchr(line, '}') == NULL && line[n] != '#' && + strncmp(&line[n], "else", 4) != 0 && + strncmp(&line[n], "while", 5) != 0 && + strncmp(&line[n], "break", 5) != 0) + { + fprintf(stderr, + "Right brace must be followed by a blank line at line %d\n", + rbrace_lineno); + } + + /* If the right brace is followed by a pre-proceeor command + * like #endif (but not #else or #elif), then set the right + * brace line number to the line number of the pre-processor + * command (it then must be followed by a blank line) + */ + + if (line[n] == '#') + { + int ii; + + for (ii = n + 1; line[ii] != '\0' && isspace(line[ii]); ii++) + { + } + + if (strncmp(&line[ii], "else", 4) != 0 && + strncmp(&line[ii], "elif", 4) != 0) + { + rbrace_lineno = lineno; + } + } + } } /* STEP 1: Find the indentation level and the start of real stuff on @@ -1023,6 +1066,8 @@ int main(int argc, char **argv, char **envp) "Blank line precedes right brace at line %d\n", lineno); } + + rbrace_lineno = lineno; } break;