include/nuttx/sensors/ioctl.h macros defined and redefined.
- Dominant language
- C
- Stars
- 4k
- Forks
- 1.7k
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 237
Description
This was Issue 178 in the old Bitbucket repository
David Alessio
created an issue 2019-11-07
SNIOC_START is defined 3 times. Other macros may also be.
Gregory Nutt
2019-11-07
Certainly SNIOC_STOP is also defined multiple times.
Other than the warnings this produces (and the overall aesthetics), this is not really a problem.
The easiest solution would be to add a group of common IOCTL commands at the top of the file and move the common definitions.
The commands are, however, only common in name not function. So a more proper solution would be rename all of the IOCTL commands, adding the device name to the IOCTL command name. That would nicely clean up the namespace (but would be a really tedious job). Someone who really cares about sensor drivers should take this on someday.
David Alessio
2019-11-0
The output of awk '/#define/ {print $2}' include/nuttx/sensors/ioctl.h | sort | uniq -d is:
SNIOC_MEASURE
SNIOC_START
SNIOC_START_SELFTEST
SNIOC_STOP
suggested fix: replace all duplicate #define statements with a comment similar to: /* SNIOC_START see above */
ioctl cmds need only be unique within a particular driver, they need not be unique across all drivers.
Contributor guide
Assessment
This issue has not been assessed yet.