You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by gn...@apache.org on 2020/05/19 00:00:34 UTC
[incubator-nuttx] branch master updated: nxstyle: Allow Hz, KHz,
GHz in identifiers
This is an automated email from the ASF dual-hosted git repository.
gnutt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 3334b40 nxstyle: Allow Hz, KHz, GHz in identifiers
3334b40 is described below
commit 3334b40aef676bd05e50c319218ee26e54f0f219
Author: Nathan Hartman <59...@users.noreply.github.com>
AuthorDate: Mon May 18 19:28:40 2020 -0400
nxstyle: Allow Hz, KHz, GHz in identifiers
Per the coding standard, we allow MHz as one of the few allowed
exceptions to the identifier case rules.
However, because this exception specifically looked for "MHz" we
would generate undeserved nxstyle errors for Hz, KHz, GHz.
This change adds recognition of any Hz value by eliminating the
requirement for Hz to be preceded by M.
tools/nxstyle.c:
* main(): Eliminate requirement for Hz to be preceded by M to
match the rule for allowed mixed case identifier. Update
relevant comments.
See:
https://cwiki.apache.org/confluence/display/NUTTX/Coding+Standard#macros
Mailing list discussion archived at:
https://lists.apache.org/thread.html/r481b9d145f439c24c8d70992081bf670bc0e893167149e0017519439%40%3Cdev.nuttx.apache.org%3E
---
tools/nxstyle.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/tools/nxstyle.c b/tools/nxstyle.c
index e5d9067..1b0f39a 100644
--- a/tools/nxstyle.c
+++ b/tools/nxstyle.c
@@ -1399,7 +1399,7 @@ int main(int argc, char **argv, char **envp)
* IGMPv2 as an IGMP version number
* [0-9]p[0-9] as a decimal point
* d[0-9] as a divisor
- * MHz for frequencies
+ * Hz for frequencies (including KHz, MHz, etc.)
*/
if (!have_lower && islower(line[n]))
@@ -1461,9 +1461,8 @@ int main(int argc, char **argv, char **envp)
break;
case 'z':
- if (!have_upper || n < 2 ||
- line[n - 1] != 'H' ||
- line[n - 2] != 'M')
+ if (!have_upper || n < 1 ||
+ line[n - 1] != 'H')
{
have_lower = true;
}