From 8264b1373756e526b67d497abd57141229e97c3a Mon Sep 17 00:00:00 2001 From: Luca Bacci Date: Thu, 12 Oct 2023 10:29:18 +0200 Subject: [PATCH] tests/cxx: Do not assume that NULL is a pointer type starting with C++11 Many toolchain did not change the definition of NULL to avoid introducing breaking changes in existing codebases. For example, on Windows NULL is 0 (int) regardless of the C++ standard in use. Fixes the following warnings on CLang when compiling for Windows: ../glib/glib/tests/cxx.cpp:539:34: warning: missing sentinel in function call [-Wsentinel] g_test_init (&argc, &argv, NULL); ^ , nullptr ../glib/glib/gtestutils.h:298:9: note: function has been explicitly marked sentinel here void g_test_init (int *argc, ^ ../glib/gio/tests/cxx.cpp:62:34: warning: missing sentinel in function call [-Wsentinel] g_test_init (&argc, &argv, NULL); ^ , nullptr ../glib/glib/gtestutils.h:298:9: note: function has been explicitly marked sentinel here void g_test_init (int *argc, ^ --- gio/tests/cxx.cpp | 2 +- glib/tests/cxx.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gio/tests/cxx.cpp b/gio/tests/cxx.cpp index 630eeab99..7aba3516e 100644 --- a/gio/tests/cxx.cpp +++ b/gio/tests/cxx.cpp @@ -59,7 +59,7 @@ int main (int argc, char **argv) { #if G_CXX_STD_CHECK_VERSION (11) - g_test_init (&argc, &argv, NULL); + g_test_init (&argc, &argv, nullptr); #else g_test_init (&argc, &argv, static_cast(NULL)); #endif diff --git a/glib/tests/cxx.cpp b/glib/tests/cxx.cpp index bc7967cce..5198621dc 100644 --- a/glib/tests/cxx.cpp +++ b/glib/tests/cxx.cpp @@ -536,7 +536,7 @@ int main (int argc, char *argv[]) { #if G_CXX_STD_CHECK_VERSION (11) - g_test_init (&argc, &argv, NULL); + g_test_init (&argc, &argv, nullptr); #else g_test_init (&argc, &argv, static_cast(NULL)); #endif