You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4cxx-dev@logging.apache.org by ca...@apache.org on 2008/04/30 06:50:43 UTC

svn commit: r652258 - in /logging/log4cxx/trunk/src: changes/changes.xml main/cpp/asyncappender.cpp main/include/log4cxx/helpers/objectptr.h

Author: carnold
Date: Tue Apr 29 21:50:43 2008
New Revision: 652258

URL: http://svn.apache.org/viewvc?rev=652258&view=rev
Log:
LOGCXX-275: Headers can not be included with very strict warning settings

Modified:
    logging/log4cxx/trunk/src/changes/changes.xml
    logging/log4cxx/trunk/src/main/cpp/asyncappender.cpp
    logging/log4cxx/trunk/src/main/include/log4cxx/helpers/objectptr.h

Modified: logging/log4cxx/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/changes/changes.xml?rev=652258&r1=652257&r2=652258&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/changes/changes.xml (original)
+++ logging/log4cxx/trunk/src/changes/changes.xml Tue Apr 29 21:50:43 2008
@@ -27,6 +27,7 @@
 <action issue="LOGCXX-263">Bad link to log4cxx-dev archive</action>
 <action issue="LOGCXX-271">MDC::put will not overwrite existing key value pair</action>
 <action issue="LOGCXX-272">Apache log4cxx 0.10.1 release</action>
+<action issue="LOGCXX-275">Headers cannot be included with very strict warning settings</action>
 </release>
 <release version="0.10.0" date="2008-04-03" description="First Apache release">
 <action issue="LOGCXX-2">logger.h includes config.h</action>

Modified: logging/log4cxx/trunk/src/main/cpp/asyncappender.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/cpp/asyncappender.cpp?rev=652258&r1=652257&r2=652258&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/cpp/asyncappender.cpp (original)
+++ logging/log4cxx/trunk/src/main/cpp/asyncappender.cpp Tue Apr 29 21:50:43 2008
@@ -313,7 +313,7 @@
 
 
 #if APR_HAS_THREADS
-void* LOG4CXX_THREAD_FUNC AsyncAppender::dispatch(apr_thread_t* thread, void* data) {
+void* LOG4CXX_THREAD_FUNC AsyncAppender::dispatch(apr_thread_t* /*thread*/, void* data) {
     AsyncAppender* pThis = (AsyncAppender*) data;
     bool isActive = true;
     try {

Modified: logging/log4cxx/trunk/src/main/include/log4cxx/helpers/objectptr.h
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/include/log4cxx/helpers/objectptr.h?rev=652258&r1=652257&r2=652258&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/include/log4cxx/helpers/objectptr.h (original)
+++ logging/log4cxx/trunk/src/main/include/log4cxx/helpers/objectptr.h Tue Apr 29 21:50:43 2008
@@ -28,9 +28,9 @@
 //   switching between the initialization styles.
 //
 #if LOG4CXX_HELGRIND
-#define _LOG4CXX_OBJECTPTR_INIT(x) { exchange(x); 
+#define _LOG4CXX_OBJECTPTR_INIT(x) : ObjectPtrBase() { exchange(x); 
 #else
-#define _LOG4CXX_OBJECTPTR_INIT(x) : p(x) {
+#define _LOG4CXX_OBJECTPTR_INIT(x) : ObjectPtrBase(), p(x) {
 #endif
 
 namespace log4cxx
@@ -169,8 +169,13 @@
             return 0;
          }
        T* exchange(const T* newValue) {
+             // Avoid GCC strict aliasing warnings
+             union {
+               T** in;
+               void** out;
+             } temp = { &p };
              return static_cast<T*>(ObjectPtrBase::exchange(
-                 reinterpret_cast<void**>(&p), 
+                 temp.out, 
                  const_cast<T*>(newValue)));
        }