From bd623592ddb46fa06ae982f76f24e6c57f246ffd Mon Sep 17 00:00:00 2001 From: Bryce Adelstein-Lelbach Date: Sun, 7 Nov 2010 19:51:05 +0000 Subject: [PATCH] Spoke to volodya about this; these changes add support for bootstrapping the Boost.Build system with clang. I also fixed a few things in the clang-linux toolchain; - Clang doesn't support -pg. - Adding -O0 to turn optimization off is silly, because it is set to zero by default if omitted on the command line. The compiler will whine about unused options if you later add another -O flag. The Boost.Build UTF interface adds a second -O0, so you end up with two redundant command line options and a warning from bjam/clang for every invocation of the compiler when using the test framework. [SVN r66441] --- v2/bootstrap.sh | 14 +++++++++++++- v2/engine/src/build.jam | 8 ++++++++ v2/engine/src/build.sh | 5 +++++ v2/engine/src/modules/order.c | 4 ++-- v2/tools/clang-linux.jam | 4 ++-- 5 files changed, 30 insertions(+), 5 deletions(-) diff --git a/v2/bootstrap.sh b/v2/bootstrap.sh index ddc2c0217..3b681004c 100755 --- a/v2/bootstrap.sh +++ b/v2/bootstrap.sh @@ -1,6 +1,7 @@ #!/bin/sh # Copyright (C) 2005, 2006 Douglas Gregor. # Copyright (C) 2006 The Trustees of Indiana University +# Copyright (C) 2010 Bryce Lelbach # # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) @@ -68,6 +69,10 @@ if test "x$TOOLSET" = x; then TOOLSET=gcc ;; + clang* ) + TOOLSET=clang + ;; + sun* ) TOOLSET=sun ;; @@ -78,6 +83,13 @@ if test "x$TOOLSET" = x; then esac fi +case $TOOLSET in + clang*) + TOOLSET=clang + ;; +esac + + rm -f config.log # Build bjam @@ -104,4 +116,4 @@ Bootstrapping is done. To build and install, run: ./bjam install --prefix= -EOF \ No newline at end of file +EOF diff --git a/v2/engine/src/build.jam b/v2/engine/src/build.jam index d53b4928f..f6a2e9c89 100644 --- a/v2/engine/src/build.jam +++ b/v2/engine/src/build.jam @@ -193,6 +193,14 @@ toolset como como : "-o " : -D [ opt --debug : --no_inlining ] -I$(--python-include) -I$(--extra-include) : -L$(--python-lib[1]) -l$(--python-lib[2]) ; +## Clang Linux 2.8+ +toolset clang clang : "-o " : -D + : -Wno-unused -Wno-format + [ opt --release : -Os ] + [ opt --debug : -g -O0 -fno-inline ] + [ opt --profile : -finline-functions -g ] + -I$(--python-include) -I$(--extra-include) + : -L$(--python-lib[1]) -l$(--python-lib[2]) ; ## MacOSX Darwin, using GCC 2.9.x, 3.x toolset darwin cc : "-o " : -D : diff --git a/v2/engine/src/build.sh b/v2/engine/src/build.sh index 3f23fc683..f1fb806d3 100755 --- a/v2/engine/src/build.sh +++ b/v2/engine/src/build.sh @@ -208,6 +208,11 @@ case $BOOST_JAM_TOOLSET in BOOST_JAM_CC=cc ;; + clang*) + BOOST_JAM_CC="clang -Wno-unused -Wno-format" + BOOST_JAM_TOOLSET=clang + ;; + tru64cxx) BOOST_JAM_CC=cc ;; diff --git a/v2/engine/src/modules/order.c b/v2/engine/src/modules/order.c index 54b58cd54..c06f6713b 100644 --- a/v2/engine/src/modules/order.c +++ b/v2/engine/src/modules/order.c @@ -50,8 +50,8 @@ void do_ts(int** graph, int current_vertex, int* colors, int** result_ptr) if (colors[adjacent_vertex] == white) do_ts(graph, adjacent_vertex, colors, result_ptr); - else if (colors[adjacent_vertex] == gray) - ; /* This is loop. Not sure what to do... */ + //else if (colors[adjacent_vertex] == gray) + //; /* This is loop. Not sure what to do... */ } colors[current_vertex] = black; **result_ptr = current_vertex; diff --git a/v2/tools/clang-linux.jam b/v2/tools/clang-linux.jam index 2ab4db559..00ebd1c27 100644 --- a/v2/tools/clang-linux.jam +++ b/v2/tools/clang-linux.jam @@ -71,7 +71,7 @@ rule init ( version ? : command * : options * ) SPACE = " " ; # Declare flags and action for compilation. -toolset.flags clang-linux.compile OPTIONS off : -O0 ; +toolset.flags clang-linux.compile OPTIONS off : ; toolset.flags clang-linux.compile OPTIONS speed : -O3 ; toolset.flags clang-linux.compile OPTIONS space : -Os ; @@ -85,7 +85,7 @@ toolset.flags clang-linux.compile OPTIONS all : -Wall -pedantic ; toolset.flags clang-linux.compile OPTIONS on : -Werror ; toolset.flags clang-linux.compile OPTIONS on : -g ; -toolset.flags clang-linux.compile OPTIONS on : -pg ; +toolset.flags clang-linux.compile OPTIONS on : ; toolset.flags clang-linux.compile OPTIONS off : -fno-rtti ; rule compile.c++ ( targets * : sources * : properties * )