From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id A8BCF386F837; Wed, 13 Jan 2021 13:06:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A8BCF386F837 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jonathan Wakely To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r10-9267] libstdc++: Fix clang analyzer suppression [PR 98605] X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/releases/gcc-10 X-Git-Oldrev: 92b131491c22eb4e4b663d226e9d97f1fd693063 X-Git-Newrev: 8d3636923a309074eb19240ebaa30c1a0801eaaf Message-Id: <20210113130618.A8BCF386F837@sourceware.org> Date: Wed, 13 Jan 2021 13:06:18 +0000 (GMT) X-BeenThere: libstdc++-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jan 2021 13:06:18 -0000 https://gcc.gnu.org/g:8d3636923a309074eb19240ebaa30c1a0801eaaf commit r10-9267-g8d3636923a309074eb19240ebaa30c1a0801eaaf Author: Jonathan Wakely Date: Wed Jan 13 11:03:58 2021 +0000 libstdc++: Fix clang analyzer suppression [PR 98605] The fix for PR libstdc++/82481 should only have applied for targets where _GLIBCXX_HAVE_TLS is defined. Because it was also done for non-TLS targets, it isn't possible to use clang's analyzers on non-TLS targets if the code uses . This fixes it by using a NOLINT comment on the relevant line instead of testing #ifdef __clang_analyzer__ and compiling different code when analyzing. I'm not actually able to reproduce the analyzer warning with the tools from Clang 10.0.1 so I'm not going to try to make the suppression more specific with NOLINTNEXTLINE(clang-analyzer-code.StackAddressEscape). libstdc++-v3/ChangeLog: PR libstdc++/98605 * include/std/mutex (call_once): Use NOLINT to suppress clang analyzer warnings. Diff: --- libstdc++-v3/include/std/mutex | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/libstdc++-v3/include/std/mutex b/libstdc++-v3/include/std/mutex index 12b7e548d17..3c619f87040 100644 --- a/libstdc++-v3/include/std/mutex +++ b/libstdc++-v3/include/std/mutex @@ -718,7 +718,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION std::forward<_Args>(__args)...); }; #ifdef _GLIBCXX_HAVE_TLS - __once_callable = std::__addressof(__callable); + __once_callable = std::__addressof(__callable); // NOLINT: PR 82481 __once_call = []{ (*(decltype(__callable)*)__once_callable)(); }; #else unique_lock __functor_lock(__get_once_mutex()); @@ -733,12 +733,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __set_once_functor_lock_ptr(0); #endif -#ifdef __clang_analyzer__ - // PR libstdc++/82481 - __once_callable = nullptr; - __once_call = nullptr; -#endif - if (__e) __throw_system_error(__e); }