[glib/no-more-regex: 1195/1196] Deprecate GRegex




commit de32e1027d71c539b4ed5bc264185ba641c41ea6
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Tue Apr 14 20:18:51 2020 +0100

    Deprecate GRegex
    
    GRegex is based off of PCRE1, and cannot be moved to PCRE2 without
    breaking its API contract. PCRE1 is in maintenance mode, and will not
    see any new feature.
    
    GRegex made sense back in the day when we embedded a copy of PCRE, but:
    
     - the maintenance burden required to update the copy of PCRE to keep up
       with upstream, coupled with the lack of synchronisation between GLib
       and PCRE releases, has become too high
     - downstream distributors try very hard to not rely on vendored
       dependencies, which meant that GLib depended on a system copy of PCRE
       anyway, except on certain platforms, which made for interesting bugs
     - regular expressions are a niche use case, and PCRE is already
       portable to all the platforms GLib cares about
    
    Thus, we recommend users to migrate their code from GRegex to PCRE2.
    
    Fixes: #1085

 gio/gsettingsschema.c |   4 ++
 glib/gregex.c         |  90 +++++++++++++++++++++++++++++++++++++--
 glib/gregex.h         | 115 +++++++++++++++++++++++++++++---------------------
 glib/tests/autoptr.c  |   4 ++
 glib/tests/regex.c    |   3 ++
 5 files changed, 165 insertions(+), 51 deletions(-)
