mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-02 17:26:17 +01:00
Fix various deprecation warnings in code and tests
This code uses, or tests, deprecated functions, types or macros; so needs to be compiled with deprecation warnings disabled. Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
parent
f0fb7b77a1
commit
e62e89f2f8
@ -20,6 +20,10 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
/* For the #GDesktopAppInfoLookup macros; since macro deprecation is implemented
|
||||
* in the preprocessor, we need to define this before including glib.h*/
|
||||
#define GLIB_DISABLE_DEPRECATION_WARNINGS
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "giomodule.h"
|
||||
@ -1087,9 +1091,7 @@ _g_io_modules_ensure_extension_points_registered (void)
|
||||
#if defined(G_OS_UNIX) && !defined(HAVE_COCOA)
|
||||
#if !GLIB_CHECK_VERSION (3, 0, 0)
|
||||
ep = g_io_extension_point_register (G_DESKTOP_APP_INFO_LOOKUP_EXTENSION_POINT_NAME);
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
g_io_extension_point_set_required_type (ep, G_TYPE_DESKTOP_APP_INFO_LOOKUP);
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -28,6 +28,9 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
/* we know we are deprecated here, no need for warnings */
|
||||
#define GLIB_DISABLE_DEPRECATION_WARNINGS
|
||||
|
||||
#include "gcache.h"
|
||||
|
||||
#include "gslice.h"
|
||||
|
@ -1,6 +1,5 @@
|
||||
#undef G_DISABLE_ASSERT
|
||||
#undef G_LOG_DOMAIN
|
||||
#undef G_DISABLE_DEPRECATED
|
||||
|
||||
#include <time.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -1169,10 +1169,11 @@ hash_table_tests (void)
|
||||
g_hash_table_destroy (hash_table);
|
||||
}
|
||||
|
||||
#ifndef G_DISABLE_DEPRECATED
|
||||
static void
|
||||
relation_test (void)
|
||||
{
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
GRelation *relation = g_relation_new (2);
|
||||
GTuples *tuples;
|
||||
gint data [1024];
|
||||
@ -1241,8 +1242,9 @@ relation_test (void)
|
||||
g_relation_destroy (relation);
|
||||
|
||||
relation = NULL;
|
||||
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
gstring_tests (void)
|
||||
@ -1637,10 +1639,11 @@ various_string_tests (void)
|
||||
/* g_debug (argv[0]); */
|
||||
}
|
||||
|
||||
#ifndef G_DISABLE_DEPRECATED
|
||||
static void
|
||||
test_mem_chunks (void)
|
||||
{
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
GMemChunk *mem_chunk = g_mem_chunk_new ("test mem chunk", 50, 100, G_ALLOC_AND_FREE);
|
||||
gchar *mem[10000];
|
||||
guint i;
|
||||
@ -1655,8 +1658,9 @@ test_mem_chunks (void)
|
||||
g_mem_chunk_free (mem_chunk, mem[i]);
|
||||
|
||||
g_mem_chunk_destroy (mem_chunk);
|
||||
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
main (int argc,
|
||||
@ -1674,15 +1678,11 @@ main (int argc,
|
||||
g_test_add_func ("/testglib/GTree", binary_tree_test);
|
||||
g_test_add_func ("/testglib/Arrays", test_arrays);
|
||||
g_test_add_func ("/testglib/GHashTable", hash_table_tests);
|
||||
#ifndef G_DISABLE_DEPRECATED
|
||||
g_test_add_func ("/testglib/Relation (deprecated)", relation_test);
|
||||
#endif
|
||||
g_test_add_func ("/testglib/File Paths", test_paths);
|
||||
g_test_add_func ("/testglib/File Functions", test_file_functions);
|
||||
g_test_add_func ("/testglib/Parse Debug Strings", test_g_parse_debug_string);
|
||||
#ifndef G_DISABLE_DEPRECATED
|
||||
g_test_add_func ("/testglib/GMemChunk (deprecated)", test_mem_chunks);
|
||||
#endif
|
||||
g_test_add_func ("/testglib/Warnings & Errors", log_warning_error_tests);
|
||||
g_test_add_func ("/testglib/Timers (slow)", timer_tests);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user