Author: carnold
Date: Mon Oct 1 21:51:54 2007
New Revision: 581137
URL: http://svn.apache.org/viewvc?rev=581137&view=rev
Log:
LOGCXX-62: Misc header-check fixes
Modified:
logging/log4cxx/trunk/src/main/include/log4cxx/helpers/datagramsocket.h
logging/log4cxx/trunk/src/main/include/log4cxx/helpers/objectptr.h
Modified:
logging/log4cxx/trunk/src/main/include/log4cxx/helpers/datagramsocket.h
URL:
http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/include/log4cxx/helpers/datagramsocket.h?rev=581137&r1=581136&r2=581137&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/include/log4cxx/helpers/datagramsocket.h
(original)
+++ logging/log4cxx/trunk/src/main/include/log4cxx/helpers/datagramsocket.h Mon
Oct 1 21:51:54 2007
@@ -109,6 +109,8 @@
void send(DatagramPacketPtr& p);
private:
+ DatagramSocket(const DatagramSocket&);
+ DatagramSocket& operator=(const DatagramSocket&);
/** The APR socket */
apr_socket_t *socket;
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=581137&r1=581136&r2=581137&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/include/log4cxx/helpers/objectptr.h
(original)
+++ logging/log4cxx/trunk/src/main/include/log4cxx/helpers/objectptr.h Mon Oct
1 21:51:54 2007
@@ -20,6 +20,19 @@
#include <log4cxx/log4cxx.h>
+//
+// Note:
+// The LOG4CXX_HELGRIND conditional sections are due to conflicting
+// demands of two diagnostic tools. The -Weffc++ option for the GCC
+// compiler wants the wrapped pointer to be initialized in
+// the member initialization list.
+// However, the Helgrind race condition tool for Valgrind will report
+// that the wrapped pointer written outside of a synchronization
+// block. The member initialization approach is more efficient
+// and should be safe since existing usage patterns should prevent
+// the pointer to be available to other threads until after
+// construction is complete.
+//
namespace log4cxx
{
namespace helpers
@@ -37,26 +50,42 @@
{
public:
template<typename InterfacePtr> ObjectPtrT(const InterfacePtr& p1)
+#if LOG4CXX_HELGRIND
{
ObjectPtrBase::exchange((void**) &p, 0);
+#else
+ : p(0) {
+#endif
cast(p1);
}
ObjectPtrT(const int& null) //throw(IllegalArgumentException)
+#if LOG4CXX_HELGRIND
{
ObjectPtrBase::exchange((void**) &p, 0);
+#else
+ : p(0) {
+#endif
ObjectPtrBase::checkNull(null);
}
ObjectPtrT()
+#if LOG4CXX_HELGRIND
{
ObjectPtrBase::exchange((void**) &p, 0);
+#else
+ : p(0) {
+#endif
}
ObjectPtrT(T * p1)
+#if LOG4CXX_HELGRIND
{
ObjectPtrBase::exchange((void**) &p, p1);
+#else
+ : p(p1) {
+#endif
if (this->p != 0)
{
this->p->addRef();
@@ -64,8 +93,12 @@
}
ObjectPtrT(const ObjectPtrT& p1)
+#if LOG4CXX_HELGRIND
{
ObjectPtrBase::exchange((void**) &p, p1.p);
+#else
+ : p(p1.p) {
+#endif
if (this->p != 0)
{
this->p->addRef();