summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ACE/ChangeLog111
-rw-r--r--ACE/ace/Acceptor.cpp2
-rw-r--r--ACE/ace/CDR_Stream.inl101
-rw-r--r--ACE/ace/CORBA_macros.h24
-rw-r--r--ACE/ace/Configuration.cpp27
-rw-r--r--ACE/ace/OS_Memory.h28
-rw-r--r--ACE/ace/OS_NS_Thread.cpp4
-rw-r--r--ACE/ace/OS_main.h3
-rw-r--r--ACE/ace/Select_Reactor_T.cpp32
-rw-r--r--ACE/ace/config-g++-common.h4
-rw-r--r--ACE/ace/config-irix6.x-common.h2
-rw-r--r--ACE/ace/config-sunos5.8.h3
-rw-r--r--ACE/ace/config-win32-common.h2
13 files changed, 235 insertions, 108 deletions
diff --git a/ACE/ChangeLog b/ACE/ChangeLog
index 7bfec4c7c91..6ff9ca061e0 100644
--- a/ACE/ChangeLog
+++ b/ACE/ChangeLog
@@ -1,3 +1,114 @@
+Thu May 17 22:13:32 UTC 2007 Ossama Othman <ossama_othman at symantec dot com>
+
+ * ace/Acceptor.cpp:
+
+ Silence Coverity error related to lack of a return value check
+ by explicitly casting the return value to void. We don't care
+ about the return value in this case.
+
+ * ace/CDR_Stream.inl (write_octet, write_ushort, write_ulong):
+ (write_ulonglong, write_longdouble):
+ (read_ushort, read_ulong, read_ulonglong, read_longdouble):
+ (skip_ushort, skip_ulong, skip_ulonglong, skip_longdouble):
+
+ Removed unnecessary assignment to a void* and reinterpret_cast<>
+ back to original type.
+
+ (write_char, write_short, write_long, write_longlong):
+
+ Simplified code by dropping assignment to void* and
+ reinterpret_cast<> to unsigned type counterpart in favor of a
+ direct static_cast<> to the unsigned type.
+
+ (skip_char, skip_short, skip_long, skip_longlong, skip_float):
+ (skip_double):
+
+ Replaced temporary variable and assignment to void* with
+ unsigned integer CDR type of same size since the value read
+ from the CDR stream is ignored. Simplifies the code.
+
+ * ace/CORBA_macros.h (ACE_NEW_THROW_EX):
+
+ Don't bother setting errno to ENOMEM if allocation fails since
+ the caller should be handling the exception thrown upon failure,
+ not checking errno.
+
+ * ace/Configuration.cpp (get_binary_value):
+
+ Improved exception safety.
+
+ * ace/OS_Memory.h (ACE_align_binary, ACE_ptr_align_binary):
+
+ Re-implemented as inlined functions instead of macros. The
+ new code is much easier to read.
+
+ Corrected pointer-integer type. s/ptrdiff_t/uintptr_t/g.
+
+ * ace/OS_NS_Thread.cpp (TSS_Cleanup_Instance):
+
+ Replaced use of "NULL" constant with zero to comply with ACE
+ coding guidelines.
+
+ * ace/Select_Reactor_T.cpp:
+
+ Replaced boolean value assignments with true and false instead
+ of 1 and 0, respectively.
+
+ Removed redundant zero pointer checks prior to operator delete()
+ calls.
+
+ Various const and boolean correctness improvements.
+ (handle_error):
+
+ Assign errno to a temporary to avoid multiple TSS accesses.
+
+ * ace/config-g++-common.h:
+
+ Define ACE_HAS_NEW_NOTHROW for g++ >= 3.3. Older versions of
+ g++ had buggy operator new(nothrow)() support.
+
+ * ace/config-irix6.x-common.h:
+
+ IRIX lacks the suseconds_t typedef.
+
+ * ace/config-sunos5.8.h (ACE_HAS_X86_STAT_MACROS):
+
+ No need to define this preprocessor symbol for Solaris 8 and
+ onwards.
+
+ * ace/config-win32-common.h (ACE_HAS_CUSTOM_EXPORT_MACROS):
+
+ Define the value to 1 instead of just defining without a value.
+ Some preprocessor conditional tests depend on a value being
+ set.
+
+ From Russell Mora:
+ * ace/OS_main.h:
+
+ Fixed ACE main macro - on Tru64 this was complaining because:
+
+ int
+ main (int argc, char *argv[])
+
+ Was becoming:
+
+ int
+ namespace v4
+ {
+ ace_os_main_i (int, char *[])
+ /* ... */
+
+ I.e. it didn't like the 'int' appearing before the namespace. I
+ added a forward declaration of main() to gobble this up - the
+ code now expands to:
+
+ int
+ main (int, char *[]);
+ namespace v4
+ {
+ int ace_os_main_i (int, char *[])
+ /* ... */
+
Thu May 17 19:29:30 UTC 2007 Jeff Parsons <j.parsons@vanderbilt.edu>
* contrib/minizip/minizip.mpc:
diff --git a/ACE/ace/Acceptor.cpp b/ACE/ace/Acceptor.cpp
index 056bb7878a5..16755b336cf 100644
--- a/ACE/ace/Acceptor.cpp
+++ b/ACE/ace/Acceptor.cpp
@@ -94,7 +94,7 @@ ACE_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::open
// socket handle is "ready" and when we call <accept>. During this
// interval, the client can shutdown the connection, in which case,
// the <accept> call can hang!
- this->peer_acceptor_.enable (ACE_NONBLOCK);
+ (void) this->peer_acceptor_.enable (ACE_NONBLOCK);
int const result = reactor->register_handler (this,
ACE_Event_Handler::ACCEPT_MASK);
diff --git a/ACE/ace/CDR_Stream.inl b/ACE/ace/CDR_Stream.inl
index f2d6724ce7b..f029042294e 100644
--- a/ACE/ace/CDR_Stream.inl
+++ b/ACE/ace/CDR_Stream.inl
@@ -177,8 +177,7 @@ ACE_OutputCDR::reset (void)
ACE_INLINE ACE_CDR::Boolean
ACE_OutputCDR::write_octet (ACE_CDR::Octet x)
{
- void const * temp = &x;
- return this->write_1 (reinterpret_cast<const ACE_CDR::Octet *> (temp));
+ return this->write_1 (&x);
}
ACE_INLINE ACE_CDR::Boolean
@@ -197,8 +196,8 @@ ACE_OutputCDR::write_char (ACE_CDR::Char x)
{
if (this->char_translator_ == 0)
{
- void const * temp = &x;
- return this->write_1 (reinterpret_cast<ACE_CDR::Octet const *> (temp));
+ ACE_CDR::Octet temp = static_cast<ACE_CDR::Octet> (x);
+ return this->write_1 (&temp);
}
return this->char_translator_->write_char (*this, x);
}
@@ -206,64 +205,60 @@ ACE_OutputCDR::write_char (ACE_CDR::Char x)
ACE_INLINE ACE_CDR::Boolean
ACE_OutputCDR::write_short (ACE_CDR::Short x)
{
- const void *temp = &x;
- return this->write_2 (reinterpret_cast<const ACE_CDR::UShort*> (temp));
+ ACE_CDR::UShort temp = static_cast<ACE_CDR::UShort> (x);
+ return this->write_2 (&temp);
}
ACE_INLINE ACE_CDR::Boolean
ACE_OutputCDR::write_ushort (ACE_CDR::UShort x)
{
- const void *temp = &x;
- return this->write_2 (reinterpret_cast<const ACE_CDR::UShort*> (temp));
+ return this->write_2 (&x);
}
ACE_INLINE ACE_CDR::Boolean
ACE_OutputCDR::write_long (ACE_CDR::Long x)
{
- const void *temp = &x;
- return this->write_4 (reinterpret_cast<const ACE_CDR::ULong*> (temp));
+ ACE_CDR::ULong temp = static_cast<ACE_CDR::ULong> (x);
+ return this->write_4 (&temp);
}
ACE_INLINE ACE_CDR::Boolean
ACE_OutputCDR::write_ulong (ACE_CDR::ULong x)
{
- const void *temp = &x;
- return this->write_4 (reinterpret_cast<const ACE_CDR::ULong*> (temp));
+ return this->write_4 (&x);
}
ACE_INLINE ACE_CDR::Boolean
ACE_OutputCDR::write_longlong (const ACE_CDR::LongLong &x)
{
- const void *temp = &x;
- return this->write_8 (reinterpret_cast<const ACE_CDR::ULongLong*> (temp));
+ void const * const temp = &x;
+ return this->write_8 (reinterpret_cast<ACE_CDR::ULongLong const *> (temp));
}
ACE_INLINE ACE_CDR::Boolean
ACE_OutputCDR::write_ulonglong (const ACE_CDR::ULongLong &x)
{
- const void *temp = &x;
- return this->write_8 (reinterpret_cast<const ACE_CDR::ULongLong*> (temp));
+ return this->write_8 (&x);
}
ACE_INLINE ACE_CDR::Boolean
ACE_OutputCDR::write_float (ACE_CDR::Float x)
{
- const void *temp = &x;
- return this->write_4 (reinterpret_cast<const ACE_CDR::ULong*> (temp));
+ void const * const temp = &x;
+ return this->write_4 (reinterpret_cast<ACE_CDR::ULong const *> (temp));
}
ACE_INLINE ACE_CDR::Boolean
ACE_OutputCDR::write_double (const ACE_CDR::Double &x)
{
- const void *temp = &x;
- return this->write_8 (reinterpret_cast<const ACE_CDR::ULongLong*> (temp));
+ void const * const temp = &x;
+ return this->write_8 (reinterpret_cast<ACE_CDR::ULongLong const *> (temp));
}
ACE_INLINE ACE_CDR::Boolean
ACE_OutputCDR::write_longdouble (const ACE_CDR::LongDouble &x)
{
- const void *temp = &x;
- return this->write_16 (reinterpret_cast<const ACE_CDR::LongDouble*> (temp));
+ return this->write_16 (&x);
}
ACE_INLINE ACE_CDR::Boolean
@@ -443,7 +438,7 @@ ACE_OutputCDR::adjust (size_t size,
return this->grow_and_adjust (size, align, buf);
#if !defined (ACE_LACKS_CDR_ALIGNMENT)
- const size_t offset =
+ size_t const offset =
ACE_align_binary (this->current_alignment_, align)
- this->current_alignment_;
@@ -452,7 +447,7 @@ ACE_OutputCDR::adjust (size_t size,
buf = this->current_->wr_ptr ();
#endif /* ACE_LACKS_CDR_ALIGNMENT */
- char *end = buf + size;
+ char * const end = buf + size;
if (end <= this->current_->end () &&
end >= buf)
@@ -641,8 +636,7 @@ ACE_InputCDR::read_short (ACE_CDR::Short &x)
ACE_INLINE ACE_CDR::Boolean
ACE_InputCDR::read_ushort (ACE_CDR::UShort &x)
{
- void *temp = &x;
- return this->read_2 (reinterpret_cast<ACE_CDR::UShort*> (temp));
+ return this->read_2 (&x);
}
@@ -657,8 +651,7 @@ ACE_InputCDR::read_long (ACE_CDR::Long &x)
ACE_INLINE ACE_CDR::Boolean
ACE_InputCDR::read_ulong (ACE_CDR::ULong &x)
{
- void *temp = &x;
- return this->read_4 (reinterpret_cast<ACE_CDR::ULong*> (temp));
+ return this->read_4 (&x);
}
@@ -672,8 +665,7 @@ ACE_InputCDR::read_longlong (ACE_CDR::LongLong &x)
ACE_INLINE ACE_CDR::Boolean
ACE_InputCDR::read_ulonglong (ACE_CDR::ULongLong &x)
{
- void *temp = &x;
- return this->read_8 (reinterpret_cast<ACE_CDR::ULongLong*> (temp));
+ return this->read_8 (&x);
}
ACE_INLINE ACE_CDR::Boolean
@@ -693,8 +685,7 @@ ACE_InputCDR::read_double (ACE_CDR::Double &x)
ACE_INLINE ACE_CDR::Boolean
ACE_InputCDR::read_longdouble (ACE_CDR::LongDouble &x)
{
- void *temp = &x;
- return this->read_16 (reinterpret_cast<ACE_CDR::LongDouble*> (temp));
+ return this->read_16 (&x);
}
ACE_INLINE size_t
@@ -930,9 +921,8 @@ ACE_InputCDR::read_longdouble_array (ACE_CDR::LongDouble* x,
ACE_INLINE ACE_CDR::Boolean
ACE_InputCDR::skip_char (void)
{
- ACE_CDR::Char x;
- void *temp = &x;
- return this->read_1 (reinterpret_cast<ACE_CDR::Octet*> (temp));
+ ACE_CDR::Octet x; // sizeof (Octet) == sizeof (Char)
+ return this->read_1 (&x);
}
ACE_INLINE ACE_CDR::Boolean
@@ -952,75 +942,64 @@ ACE_InputCDR::skip_boolean (void)
ACE_INLINE ACE_CDR::Boolean
ACE_InputCDR::skip_short (void)
{
- ACE_CDR::Short x;
- void *temp = &x;
- return this->read_2 (reinterpret_cast<ACE_CDR::UShort*> (temp));
+ ACE_CDR::UShort x; // sizeof (Short) == sizeof (UShort)
+ return this->read_2 (&x);
}
ACE_INLINE ACE_CDR::Boolean
ACE_InputCDR::skip_ushort (void)
{
ACE_CDR::UShort x;
- void *temp = &x;
- return this->read_2 (reinterpret_cast<ACE_CDR::UShort*> (temp));
+ return this->read_2 (&x);
}
ACE_INLINE ACE_CDR::Boolean
ACE_InputCDR::skip_long (void)
{
- ACE_CDR::Long x;
- void *temp = &x;
- return this->read_4 (reinterpret_cast<ACE_CDR::ULong*> (temp));
+ ACE_CDR::ULong x; // sizeof (Long) == sizeof (ULong)
+ return this->read_4 (&x);
}
ACE_INLINE ACE_CDR::Boolean
ACE_InputCDR::skip_ulong (void)
{
ACE_CDR::ULong x;
- void *temp = &x;
- return this->read_4 (reinterpret_cast<ACE_CDR::ULong*> (temp));
+ return this->read_4 (&x);
}
ACE_INLINE ACE_CDR::Boolean
ACE_InputCDR::skip_longlong (void)
{
- ACE_CDR::LongLong x;
- void *temp = &x;
- return this->read_8 (reinterpret_cast<ACE_CDR::ULongLong*> (temp));
+ ACE_CDR::ULongLong x; // sizeof (LongLong) == sizeof (ULongLong)
+ return this->read_8 (&x);
}
ACE_INLINE ACE_CDR::Boolean
ACE_InputCDR::skip_ulonglong (void)
{
ACE_CDR::ULongLong x;
- void *temp = &x;
- return this->read_8 (reinterpret_cast<ACE_CDR::ULongLong*> (temp));
+ return this->read_8 (&x);
}
ACE_INLINE ACE_CDR::Boolean
ACE_InputCDR::skip_float (void)
{
- // Changing this removes the warning for GHS and it
- // stops the compiler from getting an internal error.
- ACE_CDR::ULong value;
- void *temp = &value;
- return this->read_4 (reinterpret_cast<ACE_CDR::ULong*> (temp));
+ ACE_CDR::ULong x; // sizeof(Float) == sizeof (ULong)
+ return this->read_4 (&x);
}
ACE_INLINE ACE_CDR::Boolean
ACE_InputCDR::skip_double (void)
{
- double x;
- void *temp = &x;
- return this->read_8 (reinterpret_cast<ACE_CDR::ULongLong*> (temp));
+ ACE_CDR::ULongLong x; // sizeof(Double) == sizeof (ULongLong)
+ return this->read_8 (&x);
}
ACE_INLINE ACE_CDR::Boolean
ACE_InputCDR::skip_longdouble (void)
{
ACE_CDR::LongDouble x;
- void *temp = &x;
- return this->read_16 (reinterpret_cast<ACE_CDR::LongDouble*> (temp));
+ return this->read_16 (&x);
}
ACE_INLINE char*
@@ -1058,7 +1037,7 @@ ACE_InputCDR::adjust (size_t size,
buf = this->rd_ptr ();
#endif /* ACE_LACKS_CDR_ALIGNMENT */
- char *end = buf + size;
+ char * const end = buf + size;
if (end <= this->wr_ptr ())
{
this->start_.rd_ptr (end);
diff --git a/ACE/ace/CORBA_macros.h b/ACE/ace/CORBA_macros.h
index 0bca8272703..22ded9a54b3 100644
--- a/ACE/ace/CORBA_macros.h
+++ b/ACE/ace/CORBA_macros.h
@@ -415,26 +415,26 @@
# if defined (ACE_HAS_NEW_NOTHROW)
-# define ACE_NEW_THROW_EX(POINTER,CONSTRUCTOR,EXCEPTION) \
- do { POINTER = new (ACE_nothrow) CONSTRUCTOR; \
- if (POINTER == 0) { errno = ENOMEM; throw EXCEPTION; } \
- } while (0)
+# define ACE_NEW_THROW_EX(POINTER,CONSTRUCTOR,EXCEPTION) \
+ do { POINTER = new (ACE_nothrow) CONSTRUCTOR; \
+ if (POINTER == 0) { throw EXCEPTION; } \
+ } while (0)
# else
-# define ACE_NEW_THROW_EX(POINTER,CONSTRUCTOR,EXCEPTION) \
- do { try { POINTER = new CONSTRUCTOR; } \
- catch (ACE_bad_alloc) { ACE_del_bad_alloc errno = ENOMEM; throw EXCEPTION; } \
- } while (0)
+# define ACE_NEW_THROW_EX(POINTER,CONSTRUCTOR,EXCEPTION) \
+ do { try { POINTER = new CONSTRUCTOR; } \
+ catch (ACE_bad_alloc) { ACE_del_bad_alloc throw EXCEPTION; } \
+ } while (0)
# endif /* ACE_HAS_NEW_NOTHROW */
#else /* ! ACE_NEW_THROWS_EXCEPTIONS */
-# define ACE_NEW_THROW_EX(POINTER,CONSTRUCTOR,EXCEPTION) \
- do { POINTER = new CONSTRUCTOR; \
- if (POINTER == 0) { errno = ENOMEM; throw EXCEPTION; } \
- } while (0)
+# define ACE_NEW_THROW_EX(POINTER,CONSTRUCTOR,EXCEPTION) \
+ do { POINTER = new CONSTRUCTOR; \
+ if (POINTER == 0) { throw EXCEPTION; } \
+ } while (0)
#endif /* ACE_NEW_THROWS_EXCEPTIONS */
diff --git a/ACE/ace/Configuration.cpp b/ACE/ace/Configuration.cpp
index 820b1303523..791d80da057 100644
--- a/ACE/ace/Configuration.cpp
+++ b/ACE/ace/Configuration.cpp
@@ -850,10 +850,11 @@ ACE_Configuration_Win32Registry::get_integer_value (const ACE_Configuration_Sect
}
int
-ACE_Configuration_Win32Registry::get_binary_value (const ACE_Configuration_Section_Key &key,
- const ACE_TCHAR *name,
- void *&data,
- size_t &length)
+ACE_Configuration_Win32Registry::get_binary_value (
+ const ACE_Configuration_Section_Key &key,
+ const ACE_TCHAR *name,
+ void *&data,
+ size_t &length)
{
const ACE_TCHAR *t_name = temp_name (name);
if (validate_value_name (t_name))
@@ -886,21 +887,24 @@ ACE_Configuration_Win32Registry::get_binary_value (const ACE_Configuration_Secti
length = buffer_length;
- ACE_NEW_RETURN (data, BYTE[length], -1);
+ BYTE * the_data = 0;
+ ACE_NEW_RETURN (the_data, BYTE[length], -1);
+ ACE_Auto_Basic_Array_Ptr<BYTE> safe_data (the_data);
if ((errnum = ACE_TEXT_RegQueryValueEx (base_key,
t_name,
0,
&type,
- (BYTE *) data,
+ the_data,
&buffer_length)) != ERROR_SUCCESS)
{
- delete [] (BYTE *) data;
data = 0;
errno = errnum;
return -1;
}
+ data = safe_data.release ();
+
return 0;
}
@@ -2033,10 +2037,11 @@ ACE_Configuration_Heap::get_integer_value (const ACE_Configuration_Section_Key&
}
int
-ACE_Configuration_Heap::get_binary_value (const ACE_Configuration_Section_Key& key,
- const ACE_TCHAR* name,
- void*& data,
- size_t& length)
+ACE_Configuration_Heap::get_binary_value (
+ const ACE_Configuration_Section_Key& key,
+ const ACE_TCHAR* name,
+ void*& data,
+ size_t& length)
{
ACE_ASSERT (this->allocator_);
const ACE_TCHAR *t_name = name ? name : &this->NULL_String_;
diff --git a/ACE/ace/OS_Memory.h b/ACE/ace/OS_Memory.h
index 70716bedfc2..f33a71ce949 100644
--- a/ACE/ace/OS_Memory.h
+++ b/ACE/ace/OS_Memory.h
@@ -23,6 +23,7 @@
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include "ace/OS_Errno.h"
+#include "ace/Basic_Types.h"
#include "ace/os_include/os_stddef.h"
// Allow an installation to replace the lowest-level allocation
@@ -236,6 +237,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
#endif /* ACE_NEW_THROWS_EXCEPTIONS */
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
//@{
/**
* @name Efficiently compute aligned pointers to powers of 2 boundaries.
@@ -276,13 +278,31 @@ ACE_END_VERSIONED_NAMESPACE_DECL
* @param ptr the base pointer
* @param alignment the required alignment
*/
-#define ACE_align_binary(ptr, alignment) \
- ((ptr + ((ptrdiff_t)((alignment)-1))) & (~((ptrdiff_t)((alignment)-1))))
+inline uintptr_t
+ACE_align_binary (uintptr_t ptr, uintptr_t alignment)
+{
+ uintptr_t const tmp = alignment - 1;
+ return (ptr + tmp) & (~tmp);
+}
+
+/// Return the next address aligned to a required boundary
+inline char *
+ACE_ptr_align_binary (char const * ptr, uintptr_t alignment)
+{
+ return
+ reinterpret_cast<char *> (
+ ACE_align_binary (reinterpret_cast<uintptr_t const> (ptr), alignment));
+}
/// Return the next address aligned to a required boundary
-#define ACE_ptr_align_binary(ptr, alignment) \
- ((char *) ACE_align_binary (((ptrdiff_t) (ptr)), (alignment)))
+inline char *
+ACE_ptr_align_binary (unsigned char const * ptr, uintptr_t alignment)
+{
+ return
+ ACE_ptr_align_binary (reinterpret_cast<char const *> (ptr), alignment);
+}
//@}
+ACE_END_VERSIONED_NAMESPACE_DECL
#include "ace/OS_NS_stdlib.h"
diff --git a/ACE/ace/OS_NS_Thread.cpp b/ACE/ace/OS_NS_Thread.cpp
index 9eed38a98ea..43c3876d8ca 100644
--- a/ACE/ace/OS_NS_Thread.cpp
+++ b/ACE/ace/OS_NS_Thread.cpp
@@ -727,7 +727,7 @@ TSS_Cleanup_Instance::~TSS_Cleanup_Instance (void)
{
ACE_ASSERT (reference_count_ > 0);
--reference_count_;
- if (reference_count_ == 0 && instance_ == NULL)
+ if (reference_count_ == 0 && instance_ == 0)
condition_->signal ();
}
}
@@ -745,7 +745,7 @@ bool
TSS_Cleanup_Instance::valid()
{
ACE_SET_BITS(flags_, FLAG_VALID_CHECKED);
- return (this->instance_ != NULL);
+ return (this->instance_ != 0);
}
ACE_TSS_Cleanup *
diff --git a/ACE/ace/OS_main.h b/ACE/ace/OS_main.h
index 11376dd18fa..573278852f1 100644
--- a/ACE/ace/OS_main.h
+++ b/ACE/ace/OS_main.h
@@ -74,6 +74,7 @@ typedef int (*ace_main_proc_ptr)(int, char *[]);
extern ace_main_proc_ptr vx_ace_main_i_ptr;
# define main \
+ACE_MAIN (int, char *[]); /* forward decl to gobble up the 'int' if there is one */ \
ACE_BEGIN_VERSIONED_NAMESPACE_DECL \
ace_os_main_i (int, char *[]); \
ACE_END_VERSIONED_NAMESPACE_DECL \
@@ -90,6 +91,7 @@ ace_main_i
# elif defined (ACE_HAS_RTEMS)
# define main \
+ACE_MAIN (int, char *[]); /* forward decl to gobble up the 'int' if there is one */ \
ACE_BEGIN_VERSIONED_NAMESPACE_DECL \
ace_os_main_i (int, char *[]); \
ACE_END_VERSIONED_NAMESPACE_DECL \
@@ -108,6 +110,7 @@ ace_main_i
# elif !defined (ACE_WIN32)
# define main \
+ACE_MAIN (int, char *[]); /* forward decl to gobble up the 'int' if there is one */ \
ACE_BEGIN_VERSIONED_NAMESPACE_DECL \
ace_os_main_i (int, char *[]); \
ACE_END_VERSIONED_NAMESPACE_DECL \
diff --git a/ACE/ace/Select_Reactor_T.cpp b/ACE/ace/Select_Reactor_T.cpp
index 12cce52453d..92965451dea 100644
--- a/ACE/ace/Select_Reactor_T.cpp
+++ b/ACE/ace/Select_Reactor_T.cpp
@@ -449,10 +449,10 @@ template <class ACE_SELECT_REACTOR_TOKEN> int
ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::set_sig_handler
(ACE_Sig_Handler *signal_handler)
{
- if (this->signal_handler_ != 0 && this->delete_signal_handler_ != 0)
+ if (this->delete_signal_handler_)
delete this->signal_handler_;
this->signal_handler_ = signal_handler;
- this->delete_signal_handler_ = 0;
+ this->delete_signal_handler_ = false;
return 0;
}
@@ -466,7 +466,7 @@ template <class ACE_SELECT_REACTOR_TOKEN> int
ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::timer_queue
(ACE_Timer_Queue *tq)
{
- if (this->timer_queue_ != 0 && this->delete_timer_queue_)
+ if (this->delete_timer_queue_)
delete this->timer_queue_;
this->timer_queue_ = tq;
this->delete_timer_queue_ = false;
@@ -568,7 +568,7 @@ ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::close (void)
{
delete this->signal_handler_;
this->signal_handler_ = 0;
- this->delete_signal_handler_ = 0;
+ this->delete_signal_handler_ = false;
}
this->handler_rep_.close ();
@@ -769,7 +769,8 @@ ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::handle_error (void)
{
ACE_TRACE ("ACE_Select_Reactor_T::handle_error");
#if defined (linux) && defined (ERESTARTNOHAND)
- if (errno == EINTR || errno == ERESTARTNOHAND)
+ int const error = errno; // Avoid multiple TSS accesses.
+ if (error == EINTR || error == ERESTARTNOHAND)
return this->restart_;
#else
if (errno == EINTR)
@@ -1036,16 +1037,15 @@ ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::work_pending
this->timer_queue_->calculate_timeout (&mwt, &timer_buf);
// Check if we have timers to fire.
- int const timers_pending =
- (this_timeout != 0 && *this_timeout != mwt ? 1 : 0);
+ bool const timers_pending =
+ (this_timeout != 0 && *this_timeout != mwt ? true : false);
#ifdef ACE_WIN32
// This arg is ignored on Windows and causes pointer truncation
// warnings on 64-bit compiles.
int const width = 0;
#else
- int const width =
- this->handler_rep_.max_handlep1 ();
+ int const width = this->handler_rep_.max_handlep1 ();
#endif /* ACE_WIN32 */
ACE_Select_Reactor_Handle_Set fd_set;
@@ -1053,15 +1053,15 @@ ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::work_pending
fd_set.wr_mask_ = this->wait_set_.wr_mask_;
fd_set.ex_mask_ = this->wait_set_.ex_mask_;
- int nfds = ACE_OS::select (width,
- fd_set.rd_mask_,
- fd_set.wr_mask_,
- fd_set.ex_mask_,
- this_timeout);
+ int const nfds = ACE_OS::select (width,
+ fd_set.rd_mask_,
+ fd_set.wr_mask_,
+ fd_set.ex_mask_,
+ this_timeout);
// If timers are pending, override any timeout from the select()
// call.
- return (nfds == 0 && timers_pending != 0 ? 1 : nfds);
+ return (nfds == 0 && timers_pending ? 1 : nfds);
}
// Must be called with lock held.
@@ -1162,7 +1162,7 @@ ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::dispatch_notification_handlers
// ACE_Select_Reactor_T's internal tables or the notify pipe is
// enabled. We'll handle all these threads and notifications, and
// then break out to continue the event loop.
- int n =
+ int const n =
this->notify_handler_->dispatch_notifications (number_of_active_handles,
dispatch_set.rd_mask_);
diff --git a/ACE/ace/config-g++-common.h b/ACE/ace/config-g++-common.h
index 596269474ce..4bfeee962d8 100644
--- a/ACE/ace/config-g++-common.h
+++ b/ACE/ace/config-g++-common.h
@@ -43,6 +43,10 @@
#if defined (ACE_HAS_EXCEPTIONS)
# define ACE_NEW_THROWS_EXCEPTIONS
+# if (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3))
+// Versions of g++ prior to 3.3 had a buggy operator // new(nothrow)[]().
+# define ACE_HAS_NEW_NOTHROW
+# endif /* __GNUC__ >= 3.3 */
#endif /* ACE_HAS_EXCEPTIONS */
#if (defined (i386) || defined (__i386__)) && !defined (ACE_SIZEOF_LONG_DOUBLE)
diff --git a/ACE/ace/config-irix6.x-common.h b/ACE/ace/config-irix6.x-common.h
index 82a419edd59..38d8ea5f5cc 100644
--- a/ACE/ace/config-irix6.x-common.h
+++ b/ACE/ace/config-irix6.x-common.h
@@ -60,6 +60,8 @@
#define ACE_LACKS_CONDATTR_PSHARED
#define ACE_LACKS_MUTEXATTR_PSHARED
+#define ACE_LACKS_SUSECONDS_T
+
// Platform/compiler has the sigwait(2) prototype
#define ACE_HAS_SIGWAIT
#define ACE_HAS_SIGTIMEDWAIT
diff --git a/ACE/ace/config-sunos5.8.h b/ACE/ace/config-sunos5.8.h
index 423fb1de7c4..779f6e397bf 100644
--- a/ACE/ace/config-sunos5.8.h
+++ b/ACE/ace/config-sunos5.8.h
@@ -30,4 +30,7 @@
# endif /* ACE_LACKS_RWLOCK_T */
# endif /* _POSIX_PTHREAD_SEMANTICS */
+// This is no longer the case for Sun 5.9 onwards
+# undef ACE_HAS_X86_STAT_MACROS
+
#endif /* ACE_CONFIG_H */
diff --git a/ACE/ace/config-win32-common.h b/ACE/ace/config-win32-common.h
index 8f222bfe070..12caa6cdb7b 100644
--- a/ACE/ace/config-win32-common.h
+++ b/ACE/ace/config-win32-common.h
@@ -104,7 +104,7 @@
// Define the special export macros needed to export symbols outside a dll
#if !defined(__BORLANDC__)
-#define ACE_HAS_CUSTOM_EXPORT_MACROS
+#define ACE_HAS_CUSTOM_EXPORT_MACROS 1
#define ACE_Proper_Export_Flag __declspec (dllexport)
#define ACE_Proper_Import_Flag __declspec (dllimport)
#define ACE_EXPORT_SINGLETON_DECLARATION(T) template class __declspec (dllexport) T