mirror of
				https://gitlab.gnome.org/GNOME/glib.git
				synced 2025-10-31 00:12:19 +01:00 
			
		
		
		
	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,
          ^
			
			
This commit is contained in:
		| @@ -59,7 +59,7 @@ int | |||||||
| main (int argc, char **argv) | main (int argc, char **argv) | ||||||
| { | { | ||||||
| #if G_CXX_STD_CHECK_VERSION (11) | #if G_CXX_STD_CHECK_VERSION (11) | ||||||
|   g_test_init (&argc, &argv, NULL); |   g_test_init (&argc, &argv, nullptr); | ||||||
| #else | #else | ||||||
|   g_test_init (&argc, &argv, static_cast<void *>(NULL)); |   g_test_init (&argc, &argv, static_cast<void *>(NULL)); | ||||||
| #endif | #endif | ||||||
|   | |||||||
| @@ -536,7 +536,7 @@ int | |||||||
| main (int argc, char *argv[]) | main (int argc, char *argv[]) | ||||||
| { | { | ||||||
| #if G_CXX_STD_CHECK_VERSION (11) | #if G_CXX_STD_CHECK_VERSION (11) | ||||||
|   g_test_init (&argc, &argv, NULL); |   g_test_init (&argc, &argv, nullptr); | ||||||
| #else | #else | ||||||
|   g_test_init (&argc, &argv, static_cast<void *>(NULL)); |   g_test_init (&argc, &argv, static_cast<void *>(NULL)); | ||||||
| #endif | #endif | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user