From d2af57169bf499c50c73eba3ede19e35cddedaaa Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sun, 1 Dec 2019 13:01:16 -0600 Subject: [PATCH] tools/nxstyle.c: Fix a rare false alarm that could occur if a variable or function name begins with the sub-string 'union' or 'struct'. misc fixes under fs/ and sched/ from application of current version of nxstyle. --- fs/aio/aio_initialize.c | 1 + fs/cromfs/fs_cromfs.c | 2 +- fs/fat/fs_fat32dirent.c | 2 ++ fs/inode/fs_foreachinode.c | 1 + fs/mount/fs_automount.c | 1 + fs/nxffs/nxffs_read.c | 1 + fs/procfs/fs_procfscpuload.c | 1 + fs/procfs/fs_procfsiobinfo.c | 1 + fs/procfs/fs_procfsmeminfo.c | 1 + fs/procfs/fs_procfsuptime.c | 1 + fs/procfs/fs_skeleton.c | 1 - fs/smartfs/smartfs_procfs.c | 1 + fs/vfs/fs_stat.c | 4 ++-- sched/clock/clock_getres.c | 1 + sched/module/mod_procfs.c | 3 ++- sched/paging/pg_worker.c | 3 ++- tools/nxstyle.c | 8 ++++---- 17 files changed, 23 insertions(+), 10 deletions(-) diff --git a/fs/aio/aio_initialize.c b/fs/aio/aio_initialize.c index 2872a15a98..8917c1c03a 100644 --- a/fs/aio/aio_initialize.c +++ b/fs/aio/aio_initialize.c @@ -78,6 +78,7 @@ static uint16_t g_aio_count; /**************************************************************************** * Public Data ****************************************************************************/ + /* This is a list of pending asynchronous I/O. The user must hold the * lock on this list in order to access the list. */ diff --git a/fs/cromfs/fs_cromfs.c b/fs/cromfs/fs_cromfs.c index 28e4f305fb..44396230e8 100644 --- a/fs/cromfs/fs_cromfs.c +++ b/fs/cromfs/fs_cromfs.c @@ -1045,7 +1045,7 @@ static int cromfs_readdir(struct inode *mountpt, struct fs_dirent_s *dir) finfo("Entry %lu: %s\n", (unsigned long)offset, name); strncpy(dir->fd_dir.d_name, name, NAME_MAX + 1); - switch (node->cn_mode & s_IFTGT) + switch ((node->cn_mode & s_IFTGT) != 0) { case S_IFDIR: /* Directory */ dir->fd_dir.d_type = DTYPE_DIRECTORY; diff --git a/fs/fat/fs_fat32dirent.c b/fs/fat/fs_fat32dirent.c index 40b7263f36..71983f6a25 100644 --- a/fs/fat/fs_fat32dirent.c +++ b/fs/fat/fs_fat32dirent.c @@ -2772,6 +2772,7 @@ int fat_dirnamewrite(struct fat_mountpt_s *fs, struct fat_dirinfo_s *dirinfo) * cache. So we can just fall throught to write that directory entry, perhaps * using the short file name alias for the long file name. */ + #endif return fat_putsfname(fs, dirinfo); @@ -2816,6 +2817,7 @@ int fat_dirwrite(struct fat_mountpt_s *fs, struct fat_dirinfo_s *dirinfo, * cache. So we can just fall throught to write that directory entry, perhaps * using the short file name alias for the long file name. */ + #endif /* Put the short file name entry data */ diff --git a/fs/inode/fs_foreachinode.c b/fs/inode/fs_foreachinode.c index 3324bdfa77..538a390531 100644 --- a/fs/inode/fs_foreachinode.c +++ b/fs/inode/fs_foreachinode.c @@ -158,6 +158,7 @@ static int foreach_inodelevel(FAR struct inode *node, struct inode_path_s *info) /**************************************************************************** * Public Functions ****************************************************************************/ + /**************************************************************************** * Name: foreach_inode * diff --git a/fs/mount/fs_automount.c b/fs/mount/fs_automount.c index 79acb4572e..58e5bb2779 100644 --- a/fs/mount/fs_automount.c +++ b/fs/mount/fs_automount.c @@ -60,6 +60,7 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* Configuration ************************************************************ * * CONFIG_FS_AUTOMOUNTER - Enables AUTOMOUNT support diff --git a/fs/nxffs/nxffs_read.c b/fs/nxffs/nxffs_read.c index c2ae613480..80e4ec6278 100644 --- a/fs/nxffs/nxffs_read.c +++ b/fs/nxffs/nxffs_read.c @@ -132,6 +132,7 @@ static ssize_t nxffs_rdseek(FAR struct nxffs_volume_s *volume, /**************************************************************************** * Public Functions ****************************************************************************/ + /**************************************************************************** * Name: nxffs_read * diff --git a/fs/procfs/fs_procfscpuload.c b/fs/procfs/fs_procfscpuload.c index 975d66a427..9b78020280 100644 --- a/fs/procfs/fs_procfscpuload.c +++ b/fs/procfs/fs_procfscpuload.c @@ -65,6 +65,7 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* Determines the size of an intermediate buffer that must be large enough * to handle the longest line generated by this logic. */ diff --git a/fs/procfs/fs_procfsiobinfo.c b/fs/procfs/fs_procfsiobinfo.c index 31421a06f1..1ddfb8e66d 100644 --- a/fs/procfs/fs_procfsiobinfo.c +++ b/fs/procfs/fs_procfsiobinfo.c @@ -64,6 +64,7 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* Determines the size of an intermediate buffer that must be large enough * to handle the longest line generated by this logic. */ diff --git a/fs/procfs/fs_procfsmeminfo.c b/fs/procfs/fs_procfsmeminfo.c index 6b75715911..e681baefa5 100644 --- a/fs/procfs/fs_procfsmeminfo.c +++ b/fs/procfs/fs_procfsmeminfo.c @@ -64,6 +64,7 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* Determines the size of an intermediate buffer that must be large enough * to handle the longest line generated by this logic. */ diff --git a/fs/procfs/fs_procfsuptime.c b/fs/procfs/fs_procfsuptime.c index 2ea9071d6f..601adc7b01 100644 --- a/fs/procfs/fs_procfsuptime.c +++ b/fs/procfs/fs_procfsuptime.c @@ -65,6 +65,7 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* Determines the size of an intermediate buffer that must be large enough * to handle the longest line generated by this logic. */ diff --git a/fs/procfs/fs_skeleton.c b/fs/procfs/fs_skeleton.c index 8534cd3f0b..dcf7c90fae 100644 --- a/fs/procfs/fs_skeleton.c +++ b/fs/procfs/fs_skeleton.c @@ -95,7 +95,6 @@ struct skel_level1_s /* Add context specific data types here for managing the directory * open / read / stat, etc. */ - }; /**************************************************************************** diff --git a/fs/smartfs/smartfs_procfs.c b/fs/smartfs/smartfs_procfs.c index 8323ea7960..7c7eb21499 100644 --- a/fs/smartfs/smartfs_procfs.c +++ b/fs/smartfs/smartfs_procfs.c @@ -74,6 +74,7 @@ /**************************************************************************** * Private Types ****************************************************************************/ + /* This enumeration identifies all of the thread attributes that can be * accessed via the procfs file system. */ diff --git a/fs/vfs/fs_stat.c b/fs/vfs/fs_stat.c index 9ebdba4540..2ab3fd0182 100644 --- a/fs/vfs/fs_stat.c +++ b/fs/vfs/fs_stat.c @@ -353,8 +353,8 @@ int inode_stat(FAR struct inode *inode, FAR struct stat *buf) } else #endif - { - } + { + } } else if (inode->u.i_ops != NULL) { diff --git a/sched/clock/clock_getres.c b/sched/clock/clock_getres.c index 5aed3b87db..8e80a83d13 100644 --- a/sched/clock/clock_getres.c +++ b/sched/clock/clock_getres.c @@ -76,6 +76,7 @@ int clock_getres(clockid_t clock_id, struct timespec *res) case CLOCK_MONOTONIC: #endif case CLOCK_REALTIME: + /* Form the timspec using clock resolution in nanoseconds */ res->tv_sec = 0; diff --git a/sched/module/mod_procfs.c b/sched/module/mod_procfs.c index c658189604..9b4cbf4910 100644 --- a/sched/module/mod_procfs.c +++ b/sched/module/mod_procfs.c @@ -279,7 +279,8 @@ static int modprocfs_dup(FAR const struct file *oldp, FAR struct file *newp) /* Allocate a new container to hold the task and attribute selection */ - newpriv = (FAR struct modprocfs_file_s *)kmm_zalloc(sizeof(struct modprocfs_file_s)); + newpriv = (FAR struct modprocfs_file_s *) + kmm_zalloc(sizeof(struct modprocfs_file_s)); if (!newpriv) { ferr("ERROR: Failed to allocate file attributes\n"); diff --git a/sched/paging/pg_worker.c b/sched/paging/pg_worker.c index 35dd6bf727..b846e3d54d 100644 --- a/sched/paging/pg_worker.c +++ b/sched/paging/pg_worker.c @@ -606,7 +606,8 @@ int pg_worker(int argc, char *argv[]) else { pgerr("ERROR: Timeout!\n"); - DEBUGASSERT(clock_systimer() - g_starttime < CONFIG_PAGING_TIMEOUT_TICKS); + DEBUGASSERT(clock_systimer() - g_starttime < + CONFIG_PAGING_TIMEOUT_TICKS); } #endif } diff --git a/tools/nxstyle.c b/tools/nxstyle.c index 71178cf56a..4031f33007 100644 --- a/tools/nxstyle.c +++ b/tools/nxstyle.c @@ -487,8 +487,8 @@ int main(int argc, char **argv, char **envp) strncmp(&line[indent], "CODE ", 5) == 0 || strncmp(&line[indent], "const ", 6) == 0 || strncmp(&line[indent], "double ", 7) == 0 || -// strncmp(&line[indent], "struct ", 7) == 0 || - strncmp(&line[indent], "struct", 6) == 0 || /* May be unnamed */ + strncmp(&line[indent], "struct ", 7) == 0 || + strncmp(&line[indent], "struct\n", 7) == 0 || /* May be unnamed */ strncmp(&line[indent], "enum ", 5) == 0 || strncmp(&line[indent], "extern ", 7) == 0 || strncmp(&line[indent], "EXTERN ", 7) == 0 || @@ -510,8 +510,8 @@ int main(int argc, char **argv, char **envp) strncmp(&line[indent], "uint8_t ", 8) == 0 || strncmp(&line[indent], "uint16_t ", 9) == 0 || strncmp(&line[indent], "uint32_t ", 9) == 0 || -// strncmp(&line[indent], "union ", 6) == 0 || - strncmp(&line[indent], "union", 5) == 0 || /* May be unnamed */ + strncmp(&line[indent], "union ", 6) == 0 || + strncmp(&line[indent], "union\n", 6) == 0 || /* May be unnamed */ strncmp(&line[indent], "unsigned ", 9) == 0 || strncmp(&line[indent], "void ", 5) == 0 || strncmp(&line[indent], "volatile ", 9) == 0)