diff options
-rw-r--r-- | .clang-format | 21 | ||||
-rw-r--r-- | TAO/tests/Bug_3251_Regression/DllOrb.h | 5 | ||||
-rw-r--r-- | TAO/tests/Bug_3542_Regression/DllOrb.h | 16 | ||||
-rw-r--r-- | TAO/tests/Oneway_Send_Timeouts/ORB_Task.h | 6 | ||||
-rw-r--r-- | TAO/tests/Oneway_Send_Timeouts/Server_Task.h | 24 | ||||
-rw-r--r-- | TAO/tests/Oneway_Send_Timeouts/main.cpp | 70 |
6 files changed, 87 insertions, 55 deletions
diff --git a/.clang-format b/.clang-format index cdb39325377..91421e535a6 100644 --- a/.clang-format +++ b/.clang-format @@ -1,18 +1,25 @@ --- -# This configuration requires clang-format version 12.0 or newer. +# This configuration requires clang-format version v12.0 or newer. BasedOnStyle: Mozilla -AlignOperands: false +# AlignConsecutiveDeclarations: Consecutive +AlignEscapedNewlines: Left +AlignOperands: false AllowAllParametersOfDeclarationOnNextLine: false AllowShortBlocksOnASingleLine: true AllowShortFunctionsOnASingleLine: InlineOnly +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterReturnType: None +# AlwaysBreakAfterDefinitionReturnType: TopLevel +# AlwaysBreakAfterReturnType: TopLevelDefinitions BinPackArguments: false BinPackParameters: false +# parameters will either all be on the same line or will have one line each. BreakBeforeBraces: Custom BraceWrapping: AfterCaseLabel: true AfterClass: true - AfterControlStatement: Never + AfterControlStatement: Always AfterEnum: true AfterFunction: true AfterNamespace: true @@ -29,10 +36,14 @@ BraceWrapping: SplitEmptyRecord: true SplitEmptyNamespace: true # based on BreakBeforeBraces: GNU -ColumnLimit: 79 -#XXX IndentAccessModifiers: true +ColumnLimit: 123 # MAYBE up to 160 +# +# XXX v13.0 only IndentAccessModifiers: true +# IndentPPDirectives: AfterHash SortUsingDeclarations: false SpaceAfterTemplateKeyword: true +SpaceAfterLogicalNot: true SpaceBeforeParens: Always +SpaceInEmptyBlock: false ... diff --git a/TAO/tests/Bug_3251_Regression/DllOrb.h b/TAO/tests/Bug_3251_Regression/DllOrb.h index 0587b92c20b..f3bc11f4bcb 100644 --- a/TAO/tests/Bug_3251_Regression/DllOrb.h +++ b/TAO/tests/Bug_3251_Regression/DllOrb.h @@ -16,10 +16,7 @@ public: DllOrb (void); virtual ~DllOrb (void); - CORBA::ORB_ptr orb () const - { - return CORBA::ORB::_duplicate (mv_orb_.in ()); - } + CORBA::ORB_ptr orb () const { return CORBA::ORB::_duplicate (mv_orb_.in ()); } virtual int init (int argc, ACE_TCHAR* argv[]); diff --git a/TAO/tests/Bug_3542_Regression/DllOrb.h b/TAO/tests/Bug_3542_Regression/DllOrb.h index d953ee0b039..99f6a3d8b39 100644 --- a/TAO/tests/Bug_3542_Regression/DllOrb.h +++ b/TAO/tests/Bug_3542_Regression/DllOrb.h @@ -5,30 +5,30 @@ #include "ace/Task.h" #include "tao/ORB.h" -#include "tao/PortableServer/PortableServer.h" #include "bug_3542_export.h" +#include "tao/PortableServer/PortableServer.h" #include <memory> -class bug_3542_Export DllOrb: public ACE_Task_Base +class bug_3542_Export DllOrb : public ACE_Task_Base { public: DllOrb (void); virtual ~DllOrb (void); - CORBA::ORB_ptr orb () const { return CORBA::ORB::_duplicate(mv_orb_.in()); } + CORBA::ORB_ptr orb () const { return CORBA::ORB::_duplicate (mv_orb_.in ()); } - virtual int init (int argc, ACE_TCHAR *argv[]); + virtual int init (int argc, ACE_TCHAR* argv[]); virtual int fini (); virtual int svc (); private: - std::unique_ptr < ACE_Thread_Barrier > ma_barrier_; - CORBA::ORB_var mv_orb_; - PortableServer::POA_var mv_rootPOA_; - PortableServer::POAManager_var mv_poaManager_; + std::unique_ptr<ACE_Thread_Barrier> ma_barrier_; + CORBA::ORB_var mv_orb_; + PortableServer::POA_var mv_rootPOA_; + PortableServer::POAManager_var mv_poaManager_; }; ACE_FACTORY_DECLARE (bug_3542, DllOrb) diff --git a/TAO/tests/Oneway_Send_Timeouts/ORB_Task.h b/TAO/tests/Oneway_Send_Timeouts/ORB_Task.h index 42642e95dc4..15ef11c9839 100644 --- a/TAO/tests/Oneway_Send_Timeouts/ORB_Task.h +++ b/TAO/tests/Oneway_Send_Timeouts/ORB_Task.h @@ -14,14 +14,16 @@ public: ORB_Task (CORBA::ORB_ptr orb) : orb_ (CORBA::ORB::_duplicate (orb)) { - if (CORBA::is_nil (orb_.in ()) == 1) { + if (CORBA::is_nil (orb_.in ()) == 1) + { ACE_ERROR ((LM_ERROR, "ORB_Task> Ctr> Orb is NULL\n")); } }; virtual int svc () { - if (CORBA::is_nil (orb_.in ()) == 0) { + if (CORBA::is_nil (orb_.in ()) == 0) + { orb_->run (); } diff --git a/TAO/tests/Oneway_Send_Timeouts/Server_Task.h b/TAO/tests/Oneway_Send_Timeouts/Server_Task.h index 97450635ffd..d9a6a625ef2 100644 --- a/TAO/tests/Oneway_Send_Timeouts/Server_Task.h +++ b/TAO/tests/Oneway_Send_Timeouts/Server_Task.h @@ -21,22 +21,30 @@ public: bool initializer = false; { ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->mutex_, -1); - if (server_.get () == 0) { + if (server_.get () == 0) + { ACE_ARGV my_args (args_.c_str ()); // Initialize Server ORB in new thread - // server_ = std::make_unique<Server>(my_args.argc(), my_args.argv()); + +#ifdef ACE_HAS_CPP14 + server_ = std::make_unique<Server> (my_args.argc (), my_args.argv ()); +#else server_.reset (new Server(my_args.argc (), my_args.argv ()); - ACE_ASSERT (server_.get () != 0); +#endif + + ACE_ASSERT (server_); initializer = true; } } - if (initializer) { + if (initializer) + { server_->run (false); this->force_shutdown (); // servant thread is responsible for shutdown } - else { + else + { server_->run (true); } @@ -45,7 +53,8 @@ public: bool ready () { - if (server_.get () != 0) { + if (server_.get () != 0) + { return server_->init_; } @@ -54,7 +63,8 @@ public: void force_shutdown () { - if (server_.get () != 0) { + if (server_.get () != 0) + { server_->shutdown (); } } diff --git a/TAO/tests/Oneway_Send_Timeouts/main.cpp b/TAO/tests/Oneway_Send_Timeouts/main.cpp index c866a66cd1e..d48eb5b26a1 100644 --- a/TAO/tests/Oneway_Send_Timeouts/main.cpp +++ b/TAO/tests/Oneway_Send_Timeouts/main.cpp @@ -28,30 +28,33 @@ private: bool shutdown_; }; -void -MyMain::print_usage () +void MyMain::print_usage () {} -bool -MyMain::init_server (const ACE_TCHAR* args) +bool MyMain::init_server (const ACE_TCHAR* args) { std::string my_args (ACE_TEXT_ALWAYS_CHAR (args)); // main thread and extra thread for backdoor operations int thread_pool = 2; - // TODO: server_ = std::make_unique<Server> (my_args); +#ifdef ACE_HAS_CPP14 + server_ = std::make_unique<Server> (my_args); +#else server_.reset (new Server (my_args); - ACE_ASSERT (server_task_.get () != 0); +#endif - server_task_->activate (THR_NEW_LWP | THR_JOINABLE | THR_INHERIT_SCHED, - thread_pool); + ACE_ASSERT (server_task_); + + server_task_->activate (THR_NEW_LWP | THR_JOINABLE | THR_INHERIT_SCHED, thread_pool); int duration = 4; // wait 3 seconds for initialization ACE_Time_Value current = ACE_High_Res_Timer::gettimeofday_hr (); ACE_Time_Value timeout = current + ACE_Time_Value (duration); - while (current < timeout) { - if (server_task_->ready ()) { + while (current < timeout) + { + if (server_task_->ready ()) + { break; } ACE_Time_Value sleep_time; @@ -60,7 +63,8 @@ MyMain::init_server (const ACE_TCHAR* args) current += sleep_time; } - if (!server_task_->ready ()) { + if (! server_task_->ready ()) + { server_task_->force_shutdown (); server_task_->wait (); server_task_.reset (); @@ -70,18 +74,20 @@ MyMain::init_server (const ACE_TCHAR* args) return true; } -bool -MyMain::init_client (const ACE_TCHAR* args) +bool MyMain::init_client (const ACE_TCHAR* args) { std::string my_args (ACE_TEXT_ALWAYS_CHAR (args)); int thread_pool = 1; - // TODO: client_task_ = std::make_unique<Client_Task> (my_args); +#ifdef ACE_HAS_CPP14 + client_task_ = std::make_unique<Client_Task> (my_args); +#else client_task_.reset (new Client_Task (my_args); - ACE_ASSERT (client_task_.get () != 0); +#endif + + ACE_ASSERT (client_task_); - client_task_->activate (THR_NEW_LWP | THR_JOINABLE | THR_INHERIT_SCHED, - thread_pool); + client_task_->activate (THR_NEW_LWP | THR_JOINABLE | THR_INHERIT_SCHED, thread_pool); return true; } @@ -91,20 +97,25 @@ MyMain::MyMain (int argc, ACE_TCHAR* argv[]) , shutdown_ (false) { argc--; - for (int p = 1; p <= argc; p++) { - if (ACE_OS::strcmp (argv[p], ACE_TEXT ("-?")) == 0) { + for (int p = 1; p <= argc; p++) + { + if (ACE_OS::strcmp (argv[p], ACE_TEXT ("-?")) == 0) + { print_usage (); return; } - if (ACE_OS::strcasecmp (argv[p], ACE_TEXT ("-s")) == 0) { + if (ACE_OS::strcasecmp (argv[p], ACE_TEXT ("-s")) == 0) + { const ACE_TCHAR* s_args = (((p + 1) <= argc) ? argv[p + 1] : 0); s_init_ = this->init_server (s_args); p++; } - else if (ACE_OS::strcasecmp (argv[p], ACE_TEXT ("-c")) == 0) { + else if (ACE_OS::strcasecmp (argv[p], ACE_TEXT ("-c")) == 0) + { const ACE_TCHAR* s_args = (((p + 1) <= argc) ? argv[p + 1] : 0); - if (s_init_) { + if (s_init_) + { this->init_client (s_args); } p++; @@ -112,14 +123,15 @@ MyMain::MyMain (int argc, ACE_TCHAR* argv[]) } } -void -MyMain::run () +void MyMain::run () { - if (server_task_.get () != 0) { + if (server_task_.get () != 0) + { server_task_->wait (); } - if (client_task_.get () != 0) { + if (client_task_.get () != 0) + { client_task_->wait (); } @@ -128,13 +140,13 @@ MyMain::run () MyMain::~MyMain () { - if (!shutdown_) { + if (! shutdown_) + { this->run (); } } -int -ACE_TMAIN (int argc, ACE_TCHAR* argv[]) +int ACE_TMAIN (int argc, ACE_TCHAR* argv[]) { MyMain my_main (argc, argv); |