Commit Graph

21846 Commits

Author SHA1 Message Date
Philip Withnall
bfd8f8cbaf tests: Add multi-threaded test for g_once()
There were multi-threaded tests for g_once_init_{enter,leave}(), but not
for g_once(). Add one which tests multi-threaded contention for entering
and retrieving the value of the `GOnce`.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Helps: #1323
2020-05-19 16:06:07 +01:00
Philip Withnall
596fa49aa0 tests: Tidy up test naming in glib/tests/once.c
Make it a little clearer. This introduces no functional changes.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Helps: #1323
2020-05-19 16:06:07 +01:00
Sebastian Dröge
536e32c5a8 Merge branch '176-malloc-docs' into 'master'
gmem: Improve documentation to clarify abort-on-alloc-failure

Closes #176

See merge request GNOME/glib!1500
2020-05-19 14:41:27 +00:00
Philip Withnall
445aa65e90 gmem: Improve documentation to clarify abort-on-alloc-failure
Clarify that it applies to everything.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Fixes: #176
2020-05-19 15:12:16 +01:00
Philip Withnall
1cb2db8515 gthread: Add introspection annotations
It’s not expected that bindings will use `GThread` over their own
threading APIs (in fact that would generally be a bad idea, since
threads benefit from being integrated into language control flow
structures), but it can’t hurt to have the annotations right for
documentation purposes if nothing else.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Fixes: #602
2020-05-19 14:52:17 +01:00
Philip Withnall
81ee85c793 Merge branch 'th/g-ptr-array-new' into 'master'
array: add internal ptr_array_new() helper for creating GPtrArray

See merge request GNOME/glib!1498
2020-05-18 10:28:25 +00:00
Cheng-Chia Tseng
b86d6fee66 Update Chinese (Taiwan) translation 2020-05-17 17:09:06 +00:00
Emin Tufan Çetin
20fb5bf868 Update Turkish translation 2020-05-16 11:58:36 +00:00
Thomas Haller
1efa966b6f array: add internal ptr_array_new() helper for creating GPtrArray
Unify the creation of GPtrArray.

Maybe we will add yet another constructor for creating %NULL terminated
arrays. Unify the constructors by adding an internal helper method.

The alternative instead of adding a ptr_array_new() helper, would be to
let everybody call g_ptr_array_full(). For no strong reasons, choose
this approach because the compiler is more eager to inline the static
helper as it would inlining g_ptr_array_full().
2020-05-15 17:47:11 +02:00
Sebastian Dröge
f6d26ba772 Merge branch 'fix-1487-reversion' into 'master'
Fix GLIB_UNAVAILABLE_STATIC_INLINE declaration

See merge request GNOME/glib!1496
2020-05-15 13:10:03 +00:00
Philip Withnall
4364c51722 gmacros: Add missing GLIB_UNAVAILABLE_STATIC_INLINE declaration
This fixes building against GLib with
`GLIB_DISABLE_DEPRECATION_WARNINGS` defined.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
See: !1487
2020-05-15 12:00:03 +01:00
Philip Withnall
0fc7f409f6 Revert "Revert "glib: annotate static inline functions with G_AVAILABLE-type macros""
This reverts commit c0146be3a4.

The revert was originally added because the original change broke
gnome-build-meta. Now that the problem has been diagnosed, the original
commit can be fixed — see the commit which follows this one.

See: !1487
2020-05-15 11:59:06 +01:00
Philip Withnall
85f8efae0f Merge branch 'aleksm/mkenums-since' into 'master'
glib-mkenums: allow optional 'since' tag

See merge request GNOME/glib!1492
2020-05-14 16:10:33 +00:00
Philip Withnall
01fbeb601b Merge branch 'assert-no-errno' into 'master'
gtestutils: Add a new g_assert_no_errno() test macro

