public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] PR libstdc++/82481 Suppress clang-tidy warnings
@ 2017-10-13 12:40 Jonathan Wakely
  0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2017-10-13 12:40 UTC (permalink / raw)
  To: libstdc++, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 496 bytes --]

Clang-tidy correctly notices that after exiting std:call_once a couple
of globals are left pointing to local variables that go out of scope.
This isn't a problem, because the globals are only ever used by
std::call_once and it will re-init them before the next use. Zero the
variables out just for clang-tidy, to prevent the warnings.

	PR libstdc++/82481
	* include/std/mutex (call_once): Suppress clang-tidy warnings about
	dangling references.

Tested powerpc64le-linux, committed to trunk.



[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 811 bytes --]

commit 018813c8994b7dceab1b7d999e9c09654a22ef50
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Fri Oct 13 12:56:07 2017 +0100

    PR libstdc++/82481 Suppress clang-tidy warnings
    
            PR libstdc++/82481
            * include/std/mutex (call_once): Suppress clang-tidy warnings about
            dangling references.

diff --git a/libstdc++-v3/include/std/mutex b/libstdc++-v3/include/std/mutex
index 8c692a88ffd..50420ee22d4 100644
--- a/libstdc++-v3/include/std/mutex
+++ b/libstdc++-v3/include/std/mutex
@@ -688,6 +688,12 @@ _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);
     }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-10-13 12:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-13 12:40 [PATCH] PR libstdc++/82481 Suppress clang-tidy warnings Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).