1 # Copyright 2019 Hans Dembinski, Henry Schreiner
3 # Distributed under the Boost Software License, Version 1.0.
4 # (See accompanying file LICENSE_1_0.txt
5 # or copy at http://www.boost.org/LICENSE_1_0.txt)
11 this_path = os.path.dirname(__file__)
14 include_path = os.path.join(this_path, "..", "include")
15 for root, dirs, files in os.walk(include_path):
17 fn = os.path.join(root, fn)
18 assert fn.startswith(include_path)
19 fn = fn[len(include_path) + 1 :]
23 def get_headers(filename):
24 with open(filename) as f:
25 for hdr in re.findall('^#include [<"]([^>"]+)[>"]', f.read(), re.MULTILINE):
26 if not hdr.startswith("boost/histogram"):
28 yield hdr.replace("/", os.path.sep) # adapt the paths for Windows
31 included_headers = set()
32 unread_headers = set()
33 for hdr in get_headers(os.path.join(this_path, "odr_test.cpp")):
34 unread_headers.add(hdr)
37 included_headers.update(unread_headers)
38 for hdr in tuple(unread_headers): # copy needed because unread_headers is modified
39 unread_headers.remove(hdr)
40 for hdr2 in get_headers(os.path.join(include_path, hdr)):
41 if hdr2 not in included_headers:
42 unread_headers.add(hdr2)
44 diff = sorted(all_headers - set(included_headers))
50 print("Header not included in odr_test.cpp:")