[Libreoffice-commits] cppunit.git: Branch 'feature/c++11' - include/cppunit
GARCIN David
david.garcin at openwide.fr
Sat Oct 15 15:02:50 UTC 2016
include/cppunit/extensions/HelperMacros.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
New commits:
commit c2bb6da6cf469e44129ccc9f13e60e74d3cedef4
Author: GARCIN David <david.garcin at openwide.fr>
Date: Sat Oct 15 17:01:25 2016 +0200
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
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; \
} \
}; \
\
More information about the Libreoffice-commits
mailing list