-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
vala, codegen: Add
o
modifier to regex literal
Use compile flag `G_REGEX_OPTIMIZE` to make use of JIT optimization
- Loading branch information
Showing
6 changed files
with
77 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* scanner_regex_modifier_o.c generated by valac, the Vala compiler | ||
* generated from scanner_regex_modifier_o.vala, do not modify */ | ||
|
||
#include <glib.h> | ||
|
||
#if !defined(VALA_STRICT_C) | ||
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14) | ||
#pragma GCC diagnostic warning "-Wincompatible-pointer-types" | ||
#elif defined(__clang__) && (__clang_major__ >= 16) | ||
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types" | ||
#pragma clang diagnostic ignored "-Wincompatible-pointer-types" | ||
#endif | ||
#endif | ||
|
||
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL))) | ||
|
||
static void _vala_main (void); | ||
|
||
static GRegex* _tmp_regex_0 = NULL; | ||
|
||
static inline GRegex* | ||
_thread_safe_regex_init (GRegex** re, | ||
const gchar * pattern, | ||
GRegexCompileFlags compile_flags) | ||
{ | ||
if (g_once_init_enter ((volatile gsize*) re)) { | ||
GRegex* val = g_regex_new (pattern, compile_flags, 0, NULL); | ||
g_once_init_leave ((volatile gsize*) re, (gsize) val); | ||
} | ||
return *re; | ||
} | ||
|
||
static gpointer | ||
_g_regex_ref0 (gpointer self) | ||
{ | ||
return self ? g_regex_ref (self) : NULL; | ||
} | ||
|
||
static void | ||
_vala_main (void) | ||
{ | ||
GRegex* foo = NULL; | ||
GRegex* _tmp0_; | ||
_tmp0_ = _g_regex_ref0 (_thread_safe_regex_init (&_tmp_regex_0, "foo(.*)", 0 | G_REGEX_OPTIMIZE)); | ||
foo = _tmp0_; | ||
_g_regex_unref0 (foo); | ||
} | ||
|
||
int | ||
main (int argc, | ||
char ** argv) | ||
{ | ||
_vala_main (); | ||
return 0; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
void main () { | ||
Regex foo = /foo(.*)/o; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Invalid Code | ||
|
||
void main () { | ||
Regex foo = /foo(.*)/oo; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters