libnfc/HACKING.md

69 lines
2.1 KiB
Markdown
Raw Normal View History

Hello hackers!
General remarks about contributing
----------------------------------
Contributions to the libnfc are welcome!
Here are some directions to get you started:
1. Follow style conventions
The source code of the library trend to follow some conventions so that it
is consistent in style and thus easier to read.
Look around and respect the same style.
Don't use tabs. Increment unit is two spaces.
2012-05-29 17:56:02 +02:00
Don't leave dandling spaces or tabs at EOL.
Helper script to get some uniformity in the style:
$ make style
2016-04-08 11:02:40 +02:00
If you use vim see the [Vim: How to prevent trailing whitespaces](http://www.carbon-project.org/Vim__How_to_prevent_trailing_whitespaces.html).
2. Chase warnings: no warning should be introduced by your changes
Depending what you touch, you can check with:
2016-04-08 11:02:40 +02:00
2.1 When using autotools
2016-04-08 11:02:40 +02:00
$ autoreconf -Wall -vis
2.2 When compiling
2016-04-08 11:02:40 +02:00
2013-03-06 10:54:54 +01:00
2.2.1 Using extra flags:
2016-04-08 11:02:40 +02:00
$ export CFLAGS="-Wall -g -O2 -Wextra -pipe -funsigned-char -fstrict-aliasing \
-Wchar-subscripts -Wundef -Wshadow -Wcast-align -Wwrite-strings -Wunused \
-Wuninitialized -Wpointer-arith -Wredundant-decls -Winline -Wformat \
-Wformat-security -Wswitch-enum -Winit-self -Wmissing-include-dirs \
-Wmissing-prototypes -Wstrict-prototypes -Wold-style-definition \
-Wbad-function-cast -Wnested-externs -Wmissing-declarations"
$ ./configure
$ make clean
$ make
2013-03-06 10:54:54 +01:00
2.2.2 Using clang:
2016-04-08 11:02:40 +02:00
You can use same CFLAGS but also `-Wunreachable-code`
$ scan-build ./configure
$ make clean
$ scan-build make
2.2.3 Using `cppcheck` (v1.58 or higher):
$ make cppcheck
2.3 When Debianizing
2016-04-08 11:02:40 +02:00
$ lintian --info --display-info --display-experimental *deb
or (shorter version)
$ lintian -iIE *deb
3. Preserve cross-platform compatility
2016-04-08 11:02:40 +02:00
The source code should remain compilable across various platforms,
including some you probably cannot test alone so keep it in mind.
Supported platforms:
2016-04-08 11:02:40 +02:00
- Linux
- FreeBSD
- Mac OS X
2016-04-08 11:02:40 +02:00
- Windows with MinGW