diff mbox series

PR libstdc++/82481 Suppress clang-tidy warnings

Message ID 20171013123901.GA5931@redhat.com
State New
Headers show
Series PR libstdc++/82481 Suppress clang-tidy warnings | expand

Commit Message

Jonathan Wakely Oct. 13, 2017, 12:39 p.m. UTC
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.
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 mbox series

Patch

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);
     }