From c57c10edcd27dabe68b1deeb4b9e240a205805a9 Mon Sep 17 00:00:00 2001
From: Alex Lin <alexander.s.lin@nasa.gov>
Date: Tue, 29 Mar 2016 09:59:49 -0500
Subject: [PATCH] Add direct STL checkpointing

Made adjustments to template default arguments to avoid clang compiler
errors.  Also added an irnore warning during python glue code compilation

refs #206
---
 include/trick/checkpoint_map.hh          |  8 ++---
 include/trick/checkpoint_queue.hh        |  4 +--
 include/trick/checkpoint_sequence_stl.hh | 40 ++++++++++++------------
 include/trick/checkpoint_stack.hh        |  4 +--
 libexec/trick/make_makefile_swig         |  2 +-
 test/SIM_stls/RUN_test/input.py          |  6 ++--
 6 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/include/trick/checkpoint_map.hh b/include/trick/checkpoint_map.hh
index 29340207..52fceb9a 100644
--- a/include/trick/checkpoint_map.hh
+++ b/include/trick/checkpoint_map.hh
@@ -37,8 +37,8 @@ int checkpoint_map_stl(STL & in_map , std::string object_name , std::string var_
     typename STL::iterator iter ;
     int status ;
 
-    typename STL::key_type * keys ;
-    typename STL::mapped_type * items ;
+    typename STL::key_type * keys = nullptr ;
+    typename STL::mapped_type * items = nullptr ;
 
     cont_size = in_map.size() ;
     std::replace_if(object_name.begin(), object_name.end(), std::ptr_fun<int,int>(&std::ispunct), '_');
@@ -85,7 +85,7 @@ int checkpoint_map_stl_key_string(STL & in_map , std::string object_name , std::
     int status ;
 
     char ** keys ;
-    typename STL::mapped_type * items ;
+    typename STL::mapped_type * items = nullptr ;
 
     cont_size = in_map.size() ;
     std::replace_if(object_name.begin(), object_name.end(), std::ptr_fun<int,int>(&std::ispunct), '_');
@@ -130,7 +130,7 @@ int checkpoint_map_stl_data_string(STL & in_map , std::string object_name , std:
     typename STL::iterator iter ;
     int status ;
 
-    typename STL::key_type * keys ;
+    typename STL::key_type * keys = nullptr ;
     char ** items ;
 
     cont_size = in_map.size() ;
diff --git a/include/trick/checkpoint_queue.hh b/include/trick/checkpoint_queue.hh
index bbdb4626..a5e781d9 100644
--- a/include/trick/checkpoint_queue.hh
+++ b/include/trick/checkpoint_queue.hh
@@ -41,7 +41,7 @@ int checkpoint_stl(std::queue<ITEM_TYPE> & in_stl , std::string object_name , st
     char var_declare[128] ;
     int status ;
 
-    ITEM_TYPE * items ;
+    ITEM_TYPE * items = nullptr ;
     std::queue<ITEM_TYPE> temp_queue ;
 
     cont_size = in_stl.size() ;
@@ -74,7 +74,7 @@ int checkpoint_stl(std::priority_queue<ITEM_TYPE> & in_stl , std::string object_
     char var_declare[128] ;
     int status ;
 
-    ITEM_TYPE * items ;
+    ITEM_TYPE * items = nullptr ;
     std::priority_queue<ITEM_TYPE> temp_queue ;
 
     cont_size = in_stl.size() ;
diff --git a/include/trick/checkpoint_sequence_stl.hh b/include/trick/checkpoint_sequence_stl.hh
index a5b61b1f..6e353daa 100644
--- a/include/trick/checkpoint_sequence_stl.hh
+++ b/include/trick/checkpoint_sequence_stl.hh
@@ -174,13 +174,13 @@ int checkpoint_sequence_stl_stl(STL & in_stl , std::string object_name , std::st
 // std::vector
 
 // This template is only enabled if the items in the vector are an STL
-template <typename ITEM_TYPE, typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
+template <typename ITEM_TYPE, typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* >
 int checkpoint_stl(std::vector<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) {
     return checkpoint_sequence_stl_stl( in_stl , object_name , var_name ) ;
 }
 
 // This template is only enabled if the items in the vector are NOT an STL, except for std::string
-template <typename ITEM_TYPE, typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
+template <typename ITEM_TYPE, typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* >
 int checkpoint_stl(std::vector<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) {
     return checkpoint_sequence_stl_intrinsic( in_stl , object_name , var_name ) ;
 }
@@ -191,13 +191,13 @@ int checkpoint_stl(std::vector<std::string> & in_vector , std::string object_nam
 // -----------
 // std::list
 
-template <typename ITEM_TYPE, typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
+template <typename ITEM_TYPE, typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* >
 int checkpoint_stl(std::list<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) {
     return checkpoint_sequence_stl_stl( in_stl , object_name , var_name ) ;
 }
 
 // This template is only enabled if the items in the list are NOT an STL, except for std::string
-template <typename ITEM_TYPE, typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
+template <typename ITEM_TYPE, typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* >
 int checkpoint_stl(std::list<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) {
     return checkpoint_sequence_stl_intrinsic( in_stl , object_name , var_name ) ;
 }
@@ -208,13 +208,13 @@ int checkpoint_stl(std::list<std::string> & in_list , std::string object_name ,
 // -----------
 // std::deque
 
-template <typename ITEM_TYPE, typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
+template <typename ITEM_TYPE, typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* >
 int checkpoint_stl(std::deque<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) {
     return checkpoint_sequence_stl_stl( in_stl , object_name , var_name ) ;
 }
 
 // This template is only enabled if the items in the deque are NOT an STL, except for std::string
-template <typename ITEM_TYPE, typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
+template <typename ITEM_TYPE, typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* >
 int checkpoint_stl(std::deque<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) {
     return checkpoint_sequence_stl_intrinsic( in_stl , object_name , var_name ) ;
 }
@@ -225,13 +225,13 @@ int checkpoint_stl(std::deque<std::string> & in_vector , std::string object_name
 // -----------
 // std::set
 
-template <typename ITEM_TYPE, typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
+template <typename ITEM_TYPE, typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* >
 int checkpoint_stl(std::set<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) {
     return checkpoint_sequence_stl_stl( in_stl , object_name , var_name ) ;
 }
 
 // This template is only enabled if the items in the set are NOT an STL, except for std::string
-template <typename ITEM_TYPE, typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
+template <typename ITEM_TYPE, typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* >
 int checkpoint_stl(std::set<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) {
     return checkpoint_sequence_stl_intrinsic( in_stl , object_name , var_name ) ;
 }
@@ -242,13 +242,13 @@ int checkpoint_stl(std::set<std::string> & in_vector , std::string object_name ,
 // -----------
 // std::multiset
 
-template <typename ITEM_TYPE, typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
+template <typename ITEM_TYPE, typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* >
 int checkpoint_stl(std::multiset<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) {
     return checkpoint_sequence_stl_stl( in_stl , object_name , var_name ) ;
 }
 
 // This template is only enabled if the items in the multiset are NOT an STL, except for std::string
-template <typename ITEM_TYPE, typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
+template <typename ITEM_TYPE, typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* >
 int checkpoint_stl(std::multiset<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) {
     return checkpoint_sequence_stl_intrinsic( in_stl , object_name , var_name ) ;
 }
@@ -429,13 +429,13 @@ int restore_sequence_stl_stl(STL & in_stl , std::string object_name , std::strin
 // std::vector
 
 // This template is only enabled if the items in the vector are an STL
-template <typename ITEM_TYPE, typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
+template <typename ITEM_TYPE, typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* >
 int restore_stl(std::vector<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) {
     return restore_sequence_stl_stl( in_stl , object_name , var_name ) ;
 }
 
 // This template is only enabled if the items in the vector are NOT an STL, except for std::string
-template <typename ITEM_TYPE, typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
+template <typename ITEM_TYPE, typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* >
 int restore_stl(std::vector<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) {
     return restore_sequence_stl_intrinsic( in_stl , object_name , var_name ) ;
 }
@@ -447,13 +447,13 @@ int restore_stl(std::vector<std::string> & in_vector , std::string object_name ,
 // std::list
 
 // This template is only enabled if the items in the list are an STL
-template <typename ITEM_TYPE, typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
+template <typename ITEM_TYPE, typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* >
 int restore_stl(std::list<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) {
     return restore_sequence_stl_stl( in_stl , object_name , var_name ) ;
 }
 
 // This template is only enabled if the items in the list are NOT an STL, except for std::string
-template <typename ITEM_TYPE, typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
+template <typename ITEM_TYPE, typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* >
 int restore_stl(std::list<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) {
     return restore_sequence_stl_intrinsic( in_stl , object_name , var_name ) ;
 }
@@ -464,13 +464,13 @@ int restore_stl(std::list<std::string> & in_list , std::string object_name , std
 // std::deque
 
 // This template is only enabled if the items in the deque are an STL
-template <typename ITEM_TYPE, typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
+template <typename ITEM_TYPE, typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* >
 int restore_stl(std::deque<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) {
     return restore_sequence_stl_stl( in_stl , object_name , var_name ) ;
 }
 
 // This template is only enabled if the items in the deque are NOT an STL, except for std::string
-template <typename ITEM_TYPE, typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
+template <typename ITEM_TYPE, typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* >
 int restore_stl(std::deque<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) {
     return restore_sequence_stl_intrinsic( in_stl , object_name , var_name ) ;
 }
@@ -481,13 +481,13 @@ int restore_stl(std::deque<std::string> & in_deque , std::string object_name , s
 // std::set
 
 // This template is only enabled if the items in the set are an STL
-template <typename ITEM_TYPE, typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
+template <typename ITEM_TYPE, typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* >
 int restore_stl(std::set<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) {
     return restore_sequence_stl_stl( in_stl , object_name , var_name ) ;
 }
 
 // This template is only enabled if the items in the set are NOT an STL, except for std::string
-template <typename ITEM_TYPE, typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
+template <typename ITEM_TYPE, typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* >
 int restore_stl(std::set<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) {
     return restore_sequence_stl_intrinsic( in_stl , object_name , var_name ) ;
 }
@@ -498,13 +498,13 @@ int restore_stl(std::set<std::string> & in_set , std::string object_name , std::
 // std::multiset
 
 // This template is only enabled if the items in the multiset are an STL
-template <typename ITEM_TYPE, typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
+template <typename ITEM_TYPE, typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* >
 int restore_stl(std::multiset<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) {
     return restore_sequence_stl_stl( in_stl , object_name , var_name ) ;
 }
 
 // This template is only enabled if the items in the multiset are NOT an STL, except for std::string
-template <typename ITEM_TYPE, typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
+template <typename ITEM_TYPE, typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* >
 int restore_stl(std::multiset<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) {
     return restore_sequence_stl_intrinsic( in_stl , object_name , var_name ) ;
 }
diff --git a/include/trick/checkpoint_stack.hh b/include/trick/checkpoint_stack.hh
index 1699943f..11077748 100644
--- a/include/trick/checkpoint_stack.hh
+++ b/include/trick/checkpoint_stack.hh
@@ -31,7 +31,7 @@ int checkpoint_stl(std::stack<ITEM_TYPE> & in_stl , std::string object_name , st
     char var_declare[128] ;
     int status ;
 
-    ITEM_TYPE * items ;
+    ITEM_TYPE * items = nullptr ;
     std::stack<ITEM_TYPE> temp_stack ;
 
     cont_size = in_stl.size() ;
@@ -68,7 +68,7 @@ int restore_stl(std::stack<ITEM_TYPE> & in_stl , std::string object_name , std::
     unsigned int cont_size ;
 
     REF2 * items_ref ;
-    ITEM_TYPE * items ;
+    ITEM_TYPE * items = nullptr ;
     std::replace_if(object_name.begin(), object_name.end(), std::ptr_fun<int,int>(&std::ispunct), '_');
 
     //message_publish(1, "RESTORE_STL_STACK %s_%s\n", object_name.c_str() , var_name.c_str()) ;
diff --git a/libexec/trick/make_makefile_swig b/libexec/trick/make_makefile_swig
index 27e1a0c9..c6462c3c 100755
--- a/libexec/trick/make_makefile_swig
+++ b/libexec/trick/make_makefile_swig
@@ -173,7 +173,7 @@ sub make_swig_makefile() {
 SWIG_FLAGS ?=
 SWIG_CFLAGS := -I../include \${PYTHON_INCLUDES} -Wno-shadow -Wno-missing-field-initializers
 ifeq (\$(IS_CC_CLANG), 1)
- SWIG_CFLAGS += -Wno-self-assign -Wno-sometimes-uninitialized
+ SWIG_CFLAGS += -Wno-self-assign -Wno-sometimes-uninitialized -Wno-deprecated-register
 endif
 
 ifdef TRICK_VERBOSE_BUILD
diff --git a/test/SIM_stls/RUN_test/input.py b/test/SIM_stls/RUN_test/input.py
index d49bbf77..458f7730 100644
--- a/test/SIM_stls/RUN_test/input.py
+++ b/test/SIM_stls/RUN_test/input.py
@@ -3,9 +3,9 @@ def main():
 
     #trick.echo_jobs_on()
 
-    trick.sim_control_panel_set_enabled(True)
-    trick.real_time_enable()
-    trick.itimer_enable()
+    #trick.sim_control_panel_set_enabled(True)
+    #trick.real_time_enable()
+    #trick.itimer_enable()
 
     trick.checkpoint_pre_init(True)
     #trick.checkpoint_post_init(True)