build: Automatically detect use of POSIX includes

Scan the source for POSIX includes outside of the
allowed locations in check_format.sh. This only
tests for POSIX headers - not Linux Standards Base.

Also, fix one bug that was caught by this addition.

Change-Id: Ib0ca93fe6ac552dc49d95b27b4803e40282027e8
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Ben Walker 2017-05-08 12:46:11 -07:00
parent b961d9cc12
commit 1b2764421c
4 changed files with 94 additions and 2 deletions

View File

@ -72,6 +72,7 @@ extern "C" {
#include <syslog.h>
#include <termios.h>
#include <unistd.h>
#include <net/if.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <sys/ioctl.h>

View File

@ -42,8 +42,6 @@
#include <linux/netlink.h>
#include <linux/rtnetlink.h>
#include <net/if.h>
static TAILQ_HEAD(, spdk_interface) g_interface_head;

View File

@ -62,6 +62,17 @@ else
fi
rm -f eofnl.log
echo -n "Checking for POSIX includes..."
git grep -I -i -f scripts/posix.txt -- './*' ':!include/spdk/stdinc.h' ':!lib/vhost/rte_vhost/**' ':!scripts/posix.txt' > scripts/posix.log || true
if [ -s scripts/posix.log ]; then
echo "POSIX includes detected. Please include spdk/stdinc.h instead."
cat scripts/posix.log
rc=1
else
echo " OK"
fi
rm -f scripts/posix.log
if hash pep8; then
echo -n "Checking Python style..."

82
scripts/posix.txt Normal file
View File

@ -0,0 +1,82 @@
<aio.h>
<arpa/inet.h>
<assert.h>
<complex.h>
<cpio.h>
<ctype.h>
<dirent.h>
<dlfcn.h>
<errno.h>
<fcntl.h>
<fenv.h>
<float.h>
<fmtmsg.h>
<fnmatch.h>
<ftw.h>
<glob.h>
<grp.h>
<iconv.h>
<inttypes.h>
<iso646.h>
<langinfo.h>
<libgen.h>
<limits.h>
<locale.h>
<math.h>
<monetary.h>
<mqueue.h>
<ndbm.h>
<net/if.h>
<netdb.h>
<netinet/in.h>
<netinet/tcp.h>
<nl_types.h>
<poll.h>
<pthread.h>
<pwd.h>
<regex.h>
<sched.h>
<search.h>
<semaphore.h>
<setjmp.h>
<signal.h>
<spawn.h>
<stdarg.h>
<stdbool.h>
<stddef.h>
<stdint.h>
<stdio.h>
<stdlib.h>
<string.h>
<strings.h>
<stropts.h>
<sys/ipc.h>
<sys/mman.h>
<sys/msg.h>
<sys/resource.h>
<sys/select.h>
<sys/sem.h>
<sys/shm.h>
<sys/socket.h>
<sys/stat.h>
<sys/statvfs.h>
<sys/time.h>
<sys/times.h>
<sys/types.h>
<sys/uio.h>
<sys/un.h>
<sys/utsname.h>
<sys/wait.h>
<syslog.h>
<tar.h>
<termios.h>
<tgmath.h>
<time.h>
<trace.h>
<ulimit.h>
<unistd.h>
<utime.h>
<utmpx.h>
<wchar.h>
<wctype.h>
<wordexp.h>