Commit Graph

25865 Commits

Author SHA1 Message Date
Marco Trevisan (Treviño)
c19904d6e8 glib/tests/cxx: Enable the c++ tests for all the C++ versions
We should support these macros everywhere, if not, we should fix them
again.
2022-09-15 01:18:42 +02:00
Damjan Jovanovic
a0f200593c gatomic: Support atomic compare_and_exchange macros on older C++ standard versions
The fix in ad23894c15 only works for
__cplusplus >= 201103L, but older C++ standards are not always less strict,
and still fail to compile the g_atomic_int_compare_and_exchange() and
g_atomic_pointer_compare_and_exchange() macros.

Apply that fix to all C++ standard versions.

Even if this implies using functions that have been added as part of
C++11 specification, this is safe because we wouldn't ever try to use the
`__atomic_...()` APIs if `__ATOMIC_SEQ_CST` is not defined, and that's part
of the very same API.
2022-09-15 01:18:42 +02:00
Marco Trevisan (Treviño)
0abb82498e glib/tests/cxx: Add clear and steal pointer functions tests
These functions may be defined as macros with different behaviors in
different c++ versions (as they rely on glib_typeof), so let's ensure
they work and compile everywhere.
2022-09-15 01:18:42 +02:00
Damjan Jovanovic
d050ad8a3c glib-typeof: Define glib_typeof on on older C++ standard versions
When using an older C++ versions, the glib_typeof() macro is never
defined, as the C++ definition depends on __cplusplus >= 201103L, while the C
definition, which would work, depends on !defined(__cplusplus).
Allow old C++ versions to use the C macro definition for glib_typeof().
2022-09-15 01:18:42 +02:00
Marco Trevisan (Treviño)
1cbe7a6734 meson: Build C++ tests for the currently supported C++ standard versions
We've various macros definitions that are depending using C++ features
that may not work in all the standard versions, so recompile the cxx
tests that we have in all the ones we want to support.
2022-09-15 01:18:40 +02:00
Sebastian Dröge
a20a36b26f Merge branch 'revert-de57914b' into 'main'
Revert "Merge branch 'wip/smcv/deprecated-construct-prop' into 'main'"

See merge request GNOME/glib!2890
2022-09-13 11:32:48 +00:00
Sebastian Dröge
d41b5bf999 Revert "Merge branch 'wip/smcv/deprecated-construct-prop' into 'main'"
This reverts merge request !2888
2022-09-13 11:20:03 +00:00
Sebastian Dröge
de57914b83 Merge branch 'wip/smcv/deprecated-construct-prop' into 'main'
gobject: Only emit deprecation warnings for user-specified properties

Closes #2748

See merge request GNOME/glib!2888
2022-09-13 11:09:26 +00:00
Simon McVittie
fef0408eaa gobject: Add a test for deprecated properties
Reproduces: https://gitlab.gnome.org/GNOME/glib/-/issues/2748
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-09-13 11:20:45 +01:00
Simon McVittie
b88474ee7c gobject: Only emit deprecation warnings for user-specified properties
If a deprecated property only gets set because it is G_PARAM_CONSTRUCT
or G_PARAM_CONSTRUCT_ONLY, then there is nothing for the library user
to fix, and we should not emit a deprecation warning.

Resolves: https://gitlab.gnome.org/GNOME/glib/-/issues/2748
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-09-13 11:16:58 +01:00
Alexander Shopov
98d071498b Update Bulgarian translation 2022-09-13 08:31:20 +00:00
Marco Trevisan
0d823aa926 Merge branch 'wip/3v1n0/regex-pcre2-flags-fixes' into 'main'
GRegex flags fixes and cleanups

Closes gtksourceview#283, #2741, #2729, #2688 e gtksourceview#278

See merge request GNOME/glib!2878
2022-09-12 21:45:57 +00:00
Claude Paroz
a2a0441189 Update French translation 2022-09-12 18:00:20 +00:00
Xavier Claessens
dcb464f013 Merge branch 'install-tag' into 'main'
meson: Set install_tag on all tools

See merge request GNOME/glib!2882
2022-09-12 14:22:03 +00:00
Xavier Claessens
a1c78d63ef meson: Set install_tag on all tools
Those tools are not needed at runtime for typical applications,
distributions typically package them separately.

This makes `meson install --tag runtime` skip installation of those
tools. Omitting `--tag` argument will still install them, as well as
with `--tag bin,bin-devel`.

See https://mesonbuild.com/Installing.html#installation-tags.
2022-09-12 09:50:31 -04:00
Marco Trevisan (Treviño)
653f8eb020 tests/regex: Perform more tests both with and without optimizations 2022-09-12 14:08:13 +02:00
Marco Trevisan (Treviño)
bec68b2d74 glib/regex: Do not use JIT when using unsupported match options
Do not store jit status for regex unless during initial compilation.
After that, decide whether to use it depending on matching options.

In fact there are some matching options that are incompatible with JIT,
as the PCRE2 docs states:

  Setting PCRE2_ANCHORED or PCRE2_ENDANCHORED at match time is not
  supported by the just-in-time (JIT) compiler. If it is set, JIT
  matching is disabled and the interpretive code in pcre2_match() is
  run. Apart from PCRE2_NO_JIT (obviously), the remaining options are
  supported for JIT matching.

Fixes: GNOME/gtksourceview#283
2022-09-12 14:08:13 +02:00
Marco Trevisan (Treviño)
0831393dd0 tests/regex: Make possible to test replacements with options 2022-09-12 13:55:39 +02:00
Marco Trevisan (Treviño)
5e76cde5ff regex: Handle JIT errors more explicitly 2022-09-12 13:55:39 +02:00
Marco Trevisan (Treviño)
fe1c2628d5 regex: Avoid allocating offsets until we've a match
There's no much point of pre-allocating offsets given that we're doing
this when needed if only have matches to store.

So let's just allocate the spaces for the dummy offset we depend on,
while allocate the others on demand.
2022-09-12 13:55:39 +02:00
Marco Trevisan (Treviño)
e8628a7ed5 regex: Compute the offsets size based on match results
While the ovector count would include all the allocated space, we only
care about the actual match values, so avoid wasting allocations and
just use the ones we need to hold the offsets.
2022-09-12 13:55:39 +02:00
Marco Trevisan (Treviño)
aee84cb45c gregex: Avoid re-allocating if we have no size change
This is handled by the syscall underneath, but we can just avoid a call
cheaply.
2022-09-12 13:55:39 +02:00
Marco Trevisan (Treviño)
11521972f4 gregex: Handle the case we need to re-allocate the match data
In case PCRE2 returns an empty match

This can be easily tested by initializing the initial match data to a
value that is less than the expected match values (e.g. by calling
pcre2_match_data_create (1, NULL)), but we can't do it in our tests
without bigger changes.
2022-09-12 13:55:39 +02:00
Marco Trevisan (Treviño)
1d628dac92 regex: Use size types more in line with PCRE2 returned values
We're using int for every size value while PCRE uses uint_32t or
PCRE2_SIZE (size_t in most platforms), let's use the same types to avoid
using different signs.
2022-09-12 13:55:39 +02:00
Marco Trevisan (Treviño)
13ad4296ea gregex: Fix a potential PCRE2 code leak on reallocation failures
In case recalc_match_offsets() failed we were just returning, but in
such case, per the documentation we should still set the match_info (if
provided) and free the pcre2 code instance.

So let's just break the loop we're in it, as if we we've no matches set.
This also avoids re-allocating the offsets array and potentially
accessing to unset data.
2022-09-12 13:55:39 +02:00
Marco Trevisan (Treviño)
1f88976610 gregex: Do not try access the undefined match offsets if we have no match
In case we're getting NO-MATCH "errors", we were still recomputing the
match offsets and taking decisions based on that, that might lead to
undefined behavior.

Avoid this by just returning early a FALSE result (but with no error) in
case there's no result to proceed on.

Fixes: #2741
2022-09-12 13:55:39 +02:00
Marco Trevisan (Treviño)
1185a1304a gregex: Mark g_match_info_get_regex as transfer none
Since it had no explicit annotation, g-i was defaulting to transfer-full
while in this case the GRegex is owned by the GMatchInfo.
2022-09-12 13:55:39 +02:00
Aleksei Rybalkin
df66951b96 tests/regex: Add test for gtksourceview regression 2022-09-12 13:55:39 +02:00
Marco Trevisan (Treviño)
d639c4ec00 regex: Do not mix PCRE2 Compile, Match, Newline and BSR flags
As per the PCRE2 port we still used to try to map the old GRegex flags
(PCRE1 based) with the new PCRE2 ones, but doing that we were also
mixing flags with enums, leading to unexpected behaviors when trying to
get new line and BSR options out of bigger flags arrays.

