From 1620e7d29b7e1844c487e4ce9977c31e97d4c512 Mon Sep 17 00:00:00 2001 From: Davide Pesavento Date: Thu, 14 Mar 2024 20:27:25 -0400 Subject: [PATCH] build: tell libc++ to avoid including transitive headers And apply BOOST_*_NO_DEPRECATED to debug builds only --- .waf-tools/boost.py | 3 --- .waf-tools/coverage.py | 2 -- .waf-tools/default-compiler-flags.py | 13 +++++++------ .waf-tools/doxygen.py | 14 +++++--------- .waf-tools/sanitizers.py | 2 +- 5 files changed, 13 insertions(+), 21 deletions(-) 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 , 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 6869097..39b3025 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 getCompilerVersion(self, conf): 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_ASIO_NO_DEPRECATED', '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']} @@ -246,6 +244,9 @@ def getDebugFlags(self, conf): 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/doxygen.py b/.waf-tools/doxygen.py index 6d8066b..6948194 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(): @@ -27,9 +24,8 @@ def doxygen(bld): bld(features="doxygen", doxyfile='Doxyfile', ...) """ -from fnmatch import fnmatchcase -import os, os.path, re, stat -from waflib import Task, Utils, Node, Logs, Errors, Build +import os, os.path, re +from waflib import Task, Utils, Node from waflib.TaskGen import feature DOXY_STR = '"${DOXYGEN}" - ' @@ -207,8 +203,8 @@ def configure(conf): conf.find_program('doxygen', var='DOXYGEN', mandatory=False) conf.find_program('tar', var='TAR', mandatory=False) -# doxygen docs +# doxygen command from waflib.Build import BuildContext class doxy(BuildContext): - cmd = "doxygen" - fun = "doxygen" + cmd = 'doxygen' + fun = 'doxygen' 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',