mirror of
https://github.com/apache/nuttx.git
synced 2026-05-19 20:06:24 +08:00
Add toosl/nxstyle.c
This commit is contained in:
@@ -11015,4 +11015,6 @@
|
||||
From Pierre-noel Bouteville (2015-10-07).
|
||||
* fs/tmpfs: Created a directory that will eventually hold a trivial
|
||||
temporary RAM file file system (2015-10-0i8).
|
||||
* tools/: Add crappy style checking tool nxstyle.c. See thee tools/
|
||||
README file for more info (2015-10-08).
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
+13
-3
@@ -1,7 +1,7 @@
|
||||
############################################################################
|
||||
# Makefile.host
|
||||
#
|
||||
# Copyright (C) 2007, 2008, 2011-2012 Gregory Nutt. All rights reserved.
|
||||
# Copyright (C) 2007, 2008, 2011-2012, 2015 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
@@ -61,8 +61,9 @@ endif
|
||||
# Targets
|
||||
|
||||
all: b16$(HOSTEXEEXT) bdf-converter$(HOSTEXEEXT) cmpconfig$(HOSTEXEEXT) \
|
||||
configure$(HOSTEXEEXT) mkconfig$(HOSTEXEEXT) mkdeps$(HOSTEXEEXT) mksymtab$(HOSTEXEEXT) \
|
||||
mksyscall$(HOSTEXEEXT) mkversion$(HOSTEXEEXT)
|
||||
configure$(HOSTEXEEXT) mkconfig$(HOSTEXEEXT) mkdeps$(HOSTEXEEXT) \
|
||||
mksymtab$(HOSTEXEEXT) mksyscall$(HOSTEXEEXT) mkversion$(HOSTEXEEXT) \
|
||||
nxstyle$(HOSTEXEEXT)
|
||||
default: mkconfig$(HOSTEXEEXT) mksyscall$(HOSTEXEEXT) mkdeps$(HOSTEXEEXT)
|
||||
|
||||
ifdef HOSTEXEEXT
|
||||
@@ -152,6 +153,15 @@ ifdef HOSTEXEEXT
|
||||
bdf-converter: bdf-converter$(HOSTEXEEXT)
|
||||
endif
|
||||
|
||||
# nxsytle - Check a file for compliance to NuttX coding style
|
||||
|
||||
nxstyle$(HOSTEXEEXT): nxstyle.c
|
||||
$(Q) $(HOSTCC) $(HOSTCFLAGS) -o nxstyle$(HOSTEXEEXT) nxstyle.c
|
||||
|
||||
ifdef HOSTEXEEXT
|
||||
nxstyle: nxstyle$(HOSTEXEEXT)
|
||||
endif
|
||||
|
||||
# Create dependencies for a list of files
|
||||
|
||||
mkdeps$(HOSTEXEEXT): mkdeps.c csvparser.c
|
||||
|
||||
@@ -210,6 +210,30 @@ mkctags.sh
|
||||
A script for creating ctags from Ken Pettit. See http://en.wikipedia.org/wiki/Ctags
|
||||
and http://ctags.sourceforge.net/
|
||||
|
||||
nxstyle.c
|
||||
---------
|
||||
|
||||
I am embarassed that this is here. This program is a complete hack
|
||||
but, unfortunately, it has become so useful to me that I need to keep
|
||||
it here.
|
||||
|
||||
A little background: I have tinkered with pretty printers for some
|
||||
time and have not been happy with the results. An alternative that
|
||||
occurred to me would be just a standard checker that examines a C
|
||||
file that gives warnings for violations of the coding standard.
|
||||
|
||||
This turns out to be more difficult that you might think. A pretty
|
||||
printer understands C syntax: They break the file up into its C
|
||||
components then reassembles the output in the format. But parsing the
|
||||
C loses the original file layout and so it not useful in this case.
|
||||
|
||||
This program instead, uses a collection of heuristics (i.e., hacks and
|
||||
bandaids) to examine the C file for obvious violations of the coding
|
||||
standard. This program is completely ignorant of C syntax; it simply
|
||||
performs crude pattern matching to check the file.
|
||||
|
||||
Usage: nxstyle <path-to-file-to-check>
|
||||
|
||||
pic32mx
|
||||
-------
|
||||
|
||||
|
||||
+987
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user