diff options
author | GARCIN David <david.garcin@openwide.fr> | 2016-10-15 17:01:25 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-10-15 17:31:48 +0200 |
commit | 29ae31614fb70e192f63fdab1c65105493319edc (patch) | |
tree | c0d3c966269d34d2ae985b8a11da74a1db01c2b7 | |
parent | 42bd37a4b8d8feab2d30761648b51eaf20623abb (diff) | |
download | cppunit-29ae31614fb70e192f63fdab1c65105493319edc.tar.gz |
HelperMacros: fix deprecated NULL macro usage
Using gcc (currently using gcc 5.2) flag -Wzero-as-null-pointer-constant
triggers warnings:
[...]include/cppunit/extensions/HelperMacros.h:171:31: error: zero as null
pointer constant [-Werror=zero-as-null-pointer-constant]
CppUnitExDeleter() : suite (0) {} \
^
[...]include/cppunit/extensions/HelperMacros.h:174:45: error: zero as null
pointer constant [-Werror=zero-as-null-pointer-constant]
CPPUNIT_NS::TestSuite *tmp = suite; suite = NULL; return tmp; \
^
Using nullptr is the c++11 way to initialize pointers with null value [1].
[1] http://en.cppreference.com/w/cpp/language/nullptr
-rw-r--r-- | include/cppunit/extensions/HelperMacros.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/cppunit/extensions/HelperMacros.h b/include/cppunit/extensions/HelperMacros.h index 43fc08e..e883960 100644 --- a/include/cppunit/extensions/HelperMacros.h +++ b/include/cppunit/extensions/HelperMacros.h @@ -168,10 +168,10 @@ \ struct CppUnitExDeleter { /* avoid deprecated auto_ptr warnings */ \ CPPUNIT_NS::TestSuite *suite; \ - CppUnitExDeleter() : suite (0) {} \ + CppUnitExDeleter() : suite (nullptr) {} \ ~CppUnitExDeleter() { delete suite; } \ CPPUNIT_NS::TestSuite *release() { \ - CPPUNIT_NS::TestSuite *tmp = suite; suite = NULL; return tmp; \ + CPPUNIT_NS::TestSuite *tmp = suite; suite = nullptr; return tmp; \ } \ }; \ \ |