File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -114,6 +114,9 @@ elseif(BORLAND)
114114 add_definitions (-D__BORLAND__ -D__WIN32__ )
115115else ()
116116 add_definitions (-pedantic -W -Wall -Wundef -Wfloat-equal -Wshadow -Winline -Wno-long-long )
117+ if (HAVE_NULLPTR)
118+ list (APPEND CMAKE_CXX_FLAGS -std=c++11)
119+ endif (HAVE_NULLPTR )
117120endif ()
118121
119122include_directories (
Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ int main() {
5757" )
5858cmake_push_check_state ()
5959 if ( UNIX )
60- set ( CMAKE_REQUIRED_FLAGS "-pthread -std=c++0x " )
60+ set ( CMAKE_REQUIRED_FLAGS "-pthread -std=c++11 " )
6161 else ( UNIX )
6262 # vars probably need set for embarcadero, etc
6363 endif ( UNIX )
@@ -74,13 +74,27 @@ int main() {
7474" )
7575cmake_push_check_state ()
7676 if ( UNIX )
77- set ( CMAKE_REQUIRED_FLAGS "-std=c++0x " )
77+ set ( CMAKE_REQUIRED_FLAGS "-std=c++11 " )
7878 else ( UNIX )
7979 # vars probably need set for embarcadero, etc
8080 endif ( UNIX )
8181 CHECK_CXX_SOURCE_RUNS ( "${TEST_STD_CHRONO} " HAVE_STD_CHRONO ) #quotes are *required*!
8282cmake_pop_check_state ()
8383
84+ set ( TEST_NULLPTR "
85+ #include <cstddef>
86+ std::nullptr_t f() {return nullptr;}
87+ int main() {return !!f();}
88+ " )
89+ cmake_push_check_state ()
90+ if ( UNIX )
91+ set ( CMAKE_REQUIRED_FLAGS "-std=c++11" )
92+ else ( UNIX )
93+ # vars probably need set for embarcadero, etc
94+ endif ( UNIX )
95+ CHECK_CXX_SOURCE_RUNS ( "${TEST_NULLPTR} " HAVE_NULLPTR ) #quotes are *required*!
96+ cmake_pop_check_state ()
97+
8498# Now that all the tests are done, configure the sc_cf.h file:
8599get_property (CONFIG_H_FILE_CONTENTS GLOBAL PROPERTY SC_CONFIG_H_CONTENTS )
86100file (WRITE ${CONFIG_H_FILE} "${CONFIG_H_FILE_CONTENTS} " )
Original file line number Diff line number Diff line change 2525
2626#cmakedefine HAVE_STD_THREAD 1
2727#cmakedefine HAVE_STD_CHRONO 1
28+ #cmakedefine HAVE_NULLPTR 1
2829
2930#endif /* SCL_CF_H */
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ set(SC_BASE_HDRS
1414 sc_getopt.h
1515 sc_trace_fprintf.h
1616 sc_mkdir.h
17+ sc_nullptr.h
1718 path2str.h
1819 )
1920
Original file line number Diff line number Diff line change 1+ #ifndef NULLPTR_H
2+ #define NULLPTR_H
3+
4+ #include <sc_cf.h>
5+
6+ #ifdef HAVE_NULLPTR
7+ #include <cstddef>
8+ #else
9+ # define nullptr_t void*
10+ # define nullptr NULL
11+ #endif //HAVE_NULLPTR
12+
13+ #endif //NULLPTR_H
Original file line number Diff line number Diff line change 1919class GenericNode ;
2020class DisplayNode ;
2121#include < sdai.h>
22- // class SDAI_Application_instance;
2322
2423#include < gennode.h>
2524#include < gennodelist.h>
26- // #include <gennode.inline.h>
2725
2826#include < editordefines.h>
2927
28+ #include < sc_nullptr.h>
29+
3030class InstMgr ;
3131
3232class SC_CORE_EXPORT MgrNodeBase : public GenericNode {
3333 public:
3434 virtual inline SDAI_Application_instance * GetSTEPentity () {
3535 abort ();
36+ return nullptr ;
3637 };
3738 virtual ~MgrNodeBase () {};
3839};
Original file line number Diff line number Diff line change 2020#include " sdaiApplication_instance.h"
2121#include " superInvAttrIter.h"
2222
23+ #include < sc_nullptr.h>
24+
2325SDAI_Application_instance NilSTEPentity;
2426
2527/* *************************************************************/ /* *
@@ -944,7 +946,7 @@ const SDAI_Application_instance::iAMap_t::value_type SDAI_Application_instance::
944946 }
945947 iAstruct z;
946948 memset ( &z, 0 , sizeof z );
947- iAMap_t::value_type nil ( NULL , z );
949+ iAMap_t::value_type nil ( nullptr , z );
948950 return nil;
949951}
950952
Original file line number Diff line number Diff line change @@ -96,7 +96,7 @@ add_schema_dependent_test( "attribute" "inverse_attr" "${SC_SOURCE_DIR}/test/p21
9696
9797if (HAVE_STD_THREAD)
9898 if (UNIX )
99- set (thread_flags "-pthread -std=c++0x " )
99+ set (thread_flags "-pthread -std=c++11 " )
100100 set (thread_libs "pthread" )
101101 endif (UNIX )
102102 # for best results, use a large file. as1-oc-214.stp is currently the largest file in the repo that sc works with.
You can’t perform that action at this time.
0 commit comments