See merge request GNOME/glib!1204
2020-05-14 16:09:40 +00:00
Sebastian Dröge
12fbb286ae Merge branch 'fix-cpu-docker' into 'master'
ci: Update Android Docker image for aarch64 CPU naming change

See merge request GNOME/glib!1402
2020-05-14 15:12:48 +00:00
Sebastian Dröge
bc2bfdfa43 Merge branch '2082-get-rid-of-am-pm' into 'master'
gdatetime: Document that specific AM/PM formatting is discouraged

Closes #2082

See merge request GNOME/glib!1445
2020-05-14 15:07:12 +00:00
Aleksander Morgado
ec6056e3ab glib-mkenums: allow optional 'since' tag
The glib-mkenums program allows generating code to handle enums/flags
with very different purposes. One of its purposes could be generating
per-enum/flag methods to be exposed in a library API, and while doing
that, it would be nice to have a way to specify in which API version
the enum/flag was introduced, so that the same version could be shown
in the generated API methods.

E.g. From the following code:

    /**
     * QmiWmsMessageProtocol:
     * @QMI_WMS_MESSAGE_PROTOCOL_CDMA: CDMA.
     * @QMI_WMS_MESSAGE_PROTOCOL_WCDMA: WCDMA.
     *
     * Type of message protocol.
     *
     * Since: 1.0
     */
    typedef enum { /*< since=1.0 >*/
        QMI_WMS_MESSAGE_PROTOCOL_CDMA  = 0x00,
        QMI_WMS_MESSAGE_PROTOCOL_WCDMA = 0x01
    } QmiWmsMessageProtocol;

The template would allow us to generate a method documented like this,
including the Since tag with the value given in the mkenums 'since' tag.

    /**
     * qmi_wms_message_protocol_get_string:
     * @val: a QmiWmsMessageProtocol.
     *
     * Gets the nickname string for the #QmiWmsMessageProtocol specified at @val.
     *
     * Returns: (transfer none): a string with the nickname, or %NULL if not found. Do not free the returned value.
     * Since: 1.0
     */
    const gchar *qmi_wms_message_protocol_get_string (QmiWmsMessageProtocol val);

Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
2020-05-14 17:00:54 +02:00
Aleksander Morgado
4d1132a945 docs,glib-mkenums: setup lists for enum/value trigraph extensions
Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
2020-05-14 17:00:46 +02:00
Emmanuele Bassi
700be9f22d Merge branch 'meson-fix' into 'master'
meson: Remove stray ] in O_DIRECTORY check

See merge request GNOME/glib!1493
2020-05-14 14:02:20 +00:00
Chris Packham
a714484208 meson: Remove stray ], in O_DIRECTORY check
A stray ], was leftover from the autotools -> meson conversion. Remove
it.

Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
2020-05-14 10:18:39 +12:00
Michael Catanzaro
c0146be3a4 Revert "glib: annotate static inline functions with G_AVAILABLE-type macros"
This reverts commit 5050298749
2020-05-12 21:28:52 +00:00
Philip Withnall
a6b1afca6a Merge branch 'zbrown/datetime-annotations' into 'master'
gdatetime: update annotations

See merge request GNOME/glib!1491
2020-05-12 12:53:14 +00:00
Philip Withnall
ef1b057977 Merge branch 'static-inline-available' into 'master'
glib: annotate static inline functions with G_AVAILABLE-type macros

See merge request GNOME/glib!1487
2020-05-12 12:47:46 +00:00
Zander Brown
afaa2e31e6
gdatetime: add preconditons to public methods
Should make it easier to debug than segfaulting in from_instant
2020-05-12 13:02:20 +01:00
Zander Brown
86a0b5530d
gdatetime: update annotations
Every constructor and just about every method can and will (silently) return NULL, add
annotations to reflect this
2020-05-12 13:02:19 +01:00
Simon Marchi
5050298749 glib: annotate static inline functions with G_AVAILABLE-type macros
The public functions exposed as static inlines currently don't have
annotations to describe when they were introduced.  This means that
compiling this file:

    #include <glib.h>

    void foo (void)
    {
      g_rec_mutex_locker_new (NULL);
    }

