Commit 4c356d69 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Make vrt.h include <stddef.h> and <stdint.h>

Originally we decided that the output of VCC should be 100%
stand-alone and therefore contain no #includes at all.  This
was hoped to avoid unspecified trouble with C-compilers at runtime.

But C99 is old enough to drink now, so we move forward.

The script in tools/include_wash.py checks *.c files and
complains about violations of our intended #include orders.
parent 3ad16662
#!/usr/bin/env python
from __future__ import print_function
import os
def check(fn):
l = []
for i in open(fn):
i = i.strip()
if len(i) == 0:
continue
if i[0] != "#":
continue
if i.find("include") == -1:
continue
if i.find('"') == -1:
l.append(i.split('<')[1].split('>')[0])
else:
l.append(i.split('"')[1])
if "vrt.h" in l:
vrt = l.index("vrt.h")
if not "vdef.h" in l:
print(fn, "vdef.h not included with vrt.h")
vdef = l.index("vdef.h")
if vdef > vrt:
print(fn, "vdef.h included after vrt.h")
for i in ("stddef.h", "stdint.h", "cache/cache.h", "cache.h"):
if i in l:
print(fn, i + " included with vrt.h")
for i in ("cache/cache.h", "cache.h"):
if i in l:
for i in (
"stddef.h", "stdint.h", "vrt.h",
"math.h", "pthread.h", "stdarg.h", "sys/types.h",
"vdef.h", "miniobj.h", "vas.h", "vqueue.h",
):
if i in l:
print(fn, i + " included with cache.h")
for (dir, dns, fns) in os.walk("."):
for f in fns:
if f[-2:] == ".c":
check(dir + "/" + f)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment