diff options
author | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2022-10-19 16:00:01 +0200 |
---|---|---|
committer | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2022-10-20 16:12:39 +0200 |
commit | aaa7632f2c9832398ce036a929b465713434d310 (patch) | |
tree | 586709b22b8ddf37cae2b0795ddc4fafe85b667f | |
parent | 354d29cd614811293ddc391f1d656b226220f802 (diff) | |
download | glib-aaa7632f2c9832398ce036a929b465713434d310.tar.gz |
glib/gio: Use G_OS_LINUX in public APIs
We don't change internals as it could be dangerous given that __linux__
is defined earlier than we defined G_OS_LINUX and thus we could not run
code.
-rw-r--r-- | gio/tests/file.c | 8 | ||||
-rw-r--r-- | gio/tests/gdbus-server-auth.c | 2 | ||||
-rw-r--r-- | gio/tests/live-g-file.c | 2 | ||||
-rw-r--r-- | gio/tests/pollable.c | 2 | ||||
-rw-r--r-- | gio/tests/resources.c | 6 | ||||
-rw-r--r-- | glib/tests/cond.c | 2 | ||||
-rw-r--r-- | glib/tests/error.c | 6 | ||||
-rw-r--r-- | glib/tests/gdatetime.c | 4 | ||||
-rw-r--r-- | glib/tests/macros.c | 4 | ||||
-rw-r--r-- | glib/tests/option-argv0.c | 2 |
10 files changed, 19 insertions, 19 deletions
diff --git a/gio/tests/file.c b/gio/tests/file.c index 6a63a344f..0c528858e 100644 --- a/gio/tests/file.c +++ b/gio/tests/file.c @@ -1075,7 +1075,7 @@ test_replace_symlink_using_etag (void) /* FIXME: These tests have only been checked on Linux. Most of them are probably * applicable on Windows, too, but that has not been tested yet. * See https://gitlab.gnome.org/GNOME/glib/-/issues/2325 */ -#ifdef __linux__ +#ifdef G_OS_LINUX /* Different kinds of file which create_test_file() can create. */ typedef enum @@ -1308,7 +1308,7 @@ check_test_file (GFile *test_file, g_free (target_basename); } -#endif /* __linux__ */ +#endif /* G_OS_LINUX */ /* A big test for g_file_replace() and g_file_replace_readwrite(). The * @test_data is a boolean: %TRUE to test g_file_replace_readwrite(), %FALSE to @@ -1329,7 +1329,7 @@ check_test_file (GFile *test_file, static void test_replace (gconstpointer test_data) { -#ifdef __linux__ +#ifdef G_OS_LINUX gboolean read_write = GPOINTER_TO_UINT (test_data); const gchar *new_contents = "this is a new test message which should be written to source"; const gchar *original_source_contents = "this is some test content in source"; @@ -1973,7 +1973,7 @@ test_replace (gconstpointer test_data) g_clear_object (&source_file); g_clear_object (&tmpdir); } -#else /* if !__linux__ */ +#else /* if !G_OS_LINUX */ g_test_skip ("File replacement tests can only be run on Linux"); #endif } diff --git a/gio/tests/gdbus-server-auth.c b/gio/tests/gdbus-server-auth.c index 9c56aac72..1969bb87f 100644 --- a/gio/tests/gdbus-server-auth.c +++ b/gio/tests/gdbus-server-auth.c @@ -242,7 +242,7 @@ assert_expected_uid_pid (InteropFlags flags, } else /* We should prefer EXTERNAL whenever it is allowed. */ { -#ifdef __linux__ +#ifdef G_OS_LINUX /* We know that both GDBus and libdbus support full credentials-passing * on Linux. */ g_assert_cmpint (uid, ==, getuid ()); diff --git a/gio/tests/live-g-file.c b/gio/tests/live-g-file.c index 9e2cc0c27..0537d72a5 100644 --- a/gio/tests/live-g-file.c +++ b/gio/tests/live-g-file.c @@ -1457,7 +1457,7 @@ main (int argc, char *argv[]) g_test_add_data_func ("/live-g-file/test_unix_is_mountpoint/sysroot", "/", test_unix_is_mountpoint); -#ifdef __linux__ +#ifdef G_OS_LINUX g_test_add_data_func ("/live-g-file/test_unix_is_mountpoint/proc", "/proc", test_unix_is_mountpoint); diff --git a/gio/tests/pollable.c b/gio/tests/pollable.c index 56dfa3a31..f61b701ee 100644 --- a/gio/tests/pollable.c +++ b/gio/tests/pollable.c @@ -34,7 +34,7 @@ /* openpty() is non-standard and might not be available on all kernels * and libc implementations, but glibc on Linux definitely has it */ -#if defined(__linux__) && defined(__GNUC__) && !defined(HAVE_OPENPTY) +#if defined(G_OS_LINUX) && defined(__GNUC__) && !defined(HAVE_OPENPTY) #error Should have been able to find openpty on GNU/Linux #endif diff --git a/gio/tests/resources.c b/gio/tests/resources.c index 910b18912..b341ad017 100644 --- a/gio/tests/resources.c +++ b/gio/tests/resources.c @@ -642,10 +642,10 @@ test_resource_manual2 (void) static void test_resource_binary_linked (void) { - #ifndef __linux__ + #ifndef G_OS_LINUX g_test_skip ("--external-data test only works on Linux"); return; - #else /* if __linux__ */ + #else /* if G_OS_LINUX */ GError *error = NULL; gboolean found; gsize size; @@ -669,7 +669,7 @@ test_resource_binary_linked (void) g_assert_cmpint (size, ==, 6); g_assert_cmpstr (g_bytes_get_data (data, NULL), ==, "test1\n"); g_bytes_unref (data); - #endif /* if __linux__ */ + #endif /* if G_OS_LINUX */ } /* Test resource whose xml file starts with more than one digit diff --git a/glib/tests/cond.c b/glib/tests/cond.c index b179b3dee..b97b5ac06 100644 --- a/glib/tests/cond.c +++ b/glib/tests/cond.c @@ -272,7 +272,7 @@ test_wait_until (void) g_cond_clear (&local_cond); } -#ifdef __linux__ +#ifdef G_OS_LINUX #include <pthread.h> #include <signal.h> diff --git a/glib/tests/error.c b/glib/tests/error.c index fa3a25969..3001ecc07 100644 --- a/glib/tests/error.c +++ b/glib/tests/error.c @@ -123,7 +123,7 @@ static void test_new_valist_invalid_va (gpointer dummy, ...) { -#if defined(__linux__) && defined(__GLIBC__) +#if defined(G_OS_LINUX) && defined(__GLIBC__) /* Only worth testing this on Linux with glibc; if other platforms regress on * this legacy behaviour, we don’t care. In particular, calling * g_error_new_valist() with a %NULL format will crash on FreeBSD as its @@ -182,9 +182,9 @@ test_new_valist_invalid_va (gpointer dummy, va_end (ap); } -#else /* if !__linux__ || !__GLIBC__ */ +#else /* if !G_OS_LINUX || !__GLIBC__ */ g_test_skip ("g_error_new_valist() programmer error handling is only relevant on Linux with glibc"); -#endif /* !__linux__ || ! __GLIBC__ */ +#endif /* !G_OS_LINUX || ! __GLIBC__ */ } static void diff --git a/glib/tests/gdatetime.c b/glib/tests/gdatetime.c index 3a0d2bd28..3228e9591 100644 --- a/glib/tests/gdatetime.c +++ b/glib/tests/gdatetime.c @@ -2465,7 +2465,7 @@ test_format_time_mixed_utf8 (gconstpointer data) #endif } -#ifdef __linux__ +#ifdef G_OS_LINUX static gchar * str_utf8_replace (const gchar *str, gunichar from, @@ -2488,7 +2488,7 @@ str_utf8_replace (const gchar *str, static void test_strftime (void) { -#ifdef __linux__ +#ifdef G_OS_LINUX #define TEST_FORMAT \ "a%a A%A b%b B%B c%c C%C d%d e%e F%F g%g G%G h%h H%H I%I j%j m%m M%M " \ "n%n p%p r%r R%R S%S t%t T%T u%u V%V w%w x%x X%X y%y Y%Y z%z Z%Z %%" diff --git a/glib/tests/macros.c b/glib/tests/macros.c index 5c5bc3b62..e80128e5d 100644 --- a/glib/tests/macros.c +++ b/glib/tests/macros.c @@ -26,10 +26,10 @@ #if defined (__linux__) || defined (__linux) || defined (__gnu_linux__) # ifndef G_OS_UNIX - G_STATIC_ASSERT (FALSE); + #error "G_OS_UNIX is not defined" # endif # ifndef G_OS_LINUX - G_STATIC_ASSERT (FALSE); + #error "G_OS_LINUX is not defined" # endif #endif diff --git a/glib/tests/option-argv0.c b/glib/tests/option-argv0.c index a18e68676..70e25d946 100644 --- a/glib/tests/option-argv0.c +++ b/glib/tests/option-argv0.c @@ -62,7 +62,7 @@ test_platform_argv0 (void) */ #if !defined HAVE_PROC_SELF_CMDLINE && \ !defined __OpenBSD__ && \ - !defined __linux && \ + !defined G_OS_LINUX && \ !defined G_OS_WIN32 fatal_errors = FALSE; #endif |