with:

    gcc -c test.c \
      -I/tmp/glib/include/glib-2.0 \
      -I/tmp/glib/lib/x86_64-linux-gnu/glib-2.0/include \
      -Werror \
      -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_28 \
      -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_28

will not produce any error message, despite using
`g_rec_mutex_locker_new`, a function that was introduced after 2.28.

This patch adds some annotations to all the publicly exposed static
inline functions I could find.

I could not use the existing G_AVAILABLE* macros, because they may
expand to `extern`.  This would then clash with the `static` keyword and
produce:

    ../glib/gthread.h:397:1: error: multiple storage classes in declaration specifiers
      397 | static inline GRecMutexLocker *
          | ^~~~~~

So I opted for adding a new set of macros,
GLIB_AVAILABLE_STATIC_INLINE_IN_2_XY.

With this patch applied, the example from above produces the expected
warning:

    test.c: In function ‘foo’:
    test.c:5:3: error: ‘g_rec_mutex_locker_new’ is deprecated: Not available before 2.60 [-Werror=deprecated-declarations]
        5 |   g_rec_mutex_locker_new (NULL);
          |   ^~~~~~~~~~~~~~~~~~~~~~
    In file included from /tmp/glib/include/glib-2.0/glib/gasyncqueue.h:32,
                     from /tmp/glib/include/glib-2.0/glib.h:32,
                     from test.c:1:
    /tmp/glib/include/glib-2.0/glib/gthread.h:398:1: note: declared here
      398 | g_rec_mutex_locker_new (GRecMutex *rec_mutex)
          | ^~~~~~~~~~~~~~~~~~~~~~
2020-05-12 12:42:50 +01:00
Philip Withnall
99e2cc72dd gtranslit: Drop duplicate if case
This seems to have existed since the code was written and I can’t see
a need for it.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Fixes: #2106
2020-05-12 12:41:22 +01:00
Philip Withnall
06dc61ad6c Merge branch 'clang-win-stpcpy' into 'master'
Don't misdetect stpcpy on windows platforms on clang

See merge request GNOME/glib!1439
2020-05-12 11:39:44 +00:00
Martin Storsjö
1b94bfbd72 meson: Don't misdetect stpcpy on windows platforms on clang
See https://github.com/mesonbuild/meson/issues/3672 and
https://github.com/mesonbuild/meson/issues/5628 for explanations
of cases where meson misdetects functions due to clang builtins (that
always are available, regardless of whether the platform actually
provides them).

The same also happens on GCC 10, which added support for __has_builtin.
2020-05-11 20:23:43 +03:00
Michael Catanzaro
493b01c305 Merge branch 'option-context-translations' into 'master'
goption: Treat an empty option context parameter string as NULL

See merge request GNOME/glib!1469
2020-05-08 20:26:33 +00:00
Philip Withnall
9363fe4695 Merge branch 'wip/smcv/apple-xucred' into 'master'
gio: add gcredential support for macOS

Closes #507

