From owner-svn-src-stable@freebsd.org Tue Dec 19 11:44:25 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 70DA6EA229F; Tue, 19 Dec 2017 11:44:25 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4AFD274606; Tue, 19 Dec 2017 11:44:25 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vBJBiOkn079353; Tue, 19 Dec 2017 11:44:24 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBJBiO4j079352; Tue, 19 Dec 2017 11:44:24 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201712191144.vBJBiO4j079352@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Tue, 19 Dec 2017 11:44:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r326976 - in stable: 10/contrib/llvm/tools/clang/lib/Sema 11/contrib/llvm/tools/clang/lib/Sema 9/contrib/llvm/tools/clang/lib/Sema X-SVN-Group: stable-9 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable: 10/contrib/llvm/tools/clang/lib/Sema 11/contrib/llvm/tools/clang/lib/Sema 9/contrib/llvm/tools/clang/lib/Sema X-SVN-Commit-Revision: 326976 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Dec 2017 11:44:25 -0000 Author: dim Date: Tue Dec 19 11:44:24 2017 New Revision: 326976 URL: https://svnweb.freebsd.org/changeset/base/326976 Log: MFC r326880: Pull in r320755 from upstream clang trunk (by me): Don't trigger -Wuser-defined-literals for system headers Summary: In D41064, I proposed adding `#pragma clang diagnostic ignored "-Wuser-defined-literals"` to some of libc++'s headers, since these warnings are now triggered by clang's new `-std=gnu++14` default: $ cat test.cpp #include $ clang -std=c++14 -Wsystem-headers -Wall -Wextra -c test.cpp In file included from test.cpp:1: In file included from /usr/include/c++/v1/string:470: /usr/include/c++/v1/string_view:763:29: warning: user-defined literal suffixes not starting with '_' are reserved [-Wuser-defined-literals] basic_string_view operator "" sv(const char *__str, size_t __len) ^ /usr/include/c++/v1/string_view:769:32: warning: user-defined literal suffixes not starting with '_' are reserved [-Wuser-defined-literals] basic_string_view operator "" sv(const wchar_t *__str, size_t __len) ^ /usr/include/c++/v1/string_view:775:33: warning: user-defined literal suffixes not starting with '_' are reserved [-Wuser-defined-literals] basic_string_view operator "" sv(const char16_t *__str, size_t __len) ^ /usr/include/c++/v1/string_view:781:33: warning: user-defined literal suffixes not starting with '_' are reserved [-Wuser-defined-literals] basic_string_view operator "" sv(const char32_t *__str, size_t __len) ^ In file included from test.cpp:1: /usr/include/c++/v1/string:4012:24: warning: user-defined literal suffixes not starting with '_' are reserved [-Wuser-defined-literals] basic_string operator "" s( const char *__str, size_t __len ) ^ /usr/include/c++/v1/string:4018:27: warning: user-defined literal suffixes not starting with '_' are reserved [-Wuser-defined-literals] basic_string operator "" s( const wchar_t *__str, size_t __len ) ^ /usr/include/c++/v1/string:4024:28: warning: user-defined literal suffixes not starting with '_' are reserved [-Wuser-defined-literals] basic_string operator "" s( const char16_t *__str, size_t __len ) ^ /usr/include/c++/v1/string:4030:28: warning: user-defined literal suffixes not starting with '_' are reserved [-Wuser-defined-literals] basic_string operator "" s( const char32_t *__str, size_t __len ) ^ 8 warnings generated. Both @aaron.ballman and @mclow.lists felt that adding this workaround to the libc++ headers was the wrong way, and it should be fixed in clang instead. Here is a proposal to do just that. I verified that this suppresses the warning, even when -Wsystem-headers is used, and that the warning is still emitted for a declaration outside of system headers. Reviewers: aaron.ballman, mclow.lists, rsmith Reviewed By: aaron.ballman Subscribers: mclow.lists, aaron.ballman, andrew, emaste, cfe-commits Differential Revision: https://reviews.llvm.org/D41080 This will allow to compile some of the libc++ headers in C++14 mode (which is the default for gcc 6 and higher, and will be the default for clang 6.0.0 and higher), with -Wsystem-headers and -Werror enabled. Reported by: andrew Modified: stable/9/contrib/llvm/tools/clang/lib/Sema/SemaDeclCXX.cpp Directory Properties: stable/9/ (props changed) stable/9/contrib/ (props changed) stable/9/contrib/llvm/ (props changed) stable/9/contrib/llvm/tools/clang/ (props changed) Changes in other areas also in this revision: Modified: stable/10/contrib/llvm/tools/clang/lib/Sema/SemaDeclCXX.cpp stable/11/contrib/llvm/tools/clang/lib/Sema/SemaDeclCXX.cpp Directory Properties: stable/10/ (props changed) stable/11/ (props changed) Modified: stable/9/contrib/llvm/tools/clang/lib/Sema/SemaDeclCXX.cpp ============================================================================== --- stable/9/contrib/llvm/tools/clang/lib/Sema/SemaDeclCXX.cpp Tue Dec 19 11:39:05 2017 (r326975) +++ stable/9/contrib/llvm/tools/clang/lib/Sema/SemaDeclCXX.cpp Tue Dec 19 11:44:24 2017 (r326976) @@ -10952,7 +10952,8 @@ FinishedParams: StringRef LiteralName = FnDecl->getDeclName().getCXXLiteralIdentifier()->getName(); - if (LiteralName[0] != '_') { + if (LiteralName[0] != '_' && + !getSourceManager().isInSystemHeader(FnDecl->getLocation())) { // C++11 [usrlit.suffix]p1: // Literal suffix identifiers that do not start with an underscore // are reserved for future standardization.