From a8f8bbef99e28bbf62aeaa774814b5c3a665e9d6 Mon Sep 17 00:00:00 2001
From: Seungha Yang <seungha@centricular.com>
Date: Mon, 30 Sep 2024 23:07:40 +0900
Subject: [PATCH] structure,capsfeatures: Fix MSVC build warnings

Fixing warning "warning C4068: unknown pragma 'GCC'"

Use portable GLib macro instead

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7589>
---
 subprojects/gstreamer/gst/gstcapsfeatures.c | 10 ++++------
 subprojects/gstreamer/gst/gststructure.c    | 15 ++++++---------
 2 files changed, 10 insertions(+), 15 deletions(-)

diff --git a/subprojects/gstreamer/gst/gstcapsfeatures.c b/subprojects/gstreamer/gst/gstcapsfeatures.c
index 160ac32fba..2c9ab5949f 100644
--- a/subprojects/gstreamer/gst/gstcapsfeatures.c
+++ b/subprojects/gstreamer/gst/gstcapsfeatures.c
@@ -405,10 +405,9 @@ gst_caps_features_new_id (GQuark feature1, ...)
   g_return_val_if_fail (feature1 != 0, NULL);
 
   va_start (varargs, feature1);
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+  G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
   features = gst_caps_features_new_id_valist (feature1, varargs);
-#pragma GCC diagnostic pop
+  G_GNUC_END_IGNORE_DEPRECATIONS;
   va_end (varargs);
 
   return features;
@@ -437,10 +436,9 @@ gst_caps_features_new_id_valist (GQuark feature1, va_list varargs)
   features = gst_caps_features_new_empty ();
 
   while (feature1) {
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+    G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
     gst_caps_features_add_id (features, feature1);
-#pragma GCC diagnostic pop
+    G_GNUC_END_IGNORE_DEPRECATIONS;
     feature1 = va_arg (varargs, GQuark);
   }
 
diff --git a/subprojects/gstreamer/gst/gststructure.c b/subprojects/gstreamer/gst/gststructure.c
index 3d9f05a470..92d78cfa88 100644
--- a/subprojects/gstreamer/gst/gststructure.c
+++ b/subprojects/gstreamer/gst/gststructure.c
@@ -3860,10 +3860,9 @@ gst_structure_id_get_valist (const GstStructure * structure,
 
     expected_type = va_arg (args, GType);
 
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+    G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
     val = gst_structure_id_get_value (structure, field_id);
-#pragma GCC diagnostic pop
+    G_GNUC_END_IGNORE_DEPRECATIONS;
 
     if (val == NULL)
       goto no_such_field;
@@ -3892,15 +3891,14 @@ no_such_field:
   }
 wrong_type:
   {
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+    G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
     GST_DEBUG ("Expected field '%s' in structure to be of type '%s', but "
         "field was of type '%s': %" GST_PTR_FORMAT,
         g_quark_to_string (field_id),
         GST_STR_NULL (g_type_name (expected_type)),
         G_VALUE_TYPE_NAME (gst_structure_id_get_value (structure, field_id)),
         structure);
-#pragma GCC diagnostic pop
+    G_GNUC_END_IGNORE_DEPRECATIONS;
     return FALSE;
   }
 }
@@ -4020,10 +4018,9 @@ gst_structure_id_get (const GstStructure * structure, GQuark first_field_id,
   g_return_val_if_fail (first_field_id != 0, FALSE);
 
   va_start (args, first_field_id);
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+  G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
   ret = gst_structure_id_get_valist (structure, first_field_id, args);
-#pragma GCC diagnostic pop
+  G_GNUC_END_IGNORE_DEPRECATIONS;
   va_end (args);
 
   return ret;