See merge request GNOME/glib!1416
2020-05-07 14:05:57 +00:00
Dr. Michael Lauer
ec2f60a008 gio: add gcredential support for macOS
[smcv: Apply my review feedback from
<https://bugzilla.gnome.org/show_bug.cgi?id=668866>]

Co-authored-by: Simon McVittie <smcv@collabora.com>
Resolves: https://gitlab.gnome.org/GNOME/glib/issues/507
2020-05-07 14:19:16 +01:00
Simon McVittie
05cb229082 GCredentials: Add the concept of credentials that lack the process ID
struct xucred on macOS doesn't have the process ID, only the user ID
and groups.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-05-07 14:19:16 +01:00
Philip Withnall
a9a7aa05dc Merge branch 'wip/hadess/update-fedora-ci' into 'master'
Update Fedora CI

See merge request GNOME/glib!1464
2020-05-07 11:42:08 +00:00
Philip Withnall
217f1ea3fb Merge branch 'wip/tintou/gdesktopappinfo-nullable' into 'master'
gdesktopappinfo: Add several nullable annotation to GAppInfo getters

See merge request GNOME/glib!1463
2020-05-07 10:31:53 +00:00
Philip Withnall
e4e875a91f Merge branch 'wip/smcv/credentials-docs' into 'master'
GCredentials documentation fixes

See merge request GNOME/glib!1456
2020-05-07 10:29:21 +00:00
Bastien Nocera
555fc57a1c ci: Fix documentation tarball compression
Best compress using xz when using .tar.xz suffixes.
2020-05-07 11:14:35 +01:00
Bastien Nocera
48f756616d ci: Fix paths for dist'ed documentation 2020-05-07 11:14:35 +01:00
Bastien Nocera
62bffc294a ci: Update Fedora version to latest stable
This newer version of Fedora also includes a newer version of gtk-doc
that should satisfy the update dependency:
Dependency gtk-doc found: NO found '1.29' but need: '>=1.32'

See https://bodhi.fedoraproject.org/updates/FEDORA-2020-f93ef1b300
2020-05-07 11:13:57 +01:00
Philip Withnall
ae1003450e Merge branch 'gthread-deprecated' into 'master'
gthread: ignore deprecated declarations in static inline functions

Closes #2094

See merge request GNOME/glib!1472
2020-05-07 09:49:50 +00:00
Philip Withnall
5bef5628f5 Merge branch 'mcatanzaro/verify-chain-docs' into 'master'
Improve documentation of g_tls_database_verify_chain()

See merge request GNOME/glib!1475
2020-05-07 09:48:11 +00:00
Corentin Noël
0663a9bd56 gdesktopappinfo: Add several nullable annotation to GAppInfo getters
Some functions can return a NULL GAppInfo when the conditions given as arguments are not met.
2020-05-07 10:30:39 +01:00
Simon McVittie
e33b0d0410 GCredentials: Document when NETBSD_UNPCBID was added
Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-05-07 10:25:14 +01:00
Simon McVittie
3e61acddc5 GCredentials: Format C library type names as code
Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-05-07 10:25:14 +01:00
Philip Withnall
9d34514f7d Merge branch 'th/g-ptr-array-variable-cleanups' into 'master'
[th/g-ptr-array-variable-cleanups] minor cleanup of variables for GPtrArray

See merge request GNOME/glib!1482
2020-05-07 09:10:19 +00:00
Philip Withnall
f9ab23465e Merge branch 'mcatanzaro/client-connection-validation-flags' into 'master'
Improve documentation of client connection validation flags

See merge request GNOME/glib!1479
2020-05-07 08:53:38 +00:00
Michael Catanzaro
33c9c305e3 Improve documentation of g_tls_database_verify_chain()
It is critical to mention how the identity parameter is expected to be
handled. In particular, if identity is not passed, then the identity of
the server certificate will not be checked at all. This is in contrast
to the connection-level APIs, which are supposed to be fail-safe. The
database and certificate-level APIs are more manual.
2020-05-07 09:52:47 +01:00
Philip Withnall
2be506a3be Merge branch 'ci-msys2-use-old-meson' into 'master'
CI: Make sure we use meson 0.49.2 in MSYS2

See merge request GNOME/glib!1480
2020-05-07 08:47:56 +00:00
Philip Withnall
19b6e30cc7 Merge branch 'th/g-ptr-array-extend-and-steal-crash' into 'master'
array: fix corrupt state of GPtrArray after g_ptr_array_extend_and_steal()

See merge request GNOME/glib!1481
2020-05-07 08:41:23 +00:00
Thomas Haller
cf1263bbb9 array: combine loop variables in g_ptr_array_remove_range() 2020-05-07 09:07:31 +02:00