build: tell libc++ to avoid including transitive headers

And apply BOOST_*_NO_DEPRECATED to debug builds only

Change-Id: Ic65c7ceae07ab6ecd3b3f7322b68f817a41f7716
diff --git a/.jenkins.d/10-build.sh b/.jenkins.d/10-build.sh
index 9d415d5..f0910cf 100755
--- a/.jenkins.d/10-build.sh
+++ b/.jenkins.d/10-build.sh
@@ -30,7 +30,5 @@
 ./waf --color=yes configure --debug --with-tests $ASAN $COVERAGE
 ./waf --color=yes build
 
-# (tests will be run against the debug version)
-
 # Install
 sudo ./waf --color=yes install
diff --git a/.waf-tools/boost.py b/.waf-tools/boost.py
index a6cdabe..dab6949 100644
--- a/.waf-tools/boost.py
+++ b/.waf-tools/boost.py
@@ -1,6 +1,3 @@
-#!/usr/bin/env python
-# encoding: utf-8
-#
 # partially based on boost.py written by Gernot Vormayr
 # written by Ruediger Sonderfeld <ruediger@c-plusplus.de>, 2008
 # modified by Bjoern Michaelsen, 2008
diff --git a/.waf-tools/coverage.py b/.waf-tools/coverage.py
index cc58165..4ca9740 100644
--- a/.waf-tools/coverage.py
+++ b/.waf-tools/coverage.py
@@ -1,5 +1,3 @@
-# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
-
 from waflib import TaskGen
 
 def options(opt):
diff --git a/.waf-tools/default-compiler-flags.py b/.waf-tools/default-compiler-flags.py
index 7784d9f..681913f 100644
--- a/.waf-tools/default-compiler-flags.py
+++ b/.waf-tools/default-compiler-flags.py
@@ -1,5 +1,3 @@
-# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
-
 import platform
 from waflib import Configure, Logs, Utils
 
@@ -128,16 +126,16 @@
 
     def getGeneralFlags(self, conf):
         """Get dict of CXXFLAGS, LINKFLAGS, and DEFINES that are always needed"""
+        return {'CXXFLAGS': [], 'LINKFLAGS': [], 'DEFINES': []}
+
+    def getDebugFlags(self, conf):
+        """Get dict of CXXFLAGS, LINKFLAGS, and DEFINES that are needed only in debug mode"""
         return {
             'CXXFLAGS': [],
             'LINKFLAGS': [],
             'DEFINES': ['BOOST_FILESYSTEM_NO_DEPRECATED'],
         }
 
-    def getDebugFlags(self, conf):
-        """Get dict of CXXFLAGS, LINKFLAGS, and DEFINES that are needed only in debug mode"""
-        return {'CXXFLAGS': [], 'LINKFLAGS': [], 'DEFINES': []}
-
     def getOptimizedFlags(self, conf):
         """Get dict of CXXFLAGS, LINKFLAGS, and DEFINES that are needed only in optimized mode"""
         return {'CXXFLAGS': [], 'LINKFLAGS': [], 'DEFINES': ['NDEBUG']}
@@ -245,6 +243,9 @@
         elif self.getCompilerVersion(conf) >= (15, 0, 0):
             # https://releases.llvm.org/15.0.0/projects/libcxx/docs/UsingLibcxx.html#enabling-the-safe-libc-mode
             flags['DEFINES'] += ['_LIBCPP_ENABLE_ASSERTIONS=1']
+        # Tell libc++ to avoid including transitive headers
+        # https://libcxx.llvm.org/DesignDocs/HeaderRemovalPolicy.html
+        flags['DEFINES'] += ['_LIBCPP_REMOVE_TRANSITIVE_INCLUDES=1']
         return flags
 
     def getOptimizedFlags(self, conf):
diff --git a/.waf-tools/dependency-checker.py b/.waf-tools/dependency-checker.py
index 63199a5..d978ba9 100644
--- a/.waf-tools/dependency-checker.py
+++ b/.waf-tools/dependency-checker.py
@@ -1,6 +1,4 @@
-# encoding: utf-8
-
-from waflib import Options, Logs
+from waflib import Options
 from waflib.Configure import conf
 
 def addDependencyOptions(self, opt, name, extraHelp=''):
diff --git a/.waf-tools/doxygen.py b/.waf-tools/doxygen.py
index 6d8066b..18b3292 100644
--- a/.waf-tools/doxygen.py
+++ b/.waf-tools/doxygen.py
@@ -1,9 +1,6 @@
-#! /usr/bin/env python
-# encoding: UTF-8
 # Thomas Nagy 2008-2010 (ita)
 
 """
-
 Doxygen support
 
 Variables passed to bld():
diff --git a/.waf-tools/pch.py b/.waf-tools/pch.py
index 103e752..6f410b4 100644
--- a/.waf-tools/pch.py
+++ b/.waf-tools/pch.py
@@ -1,5 +1,3 @@
-#! /usr/bin/env python
-# encoding: utf-8
 # Alexander Afanasyev (UCLA), 2014
 
 """
diff --git a/.waf-tools/sanitizers.py b/.waf-tools/sanitizers.py
index a8fe55d..c65d009 100644
--- a/.waf-tools/sanitizers.py
+++ b/.waf-tools/sanitizers.py
@@ -1,4 +1,4 @@
-# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
+# Davide Pesavento (LIP6), 2016
 
 def options(opt):
     opt.add_option('--with-sanitizer', action='store', default='', dest='sanitizers',
diff --git a/.waf-tools/sphinx_build.py b/.waf-tools/sphinx_build.py
index b44a54f..8585352 100644
--- a/.waf-tools/sphinx_build.py
+++ b/.waf-tools/sphinx_build.py
@@ -1,6 +1,3 @@
-#!/usr/bin/env python
-# encoding: utf-8
-
 # inspired by code by Hans-Martin von Gaudecker, 2012
 
 import os
diff --git a/.waf-tools/unix-socket.py b/.waf-tools/unix-socket.py
index 4c98f1a..391fffb 100644
--- a/.waf-tools/unix-socket.py
+++ b/.waf-tools/unix-socket.py
@@ -1,5 +1,3 @@
-# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
-#
 # Copyright (c) 2014-2019, Regents of the University of California
 #
 # GPL 3.0 license, see the COPYING.md file for more information
diff --git a/.waf-tools/websocket.py b/.waf-tools/websocket.py
index e2cba84..afb7e70 100644
--- a/.waf-tools/websocket.py
+++ b/.waf-tools/websocket.py
@@ -1,5 +1,3 @@
-# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
-
 from waflib import Options, Logs, Errors, Configure
 import re