---
diff --git a/gio/gsettingsschema.c b/gio/gsettingsschema.c
index ec0caf655..908d8e594 100644
--- a/gio/gsettingsschema.c
+++ b/gio/gsettingsschema.c
@@ -551,6 +551,8 @@ start_element (GMarkupParseContext  *context,
 static gchar *
 normalise_whitespace (const gchar *orig)
 {
+  G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+
   /* We normalise by the same rules as in intltool:
    *
    *   sub cleanup {
@@ -599,6 +601,8 @@ normalise_whitespace (const gchar *orig)
       lines[i] = c;
     }
 
+  G_GNUC_END_IGNORE_DEPRECATIONS
+
   result = g_strjoinv ("\n\n", lines);
   g_strfreev (lines);
 
diff --git a/glib/gregex.c b/glib/gregex.c
index a8a35a424..40ddab628 100644
--- a/glib/gregex.c
+++ b/glib/gregex.c
@@ -18,6 +18,9 @@
  * along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
 
+/* Yes, we're using deprecated API */
+#define GLIB_DISABLE_DEPRECATION_WARNINGS
+
 #include "config.h"
 
 #include <string.h>
@@ -102,9 +105,10 @@
  * is not threadsafe.
  *
  * The regular expressions low-level functionalities are obtained through
- * the excellent
- * [PCRE](http://www.pcre.org/)
- * library written by Philip Hazel.
+ * the excellent [PCRE](http://www.pcre.org/) library written by Philip Hazel.
+ *
+ * Deprecated: 2.68: The #GRegex API is deprecated, as it wraps the old PCRE 1
+ * API; newly written code should use the [PCRE 2 API](https://www.pcre.org/current/doc/html/) directly.
  */
 
 /* Mask of all the possible values for GRegexCompileFlags. */
@@ -607,6 +611,8 @@ match_info_new (const GRegex *regex,
  * Returns: #GRegex object used in @match_info
  *
  * Since: 2.14
+ *
+ * Deprecated: 2.68: Use PCRE 2 instead
  */
 GRegex *
 g_match_info_get_regex (const GMatchInfo *match_info)
@@ -626,6 +632,8 @@ g_match_info_get_regex (const GMatchInfo *match_info)
  * Returns: the string searched with @match_info
  *
  * Since: 2.14
+ *
+ * Deprecated: 2.68: Use PCRE 2 instead
  */
 const gchar *
 g_match_info_get_string (const GMatchInfo *match_info)
@@ -643,6 +651,8 @@ g_match_info_get_string (const GMatchInfo *match_info)
  * Returns: @match_info
  *
  * Since: 2.30
+ *
+ * Deprecated: 2.68: Use PCRE 2 instead
  */
 GMatchInfo       *
 g_match_info_ref (GMatchInfo *match_info)
@@ -660,6 +670,8 @@ g_match_info_ref (GMatchInfo *match_info)
  * to zero, it frees all the memory associated with the match_info structure.
  *
  * Since: 2.30
+ *
+ * Deprecated: 2.68: Use PCRE 2 instead
  */
 void
 g_match_info_unref (GMatchInfo *match_info)
@@ -681,6 +693,8 @@ g_match_info_unref (GMatchInfo *match_info)
  * nothing.
  *
  * Since: 2.14
+ *
+ * Deprecated: 2.68: Use PCRE 2 instead
  */
 void
 g_match_info_free (GMatchInfo *match_info)
@@ -706,6 +720,8 @@ g_match_info_free (GMatchInfo *match_info)
  * Returns: %TRUE is the string matched, %FALSE otherwise
  *
  * Since: 2.14
+ *
+ * Deprecated: 2.68: Use PCRE 2 instead
  */
 gboolean
 g_match_info_next (GMatchInfo  *match_info,
@@ -800,6 +816,8 @@ g_match_info_next (GMatchInfo  *match_info,
  *   %FALSE otherwise
  *
  * Since: 2.14
+ *
+ * Deprecated: 2.68: Use PCRE 2 instead
  */
 gboolean
 g_match_info_matches (const GMatchInfo *match_info)
@@ -825,6 +843,8 @@ g_match_info_matches (const GMatchInfo *match_info)
  * Returns: Number of matched substrings, or -1 if an error occurred
  *
  * Since: 2.14
+ *
+ * Deprecated: 2.68: Use PCRE 2 instead
  */
 gint
 g_match_info_get_match_count (const GMatchInfo *match_info)
@@ -883,6 +903,8 @@ g_match_info_get_match_count (const GMatchInfo *match_info)
  * Returns: %TRUE if the match was partial, %FALSE otherwise
  *
  * Since: 2.14
+ *
+ * Deprecated: 2.68: Use PCRE 2 instead
  */
 gboolean
 g_match_info_is_partial_match (const GMatchInfo *match_info)
@@ -919,6 +941,8 @@ g_match_info_is_partial_match (const GMatchInfo *match_info)
  * Returns: (nullable): the expanded string, or %NULL if an error occurred
  *
  * Since: 2.14
+ *
+ * Deprecated: 2.68: Use PCRE 2 instead
  */
 gchar *
 g_match_info_expand_references (const GMatchInfo  *match_info,
@@ -981,6 +1005,8 @@ g_match_info_expand_references (const GMatchInfo  *match_info,
  *     occurred. You have to free the string yourself
  *
  * Since: 2.14
+ *
+ * Deprecated: 2.68: Use PCRE 2 instead
  */
 gchar *
 g_match_info_fetch (const GMatchInfo *match_info,
@@ -1034,6 +1060,8 @@ g_match_info_fetch (const GMatchInfo *match_info,
  *   unchanged
  *
  * Since: 2.14
+ *
+ * Deprecated: 2.68: Use PCRE 2 instead
  */
 gboolean
 g_match_info_fetch_pos (const GMatchInfo *match_info,
@@ -1117,6 +1145,8 @@ get_matched_substring_number (const GMatchInfo *match_info,
  *     occurred. You have to free the string yourself
  *
  * Since: 2.14
+ *
+ * Deprecated: 2.68: Use PCRE 2 instead
  */
 gchar *
 g_match_info_fetch_named (const GMatchInfo *match_info,
@@ -1156,6 +1186,8 @@ g_match_info_fetch_named (const GMatchInfo *match_info,
  *     are left unchanged.
  *
  * Since: 2.14
+ *
+ * Deprecated: 2.68: Use PCRE 2 instead
  */
 gboolean
 g_match_info_fetch_named_pos (const GMatchInfo *match_info,
@@ -1201,6 +1233,8 @@ g_match_info_fetch_named_pos (const GMatchInfo *match_info,
  *     match failed %NULL is returned
  *
  * Since: 2.14
+ *
+ * Deprecated: 2.68: Use PCRE 2 instead
  */
 gchar **
 g_match_info_fetch_all (const GMatchInfo *match_info)
@@ -1237,6 +1271,8 @@ G_DEFINE_QUARK (g-regex-error-quark, g_regex_error)
  * Returns: @regex
  *
  * Since: 2.14
+ *
+ * Deprecated: 2.68: Use PCRE 2 instead
  */
 GRegex *
 g_regex_ref (GRegex *regex)
@@ -1254,6 +1290,8 @@ g_regex_ref (GRegex *regex)
  * to zero, it frees all the memory associated with the regex structure.
  *
  * Since: 2.14
+ *
+ * Deprecated: 2.68: Use PCRE 2 instead
  */
 void
 g_regex_unref (GRegex *regex)
@@ -1294,6 +1332,8 @@ static pcre *regex_compile (const gchar         *pattern,
  *   g_regex_unref() when you are done with it
  *
  * Since: 2.14
+ *
+ * Deprecated: 2.68: Use PCRE 2 instead
  */
 GRegex *
 g_regex_new (const gchar         *pattern,
@@ -1483,6 +1523,8 @@ regex_compile (const gchar         *pattern,
  * Returns: the pattern of @regex
  *
  * Since: 2.14
+ *
+ * Deprecated: 2.68: Use PCRE 2 instead
  */
 const gchar *
 g_regex_get_pattern (const GRegex *regex)
@@ -1503,6 +1545,8 @@ g_regex_get_pattern (const GRegex *regex)
  * Returns: the number of the highest back reference
  *
  * Since: 2.14
+ *
+ * Deprecated: 2.68: Use PCRE 2 instead
  */
 gint
 g_regex_get_max_backref (const GRegex *regex)
@@ -1524,6 +1568,8 @@ g_regex_get_max_backref (const GRegex *regex)
  * Returns: the number of capturing subpatterns
  *
  * Since: 2.14
+ *
+ * Deprecated: 2.68: Use PCRE 2 instead
  */
 gint
 g_regex_get_capture_count (const GRegex *regex)
@@ -1545,6 +1591,8 @@ g_regex_get_capture_count (const GRegex *regex)
  * Returns: %TRUE if the pattern contains explicit CR or LF references
  *
  * Since: 2.34
+ *
+ * Deprecated: 2.68: Use PCRE 2 instead
  */
 gboolean
 g_regex_get_has_cr_or_lf (const GRegex *regex)
@@ -1568,6 +1616,8 @@ g_regex_get_has_cr_or_lf (const GRegex *regex)
  * Returns: the number of characters in the longest lookbehind assertion.
  *
  * Since: 2.38
+ *
+ * Deprecated: 2.68: Use PCRE 2 instead
  */
 gint
 g_regex_get_max_lookbehind (const GRegex *regex)
@@ -1593,6 +1643,8 @@ g_regex_get_max_lookbehind (const GRegex *regex)
  * Returns: flags from #GRegexCompileFlags
  *
  * Since: 2.26
+ *
+ * Deprecated: 2.68: Use PCRE 2 instead
  */
 GRegexCompileFlags
 g_regex_get_compile_flags (const GRegex *regex)
@@ -1611,6 +1663,8 @@ g_regex_get_compile_flags (const GRegex *regex)
  * Returns: flags from #GRegexMatchFlags
  *
  * Since: 2.26
+ *
+ * Deprecated: 2.68: Use PCRE 2 instead
  */
 GRegexMatchFlags
 g_regex_get_match_flags (const GRegex *regex)
@@ -1641,6 +1695,8 @@ g_regex_get_match_flags (const GRegex *regex)
  * Returns: %TRUE if the string matched, %FALSE otherwise
  *
  * Since: 2.14
+ *
+ * Deprecated: 2.68: Use PCRE 2 instead
  */
 gboolean
 g_regex_match_simple (const gchar        *pattern,
@@ -1711,6 +1767,8 @@ g_regex_match_simple (const gchar        *pattern,
  * Returns: %TRUE is the string matched, %FALSE otherwise
  *
  * Since: 2.14
+ *
+ * Deprecated: 2.68: Use PCRE 2 instead
  */
 gboolean
 g_regex_match (const GRegex      *regex,
@@ -1788,6 +1846,8 @@ g_regex_match (const GRegex      *regex,
  * Returns: %TRUE is the string matched, %FALSE otherwise
  *
  * Since: 2.14
+ *
+ * Deprecated: 2.68: Use PCRE 2 instead
  */
 gboolean
 g_regex_match_full (const GRegex      *regex,
@@ -1844,6 +1904,8 @@ g_regex_match_full (const GRegex      *regex,
  * Returns: %TRUE is the string matched, %FALSE otherwise
  *
  * Since: 2.14
+ *
+ * Deprecated: 2.68: Use PCRE 2 instead
  */
 gboolean
 g_regex_match_all (const GRegex      *regex,
@@ -1908,6 +1970,8 @@ g_regex_match_all (const GRegex      *regex,
  * Returns: %TRUE is the string matched, %FALSE otherwise
  *
  * Since: 2.14
+ *
+ * Deprecated: 2.68: Use PCRE 2 instead
  */
 gboolean
 g_regex_match_all_full (const GRegex      *regex,
@@ -2020,6 +2084,8 @@ g_regex_match_all_full (const GRegex      *regex,
  *   does not exists
  *
  * Since: 2.14
+ *
+ * Deprecated: 2.68: Use PCRE 2 instead
  */
 gint
 g_regex_get_string_number (const GRegex *regex,
@@ -2076,6 +2142,8 @@ g_regex_get_string_number (const GRegex *regex,
  * it using g_strfreev()
  *
  * Since: 2.14
+ *
+ * Deprecated: 2.68: Use PCRE 2 instead
  **/
 gchar **
 g_regex_split_simple (const gchar        *pattern,
@@ -2123,6 +2191,8 @@ g_regex_split_simple (const gchar        *pattern,
  * it using g_strfreev()
  *
  * Since: 2.14
+ *
+ * Deprecated: 2.68: Use PCRE 2 instead
  **/
 gchar **
 g_regex_split (const GRegex     *regex,
@@ -2170,6 +2240,8 @@ g_regex_split (const GRegex     *regex,
  * it using g_strfreev()
  *
  * Since: 2.14
+ *
+ * Deprecated: 2.68: Use PCRE 2 instead
  **/
 gchar **
 g_regex_split_full (const GRegex      *regex,
@@ -2803,6 +2875,8 @@ interpolation_list_needs_match (GList *list)
  * Returns: a newly allocated string containing the replacements
  *
  * Since: 2.14
+ *
+ * Deprecated: 2.68: Use PCRE 2 instead
  */
 gchar *
 g_regex_replace (const GRegex      *regex,
@@ -2876,6 +2950,8 @@ literal_replacement (const GMatchInfo *match_info,
  * Returns: a newly allocated string containing the replacements
  *
  * Since: 2.14
+ *
+ * Deprecated: 2.68: Use PCRE 2 instead
  */
 gchar *
 g_regex_replace_literal (const GRegex      *regex,
@@ -2957,6 +3033,8 @@ g_regex_replace_literal (const GRegex      *regex,
  * Returns: a newly allocated string containing the replacements
  *
  * Since: 2.14
+ *
+ * Deprecated: 2.68: Use PCRE 2 instead
  */
 gchar *
 g_regex_replace_eval (const GRegex        *regex,
@@ -3029,6 +3107,8 @@ g_regex_replace_eval (const GRegex        *regex,
  * Returns: whether @replacement is a valid replacement string
  *
  * Since: 2.14
+ *
+ * Deprecated: 2.68: Use PCRE 2 instead
  */
 gboolean
 g_regex_check_replacement (const gchar  *replacement,
@@ -3068,6 +3148,8 @@ g_regex_check_replacement (const gchar  *replacement,
  * Returns: a newly-allocated escaped string
  *
  * Since: 2.30
+ *
+ * Deprecated: 2.68: Use PCRE 2 instead
  */
 gchar *
 g_regex_escape_nul (const gchar *string,
@@ -3138,6 +3220,8 @@ g_regex_escape_nul (const gchar *string,
  * Returns: a newly-allocated escaped string
  *
  * Since: 2.14
+ *
+ * Deprecated: 2.68: Use PCRE 2 instead
  */
 gchar *
 g_regex_escape_string (const gchar *string,
diff --git a/glib/gregex.h b/glib/gregex.h
index 45e198df6..f818fc2c0 100644
--- a/glib/gregex.h
+++ b/glib/gregex.h
@@ -136,6 +136,7 @@ G_BEGIN_DECLS
  * Error codes returned by regular expressions functions.
  *
  * Since: 2.14
+ * Deprecated: 2.68: Use PCRE 2 instead
  */
 typedef enum
 {
@@ -198,7 +199,7 @@ typedef enum
   G_REGEX_ERROR_TOO_MANY_FORWARD_REFERENCES = 172,
   G_REGEX_ERROR_NAME_TOO_LONG = 175,
   G_REGEX_ERROR_CHARACTER_VALUE_TOO_LARGE = 176
-} GRegexError;
+} GRegexError GLIB_DEPRECATED_TYPE_IN_2_68;
 
 /**
  * G_REGEX_ERROR:
@@ -208,10 +209,12 @@ typedef enum
  * error domains.
  *
  * Since: 2.14
+ *
+ * Deprecated: 2.68: Use PCRE 2 instead
  */
-#define G_REGEX_ERROR g_regex_error_quark ()
+#define G_REGEX_ERROR g_regex_error_quark () GLIB_DEPRECATED_MACRO_IN_2_68
 
-GLIB_AVAILABLE_IN_ALL
+GLIB_DEPRECATED_IN_2_68
 GQuark g_regex_error_quark (void);
 
 /**
@@ -289,6 +292,8 @@ GQuark g_regex_error_quark (void);
  * Flags specifying compile-time options.
  *
  * Since: 2.14
+ *
+ * Deprecated: 2.68: Use PCRE 2 instead
  */
 /* Remember to update G_REGEX_COMPILE_MASK in gregex.c after
  * adding a new flag.
@@ -313,7 +318,7 @@ typedef enum
   G_REGEX_NEWLINE_ANYCRLF   = G_REGEX_NEWLINE_CR | 1 << 22,
   G_REGEX_BSR_ANYCRLF       = 1 << 23,
   G_REGEX_JAVASCRIPT_COMPAT = 1 << 25
-} GRegexCompileFlags;
+} GRegexCompileFlags GLIB_DEPRECATED_TYPE_IN_2_68;
 
 /**
  * GRegexMatchFlags:
@@ -380,6 +385,8 @@ typedef enum
  * Flags specifying match-time options.
  *
  * Since: 2.14
+ *
+ * Deprecated: 2.68: Use PCRE 2 instead
  */
 /* Remember to update G_REGEX_MATCH_MASK in gregex.c after
  * adding a new flag. */
@@ -400,7 +407,7 @@ typedef enum
   G_REGEX_MATCH_PARTIAL_SOFT     = G_REGEX_MATCH_PARTIAL,
   G_REGEX_MATCH_PARTIAL_HARD     = 1 << 27,
   G_REGEX_MATCH_NOTEMPTY_ATSTART = 1 << 28
-} GRegexMatchFlags;
+} GRegexMatchFlags GLIB_DEPRECATED_TYPE_IN_2_68;
 
 /**
  * GRegex:
@@ -409,8 +416,10 @@ typedef enum
  * This structure is opaque and its fields cannot be accessed directly.
  *
  * Since: 2.14
+ *
+ * Deprecated: 2.68: Use PCRE 2 instead
  */
-typedef struct _GRegex         GRegex;
+typedef struct _GRegex         GRegex GLIB_DEPRECATED_TYPE_IN_2_68;
 
 
 /**
@@ -418,8 +427,14 @@ typedef struct _GRegex             GRegex;
  *
  * A GMatchInfo is an opaque struct used to return information about
  * matches.
+ *
+ * Since: 2.14
+ *
+ * Deprecated: 2.68: Use PCRE 2 instead
  */
-typedef struct _GMatchInfo     GMatchInfo;
+typedef struct _GMatchInfo     GMatchInfo GLIB_DEPRECATED_TYPE_IN_2_68;
+
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
 
 /**
  * GRegexEvalCallback:
@@ -437,58 +452,60 @@ typedef struct _GMatchInfo        GMatchInfo;
  * Returns: %FALSE to continue the replacement process, %TRUE to stop it
  *
  * Since: 2.14
+ *
+ * Deprecated: 2.68: Use PCRE 2 instead
  */
 typedef gboolean (*GRegexEvalCallback)         (const GMatchInfo *match_info,
                                                 GString          *result,
-                                                gpointer          user_data);
+                                                gpointer          user_data) GLIB_DEPRECATED_TYPE_IN_2_68;
 
 
-GLIB_AVAILABLE_IN_ALL
+GLIB_DEPRECATED_IN_2_68
 GRegex          *g_regex_new                   (const gchar         *pattern,
                                                 GRegexCompileFlags   compile_options,
                                                 GRegexMatchFlags     match_options,
                                                 GError             **error);
-GLIB_AVAILABLE_IN_ALL
+GLIB_DEPRECATED_IN_2_68
 GRegex           *g_regex_ref                  (GRegex              *regex);
-GLIB_AVAILABLE_IN_ALL
+GLIB_DEPRECATED_IN_2_68
 void             g_regex_unref                 (GRegex              *regex);
-GLIB_AVAILABLE_IN_ALL
+GLIB_DEPRECATED_IN_2_68
 const gchar     *g_regex_get_pattern           (const GRegex        *regex);
-GLIB_AVAILABLE_IN_ALL
+GLIB_DEPRECATED_IN_2_68
 gint             g_regex_get_max_backref       (const GRegex        *regex);
-GLIB_AVAILABLE_IN_ALL
+GLIB_DEPRECATED_IN_2_68
 gint             g_regex_get_capture_count     (const GRegex        *regex);
-GLIB_AVAILABLE_IN_ALL
+GLIB_DEPRECATED_IN_2_68
 gboolean          g_regex_get_has_cr_or_lf      (const GRegex        *regex);
-GLIB_AVAILABLE_IN_2_38
+GLIB_DEPRECATED_IN_2_68
 gint              g_regex_get_max_lookbehind    (const GRegex        *regex);
-GLIB_AVAILABLE_IN_ALL
+GLIB_DEPRECATED_IN_2_68
 gint             g_regex_get_string_number     (const GRegex        *regex, 
                                                 const gchar         *name);
-GLIB_AVAILABLE_IN_ALL
+GLIB_DEPRECATED_IN_2_68
 gchar           *g_regex_escape_string         (const gchar         *string,
                                                 gint                 length);
-GLIB_AVAILABLE_IN_ALL
+GLIB_DEPRECATED_IN_2_68
 gchar           *g_regex_escape_nul            (const gchar         *string,
                                                 gint                 length);
 
-GLIB_AVAILABLE_IN_ALL
+GLIB_DEPRECATED_IN_2_68
 GRegexCompileFlags g_regex_get_compile_flags    (const GRegex        *regex);
-GLIB_AVAILABLE_IN_ALL
+GLIB_DEPRECATED_IN_2_68
 GRegexMatchFlags   g_regex_get_match_flags      (const GRegex        *regex);
 
 /* Matching. */
-GLIB_AVAILABLE_IN_ALL
+GLIB_DEPRECATED_IN_2_68
 gboolean         g_regex_match_simple          (const gchar         *pattern,
                                                 const gchar         *string,
                                                 GRegexCompileFlags   compile_options,
                                                 GRegexMatchFlags     match_options);
-GLIB_AVAILABLE_IN_ALL
+GLIB_DEPRECATED_IN_2_68
 gboolean         g_regex_match                 (const GRegex        *regex,
                                                 const gchar         *string,
                                                 GRegexMatchFlags     match_options,
                                                 GMatchInfo         **match_info);
-GLIB_AVAILABLE_IN_ALL
+GLIB_DEPRECATED_IN_2_68
 gboolean         g_regex_match_full            (const GRegex        *regex,
                                                 const gchar         *string,
                                                 gssize               string_len,
@@ -496,12 +513,12 @@ gboolean    g_regex_match_full            (const GRegex        *regex,
                                                 GRegexMatchFlags     match_options,
                                                 GMatchInfo         **match_info,
                                                 GError             **error);
-GLIB_AVAILABLE_IN_ALL
+GLIB_DEPRECATED_IN_2_68
 gboolean         g_regex_match_all             (const GRegex        *regex,
                                                 const gchar         *string,
                                                 GRegexMatchFlags     match_options,
                                                 GMatchInfo         **match_info);
-GLIB_AVAILABLE_IN_ALL
+GLIB_DEPRECATED_IN_2_68
 gboolean         g_regex_match_all_full        (const GRegex        *regex,
                                                 const gchar         *string,
                                                 gssize               string_len,
@@ -511,16 +528,16 @@ gboolean    g_regex_match_all_full        (const GRegex        *regex,
                                                 GError             **error);
 
 /* String splitting. */
-GLIB_AVAILABLE_IN_ALL
+GLIB_DEPRECATED_IN_2_68
 gchar          **g_regex_split_simple          (const gchar         *pattern,
                                                 const gchar         *string,
                                                 GRegexCompileFlags   compile_options,
                                                 GRegexMatchFlags     match_options);
-GLIB_AVAILABLE_IN_ALL
+GLIB_DEPRECATED_IN_2_68
 gchar          **g_regex_split                 (const GRegex        *regex,
                                                 const gchar         *string,
                                                 GRegexMatchFlags     match_options);
-GLIB_AVAILABLE_IN_ALL
+GLIB_DEPRECATED_IN_2_68
 gchar          **g_regex_split_full            (const GRegex        *regex,
                                                 const gchar         *string,
                                                 gssize               string_len,
@@ -530,7 +547,7 @@ gchar               **g_regex_split_full            (const GRegex        *regex,
                                                 GError             **error);
 
 /* String replacement. */
-GLIB_AVAILABLE_IN_ALL
+GLIB_DEPRECATED_IN_2_68
 gchar           *g_regex_replace               (const GRegex        *regex,
                                                 const gchar         *string,
                                                 gssize               string_len,
@@ -538,7 +555,7 @@ gchar                *g_regex_replace               (const GRegex        *regex,
                                                 const gchar         *replacement,
                                                 GRegexMatchFlags     match_options,
                                                 GError             **error);
-GLIB_AVAILABLE_IN_ALL
+GLIB_DEPRECATED_IN_2_68
 gchar           *g_regex_replace_literal       (const GRegex        *regex,
                                                 const gchar         *string,
                                                 gssize               string_len,
@@ -546,7 +563,7 @@ gchar                *g_regex_replace_literal       (const GRegex        *regex,
                                                 const gchar         *replacement,
                                                 GRegexMatchFlags     match_options,
                                                 GError             **error);
-GLIB_AVAILABLE_IN_ALL
+GLIB_DEPRECATED_IN_2_68
 gchar           *g_regex_replace_eval          (const GRegex        *regex,
                                                 const gchar         *string,
                                                 gssize               string_len,
@@ -555,55 +572,57 @@ gchar              *g_regex_replace_eval          (const GRegex        *regex,
                                                 GRegexEvalCallback   eval,
                                                 gpointer             user_data,
                                                 GError             **error);
-GLIB_AVAILABLE_IN_ALL
+GLIB_DEPRECATED_IN_2_68
 gboolean         g_regex_check_replacement     (const gchar         *replacement,
                                                 gboolean            *has_references,
                                                 GError             **error);
 
 /* Match info */
-GLIB_AVAILABLE_IN_ALL
+GLIB_DEPRECATED_IN_2_68
 GRegex          *g_match_info_get_regex        (const GMatchInfo    *match_info);
-GLIB_AVAILABLE_IN_ALL
+GLIB_DEPRECATED_IN_2_68
 const gchar      *g_match_info_get_string       (const GMatchInfo    *match_info);
 
-GLIB_AVAILABLE_IN_ALL
+GLIB_DEPRECATED_IN_2_68
 GMatchInfo       *g_match_info_ref              (GMatchInfo          *match_info);
-GLIB_AVAILABLE_IN_ALL
+GLIB_DEPRECATED_IN_2_68
 void              g_match_info_unref            (GMatchInfo          *match_info);
-GLIB_AVAILABLE_IN_ALL
+GLIB_DEPRECATED_IN_2_68
 void             g_match_info_free             (GMatchInfo          *match_info);
-GLIB_AVAILABLE_IN_ALL
+GLIB_DEPRECATED_IN_2_68
 gboolean         g_match_info_next             (GMatchInfo          *match_info,
                                                 GError             **error);
-GLIB_AVAILABLE_IN_ALL
+GLIB_DEPRECATED_IN_2_68
 gboolean         g_match_info_matches          (const GMatchInfo    *match_info);
-GLIB_AVAILABLE_IN_ALL
+GLIB_DEPRECATED_IN_2_68
 gint             g_match_info_get_match_count  (const GMatchInfo    *match_info);
-GLIB_AVAILABLE_IN_ALL
+GLIB_DEPRECATED_IN_2_68
 gboolean         g_match_info_is_partial_match (const GMatchInfo    *match_info);
-GLIB_AVAILABLE_IN_ALL
+GLIB_DEPRECATED_IN_2_68
 gchar           *g_match_info_expand_references(const GMatchInfo    *match_info,
                                                 const gchar         *string_to_expand,
                                                 GError             **error);
-GLIB_AVAILABLE_IN_ALL
+GLIB_DEPRECATED_IN_2_68
 gchar           *g_match_info_fetch            (const GMatchInfo    *match_info,
                                                 gint                 match_num);
-GLIB_AVAILABLE_IN_ALL
+GLIB_DEPRECATED_IN_2_68
 gboolean         g_match_info_fetch_pos        (const GMatchInfo    *match_info,
                                                 gint                 match_num,
                                                 gint                *start_pos,
                                                 gint                *end_pos);
-GLIB_AVAILABLE_IN_ALL
+GLIB_DEPRECATED_IN_2_68
 gchar           *g_match_info_fetch_named      (const GMatchInfo    *match_info,
                                                 const gchar         *name);
-GLIB_AVAILABLE_IN_ALL
+GLIB_DEPRECATED_IN_2_68
 gboolean         g_match_info_fetch_named_pos  (const GMatchInfo    *match_info,
                                                 const gchar         *name,
                                                 gint                *start_pos,
                                                 gint                *end_pos);
-GLIB_AVAILABLE_IN_ALL
+GLIB_DEPRECATED_IN_2_68
 gchar          **g_match_info_fetch_all        (const GMatchInfo    *match_info);
 
+G_GNUC_END_IGNORE_DEPRECATIONS
+
 G_END_DECLS
 
 #endif  /*  __G_REGEX_H__ */
diff --git a/glib/tests/autoptr.c b/glib/tests/autoptr.c
index 59471d02f..354c08ee1 100644
--- a/glib/tests/autoptr.c
+++ b/glib/tests/autoptr.c
@@ -291,18 +291,22 @@ test_g_rand (void)
 static void
 test_g_regex (void)
 {
+  G_GNUC_BEGIN_IGNORE_DEPRECATIONS
   g_autoptr(GRegex) val = g_regex_new (".*", 0, 0, NULL);
   g_assert_nonnull (val);
+  G_GNUC_END_IGNORE_DEPRECATIONS
 }
 
 static void
 test_g_match_info (void)
 {
+  G_GNUC_BEGIN_IGNORE_DEPRECATIONS
   g_autoptr(GRegex) regex = g_regex_new (".*", 0, 0, NULL);
   g_autoptr(GMatchInfo) match = NULL;
 
   if (!g_regex_match (regex, "hello", 0, &match))
     g_assert_not_reached ();
+  G_GNUC_END_IGNORE_DEPRECATIONS
 }
 
 static void
diff --git a/glib/tests/regex.c b/glib/tests/regex.c
index 88d12edf6..5a2a07d23 100644
--- a/glib/tests/regex.c
+++ b/glib/tests/regex.c
@@ -19,6 +19,9 @@
 #undef G_DISABLE_ASSERT
 #undef G_LOG_DOMAIN
 
+/* The entire GRegex API has been deprecated */
+#define GLIB_DISABLE_DEPRECATION_WARNINGS
+
 #include "config.h"
 
 #include <string.h>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]