diff --git a/.gitattributes b/.gitattributes index 9bacc11b6..c5b0f5fb2 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2,10 +2,10 @@ *.gitattributes text svneol=native#text/plain # Scriptish formats -*.bat text svneol=crlf#text/plain +*.bat text eol=crlf svneol=crlf#text/plain *.bsh text svneol=native#text/x-beanshell *.cgi text svneol=native#text/plain -*.cmd text svneol=native#text/plain +*.cmd text eol=crlf svneol=crlf#text/plain *.js text svneol=native#text/javascript *.php text svneol=native#text/x-php *.pl text svneol=native#text/x-perl diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 3a4e640e6..d6e34cfbe 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -141,8 +141,8 @@ stages: wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - sudo -E apt-add-repository "deb http://apt.llvm.org/xenial/ ${LLVM_REPO} main" fi - sudo -E apt-get update - sudo -E apt-get -yq --no-install-suggests --no-install-recommends install ${PACKAGES} + sudo -E apt-get -o Acquire::Retries=3 update + sudo -E apt-get -o Acquire::Retries=3 -yq --no-install-suggests --no-install-recommends install ${PACKAGES} displayName: Install - bash: | set -e @@ -381,8 +381,8 @@ stages: wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - sudo -E apt-add-repository "deb http://apt.llvm.org/xenial/ ${LLVM_REPO} main" fi - sudo -E apt-get update - sudo -E apt-get -yq --no-install-suggests --no-install-recommends install ${PACKAGES} + sudo -E apt-get -o Acquire::Retries=3 update + sudo -E apt-get -o Acquire::Retries=3 -yq --no-install-suggests --no-install-recommends install ${PACKAGES} displayName: Install - bash: | set -e @@ -438,8 +438,8 @@ stages: wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - sudo -E apt-add-repository "deb http://apt.llvm.org/xenial/ ${LLVM_REPO} main" fi - sudo -E apt-get update - sudo -E apt-get -yq --no-install-suggests --no-install-recommends install ${PACKAGES} + sudo -E apt-get -o Acquire::Retries=3 update + sudo -E apt-get -o Acquire::Retries=3 -yq --no-install-suggests --no-install-recommends install ${PACKAGES} displayName: Install - bash: | set -e diff --git a/src/build/property.jam b/src/build/property.jam index 35bf96281..8671e6e4d 100644 --- a/src/build/property.jam +++ b/src/build/property.jam @@ -1,6 +1,7 @@ # Copyright 2001, 2002, 2003 Dave Abrahams # Copyright 2006 Rene Rivera # Copyright 2002, 2003, 2004, 2005, 2006 Vladimir Prus +# Copyright 2020 Nikita Kniazev # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) @@ -104,28 +105,15 @@ rule evaluate-conditionals-in-context ( properties * : context * ) { # Have negative checks local fail ; - while $(condition) + for local c in $(condition) { - local c = $(condition[1]) ; - local m = [ MATCH ^!(.*) : $(c) ] ; - if $(m) + local c = [ MATCH ^(!)?(.*) : $(c) ] ; + # It is XOR: $(c[1]) = "!" ^ $(c[2]) in $(context) + if $(c[1]) = "!" && $(c[2]) in $(context) || $(c[1]) != "!" && ! ( $(c[2]) in $(context) ) { - local p = $(m:G=$(c:G)) ; - if $(p) in $(context) - { - fail = true ; - c = ; - } + fail = true ; + break ; } - else - { - if ! $(c) in $(context) - { - fail = true ; - c = ; - } - } - condition = $(condition[2-]) ; } if ! $(fail) { @@ -574,7 +562,10 @@ rule translate ( properties * : project-id : project-location : context-module ) local e ; for local c in [ regex.split $(condition) "," ] { - e += [ feature.expand-subfeatures $(c) : true ] ; + # strip negation for expansion and readd after + c = [ MATCH "^(!)?(.*)" : $(c) ] ; + local expanded = [ feature.expand-subfeatures $(c[2]) : true ] ; + e += $(c[1])$(expanded) ; } condition = "$(e:J=,):" ; @@ -901,11 +892,26 @@ rule __test__ ( ) : refine gcc:foo : gcc:bar : $(test-space) ; + assert.result + : evaluate-conditionals-in-context + release,off:MY_RELEASE + : gcc release on ; + assert.result MY_RELEASE : evaluate-conditionals-in-context release,off:MY_RELEASE : gcc release off ; + assert.result MY_RELEASE + : evaluate-conditionals-in-context + release,!off:MY_RELEASE + : gcc release on ; + + assert.result + : evaluate-conditionals-in-context + release,!off:MY_RELEASE + : gcc release off ; + assert.result debug : as-path off debug : $(test-space) ; @@ -973,5 +979,10 @@ rule __test__ ( ) assert.result-set-equal gcc,3.0 FOO : split-conditional gcc,3.0:FOO ; + # Test translate does not choke on negations in conditional + assert.result gcc,!off:HELLO + : translate gcc,!off:HELLO + : project-id : project-location : context-module ; + feature.finish-test property-test-temp ; } diff --git a/src/engine/config_toolset.bat b/src/engine/config_toolset.bat index d4b535f9f..d13fcc667 100644 --- a/src/engine/config_toolset.bat +++ b/src/engine/config_toolset.bat @@ -33,7 +33,7 @@ call :Call_If_Exists "%B2_TOOLSET_ROOT%bin\VCVARS32.BAT" if not "_%B2_TOOLSET_ROOT%_" == "__" ( set "PATH=%B2_TOOLSET_ROOT%bin;%PATH%" ) -set "B2_CXX=%CXX% /nologo /MT /TP /Feb2 /wd4996 /O2 /GL" +set "B2_CXX=%CXX% /nologo /MP /MT /TP /Feb2 /wd4996 /O2 /GL" set "B2_CXX_LINK=/link kernel32.lib advapi32.lib user32.lib" set "_known_=1" goto :eof @@ -48,7 +48,7 @@ if NOT "_%B2_TOOLSET_ROOT%_" == "__" ( if "_%VCINSTALLDIR%_" == "__" ( set "PATH=%B2_TOOLSET_ROOT%bin;%PATH%" ) ) -set "B2_CXX=%CXX% /nologo /MT /TP /Feb2 /wd4996 /O2 /GL" +set "B2_CXX=%CXX% /nologo /MP /MT /TP /Feb2 /wd4996 /O2 /GL" set "B2_CXX_LINK=/link kernel32.lib advapi32.lib user32.lib" set "_known_=1" goto :eof @@ -67,7 +67,7 @@ if NOT "_%B2_TOOLSET_ROOT%_" == "__" ( if "_%VCINSTALLDIR%_" == "__" ( set "PATH=%B2_TOOLSET_ROOT%bin;%PATH%" ) ) -set "B2_CXX=%CXX% /nologo /MT /TP /Feb2 /wd4996 /O2 /GL" +set "B2_CXX=%CXX% /nologo /MP /MT /TP /Feb2 /wd4996 /O2 /GL" set "B2_CXX_LINK=/link kernel32.lib advapi32.lib user32.lib" set "_known_=1" goto :eof @@ -87,7 +87,7 @@ if NOT "_%B2_TOOLSET_ROOT%_" == "__" ( if "_%VCINSTALLDIR%_" == "__" ( set "PATH=%B2_TOOLSET_ROOT%bin;%PATH%" ) ) -set "B2_CXX=%CXX% /nologo /Zi /MT /TP /Feb2 /wd4996 /Ox /GL /EHsc" +set "B2_CXX=%CXX% /nologo /MP /MT /TP /Feb2 /wd4996 /O2 /GL" set "B2_CXX_LINK=/link kernel32.lib advapi32.lib user32.lib" set "_known_=1" goto :eof @@ -109,7 +109,7 @@ REM return to current directory as vsdevcmd_end.bat switches to %USERPROFILE%\So pushd %CD% if "_%VSINSTALLDIR%_" == "__" call :Call_If_Exists "%B2_TOOLSET_ROOT%Auxiliary\Build\vcvarsall.bat" %B2_BUILD_ARGS% popd -set "B2_CXX=%CXX% /nologo /MT /TP /Feb2 /wd4996 /O2 /GL" +set "B2_CXX=%CXX% /nologo /MP /MT /TP /Feb2 /wd4996 /O2 /GL" set "B2_CXX_LINK=/link kernel32.lib advapi32.lib user32.lib" set "_known_=1" goto :eof @@ -131,7 +131,7 @@ REM return to current directory as vsdevcmd_end.bat switches to %USERPROFILE%\So pushd %CD% if "_%VSINSTALLDIR%_" == "__" call :Call_If_Exists "%B2_TOOLSET_ROOT%Auxiliary\Build\vcvarsall.bat" %B2_BUILD_ARGS% popd -set "B2_CXX=%CXX% /nologo /MT /TP /Feb2 /wd4996 /O2 /GL" +set "B2_CXX=%CXX% /nologo /MP /MT /TP /Feb2 /wd4996 /O2 /GL" set "B2_CXX_LINK=/link kernel32.lib advapi32.lib user32.lib" set "_known_=1" goto :eof @@ -153,7 +153,7 @@ REM return to current directory as vsdevcmd_end.bat switches to %USERPROFILE%\So pushd %CD% if "_%VSINSTALLDIR%_" == "__" call :Call_If_Exists "%B2_TOOLSET_ROOT%Auxiliary\Build\vcvarsall.bat" %B2_BUILD_ARGS% popd -set "B2_CXX=%CXX% /nologo /MT /TP /Feb2 /wd4996 /O2 /GL" +set "B2_CXX=%CXX% /nologo /MP /MT /TP /Feb2 /wd4996 /O2 /GL" set "B2_CXX_LINK=/link kernel32.lib advapi32.lib user32.lib" set "_known_=1" goto :eof diff --git a/src/engine/execvms.cpp b/src/engine/execvms.cpp index 6c95011c6..b4b061845 100644 --- a/src/engine/execvms.cpp +++ b/src/engine/execvms.cpp @@ -169,7 +169,8 @@ void exec_cmd /* Open tempfile. */ if ( !( f = fopen( commandbuf + 1, "w" ) ) ) { - printf( "can't open cmd_string file\n" ); + err_printf( "[errno %d] failed to wite cmd_string file '%s': %s", + errno, commandbuf + 1, strerror(errno) ); rstat = EXEC_CMD_FAIL; exit_reason = EXIT_FAIL; diff --git a/src/engine/function.cpp b/src/engine/function.cpp index 71f9b119a..295192d15 100644 --- a/src/engine/function.cpp +++ b/src/engine/function.cpp @@ -24,6 +24,7 @@ #include "output.h" #include +#include #include #include #include @@ -5017,8 +5018,8 @@ LIST * function_run( FUNCTION * function_, FRAME * frame, STACK * s ) if ( !out_file ) { - err_printf( "failed to write output file '%s'!\n", - out_name->value ); + err_printf( "[errno %d] failed to write output file '%s': %s", + errno, out_name->value, strerror(errno) ); exit( EXITBAD ); } string_free( out_name ); diff --git a/src/engine/hcache.cpp b/src/engine/hcache.cpp index 15ab12a35..f46f69bf9 100644 --- a/src/engine/hcache.cpp +++ b/src/engine/hcache.cpp @@ -45,6 +45,9 @@ #include "variable.h" #include "output.h" +#include +#include + typedef struct hcachedata HCACHEDATA ; struct hcachedata @@ -192,7 +195,12 @@ void hcache_init() return; if ( !( f = fopen( hcachename, "rb" ) ) ) + { + if ( errno != ENOENT ) + err_printf( "[errno %d] failed to read hcache file '%s': %s", + errno, hcachename, strerror(errno) ); return; + } version = read_netstring( f ); @@ -359,7 +367,11 @@ void hcache_done() goto cleanup; if ( !( f = fopen( hcachename, "wb" ) ) ) + { + err_printf( "[errno %d] failed to write hcache file '%s': %s", + errno, hcachename, strerror(errno) ); goto cleanup; + } maxage = cache_maxage(); diff --git a/src/engine/hdrmacro.cpp b/src/engine/hdrmacro.cpp index 9b6507ec6..013cc62b0 100644 --- a/src/engine/hdrmacro.cpp +++ b/src/engine/hdrmacro.cpp @@ -41,6 +41,8 @@ #include "variable.h" #include "output.h" +#include +#include /* this type is used to store a dictionary of file header macros */ typedef struct header_macro @@ -81,7 +83,11 @@ void macro_headers( TARGET * t ) } if ( !( f = fopen( object_str( t->boundname ), "r" ) ) ) + { + err_printf( "[errno %d] failed to scan include file '%s': %s", + errno, object_str( t->boundname ), strerror(errno) ); return; + } while ( fgets( buf, sizeof( buf ), f ) ) { diff --git a/src/engine/headers.cpp b/src/engine/headers.cpp index e653abcfa..5ad68cf1d 100644 --- a/src/engine/headers.cpp +++ b/src/engine/headers.cpp @@ -41,6 +41,9 @@ # include "hcache.h" #endif +#include +#include + #ifndef OPT_HEADER_CACHE_EXT static LIST * headers1( LIST *, OBJECT * file, int rec, regexp * re[] ); #endif @@ -145,7 +148,13 @@ LIST * headers1( LIST * l, OBJECT * file, int rec, regexp * re[] ) } if ( !( f = fopen( object_str( file ), "r" ) ) ) + { + /* No source files will be generated when -n flag is passed */ + if ( !globs.noexec || errno != ENOENT ) + err_printf( "[errno %d] failed to scan file '%s': %s", + errno, object_str( file ), strerror(errno) ); return l; + } while ( fgets( buf, sizeof( buf ), f ) ) { diff --git a/src/engine/jam.cpp b/src/engine/jam.cpp index eab9bae2d..fa90f6765 100644 --- a/src/engine/jam.cpp +++ b/src/engine/jam.cpp @@ -136,6 +136,9 @@ #include "execcmd.h" #include "sysinfo.h" +#include +#include + /* Macintosh is "special" */ #ifdef OS_MAC # include @@ -462,7 +465,8 @@ int main( int argc, char * * argv, char * * arg_environ ) { if ( !( globs.out = fopen( s, "w" ) ) ) { - err_printf( "Failed to write to '%s'\n", s ); + err_printf( "[errno %d] failed to write output file '%s': %s", + errno, s, strerror(errno) ); exit( EXITBAD ); } /* ++globs.noexec; */ diff --git a/src/engine/jamgram.cpp b/src/engine/jamgram.cpp index d4ccc8e4f..19cacde97 100644 --- a/src/engine/jamgram.cpp +++ b/src/engine/jamgram.cpp @@ -1,4 +1,4 @@ -/* A Bison parser, made by GNU Bison 3.5.2. */ +/* A Bison parser, made by GNU Bison 3.5.4. */ /* Bison implementation for Yacc-like parsers in C @@ -48,7 +48,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "3.5.2" +#define YYBISON_VERSION "3.5.4" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" diff --git a/src/engine/jamgram.hpp b/src/engine/jamgram.hpp index 984761939..165b07f1a 100644 --- a/src/engine/jamgram.hpp +++ b/src/engine/jamgram.hpp @@ -1,4 +1,4 @@ -/* A Bison parser, made by GNU Bison 3.5.2. */ +/* A Bison parser, made by GNU Bison 3.5.4. */ /* Bison interface for Yacc-like parsers in C diff --git a/src/engine/timestamp.cpp b/src/engine/timestamp.cpp index 67090ca55..fe9947642 100644 --- a/src/engine/timestamp.cpp +++ b/src/engine/timestamp.cpp @@ -6,6 +6,7 @@ /* This file is ALSO: * Copyright 2001-2004 David Abrahams. + * Copyright 2020 Nikita Kniazev. * 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) @@ -226,5 +227,5 @@ void timestamp_done() */ double timestamp_delta_seconds( timestamp const * const a , timestamp const * const b ) { - return ((b->secs*1000000.0+b->nsecs)-(a->secs*1000000.0+a->nsecs))/1000000.0; + return difftime(b->secs, a->secs) + (b->nsecs - a->nsecs) * 1.0E-9; } diff --git a/src/engine/yyacc.cpp b/src/engine/yyacc.cpp index 1ff3223f0..3de0210f5 100644 --- a/src/engine/yyacc.cpp +++ b/src/engine/yyacc.cpp @@ -1,12 +1,14 @@ -/* Copyright 2002 Rene Rivera. +/* Copyright 2002, 2020 Rene Rivera. ** 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) */ -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include /* # yyacc - yacc wrapper @@ -33,18 +35,68 @@ # reversed order of args to be compatible with GenFile rule # 11-20-2002 # Reimplemented as a C program for portability. (Rene Rivera) +# 05-xx-2020 +# Reimplement yet again, in C++. (Rene Rivera) */ -void print_usage(); -char * copy_string(char * s, int l); -char * tokenize_string(char * s); -int cmp_literal(const void * a, const void * b); +static const std::string usage[] = { + "yyacc " + }; -typedef struct +void print_usage() { - char * string; - char * token; -} literal; + for (auto u: usage) + { + std::printf("%s\n", u.c_str()); + } +} + +std::string tokenize_string(std::string s) +{ + std::string result = s; + if (s == ":") result = "_colon"; + else if (s == "!") result = "_bang"; + else if (s == "!=") result = "_bang_equals"; + else if (s == "&&") result = "_amperamper"; + else if (s == "&") result = "_amper"; + else if (s == "+") result = "_plus"; + else if (s == "+=") result = "_plus_equals"; + else if (s == "||") result = "_barbar"; + else if (s == "|") result = "_bar"; + else if (s == ";") result = "_semic"; + else if (s == "-") result = "_minus"; + else if (s == "<") result = "_langle"; + else if (s == "<=") result = "_langle_equals"; + else if (s == ">") result = "_rangle"; + else if (s == ">=") result = "_rangle_equals"; + else if (s == ".") result = "_period"; + else if (s == "?") result = "_question"; + else if (s == "?=") result = "_question_equals"; + else if (s == "=") result = "_equals"; + else if (s == ",") result = "_comma"; + else if (s == "[") result = "_lbracket"; + else if (s == "]") result = "_rbracket"; + else if (s == "{") result = "_lbrace"; + else if (s == "}") result = "_rbrace"; + else if (s == "(") result = "_lparen"; + else if (s == ")") result = "_rparen"; + + std::transform( + result.begin(), result.end(), result.begin(), + [](unsigned char c){ return std::toupper(c); }); + return result+"_t"; +} + +struct literal +{ + std::string string; + std::string token; + + bool operator<(const literal & x) const + { + return this->string < x.string; + } +}; int main(int argc, char ** argv) { @@ -64,8 +116,7 @@ int main(int argc, char ** argv) if (grammar_source_f == 0) { result = 1; } if (result == 0) { - literal literals[1024]; - int t = 0; + std::set literals; char l[2048]; while (1) { @@ -74,15 +125,14 @@ int main(int argc, char ** argv) char * c = l; while (1) { - char * c1 = strchr(c,'`'); + char * c1 = std::strchr(c,'`'); if (c1 != 0) { - char * c2 = strchr(c1+1,'`'); + char * c2 = std::strchr(c1+1,'`'); if (c2 != 0) { - literals[t].string = copy_string(c1+1,c2-c1-1); - literals[t].token = tokenize_string(literals[t].string); - t += 1; + auto l = std::string(c1+1,c2-c1-1); + literals.insert({ l, tokenize_string(l) }); c = c2+1; } else @@ -97,48 +147,25 @@ int main(int argc, char ** argv) break; } } - literals[t].string = 0; - literals[t].token = 0; - qsort(literals,t,sizeof(literal),cmp_literal); - { - int p = 1; - int i = 1; - while (literals[i].string != 0) - { - if (strcmp(literals[p-1].string,literals[i].string) != 0) - { - literals[p] = literals[i]; - p += 1; - } - i += 1; - } - literals[p].string = 0; - literals[p].token = 0; - t = p; - } - token_output_f = fopen(argv[2],"w"); + token_output_f = std::fopen(argv[2],"w"); if (token_output_f != 0) { - int i = 0; - while (literals[i].string != 0) + for (const literal & l: literals) { - fprintf(token_output_f," { \"%s\", %s },\n",literals[i].string,literals[i].token); - i += 1; + std::fprintf(token_output_f," { \"%s\", %s },\n",l.string.c_str(), l.token.c_str()); } - fclose(token_output_f); + std::fclose(token_output_f); } else result = 1; if (result == 0) { - grammar_output_f = fopen(argv[1],"w"); + grammar_output_f = std::fopen(argv[1],"w"); if (grammar_output_f != 0) { - int i = 0; - while (literals[i].string != 0) + for (const literal & l: literals) { - fprintf(grammar_output_f,"%%token %s\n",literals[i].token); - i += 1; + fprintf(grammar_output_f,"%%token %s\n",l.token.c_str()); } rewind(grammar_source_f); while (1) @@ -154,25 +181,20 @@ int main(int argc, char ** argv) char * c2 = strchr(c1+1,'`'); if (c2 != 0) { - literal key; - literal * replacement = 0; - key.string = copy_string(c1+1,c2-c1-1); - key.token = 0; - replacement = (literal*)bsearch( - &key,literals,t,sizeof(literal),cmp_literal); + auto replacement = literals.find({std::string(c1+1,c2-c1-1), ""}); *c1 = 0; - fprintf(grammar_output_f,"%s%s",c,replacement->token); + std::fprintf(grammar_output_f,"%s%s",c,replacement->token.c_str()); c = c2+1; } else { - fprintf(grammar_output_f,"%s",c); + std::fprintf(grammar_output_f,"%s",c); break; } } else { - fprintf(grammar_output_f,"%s",c); + std::fprintf(grammar_output_f,"%s",c); break; } } @@ -182,7 +204,7 @@ int main(int argc, char ** argv) break; } } - fclose(grammar_output_f); + std::fclose(grammar_output_f); } else result = 1; @@ -195,74 +217,3 @@ int main(int argc, char ** argv) } return result; } - -static const char * usage[] = { - "yyacc ", - 0 }; - -void print_usage() -{ - const char ** u; - for (u = usage; *u != 0; ++u) - { - fputs(*u,stderr); putc('\n',stderr); - } -} - -char * copy_string(char * s, int l) -{ - char * result = (char*)malloc(l+1); - strncpy(result,s,l); - result[l] = 0; - return result; -} - -char * tokenize_string(char * s) -{ - char * result; - const char * literal = s; - int l; - int c; - - if (strcmp(s,":") == 0) literal = "_colon"; - else if (strcmp(s,"!") == 0) literal = "_bang"; - else if (strcmp(s,"!=") == 0) literal = "_bang_equals"; - else if (strcmp(s,"&&") == 0) literal = "_amperamper"; - else if (strcmp(s,"&") == 0) literal = "_amper"; - else if (strcmp(s,"+") == 0) literal = "_plus"; - else if (strcmp(s,"+=") == 0) literal = "_plus_equals"; - else if (strcmp(s,"||") == 0) literal = "_barbar"; - else if (strcmp(s,"|") == 0) literal = "_bar"; - else if (strcmp(s,";") == 0) literal = "_semic"; - else if (strcmp(s,"-") == 0) literal = "_minus"; - else if (strcmp(s,"<") == 0) literal = "_langle"; - else if (strcmp(s,"<=") == 0) literal = "_langle_equals"; - else if (strcmp(s,">") == 0) literal = "_rangle"; - else if (strcmp(s,">=") == 0) literal = "_rangle_equals"; - else if (strcmp(s,".") == 0) literal = "_period"; - else if (strcmp(s,"?") == 0) literal = "_question"; - else if (strcmp(s,"?=") == 0) literal = "_question_equals"; - else if (strcmp(s,"=") == 0) literal = "_equals"; - else if (strcmp(s,",") == 0) literal = "_comma"; - else if (strcmp(s,"[") == 0) literal = "_lbracket"; - else if (strcmp(s,"]") == 0) literal = "_rbracket"; - else if (strcmp(s,"{") == 0) literal = "_lbrace"; - else if (strcmp(s,"}") == 0) literal = "_rbrace"; - else if (strcmp(s,"(") == 0) literal = "_lparen"; - else if (strcmp(s,")") == 0) literal = "_rparen"; - l = strlen(literal)+2; - result = (char*)malloc(l+1); - for (c = 0; literal[c] != 0; ++c) - { - result[c] = toupper(literal[c]); - } - result[l-2] = '_'; - result[l-1] = 't'; - result[l] = 0; - return result; -} - -int cmp_literal(const void * a, const void * b) -{ - return strcmp(((const literal *)a)->string,((const literal *)b)->string); -} diff --git a/src/tools/borland.jam b/src/tools/borland.jam index 484c91a4c..f5bee75ee 100644 --- a/src/tools/borland.jam +++ b/src/tools/borland.jam @@ -190,6 +190,8 @@ else flags borland.compile OPTIONS off : -w- ; flags borland.compile OPTIONS all : -w ; +flags borland.compile OPTIONS extra : -w ; +flags borland.compile OPTIONS pedantic : -w ; flags borland.compile OPTIONS on : -w! ; flags borland OPTIONS gui : -tW ; diff --git a/src/tools/builtin.py b/src/tools/builtin.py index 6bd2a8720..9eeaaf697 100644 --- a/src/tools/builtin.py +++ b/src/tools/builtin.py @@ -270,8 +270,8 @@ def register_globals (): # Advanced RISC Machines 'arm', - # z Systems (aka s390x) - 's390x', + # z Systems (aka s390x) + 's390x', # Combined architectures for platforms/toolsets that support building for # multiple architectures at once. "combined" would be the default multi-arch @@ -287,9 +287,14 @@ def register_globals (): 'native', 'i486', 'i586', 'i686', 'pentium', 'pentium-mmx', 'pentiumpro', 'pentium2', 'pentium3', 'pentium3m', 'pentium-m', 'pentium4', 'pentium4m', 'prescott', 'nocona', 'core2', 'corei7', 'corei7-avx', 'core-avx-i', 'conroe', 'conroe-xe', 'conroe-l', 'allendale', 'merom', 'merom-xe', 'kentsfield', 'kentsfield-xe', 'penryn', 'wolfdale', - 'yorksfield', 'nehalem', 'sandy-bridge', 'ivy-bridge', 'haswell', 'k6', 'k6-2', 'k6-3', 'athlon', 'athlon-tbird', 'athlon-4', 'athlon-xp', - 'athlon-mp', 'k8', 'opteron', 'athlon64', 'athlon-fx', 'k8-sse3', 'opteron-sse3', 'athlon64-sse3', 'amdfam10', 'barcelona', - 'bdver1', 'bdver2', 'bdver3', 'btver1', 'btver2', 'winchip-c6', 'winchip2', 'c3', 'c3-2', 'atom', + 'yorksfield', 'nehalem', 'sandy-bridge', 'ivy-bridge', 'haswell', 'broadwell', 'skylake', 'skylake-avx512', 'cannonlake', + 'icelake-client', 'icelake-server', 'cascadelake', 'cooperlake', 'tigerlake', + 'atom', + 'k6', 'k6-2', 'k6-3', 'athlon', 'athlon-tbird', 'athlon-4', 'athlon-xp', 'athlon-mp', 'k8', 'opteron', 'athlon64', 'athlon-fx', + 'k8-sse3', 'opteron-sse3', 'athlon64-sse3', 'amdfam10', 'barcelona', 'bdver1', 'bdver2', 'bdver3', 'btver1', + 'btver2', 'znver1', 'znver2', + 'winchip-c6', 'winchip2', + 'c3', 'c3-2', 'c7', # ia64 'itanium', 'itanium1', 'merced', 'itanium2', 'mckinley', @@ -320,8 +325,8 @@ def register_globals (): 'armv2', 'armv2a', 'armv3', 'armv3m', 'armv4', 'armv4t', 'armv5', 'armv5t', 'armv5te', 'armv6', 'armv6j', 'iwmmxt', 'ep9312', - # z Systems (aka s390x) - 'z196', 'zEC12', 'z13', 'z13', 'z14', 'z15'], + # z Systems (aka s390x) + 'z196', 'zEC12', 'z13', 'z13', 'z14', 'z15'], ['propagated', 'optional']) diff --git a/src/tools/clang-win.jam b/src/tools/clang-win.jam index 0e7a90332..94a8f5157 100644 --- a/src/tools/clang-win.jam +++ b/src/tools/clang-win.jam @@ -171,11 +171,12 @@ rule init ( version ? : command * : options * ) toolset.flags clang-win.compile .CC $(cond) : $(compiler) -m$(addr) ; toolset.flags clang-win.link .LD $(cond) : $(compiler) -m$(addr) /link "/incremental:no" "/manifest" ; - toolset.flags clang-win.compile .ASM $(cond) : $(assembler) -nologo ; + toolset.flags clang-win.compile .ASM $(cond) : $(assembler) -nologo -c -Zp4 -Cp -Cx ; + toolset.flags clang-win.compile .ASM_OUTPUT $(cond) : -Fo ; toolset.flags clang-win.archive .LD $(cond) : $(archiver) /nologo ; toolset.flags clang-win.link .MT $(cond) : $(manifest-tool) -nologo ; toolset.flags clang-win.compile .MC $(cond) : $(mc-compiler) ; - toolset.flags clang-win.compile .RC $(cond) : $(resource-compiler) /nologo ; + toolset.flags clang-win.compile .RC $(cond) : $(resource-compiler) ; toolset.flags clang-win.compile .IDL $(cond) : $(idl-compiler) ; } diff --git a/src/tools/clang.jam b/src/tools/clang.jam index bcb383703..f1850db19 100644 --- a/src/tools/clang.jam +++ b/src/tools/clang.jam @@ -55,7 +55,10 @@ rule init-cxxstd-flags ( toolset : condition * : version ) local dialects = [ feature.values ] ; dialects = [ set.difference $(dialects) : gnu iso ] ; local std ; - if [ version-ge $(version) : 3.5 ] { std = 1z ; } + if [ version-ge $(version) : 10.0 ] { std = 20 ; } + else if [ version-ge $(version) : 6.0 ] { std = 2a ; } + else if [ version-ge $(version) : 5.0 ] { std = 17 ; } + else if [ version-ge $(version) : 3.5 ] { std = 1z ; } else if [ version-ge $(version) : 3.4 ] { std = 14 ; } else if [ version-ge $(version) : 3.3 ] { std = 11 ; } else { std = 03 ; } diff --git a/src/tools/cray.jam b/src/tools/cray.jam index 107b3dbbc..d586af3af 100644 --- a/src/tools/cray.jam +++ b/src/tools/cray.jam @@ -707,7 +707,7 @@ rule set-cxxstd-procedure ( targets * : sources * : properties * ) local cxxstd = [ feature.get-values cxxstd : $(properties) ] ; local cray-cxxstd = ; - local unsupported-values = 2a ; # I don't know what '2a' means. + local unsupported-values = 2a 20 ; # I don't know what '2a' means. if $(cxxstd) && $(cxxstd) in $(unsupported-values) { diff --git a/src/tools/cw.jam b/src/tools/cw.jam index 531c9c9fa..3451f54cc 100644 --- a/src/tools/cw.jam +++ b/src/tools/cw.jam @@ -225,6 +225,8 @@ flags cw.compile CFLAGS off : -RTTI off ; flags cw.compile CFLAGS on : -w on ; flags cw.compile CFLAGS off : -w off ; flags cw.compile CFLAGS all : -w all ; +flags cw.compile CFLAGS extra : -w all ; +flags cw.compile CFLAGS pedantic : -w all ; flags cw.compile CFLAGS on : -w error ; flags cw.compile USER_CFLAGS : ; diff --git a/src/tools/darwin.jam b/src/tools/darwin.jam index 97e7ecb85..c28ca42b0 100644 --- a/src/tools/darwin.jam +++ b/src/tools/darwin.jam @@ -149,7 +149,7 @@ rule init ( version ? : command * : options * : requirement * ) flags darwin.compile OPTIONS $(condition) : -Wno-long-double ; } # - GCC on Darwin with -pedantic, suppress unsupported long long warning - flags darwin.compile OPTIONS $(condition)/all : -Wno-long-long ; + flags darwin.compile OPTIONS $(condition)/pedantic : -Wno-long-long ; # - GCC on El Capitan (10.11) does not support -finline-functions if "10.11.0" <= $(.host-osx-version) diff --git a/src/tools/embarcadero.jam b/src/tools/embarcadero.jam index 2ad845883..2b6489942 100644 --- a/src/tools/embarcadero.jam +++ b/src/tools/embarcadero.jam @@ -176,6 +176,7 @@ toolset.inherit-flags embarcadero 1z 17 2a + 20 latest 98/iso 03/iso @@ -186,6 +187,7 @@ toolset.inherit-flags embarcadero 1z/iso 17/iso 2a/iso + 20/iso latest/iso ; diff --git a/src/tools/emscripten.jam b/src/tools/emscripten.jam index c9a0009db..a12576070 100644 --- a/src/tools/emscripten.jam +++ b/src/tools/emscripten.jam @@ -46,9 +46,6 @@ toolset.inherit-flags emscripten : gcc : off speed space off on - off on full - off all on - off on off on off on ; @@ -74,11 +71,6 @@ toolset.flags emscripten.compile OPTIONS off : -fno-inline ; toolset.flags emscripten.compile OPTIONS on : -Wno-inline ; toolset.flags emscripten.compile OPTIONS full : -Wno-inline ; -toolset.flags emscripten.compile OPTIONS off : -w ; -toolset.flags emscripten.compile OPTIONS on : -Wall ; -toolset.flags emscripten.compile OPTIONS all : -Wall -pedantic ; -toolset.flags emscripten.compile OPTIONS on : -Werror ; - toolset.flags emscripten OPTIONS off : -g0 ; toolset.flags emscripten OPTIONS on : -g4 -s DEMANGLE_SUPPORT=1 ; toolset.flags emscripten OPTIONS off : -fno-rtti ; diff --git a/src/tools/features/cxxstd-feature.jam b/src/tools/features/cxxstd-feature.jam index dfddf5bb7..3d7ba8d8c 100644 --- a/src/tools/features/cxxstd-feature.jam +++ b/src/tools/features/cxxstd-feature.jam @@ -8,7 +8,7 @@ import feature ; #| tag::doc[] [[bbv2.builtin.features.cxxstd]]`cxxstd`:: -*Allowed values*: `98`, `03`, `0x`, `11`, `1y`, `14`, `1z`, `17`, `2a`, +*Allowed values*: `98`, `03`, `0x`, `11`, `1y`, `14`, `1z`, `17`, `2a`, `20`, `latest`. + Specifies the version of the C++ Standard Language to build with. All the @@ -28,7 +28,7 @@ is supported. |# # end::doc[] feature.feature cxxstd - : 98 03 0x 11 1y 14 1z 17 2a latest + : 98 03 0x 11 1y 14 1z 17 2a 20 latest : optional composite propagated ; #| tag::doc[] diff --git a/src/tools/features/instruction-set-feature.jam b/src/tools/features/instruction-set-feature.jam index d68c29afc..16868bafe 100644 --- a/src/tools/features/instruction-set-feature.jam +++ b/src/tools/features/instruction-set-feature.jam @@ -27,10 +27,13 @@ feature.feature instruction-set pentium3m pentium-m pentium4 pentium4m prescott nocona core2 corei7 corei7-avx core-avx-i conroe conroe-xe conroe-l allendale merom merom-xe kentsfield kentsfield-xe penryn wolfdale yorksfield nehalem sandy-bridge ivy-bridge haswell broadwell skylake skylake-avx512 cannonlake - icelake + icelake-client icelake-server cascadelake cooperlake tigerlake + atom k6 k6-2 k6-3 athlon athlon-tbird athlon-4 athlon-xp athlon-mp k8 opteron athlon64 athlon-fx k8-sse3 opteron-sse3 athlon64-sse3 amdfam10 barcelona bdver1 bdver2 bdver3 bdver4 btver1 - btver2 znver1 winchip-c6 winchip2 c3 c3-2 atom + btver2 znver1 znver2 + winchip-c6 winchip2 + c3 c3-2 c7 # ia64 itanium itanium1 merced itanium2 mckinley diff --git a/src/tools/gcc.jam b/src/tools/gcc.jam index ed77d40e3..ff3209f7b 100644 --- a/src/tools/gcc.jam +++ b/src/tools/gcc.jam @@ -499,8 +499,11 @@ local rule compile-link-flags ( * ) local rule init-cxxstd-flags ( condition * : version ) { local std ; - if [ version-ge $(version) : 8 ] { std = 2a ; } + if [ version-ge $(version) : 10 ] { std = 20 ; } + else if [ version-ge $(version) : 8 ] { std = 2a ; } + else if [ version-ge $(version) : 6 ] { std = 17 ; } else if [ version-ge $(version) : 5 ] { std = 1z ; } + else if [ version-ge $(version) : 4.9 ] { std = 14 ; } else if [ version-ge $(version) : 4.8 ] { std = 1y ; } else if [ version-ge $(version) : 4.7 ] { std = 11 ; } else if [ version-ge $(version) : 3.3 ] { std = 98 ; } @@ -1260,7 +1263,11 @@ cpu-flags gcc OPTIONS : x86 : broadwell : -march=broadwell ; cpu-flags gcc OPTIONS : x86 : skylake : -march=skylake ; cpu-flags gcc OPTIONS : x86 : skylake-avx512 : -march=skylake-avx512 ; cpu-flags gcc OPTIONS : x86 : cannonlake : -march=skylake-avx512 -mavx512vbmi -mavx512ifma -msha ; -cpu-flags gcc OPTIONS : x86 : icelake : -march=icelake ; +cpu-flags gcc OPTIONS : x86 : icelake-client : -march=icelake-client ; +cpu-flags gcc OPTIONS : x86 : icelake-server : -march=icelake-server ; +cpu-flags gcc OPTIONS : x86 : cascadelake : -march=skylake-avx512 -mavx512vnni ; +cpu-flags gcc OPTIONS : x86 : cooperlake : -march=cooperlake ; +cpu-flags gcc OPTIONS : x86 : tigerlake : -march=tigerlake ; cpu-flags gcc OPTIONS : x86 : k6 : -march=k6 ; cpu-flags gcc OPTIONS : x86 : k6-2 : -march=k6-2 ; cpu-flags gcc OPTIONS : x86 : k6-3 : -march=k6-3 ; @@ -1286,10 +1293,12 @@ cpu-flags gcc OPTIONS : x86 : bdver4 : -march=bdver4 ; cpu-flags gcc OPTIONS : x86 : btver1 : -march=btver1 ; cpu-flags gcc OPTIONS : x86 : btver2 : -march=btver2 ; cpu-flags gcc OPTIONS : x86 : znver1 : -march=znver1 ; +cpu-flags gcc OPTIONS : x86 : znver2 : -march=znver2 ; cpu-flags gcc OPTIONS : x86 : winchip-c6 : -march=winchip-c6 ; cpu-flags gcc OPTIONS : x86 : winchip2 : -march=winchip2 ; cpu-flags gcc OPTIONS : x86 : c3 : -march=c3 ; cpu-flags gcc OPTIONS : x86 : c3-2 : -march=c3-2 ; +cpu-flags gcc OPTIONS : x86 : c7 : -march=c7 ; ## cpu-flags gcc OPTIONS : x86 : atom : -march=atom ; # Sparc diff --git a/src/tools/gcc.py b/src/tools/gcc.py index 1db7d5758..9bf98a3a7 100644 --- a/src/tools/gcc.py +++ b/src/tools/gcc.py @@ -779,6 +779,15 @@ cpu_flags('gcc', 'OPTIONS', 'x86', 'sandy-bridge', ['-march=corei7-avx']) cpu_flags('gcc', 'OPTIONS', 'x86', 'core-avx-i', ['-march=core-avx-i']) cpu_flags('gcc', 'OPTIONS', 'x86', 'ivy-bridge', ['-march=core-avx-i']) cpu_flags('gcc', 'OPTIONS', 'x86', 'haswell', ['-march=core-avx-i', '-mavx2', '-mfma', '-mbmi', '-mbmi2', '-mlzcnt']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'broadwell', ['-march=broadwell']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'skylake', ['-march=skylake']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'skylake-avx512', ['-march=skylake-avx512']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'cannonlake', ['-march=skylake-avx512', '-mavx512vbmi', '-mavx512ifma', '-msha']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'icelake-client', ['-march=icelake-client']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'icelake-server', ['-march=icelake-server']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'cascadelake', ['-march=skylake-avx512', '-mavx512vnni']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'cooperlake', ['-march=cooperlake']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'tigerlake', ['-march=tigerlake']) cpu_flags('gcc', 'OPTIONS', 'x86', 'k6', ['-march=k6']) cpu_flags('gcc', 'OPTIONS', 'x86', 'k6-2', ['-march=k6-2']) cpu_flags('gcc', 'OPTIONS', 'x86', 'k6-3', ['-march=k6-3']) @@ -802,10 +811,13 @@ cpu_flags('gcc', 'OPTIONS', 'x86', 'bdver2', ['-march=bdver2']) cpu_flags('gcc', 'OPTIONS', 'x86', 'bdver3', ['-march=bdver3']) cpu_flags('gcc', 'OPTIONS', 'x86', 'btver1', ['-march=btver1']) cpu_flags('gcc', 'OPTIONS', 'x86', 'btver2', ['-march=btver2']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'znver1', ['-march=znver1']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'znver2', ['-march=znver2']) cpu_flags('gcc', 'OPTIONS', 'x86', 'winchip-c6', ['-march=winchip-c6']) cpu_flags('gcc', 'OPTIONS', 'x86', 'winchip2', ['-march=winchip2']) cpu_flags('gcc', 'OPTIONS', 'x86', 'c3', ['-march=c3']) cpu_flags('gcc', 'OPTIONS', 'x86', 'c3-2', ['-march=c3-2']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'c7', ['-march=c7']) ## cpu_flags('gcc', 'OPTIONS', 'x86', 'atom', ['-march=atom']) # Sparc diff --git a/src/tools/intel-darwin.jam b/src/tools/intel-darwin.jam index 03a75df61..6dc5d8e3b 100644 --- a/src/tools/intel-darwin.jam +++ b/src/tools/intel-darwin.jam @@ -32,6 +32,8 @@ toolset.inherit-rules intel-darwin : gcc ; toolset.inherit-flags intel-darwin : gcc : off on full space off all on + extra pedantic + off on x86/32 x86/64 ; @@ -139,10 +141,11 @@ flags intel-darwin.compile OPTIONS space : -O1 ; # no specific spa conroe conroe-xe conroe-l allendale merom merom-xe kentsfield kentsfield-xe penryn wolfdale yorksfield nehalem sandy-bridge ivy-bridge haswell - broadwell skylake skylake-avx512 cannonlake icelake ; + broadwell skylake skylake-avx512 cannonlake icelake-client + icelake-server cascadelake cooperlake tigerlake ; .cpu-type-amd64 = k8 opteron athlon64 athlon-fx k8-sse3 opteron-sse3 athlon64-sse3 amdfam10 barcelona bdver1 bdver2 bdver3 - bdver4 btver1 btver2 znver1 ; + bdver4 btver1 btver2 znver1 znver2 ; .cpu-type-x86-64 = $(.cpu-type-em64t) $(.cpu-type-amd64) ; flags intel-darwin.compile OPTIONS $(.cpu-type-x86-64)/32 : -m32 ; # -mcmodel=small ; @@ -151,10 +154,16 @@ flags intel-darwin.compile OPTIONS $(.cpu-type-x86-64)/
off : -w0 ; flags intel-darwin.compile.c OPTIONS on : -w1 ; flags intel-darwin.compile.c OPTIONS all : -w2 ; +flags intel-darwin.compile.c OPTIONS extra : -w3 ; +flags intel-darwin.compile.c OPTIONS pedantic : -w3 -Wcheck ; +flags intel-darwin.compile.c OPTIONS on : -Werror-all ; flags intel-darwin.compile.c++ OPTIONS off : -w0 ; flags intel-darwin.compile.c++ OPTIONS on : -w1 ; flags intel-darwin.compile.c++ OPTIONS all : -w2 ; +flags intel-darwin.compile.c++ OPTIONS extra : -w3 ; +flags intel-darwin.compile.c++ OPTIONS pedantic : -w3 -Wcheck ; +flags intel-darwin.compile.c++ OPTIONS on : -Werror-all ; actions compile.c { diff --git a/src/tools/intel-linux.jam b/src/tools/intel-linux.jam index d5edf2e1d..920cefed0 100644 --- a/src/tools/intel-linux.jam +++ b/src/tools/intel-linux.jam @@ -36,6 +36,8 @@ toolset.inherit-flags intel-linux : gcc : off on full space speed off all on + extra pedantic + off on ; if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ] @@ -157,6 +159,9 @@ SPACE = " " ; flags intel-linux.compile OPTIONS off : -w0 ; flags intel-linux.compile OPTIONS on : -w1 ; flags intel-linux.compile OPTIONS all : -w2 ; +flags intel-linux.compile OPTIONS extra : -w3 ; +flags intel-linux.compile OPTIONS pedantic : -w3 -Wcheck ; +flags intel-linux.compile OPTIONS on : -Werror-all ; rule compile.c++ ( targets * : sources * : properties * ) { diff --git a/src/tools/intel-vxworks.jam b/src/tools/intel-vxworks.jam index 2a457c334..c217ead32 100644 --- a/src/tools/intel-vxworks.jam +++ b/src/tools/intel-vxworks.jam @@ -31,6 +31,8 @@ toolset.inherit-rules intel-vxworks : gcc ; toolset.inherit-flags intel-vxworks : gcc : off on full space off all on + extra pedantic + off on x86/32 x86/64 ; @@ -112,9 +114,13 @@ flags intel-vxworks.compile INCLUDES ; .cpu-type-em64t = prescott nocona core2 corei7 corei7-avx core-avx-i conroe conroe-xe conroe-l allendale merom merom-xe kentsfield kentsfield-xe penryn wolfdale - yorksfield nehalem sandy-bridge ivy-bridge haswell ; + yorksfield nehalem sandy-bridge ivy-bridge haswell + broadwell skylake skylake-avx512 cannonlake + icelake-client icelake-server cascadelake cooperlake + tigerlake ; .cpu-type-amd64 = k8 opteron athlon64 athlon-fx k8-sse3 opteron-sse3 - athlon64-sse3 amdfam10 barcelona bdver1 bdver2 bdver3 btver1 btver2 ; + athlon64-sse3 amdfam10 barcelona bdver1 bdver2 bdver3 btver1 btver2 + znver1 znver2 ; .cpu-type-x86-64 = $(.cpu-type-em64t) $(.cpu-type-amd64) ; #flags intel-vxworks.compile OPTIONS $(.cpu-type-x86-64)/32 : -m32 ; # -mcmodel=small ; @@ -123,10 +129,16 @@ flags intel-vxworks.compile INCLUDES ; flags intel-vxworks.compile.c OPTIONS off : -w0 ; flags intel-vxworks.compile.c OPTIONS on : -w1 ; flags intel-vxworks.compile.c OPTIONS all : -w2 ; +flags intel-vxworks.compile.c OPTIONS extra : -w3 ; +flags intel-vxworks.compile.c OPTIONS pedantic : -w3 -Wcheck ; +flags intel-vxworks.compile.c OPTIONS on : -Werror-all ; flags intel-vxworks.compile.c++ OPTIONS off : -w0 ; flags intel-vxworks.compile.c++ OPTIONS on : -w1 ; flags intel-vxworks.compile.c++ OPTIONS all : -w2 ; +flags intel-vxworks.compile.c++ OPTIONS extra : -w3 ; +flags intel-vxworks.compile.c++ OPTIONS pedantic : -w3 -Wcheck ; +flags intel-vxworks.compile.c++ OPTIONS on : -Werror-all ; actions compile.c { diff --git a/src/tools/mipspro.jam b/src/tools/mipspro.jam index 9e8c39693..7f4d05950 100644 --- a/src/tools/mipspro.jam +++ b/src/tools/mipspro.jam @@ -69,6 +69,9 @@ flags mipspro.compile OPTIONS on : -g ; flags mipspro.compile OPTIONS off : -w ; flags mipspro.compile OPTIONS on : -ansiW -diag_suppress 1429 ; # suppress long long is nonstandard warning flags mipspro.compile OPTIONS all : -fullwarn ; +flags mipspro.compile OPTIONS extra : -fullwarn ; +flags mipspro.compile OPTIONS pedantic : -fullwarn -ansiW -diag_suppress 1429 ; # suppress long long is nonstandard warning +flags mipspro.compile OPTIONS on : -w2 ; flags mipspro.compile OPTIONS speed : -Ofast ; flags mipspro.compile OPTIONS space : -O2 ; flags mipspro.compile OPTIONS : "-LANG:std" ; diff --git a/src/tools/msvc.jam b/src/tools/msvc.jam index c0e7b1b58..90c296229 100644 --- a/src/tools/msvc.jam +++ b/src/tools/msvc.jam @@ -7,6 +7,7 @@ # Copyright (c) 2008 Jurko Gospodnetic # Copyright (c) 2014 Microsoft Corporation # Copyright (c) 2019 MichaƂ Janiszewski +# Copyright (c) 2020 Nikita Kniazev # # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt or copy at @@ -36,7 +37,7 @@ command line tools are listed below: The user would then call the boost build executable with the toolset set equal to `msvc-[version number]` for example to build with Visual Studio -2017 one could run: +2019 one could run: ---- .\b2 toolset=msvc-14.2 target @@ -229,6 +230,7 @@ import set ; import toolset ; import type ; import virtual-target ; +import version ; type.register MANIFEST : manifest ; @@ -454,6 +456,21 @@ rule configure-version-specific ( toolset : version : conditions ) } } + # 12.0 (VS2013 Update 2) introduced /Zc:inline opt-in standard conformance + # compiler flag that also similar to linker /opt:ref removes unreferenced + # variables and functions that have internal linkage + if ! [ version.version-less [ SPLIT_BY_CHARACTERS $(version) : . ] : 12 ] + { + toolset.flags $(toolset).compile CFLAGS $(conditions) : "/Zc:inline" ; + } + + # 14.0 introduced /Zc:throwingNew opt-in flag that disables a workaround + # for not throwing operator new in VC up to 6.0 + if ! [ version.version-less [ SPLIT_BY_CHARACTERS $(version) : . ] : 14 ] + { + toolset.flags $(toolset).compile CFLAGS $(conditions) : "/Zc:throwingNew" ; + } + # # Processor-specific optimization. # @@ -735,7 +752,7 @@ rule compile.rc ( targets + : sources * : properties * ) actions compile.rc { - $(.SETUP) $(.RC) -l 0x409 -U$(UNDEFS) -D$(DEFINES) -I"$(INCLUDES:W)" -fo "$(<:W)" "$(>:W)" + $(.SETUP) $(.RC) /nologo -l 0x409 -U$(UNDEFS) -D$(DEFINES) -I"$(INCLUDES:W)" -fo "$(<:W)" "$(>:W)" } toolset.uses-features msvc.link : ; @@ -801,19 +818,15 @@ rule link.dll ( targets + : sources * : properties * ) # assemblies and Windows native DLLs. The manifests are embedded as resources # and are useful in any PE target (both DLL and EXE). -if [ os.name ] in NT { actions link bind DEF_FILE LIBRARIES_MENTIONED_BY_FILE { $(.SETUP) $(.LD) $(LINKFLAGS) /out:"$(<[1]:W)" /LIBPATH:"$(LINKPATH:W)" $(OPTIONS) @"@($(<[1]:W).rsp:E=$(.nl)"$(>)" $(.nl)$(LIBRARIES_MENTIONED_BY_FILE) $(.nl)$(LIBRARIES) $(.nl)"$(LIBRARY_OPTION)$(FINDLIBS_ST).lib" $(.nl)"$(LIBRARY_OPTION)$(FINDLIBS_SA).lib")" - if %ERRORLEVEL% NEQ 0 EXIT %ERRORLEVEL% } actions manifest { - if exist "$(<[1]).manifest" ( - $(.SETUP) $(.MT) -manifest "$(<[1]).manifest" "-outputresource:$(<[1]);1" - ) + $(.SETUP) $(.MT) -manifest "$(<[1]).manifest" "-outputresource:$(<[1]);1" } actions manifest.user bind EMBED_MANIFEST_FILE @@ -824,44 +837,11 @@ if [ os.name ] in NT actions link.dll bind IMPORT_LIB DEF_FILE LIBRARIES_MENTIONED_BY_FILE { $(.SETUP) $(.LD) /DLL $(LINKFLAGS) /out:"$(<[1]:W)" /IMPLIB:"$(IMPORT_LIB:W)" /LIBPATH:"$(LINKPATH:W)" /def:"$(DEF_FILE)" $(OPTIONS) @"@($(<[1]:W).rsp:E=$(.nl)"$(>)" $(.nl)$(LIBRARIES_MENTIONED_BY_FILE) $(.nl)$(LIBRARIES) $(.nl)"$(LIBRARY_OPTION)$(FINDLIBS_ST).lib" $(.nl)"$(LIBRARY_OPTION)$(FINDLIBS_SA).lib")" - if %ERRORLEVEL% NEQ 0 EXIT %ERRORLEVEL% } actions manifest.dll { - if exist "$(<[1]).manifest" ( - $(.SETUP) $(.MT) -manifest "$(<[1]).manifest" "-outputresource:$(<[1]);2" - ) - } - actions manifest.dll.user bind EMBED_MANIFEST_FILE - { - $(.SETUP) $(.MT) -manifest "$(EMBED_MANIFEST_FILE)" "-outputresource:$(<[1]);2" - } -} -else -{ - actions link bind DEF_FILE LIBRARIES_MENTIONED_BY_FILE - { - $(.SETUP) $(.LD) $(LINKFLAGS) /out:"$(<[1]:W)" /LIBPATH:"$(LINKPATH:W)" $(OPTIONS) @"@($(<[1]:W).rsp:E=$(.nl)"$(>)" $(.nl)$(LIBRARIES_MENTIONED_BY_FILE) $(.nl)$(LIBRARIES) $(.nl)"$(LIBRARY_OPTION)$(FINDLIBS_ST).lib" $(.nl)"$(LIBRARY_OPTION)$(FINDLIBS_SA).lib")" - } - - actions manifest - { - if test -e "$(<[1]).manifest"; then - $(.MT) -manifest "$(<[1]:W).manifest" "-outputresource:$(<[1]:W);1" - fi - } - - actions link.dll bind IMPORT_LIB DEF_FILE LIBRARIES_MENTIONED_BY_FILE - { - $(.SETUP) $(.LD) /DLL $(LINKFLAGS) /out:"$(<[1]:W)" /IMPLIB:"$(IMPORT_LIB:W)" /LIBPATH:"$(LINKPATH:W)" /def:"$(DEF_FILE)" $(OPTIONS) @"@($(<[1]:W).rsp:E=$(.nl)"$(>)" $(.nl)$(LIBRARIES_MENTIONED_BY_FILE) $(.nl)$(LIBRARIES) $(.nl)"$(LIBRARY_OPTION)$(FINDLIBS_ST).lib" $(.nl)"$(LIBRARY_OPTION)$(FINDLIBS_SA).lib")" - } - - actions manifest.dll - { - if test -e "$(<[1]).manifest"; then - $(.SETUP) $(.MT) -manifest "$(<[1]:W).manifest" "-outputresource:$(<[1]:W);2" - fi + $(.SETUP) $(.MT) -manifest "$(<[1]).manifest" "-outputresource:$(<[1]);2" } actions manifest.dll.user bind EMBED_MANIFEST_FILE @@ -2020,15 +2000,16 @@ if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ] # detailed information. .cpu-type-g5 = i586 pentium pentium-mmx ; .cpu-type-g6 = i686 pentiumpro pentium2 pentium3 pentium3m pentium-m k6 - k6-2 k6-3 winchip-c6 winchip2 c3 c3-2 ; + k6-2 k6-3 winchip-c6 winchip2 c3 c3-2 c7 ; .cpu-type-em64t = prescott nocona core2 corei7 corei7-avx core-avx-i conroe conroe-xe conroe-l allendale merom merom-xe kentsfield kentsfield-xe penryn wolfdale yorksfield nehalem sandy-bridge ivy-bridge haswell - broadwell skylake skylake-avx512 cannonlake icelake ; + broadwell skylake skylake-avx512 cannonlake icelake-client + icelake-server cascadelake cooperlake tigerlake ; .cpu-type-amd64 = k8 opteron athlon64 athlon-fx k8-sse3 opteron-sse3 athlon64-sse3 amdfam10 barcelona bdver1 bdver2 bdver3 - bdver4 btver1 btver2 znver1 ; + bdver4 btver1 btver2 znver1 znver2 ; .cpu-type-g7 = pentium4 pentium4m athlon athlon-tbird athlon-4 athlon-xp athlon-mp $(.cpu-type-em64t) $(.cpu-type-amd64) ; .cpu-type-itanium = itanium itanium1 merced ; diff --git a/src/tools/msvc.py b/src/tools/msvc.py index efd3a908a..39063a5ca 100644 --- a/src/tools/msvc.py +++ b/src/tools/msvc.py @@ -1252,12 +1252,13 @@ __cpu_arch_ia64 = [ # detailed information. __cpu_type_g5 = ['i586', 'pentium', 'pentium-mmx' ] __cpu_type_g6 = ['i686', 'pentiumpro', 'pentium2', 'pentium3', 'pentium3m', 'pentium-m', 'k6', - 'k6-2', 'k6-3', 'winchip-c6', 'winchip2', 'c3', 'c3-2' ] + 'k6-2', 'k6-3', 'winchip-c6', 'winchip2', 'c3', 'c3-2', 'c7' ] __cpu_type_em64t = ['prescott', 'nocona', 'core2', 'corei7', 'corei7-avx', 'core-avx-i', 'conroe', 'conroe-xe', 'conroe-l', 'allendale', 'merom', 'merom-xe', 'kentsfield', 'kentsfield-xe', 'penryn', 'wolfdale', - 'yorksfield', 'nehalem', 'sandy-bridge', 'ivy-bridge', 'haswell' ] + 'yorksfield', 'nehalem', 'sandy-bridge', 'ivy-bridge', 'haswell', 'broadwell', 'skylake', 'skylake-avx512', 'cannonlake', + 'icelake-client', 'icelake-server', 'cascadelake', 'cooperlake', 'tigerlake' ] __cpu_type_amd64 = ['k8', 'opteron', 'athlon64', 'athlon-fx', 'k8-sse3', 'opteron-sse3', 'athlon64-sse3', 'amdfam10', 'barcelona', - 'bdver1', 'bdver2', 'bdver3', 'btver1', 'btver2' ] + 'bdver1', 'bdver2', 'bdver3', 'btver1', 'btver2', 'znver1', 'znver2' ] __cpu_type_g7 = ['pentium4', 'pentium4m', 'athlon', 'athlon-tbird', 'athlon-4', 'athlon-xp' 'athlon-mp'] + __cpu_type_em64t + __cpu_type_amd64 __cpu_type_itanium = ['itanium', 'itanium1', 'merced'] diff --git a/src/tools/pathscale.jam b/src/tools/pathscale.jam index 94abcf1c8..1eadb444c 100644 --- a/src/tools/pathscale.jam +++ b/src/tools/pathscale.jam @@ -83,7 +83,9 @@ flags pathscale.compile OPTIONS full : -inline ; flags pathscale.compile OPTIONS off : -woffall ; flags pathscale.compile OPTIONS on : -Wall ; -flags pathscale.compile OPTIONS all : -Wall -pedantic ; +flags pathscale.compile OPTIONS all : -Wall ; +flags pathscale.compile OPTIONS extra : -Wall -Wextra ; +flags pathscale.compile OPTIONS pedantic : -Wall -Wextra -pedantic ; flags pathscale.compile OPTIONS on : -Werror ; flags pathscale.compile OPTIONS on : -ggdb ; diff --git a/src/tools/pgi.jam b/src/tools/pgi.jam index e40fcd09a..6eed7759f 100644 --- a/src/tools/pgi.jam +++ b/src/tools/pgi.jam @@ -57,6 +57,7 @@ flags pgi.compile.c++ OPTIONS 14 : -std=c++14 ; flags pgi.compile.c++ OPTIONS 1z : -std=c++17 ; flags pgi.compile.c++ OPTIONS 17 : -std=c++17 ; flags pgi.compile.c++ OPTIONS 2a : -std=c++17 ; +flags pgi.compile.c++ OPTIONS 20 : -std=c++17 ; flags pgi.compile.c++ OPTIONS latest : -std=c++17 ; flags pgi.compile OPTIONS shared : -fpic ; @@ -68,6 +69,8 @@ flags pgi.compile OPTIONS space : -fast ; flags pgi.compile OPTIONS off : -Minform=severe ; flags pgi.compile OPTIONS on : -Minform=warn ; flags pgi.compile OPTIONS all : -Minform=warn ; +flags pgi.compile OPTIONS extra : -Minform=inform ; +flags pgi.compile OPTIONS pedantic : -Minform=inform ; flags pgi.compile OPTIONS on : -Werror ; flags pgi.compile.c++ OPTIONS off : --no_rtti ; diff --git a/src/tools/qcc.jam b/src/tools/qcc.jam index 7ea470d2c..740e90705 100644 --- a/src/tools/qcc.jam +++ b/src/tools/qcc.jam @@ -99,6 +99,8 @@ toolset.flags qcc.compile OPTIONS full : -Wc,-finline-functions -Wc,-W toolset.flags qcc.compile OPTIONS off : -w ; toolset.flags qcc.compile OPTIONS all : -Wc,-Wall ; +toolset.flags qcc.compile OPTIONS extra : -Wc,-Wall -Wc,-Wextra ; +toolset.flags qcc.compile OPTIONS pedantic : -Wc,-Wall -Wc,-Wextra -Wc,-pedantic ; toolset.flags qcc.compile OPTIONS on : -Wc,-Werror ; toolset.flags qcc.compile OPTIONS on : -p ; diff --git a/src/tools/sun.jam b/src/tools/sun.jam index da7d7fe82..a5a19089d 100644 --- a/src/tools/sun.jam +++ b/src/tools/sun.jam @@ -106,6 +106,8 @@ flags sun.compile OPTIONS multi : -mt ; flags sun.compile OPTIONS off : -erroff ; flags sun.compile OPTIONS on : -erroff=%none ; flags sun.compile OPTIONS all : -erroff=%none ; +flags sun.compile OPTIONS extra : -erroff=%none ; +flags sun.compile OPTIONS pedantic : -erroff=%none ; flags sun.compile OPTIONS on : -errwarn ; flags sun.compile OPTIONS hidden : -xldscope=hidden ; diff --git a/src/tools/vmsdecc.jam b/src/tools/vmsdecc.jam index 8f1e8ed17..48b685857 100644 --- a/src/tools/vmsdecc.jam +++ b/src/tools/vmsdecc.jam @@ -93,6 +93,8 @@ flags vmsdecc.compile OPTIONS space : /OPT=INLINE=SIZE/OPT=NOINLIN flags vmsdecc.compile OPTIONS off : /NOWARN ; flags vmsdecc.compile OPTIONS on : /WARN ; flags vmsdecc.compile OPTIONS all : /WARN=ENABLE=ALL ; +flags vmsdecc.compile OPTIONS extra : /WARN=ENABLE=ALL ; +flags vmsdecc.compile OPTIONS pedantic : /WARN=ENABLE=ALL ; flags vmsdecc.compile.c++ OPTIONS off : /OPT=NOINLINE ; diff --git a/src/tools/xlcpp.jam b/src/tools/xlcpp.jam index 1b66301cf..a9e767cef 100644 --- a/src/tools/xlcpp.jam +++ b/src/tools/xlcpp.jam @@ -112,6 +112,10 @@ flags xlcpp.compile.c++ OPTIONS 0x : -std=c++11 ; flags xlcpp.compile.c++ OPTIONS 11 : -std=c++11 ; flags xlcpp.compile.c++ OPTIONS 1y : -std=c++1y ; flags xlcpp.compile.c++ OPTIONS 14 : -std=c++1y ; +flags xlcpp.compile.c++ OPTIONS 1z : -std=c++1y ; +flags xlcpp.compile.c++ OPTIONS 17 : -std=c++1y ; +flags xlcpp.compile.c++ OPTIONS 2a : -std=c++1y ; +flags xlcpp.compile.c++ OPTIONS 20 : -std=c++1y ; flags xlcpp.compile.c++ OPTIONS latest : -std=c++1y ; flags xlcpp.compile OPTIONS ;