diff mbox

libstdc++: add _GLIBCXX_ macro prefix in atexit_thread.cc

Message ID 20140801194638.GK2361@redhat.com
State New
Headers show

Commit Message

Jonathan Wakely Aug. 1, 2014, 7:46 p.m. UTC
On 30/07/14 23:36 +0800, Zifei Tong wrote:
>On Wed, Jul 30, 2014 at 11:25 PM, Jonathan Wakely <jwakely@redhat.com> wrote:
>> On 30/07/14 22:42 +0800, Zifei Tong wrote:
>>>
>>> Hi,
>>>
>>> I found an issue that the __cxa_thread_atexit_impl() function never called
>>> by
>>> __cxa_thread_atexit() even with newest glibc which have
>>> __cxa_thread_atexit_impl
>>> implemented.
>>>
>>> It turns out that the code tried to use macro
>>> HAVE___CXA_THREAD_ATEXIT_IMPL, but
>>> not _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL which is defined in
>>> bits/c++config.h
>>> (generated from autoconf scripts).
>>>
>>> This patch adds the missing macro prefix.
>>
>>
>> The patch is correct, thanks very much.
>>
>> Do you have commit access?
>I don't think so, this is my first patch to gcc :)
>
>> If not I can do it for you.
>Thanks!

I've committed the attached patch to trunk, I'll apply it to the 4.8
and 4.9 branches soon too.

Tested x86_64-linux, with both glibc 2.11 and 2.18 so with and without
__cxa_thread_atexit_impl.

Thanks again for the report and patch.
diff mbox

Patch

commit ecaf491ba1a82e858b8a0654efeee74e55c74c05
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Fri Aug 1 19:53:58 2014 +0100

    2014-08-01  Zifei Tong  <zifeitong@gmail.com>
    
    	* libsupc++/atexit_thread.cc (HAVE___CXA_THREAD_ATEXIT_IMPL): Add
    	_GLIBCXX_ prefix to macro.

diff --git a/libstdc++-v3/libsupc++/atexit_thread.cc b/libstdc++-v3/libsupc++/atexit_thread.cc
index db20200..dff08e9 100644
--- a/libstdc++-v3/libsupc++/atexit_thread.cc
+++ b/libstdc++-v3/libsupc++/atexit_thread.cc
@@ -26,7 +26,7 @@ 
 #include <new>
 #include "bits/gthr.h"
 
-#if HAVE___CXA_THREAD_ATEXIT_IMPL
+#if _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL
 
 extern "C" int __cxa_thread_atexit_impl (void (*func) (void *),
 					 void *arg, void *d);
@@ -38,7 +38,7 @@  __cxxabiv1::__cxa_thread_atexit (void (*dtor)(void *),
   return __cxa_thread_atexit_impl (dtor, obj, dso_handle);
 }
 
-#else /* HAVE___CXA_THREAD_ATEXIT_IMPL */
+#else /* _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL */
 
 namespace {
   // One element in a singly-linked stack of cleanups.
@@ -142,4 +142,4 @@  __cxxabiv1::__cxa_thread_atexit (void (*dtor)(void *), void *obj, void */*dso_ha
   return 0;
 }
 
-#endif /* HAVE___CXA_THREAD_ATEXIT_IMPL */
+#endif /* _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL */