mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-26 07:26:15 +01:00
gregex: Allow G_REGEX_JAVASCRIPT_COMPAT in compile mask for g_regex_new
The flag is still ignored but this way we properly deprecate
at compile time without raising an unexpected criticals at runtime:
g_regex_new: assertion '(compile_options & ~G_REGEX_COMPILE_MASK) == 0' failed
and then failing to create the regex completely.
Fixes 8d5a44dc8
("replace pcre1 with pcre2")
This commit is contained in:
parent
4e61dbc07b
commit
a164b49532
@ -1684,7 +1684,10 @@ g_regex_new (const gchar *pattern,
|
||||
|
||||
g_return_val_if_fail (pattern != NULL, NULL);
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
|
||||
g_return_val_if_fail ((compile_options & ~G_REGEX_COMPILE_MASK) == 0, NULL);
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
g_return_val_if_fail ((compile_options & ~(G_REGEX_COMPILE_MASK |
|
||||
G_REGEX_JAVASCRIPT_COMPAT)) == 0, NULL);
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
g_return_val_if_fail ((match_options & ~G_REGEX_MATCH_MASK) == 0, NULL);
|
||||
|
||||
if (g_once_init_enter (&initialised))
|
||||
|
@ -2542,6 +2542,10 @@ main (int argc, char *argv[])
|
||||
TEST_NEW_CHECK_FLAGS ("(*BSR_ANYCRLF)a", 0, 0, G_REGEX_BSR_ANYCRLF, 0);
|
||||
TEST_NEW_CHECK_FLAGS ("(*BSR_UNICODE)a", 0, 0, 0 /* this is the default in GRegex */, 0);
|
||||
TEST_NEW_CHECK_FLAGS ("(*NO_START_OPT)a", 0, 0, 0 /* not exposed in GRegex */, 0);
|
||||
/* Make sure we ignore deprecated G_REGEX_JAVASCRIPT_COMPAT */
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
TEST_NEW_CHECK_FLAGS ("a", G_REGEX_JAVASCRIPT_COMPAT, 0, 0, 0);
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
/* TEST_NEW_FAIL(pattern, compile_opts, expected_error) */
|
||||
TEST_NEW_FAIL("(", 0, G_REGEX_ERROR_UNMATCHED_PARENTHESIS);
|
||||
|
Loading…
Reference in New Issue
Block a user