summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorocielliottc <elliottc@objectcomputing.com>2022-12-14 11:51:41 -0600
committerGitHub <noreply@github.com>2022-12-14 11:51:41 -0600
commit67518043f1e02e67b02f057f9b183354bb070fd0 (patch)
tree478170ad749122adc7ffea8b395dc1adce9af41c
parent432c3c03538e5b227e8095c42f6a58a9744a9d77 (diff)
parentb7b81d09b6d0a15e384339fb1aa5c614d57435ae (diff)
downloadATCD-67518043f1e02e67b02f057f9b183354bb070fd0.tar.gz
Merge pull request #1997 from DOCGroup/elliottc/715-additional
[ace6tao2] Fix additional warnings from OpenDDS builds.
-rw-r--r--ACE/ACEXML/parser/parser/Parser.cpp10
-rw-r--r--ACE/ace/MEM_Addr.h3
-rw-r--r--ACE/ace/MEM_Addr.inl12
-rw-r--r--ACE/ace/OS_NS_stdlib.cpp21
-rw-r--r--ACE/ace/OS_NS_string.cpp6
-rw-r--r--ACE/ace/Process.cpp3
-rw-r--r--ACE/ace/Process_Manager.cpp3
-rw-r--r--ACE/ace/config-macros.h11
-rw-r--r--TAO/TAO_IDL/be/be_visitor_native/native_ch.cpp11
-rw-r--r--TAO/tao/Storable_FlatFileStream.cpp2
10 files changed, 56 insertions, 26 deletions
diff --git a/ACE/ACEXML/parser/parser/Parser.cpp b/ACE/ACEXML/parser/parser/Parser.cpp
index 385ba540c55..687fcd11531 100644
--- a/ACE/ACEXML/parser/parser/Parser.cpp
+++ b/ACE/ACEXML/parser/parser/Parser.cpp
@@ -181,6 +181,7 @@ ACEXML_Parser::parse (ACEXML_InputSource *input)
break;
case 0:
this->fatal_error (ACE_TEXT ("Unexpected end-of-file"));
+ break;
default: // Root element begins
prolog_done = 1;
break;
@@ -541,6 +542,7 @@ ACEXML_Parser::parse_includesect (void)
case 0: // [VC: Proper Conditional Section/PE Nesting]
this->fatal_error (ACE_TEXT ("Invalid Conditional Section/PE ")
ACE_TEXT ("Nesting "));
+ break;
case ']':
if (this->peek() == ']')
{
@@ -551,6 +553,7 @@ ACEXML_Parser::parse_includesect (void)
return 0;
}
}
+ ACE_FALLTHROUGH;
default:
this->fatal_error (ACE_TEXT ("Invalid includeSect"));
}
@@ -596,6 +599,7 @@ ACEXML_Parser::parse_markup_decl (void)
break;
case 0: // [VC: Proper Declaration/PE Nesting]
this->fatal_error (ACE_TEXT ("Unexpected end-of-file"));
+ break;
default:
this->fatal_error (ACE_TEXT ("Invalid markupDecl"));
}
@@ -989,7 +993,7 @@ ACEXML_Parser::parse_content (const ACEXML_Char* startname,
// cdata_length = 0;
// break;
// }
- // Fall thru...
+ ACE_FALLTHROUGH;
default:
++cdata_length;
this->obstack_.grow (ch);
@@ -1368,6 +1372,7 @@ ACEXML_Parser::parse_tokenized_type (void)
// Admittedly, this error message is not precise enough
this->fatal_error(ACE_TEXT ("Expecting keyword `ID', `IDREF', or")
ACE_TEXT ("`IDREFS'"));
+ break;
case 'E': // ENTITY or ENTITIES
if (this->parse_token (ACE_TEXT ("NTIT")) == 0)
{
@@ -1393,6 +1398,7 @@ ACEXML_Parser::parse_tokenized_type (void)
// Admittedly, this error message is not precise enough
this->fatal_error(ACE_TEXT ("Expecting keyword `ENTITY', or")
ACE_TEXT ("`ENTITIES'"));
+ break;
case 'M':
if (this->parse_token (ACE_TEXT ("TOKEN")) == 0)
{
@@ -2854,7 +2860,7 @@ ACEXML_Parser::parse_processing_instruction (void)
}
break;
case 0x0A:
- // Fall thru...
+ ACE_FALLTHROUGH;
default:
if (state == 1)
this->obstack_.grow ('?');
diff --git a/ACE/ace/MEM_Addr.h b/ACE/ace/MEM_Addr.h
index 21728cf45e1..c9616082745 100644
--- a/ACE/ace/MEM_Addr.h
+++ b/ACE/ace/MEM_Addr.h
@@ -40,6 +40,9 @@ public:
/// Copy constructor.
ACE_MEM_Addr (const ACE_MEM_Addr &);
+ /// Assignment operator
+ ACE_MEM_Addr& operator= (const ACE_MEM_Addr& rhs);
+
/// Creates an ACE_MEM_Addr from a @a port_number
ACE_MEM_Addr (u_short port_number);
diff --git a/ACE/ace/MEM_Addr.inl b/ACE/ace/MEM_Addr.inl
index f849070acfb..7cf22ce26bc 100644
--- a/ACE/ace/MEM_Addr.inl
+++ b/ACE/ace/MEM_Addr.inl
@@ -4,6 +4,18 @@
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+/// Assignment operator
+ACE_INLINE ACE_MEM_Addr&
+ACE_MEM_Addr::operator= (const ACE_MEM_Addr& rhs)
+{
+ if (this != &rhs)
+ {
+ this->external_.set (rhs.external_);
+ this->internal_.set (rhs.internal_);
+ }
+ return *this;
+}
+
/// Set the port number.
ACE_INLINE void
ACE_MEM_Addr::set_port_number (u_short port_number,
diff --git a/ACE/ace/OS_NS_stdlib.cpp b/ACE/ace/OS_NS_stdlib.cpp
index e73808e9af7..612cfa5e8e3 100644
--- a/ACE/ace/OS_NS_stdlib.cpp
+++ b/ACE/ace/OS_NS_stdlib.cpp
@@ -136,20 +136,17 @@ ACE_OS::strenvdup (const ACE_TCHAR *str)
size_t buf_len = ACE_OS::strlen (str) + 1;
if (temp != 0)
buf_len += ACE_OS::strlen (temp) - var_len;
- ACE_TCHAR * buf_p = buf;
- if (buf_len > ACE_DEFAULT_ARGV_BUFSIZ)
- {
- buf_p =
+ ACE_TCHAR * buf_p =
#if defined (ACE_HAS_ALLOC_HOOKS)
- (ACE_TCHAR *) ACE_Allocator::instance()->malloc (buf_len * sizeof (ACE_TCHAR));
+ (ACE_TCHAR *) ACE_Allocator::instance()->malloc (buf_len * sizeof (ACE_TCHAR));
#else
- (ACE_TCHAR *) ACE_OS::malloc (buf_len * sizeof (ACE_TCHAR));
+ (ACE_TCHAR *) ACE_OS::malloc (buf_len * sizeof (ACE_TCHAR));
#endif /* ACE_HAS_ALLOC_HOOKS */
- if (buf_p == 0)
- {
- errno = ENOMEM;
- return 0;
- }
+
+ if (buf_p == 0)
+ {
+ errno = ENOMEM;
+ return 0;
}
ACE_TCHAR * p = buf_p;
size_t len = start - str;
@@ -170,7 +167,7 @@ ACE_OS::strenvdup (const ACE_TCHAR *str)
*p = ACE_TEXT ('\0');
}
ACE_OS::strcpy (p, &start[var_len]);
- return (buf_p == buf) ? ACE_OS::strdup (buf) : buf_p;
+ return buf_p;
}
else
return ACE_OS::strdup (str);
diff --git a/ACE/ace/OS_NS_string.cpp b/ACE/ace/OS_NS_string.cpp
index ff5c4e1e549..03a91a45f2c 100644
--- a/ACE/ace/OS_NS_string.cpp
+++ b/ACE/ace/OS_NS_string.cpp
@@ -83,9 +83,9 @@ ACE_OS::strerror (int errnum)
if (ACE::is_sock_error (errnum))
{
const ACE_TCHAR *errortext = ACE::sock_error (errnum);
- ACE_OS::strncpy (ret_errortext,
- ACE_TEXT_ALWAYS_CHAR (errortext),
- sizeof (ret_errortext));
+ ACE_OS::strsncpy (ret_errortext,
+ ACE_TEXT_ALWAYS_CHAR (errortext),
+ sizeof (ret_errortext));
return ret_errortext;
}
#if defined (ACE_LACKS_STRERROR)
diff --git a/ACE/ace/Process.cpp b/ACE/ace/Process.cpp
index a1921102960..10500483e30 100644
--- a/ACE/ace/Process.cpp
+++ b/ACE/ace/Process.cpp
@@ -695,7 +695,8 @@ ACE_Process::wait (const ACE_Time_Value &tv,
// open(), and there's already a SIGCHLD action set, so no
// action is needed here.
ACE_Sig_Action old_action;
- ACE_Sig_Action do_sigchld ((ACE_SignalHandler)sigchld_nop);
+ ACE_Sig_Handler_Ex sigchld_nop_ptr = sigchld_nop;
+ ACE_Sig_Action do_sigchld (reinterpret_cast<ACE_SignalHandler> (reinterpret_cast<void*> (sigchld_nop_ptr)));
do_sigchld.register_action (SIGCHLD, &old_action);
pid_t pid;
diff --git a/ACE/ace/Process_Manager.cpp b/ACE/ace/Process_Manager.cpp
index 4db0f020eed..6a609cb8dc0 100644
--- a/ACE/ace/Process_Manager.cpp
+++ b/ACE/ace/Process_Manager.cpp
@@ -888,7 +888,8 @@ ACE_Process_Manager::wait (pid_t pid,
ACE_Sig_Action old_action;
if (this->reactor () == 0)
{
- ACE_Sig_Action do_sigchld ((ACE_SignalHandler)sigchld_nop);
+ ACE_Sig_Handler_Ex sigchld_nop_ptr = sigchld_nop;
+ ACE_Sig_Action do_sigchld (reinterpret_cast<ACE_SignalHandler> (reinterpret_cast<void*> (sigchld_nop_ptr)));
do_sigchld.register_action (SIGCHLD, &old_action);
}
diff --git a/ACE/ace/config-macros.h b/ACE/ace/config-macros.h
index 5989d2cc6d8..c1aef4c1f08 100644
--- a/ACE/ace/config-macros.h
+++ b/ACE/ace/config-macros.h
@@ -277,6 +277,17 @@
# define ACE_NOTREACHED(a) a
#endif /* ghs || ..... */
+
+// Compiler-specific configs can define ACE_FALLTHROUGH but if not,
+// and it's a C++17 or higher compiler, use the defined mechanism.
+#if !defined ACE_FALLTHROUGH
+# if defined ACE_HAS_CPP17
+# define ACE_FALLTHROUGH [[fallthrough]]
+# else
+# define ACE_FALLTHROUGH
+# endif /* ACE_HAS_CPP17 */
+#endif /* ACE_FALLTHROUGH */
+
// ============================================================================
// ACE_ALLOC_HOOK* macros
//
diff --git a/TAO/TAO_IDL/be/be_visitor_native/native_ch.cpp b/TAO/TAO_IDL/be/be_visitor_native/native_ch.cpp
index 638cce03153..0dc5927131b 100644
--- a/TAO/TAO_IDL/be/be_visitor_native/native_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_native/native_ch.cpp
@@ -68,15 +68,16 @@ be_visitor_native_ch::visit_native (be_native *node)
// strip the "Seq" ending to get the sample's name
const char * node_name = node->full_name ();
const size_t max_name_length = 2000;
- if (ACE_OS::strlen (node_name) >= max_name_length)
+ const size_t node_name_length = ACE_OS::strlen (node_name);
+ if (node_name_length >= max_name_length ||
+ node_name_length <= 3)
{
return -1;
}
char sample_name[max_name_length];
- ACE_OS::strncpy (sample_name,
- node_name,
- ACE_OS::strlen (node_name) - 3);
- sample_name[ACE_OS::strlen (node_name) - 3] = '\0';
+ // Copy node_name into sample_name and shorten to remove Seq suffix
+ ACE_OS::strcpy (sample_name, node_name);
+ sample_name[node_name_length - 3] = '\0';
*os << be_nl_2
<< "typedef ::TAO::DCPS::ZeroCopyDataSeq< "
diff --git a/TAO/tao/Storable_FlatFileStream.cpp b/TAO/tao/Storable_FlatFileStream.cpp
index a95c5063fc0..d9f688175f3 100644
--- a/TAO/tao/Storable_FlatFileStream.cpp
+++ b/TAO/tao/Storable_FlatFileStream.cpp
@@ -94,7 +94,6 @@ namespace
{
if (ACE_OS::fwrite(buffer, 1, n_read, f2) != n_read)
{
- ferror (f2);
if (TAO_debug_level > 0)
{
TAOLIB_ERROR ((LM_ERROR,
@@ -109,7 +108,6 @@ namespace
errno = 0;
if (!feof (f1))
{
- ferror (f1);
if (TAO_debug_level > 0)
{
TAOLIB_ERROR ((LM_ERROR,