So, avoid doing any mapping and store the values as native PCRE2 flags
internally and converting them back only when requested.

This fixes some regressions on newline handling.

Fixes: #2729
Fixes: #2688
Fixes: GNOME/gtksourceview#278
2022-09-12 13:55:39 +02:00
Marco Trevisan (Treviño)
d4966911e6 tests/regex: Actually check for match options changes 2022-09-12 13:55:39 +02:00
Marco Trevisan (Treviño)
23c1b401d8 tests/regex: Add debug strings for compile and match option flags
In case of failures they give a better info.
2022-09-12 13:55:39 +02:00
Danial Behzadi
c646901d34 Update Persian translation 2022-09-12 10:06:28 +00:00
Daniel Mustieles
5676303e97 Updated Spanish translation 2022-09-12 07:48:51 +02:00
Daniel Mustieles
a94121ffb6 Updated Spanish translation 2022-09-12 07:46:48 +02:00
Matej Urbančič
0a665b51cd Update Slovenian translation 2022-09-11 19:11:06 +00:00
Luming Zh
615c4008f1 Update Chinese (China) translation 2022-09-11 19:10:09 +00:00
Luna Jernberg
07506b3a38 Update Swedish translation 2022-09-10 09:05:00 +00:00
Marco Trevisan
949f07044e Merge branch 'ci-style-check-improvements' into 'main'
ci: Improve style check script

See merge request GNOME/glib!2883
2022-09-10 00:51:01 +00:00
Matthias Clasen
7526f77e9a ci: Improve style check script
Sync with changes from GTK:

- Set a git config to work around security
  improvements in recent git.
- Only fetch the two branches we want to compare
  for the style check.
- Use the existing git merge-base command to find
  their common ancestor.
2022-09-09 20:23:44 -04:00
Luca Bacci
24572c93c2 Merge branch 'g-win32-app-info-fixes' into 'main'
GWin32AppInfo: Add missing g_spawn_close_pid

See merge request GNOME/glib!2881
2022-09-08 14:12:05 +00:00
Emmanuele Bassi
07a08d5cf5 Merge branch 'coverity-build-fix' into 'main'
gioenumtypes: Only define GLIB_DISABLE_DEPRECATION_WARNINGS if needed

See merge request GNOME/glib!2879
2022-09-07 14:07:45 +00:00
Marco Trevisan (Treviño)
07c808ad90 gioenumtypes: Only define GLIB_DISABLE_DEPRECATION_WARNINGS if needed 2022-09-07 15:31:38 +02:00
Matthias Clasen
1f4188f0ab Merge branch 'fgets-error-ignore' into 'main'
gio-tool-mount: Return early on fgets EOF

Closes #2737

See merge request GNOME/glib!2870
2022-09-06 17:22:15 +00:00
Matthias Clasen
1a32433f31 Merge branch 'strsplit-pre-allocated-array' into 'main'
g_strsplit: Use a pre-allocated GArray when max_tokens is provided

See merge request GNOME/glib!2875
2022-09-06 17:15:03 +00:00
Sebastian Dröge
5125194064 Merge branch 'andyholmes/gactiongroup-queryaction-ownership' into 'main'
GActionGroup: Fix ownership transfer annotation for query_action()

See merge request GNOME/glib!2876
2022-09-05 07:38:33 +00:00
Andy Holmes
1eb1a47a50
GActionGroup: Fix ownership transfer annotation for query_action()
The `(transfer none)` behaviour for `parameter_type` and `state_type`
parameters is implicit with the `const` attribute, but was incorrectly
determined to be `(transfer full)` in the GIR.

Add explicit `(transfer none)` annotations for these two parameters.
2022-09-04 17:29:39 -07:00
Changwoo Ryu
72ed39a8c2 Update Korean translation 2022-09-04 10:15:35 +00:00
Danial Behzadi
6ed89347db Update Persian translation 2022-09-03 12:16:33 +00:00
Emmanuele Bassi
bafd025811 Merge branch 'ebassi/gcc-12-fixes' into 'main'
Fix array-bounds compiler warnings with GCC 12

See merge request GNOME/glib!2873
2022-09-02 23:17:25 +00:00
Marco Trevisan
1d9a362bc7 Merge branch 'fix-some-variant-leaks' into 'main'
tests, GDesktopAppInfo: Fix various GVariant leaks

See merge request GNOME/glib!2874
2022-09-02 20:12:50 +00:00