From 6f21f17c96fe4f1536481754d1692a24ed810ebc Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Thu, 7 Nov 2013 17:24:30 -0500 Subject: [PATCH 2/2] Use G_GNUC_BEGIN_IGNORE_DEPRECATIONS to avoid warning spam In these cases, we can't every drop use of our API which we deprecated for external callers; for example where a (deprecated) command line is invoking the deprecated API. This patch avoids having polkit developers get spammed by unfixable warnings. --- src/polkit/polkitsubject.c | 4 ++++ src/programs/pkcheck.c | 4 ++++ src/programs/pkttyagent.c | 12 ++++++++++-- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/polkit/polkitsubject.c b/src/polkit/polkitsubject.c index aed5795..b86e0b9 100644 --- a/src/polkit/polkitsubject.c +++ b/src/polkit/polkitsubject.c @@ -247,11 +247,15 @@ polkit_subject_from_string (const gchar *str, } else if (sscanf (str, "unix-process:%d:%" G_GUINT64_FORMAT, &scanned_pid, &scanned_starttime) == 2) { + G_GNUC_BEGIN_IGNORE_DEPRECATIONS subject = polkit_unix_process_new_full (scanned_pid, scanned_starttime); + G_GNUC_END_IGNORE_DEPRECATIONS } else if (sscanf (str, "unix-process:%d", &scanned_pid) == 1) { + G_GNUC_BEGIN_IGNORE_DEPRECATIONS subject = polkit_unix_process_new (scanned_pid); + G_GNUC_END_IGNORE_DEPRECATIONS if (polkit_unix_process_get_start_time (POLKIT_UNIX_PROCESS (subject)) == 0) { g_object_unref (subject); diff --git a/src/programs/pkcheck.c b/src/programs/pkcheck.c index 11b2e26..5781893 100644 --- a/src/programs/pkcheck.c +++ b/src/programs/pkcheck.c @@ -399,11 +399,15 @@ main (int argc, char *argv[]) } else if (sscanf (argv[n], "%i,%" G_GUINT64_FORMAT, &pid, &pid_start_time) == 2) { + G_GNUC_BEGIN_IGNORE_DEPRECATIONS subject = polkit_unix_process_new_full (pid, pid_start_time); + G_GNUC_END_IGNORE_DEPRECATIONS } else if (sscanf (argv[n], "%i", &pid) == 1) { + G_GNUC_BEGIN_IGNORE_DEPRECATIONS subject = polkit_unix_process_new (pid); + G_GNUC_END_IGNORE_DEPRECATIONS } else { diff --git a/src/programs/pkttyagent.c b/src/programs/pkttyagent.c index e5088bb..423b728 100644 --- a/src/programs/pkttyagent.c +++ b/src/programs/pkttyagent.c @@ -111,9 +111,17 @@ main (int argc, char *argv[]) if (sscanf (opt_process, "%i,%" G_GUINT64_FORMAT, &pid, &pid_start_time) == 2) - subject = polkit_unix_process_new_full (pid, pid_start_time); + { + G_GNUC_BEGIN_IGNORE_DEPRECATIONS + subject = polkit_unix_process_new_full (pid, pid_start_time); + G_GNUC_END_IGNORE_DEPRECATIONS + } else if (sscanf (opt_process, "%i", &pid) == 1) - subject = polkit_unix_process_new (pid); + { + G_GNUC_BEGIN_IGNORE_DEPRECATIONS + subject = polkit_unix_process_new (pid); + G_GNUC_END_IGNORE_DEPRECATIONS + } else { g_printerr (_("%s: Invalid process specifier `%s'\n"), -- 1.7.1