Commit Graph

6390 Commits

Author SHA1 Message Date
Philip Withnall
249299a76f Merge branch 'doc-fixes' into 'master'
Various doc fixes

See merge request GNOME/glib!982
2019-07-17 10:58:21 +00:00
Philip Withnall
fa4423d435 Merge branch 'clang-cl-support' into 'master'
Experimental clang-cl support

See merge request GNOME/glib!979
2019-07-17 10:30:28 +00:00
Philip Withnall
4b087717a0 docs: Add example to g_test_summary() documentation
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-07-15 11:07:38 +01:00
Chun-wei Fan
e8d471f3e1 meson: Mostly assume clang-cl is MSVC
We need to enable building the dirent and gnulib sources for clang-cl,
as we are still using the Microsoft-style headers and lib's and CRT.
We need to also do this for the following, for similar reasoning:

-Symbol export (via __declspec(dllexport))
-Dependency discovery without pkg-config files
-long long and ssize_t detection

We do, however, enable the autoptr tests for clang-cl builds.  Note that
at this point real MSVC builds are still better supported than clang-cl
builds, and it will likely remain so for at least the near future,
alhtough real MSVC builds of the GTK stack are consumable and are usable
by clang-cl.
2019-07-11 15:38:21 +08:00
Xavier Claessens
e5c2327dcb doc: Remove trailing dot that confuse gtkdoc 2019-07-10 10:10:58 -04:00
Xavier Claessens
5c9af3c75c doc: Add some empty lines to unbreak gtkdoc
For some reason gtkdoc thinks g_test_trap_fork() is undefined, unless
some more spacing is added.
2019-07-10 10:10:49 -04:00
Xavier Claessens
9b7332ce2e doc: Workaround gtkdoc-scan bug leading to undocumented symbols 2019-07-10 10:10:40 -04:00
Xavier Claessens
6b6e92cb63 doc: Add new G_UNICODE_SCRIPT_ values 2019-07-10 10:10:40 -04:00
Chun-wei Fan
d616ca25ff gmacros.h: Support deprecation macros better on clang-cl
Use the GCC-style definition for the deprecation warning macros so that
builds using those won't break due to how they are placed as clang-cl
seems to not support __declspec(deprecated) very well.  Also make sure
that we do indeed support the temparary disabling of deprecation
warnings on clang-cl, as the MSVC ones don't really work on clang-cl.
2019-07-10 10:47:35 +08:00
Chun-wei Fan
2bc73d7281 glib/gmacros.h: Check for __clang__ for g_autoptr
clang-cl does support __attribute__((cleanup)), which is what is used
for the g_auto* macros, but neither it, nor clang.exe defines __GNUC__
when they are used in a MSVC cmd.exe environment.  It does, however,
define __clang__.

So, check for the presence of the __clang__ macro to enable g_autoptr as
well, so that we can build things with MSVC builds that make use
of g_autoptr via pretending to be MSVC by using clang-cl.
2019-07-10 10:32:49 +08:00
Emmanuele Bassi
2e39f4148e Merge branch 'fix-prepare-annot' into 'master'
gmain: Fix g_main_context_prepare priority annotation

See merge request GNOME/glib!961
2019-07-09 12:21:14 +00:00
Emmanuele Bassi
c23ee5fabf Merge branch 'garray_binary_search' into 'master'
Add g_array_binary_search() to garray API

Closes #373

See merge request GNOME/glib!850
2019-07-09 10:39:34 +00:00
Emmanuel Fleury
104fca78cd Add g_array_binary_search() to garray API
Original code written by Christian Hergert

Fix issue #373
2019-07-09 12:12:18 +02:00
Chun-wei Fan
5d54727180 glib/tests/gdatetime.c: Fix TZ envvar test on Windows
Windows does not recognize the "America/Recife" as a valid timezone
identifier, so setting the TZ envvar to that will result in "UTC" to
be returned on Windows.

Instead, set TZ to be the Windows equivilant "SA Eastern Standard
Time", and see whether that is indeed our identifier when we create the
GTimeZone using that.
2019-07-05 18:52:02 +08:00
Chun-wei Fan
f24444c585 gtimezone.c: Fix identifier assignment on Windows
On Windows, we may be using the US DST boundaries by using the default
"Pacific Standard Time" for rules_from_windows_time_zone() in
rules_from_identifier().  This has the unfortunate side-effect of
hardcoding the out_identifier to "Pacific Standard Time", which is
likely not what we want.

Instead, upon retrieving the items successfully using
rules_from_windows_time_zone ("Pacific Standard Time", ...), we just
set the out_identifier to whatever identifier that was passed into
rules_from_identifier().
2019-07-05 18:52:02 +08:00
Chun-wei Fan
5ca4ac16ef Update the gdatetime Test Program for Windows
Update the gdatetime test program to make use of the updates that was
done in gtimezone.c in the previous commit, so that we don't have to
worry what language version of Windows the tests are being run in, but
instead be assured that we produce and check for the English-language
time zone name strings.

Also, instead of testing for "Pacific Standard Time" in
test_GDAteTime_printf(), use GetDynamicTimeZoneInformation() to get the
actual time zone string (where the system running the test program is)
we want to check for, because on Windows the actual result will be
dependent on which timezone the system running the test program is in.

https://bugzilla.gnome.org/show_bug.cgi?id=719344
2019-07-05 18:52:02 +08:00
Chun-wei Fan
2e5d3aa911 glib/gtimezone.c: Use RegLoadMUIStringW() to query Std/Dlt strings
The existing method of using RegQueryValueExW() to query the Std/Dlt
strings can only retrive the localized versions of those strings, so
that means they will vary by the language version of Windows.  Instead,
use RegQueryValueExW() only as a fallback when RegLoadMUIStringW() fails,
as RegLoadMUIStringW() can query for the Std and Dlt strings in
whatever language we need by setting the locale stuff programatically on
the fly.
2019-07-05 18:52:02 +08:00
Chun-wei Fan
c868123c0a glib/gtimezone.c: Use Unicode versions of Windows Registry API
We are going to use RegLoadMUIStringW() in the next commit, since there
is no real RegLoadMUIStringA() function (it exists as a stub only).
This is done so that we are consistent along the way

Also fix rule_from_windows_time_zone_info() as we can't just do a strncpy()
of tzi->StandardName and tzi->DaylightName directly, as they are wchar_t/
gunichar2 strings, where we must convert to UTF-8 first.

https://bugzilla.gnome.org/show_bug.cgi?id=719344
2019-07-05 18:51:49 +08:00
Philip Withnall
dc774db608 Merge branch 'dboles/gmacros-docs' into 'master'
docs.c: Forward link from g_auto* → G_DEFINE_AUTO*

See merge request GNOME/glib!971
2019-07-05 09:56:42 +00:00
Daniel Boles
71ccfadbe1 docs.c: Forward link from g_auto* → G_DEFINE_AUTO*
We said the type must support being cleaned up and will be cleaned up in
an appropriate way, but in order to figure out how to do that, you had
to jump forward in the documentation to the other macros. Just say them.
2019-07-05 10:34:27 +01:00
Philip Withnall
1230be3d11 Merge branch 'wip/lantw/gdatetime-unset-lc-all-for-the-test-as-well' into 'master'
gdatetime: Unset LC_ALL for the test as well

See merge request GNOME/glib!970
2019-07-05 09:30:56 +00:00
Ting-Wei Lan
7089f67f14 gdatetime: Unset LC_ALL for the test as well
This is a follow-up to a0c7f85437.

In addition LC_MESSAGES, we should remove LC_ALL from the environment
as well. Otherwise, LC_ALL overrides LC_MESSAGES, causing the test to
fail on FreeBSD when LC_ALL is set to a non-English locale.
2019-07-05 15:13:11 +08:00
Philip Withnall
91c1f33bb4 Merge branch 'win32-gstdio-minor' into 'master'
gstdio: minor cleanups

See merge request GNOME/glib!939
2019-07-03 11:06:01 +00:00
Allison Karlitskaya
de009c1e91 tests: test g_cond_wait_until() under stress
This (dubious) testcase fails before the previous commit due to errno
being clobbered by the interrupted wait on the contended mutex.  The
previous commit fixes that.

The testcase is dubious because, in theory (as per POSIX),
g_cond_wait_until() is permitted to return TRUE at any time for any
reason, due to so-called "spurious wakeups".  Having a testcase that
asserts that the return value should be FALSE is therefore fundamentally
broken.  We do it anyway, though.

We're only really trying to test a bug in our homemade Linux/futex
implementation here, and it takes a fair amount of effort to actually
convince the old code to fail (including some system stuff which
probably isn't available on Windows).  There's also the spurious wakeup
situation mentioned above to worry about on other systems.  For all of
those reasons, this test is only enabled on Linux.
2019-07-02 12:22:16 +02:00
Allison Karlitskaya
d92f22ab47 gthread: fix minor errno problem in GCond
The return value from `g_cond_wait_until()` is calculated, based on the
value of `errno` after reacquiring the mutex.  This is a problem because
`errno` can be overwritten in the case the mutex is contended (in which
case the slow-path code will re-enter the kernel).

Perform the calculation before reacquiring the mutex.

See merge request GNOME/glib!958
2019-07-02 12:22:07 +02:00
Chun-wei Fan
7b91440ca4 gmacros.h: Use static_assert on MSVC if possible
Visual Studio 2010 and later support static_assert on both C and C++,
but we can only enable it for plain-C code on Visual Studio 2013 and
later, as apparently the static_assert macro implementation will carry
out something after defining certain variables.

For C++ code, we use static_assert on Visual Studio 2010 and later.
2019-07-02 11:52:52 +08:00
Nirbheek Chauhan
b169b5a45d gmacros: Use _Static_assert only for non-expr static assert
We can't actually use it inside an expression, so keep the old macro
for that. Also add a test so that this doesn't break the next time we
change it.

See: https://gitlab.gnome.org/GNOME/glib/merge_requests/955#note_542646
2019-07-01 13:41:58 +00:00
Michael Catanzaro
0c9dab3671 Revert "gmacros: Use _Static_assert when C11 is available"
This reverts commit 5d14764a6b.

It broke G_STATIC_ASSERT_EXPR(). See discussion in !955.
2019-06-29 13:48:08 -05:00
David Emett
ca47f3dfd5 gmain: Fix g_main_context_prepare priority annotation 2019-06-29 14:13:16 +01:00
Michael Gratton
af9696caad g_utf8_normalize: Doc comment return missing nullable annotation
The return value for g_utf8_normalize may be null, but the return type
is not annotated as such. This is important for language bindings for
langs that are about nullability, such as Vala and Haskell.
2019-06-29 15:06:20 +10:00
Emmanuel Fleury
46f70e9901 Adding a function g_array_copy() to glib/garray.c
Original code from Simon van der Linden

Close issue #236
2019-06-27 13:40:26 +02:00
Philip Withnall
75614a0972 Merge branch 'improve_g_ptr_array_api' into 'master'
Adding g_ptr_array_copy() and g_ptr_array_extend() to garray API

Closes #269

See merge request GNOME/glib!918
2019-06-27 11:11:41 +00:00
Emmanuel Fleury
0675703af0 Adding g_ptr_array_extend_and_steal() function to glib/garray.c 2019-06-27 12:28:32 +02:00
Philip Withnall
7b5d1c8b06 Merge branch 'nirbheek/static-assert-c11' into 'master'
gmacros: Use _Static_assert when C11 is available

See merge request GNOME/glib!955
2019-06-27 10:20:46 +00:00
Nirbheek Chauhan
5d14764a6b gmacros: Use _Static_assert when C11 is available
The static assert message is much nicer to read, and is less likely to
be misinterpreted as a false positive.

glib is built with `-std=gnu89`, but this macro will be available to
projects that use glib with c11 or gnu11.
2019-06-27 14:18:43 +05:30
David Corbett
2fdc35aabd Fix the ISO 15924 code for Manichaean 2019-06-26 21:31:22 -04:00
Emmanuel Fleury
43ad244df2 Adding g_ptr_array_extend() function to glib/garray.c
Related to issue #269
2019-06-26 15:35:28 +02:00
Emmanuel Fleury
86bcc5c942 Adding g_ptr_array_copy() function to glib/garray.c
Related to issue #269
2019-06-26 15:34:47 +02:00
Emmanuel Fleury
cf29e37c54 Moving GCopyFunc typedef from glib/gnode.h to glib/gtypes.h 2019-06-25 09:19:49 +02:00
Ting-Wei Lan
446ba28d31 gutils: Don't limit the length of the host name to 99
It is unclear that why the size of the buffer was chosen to be 100
because the commit introduced the code didn't mention the reason.
POSIX defines _POSIX_HOST_NAME_MAX to be 255 and provides a way to
determine the suitable value with sysconf, so we should use it instead
of hard-coding a small value.
2019-06-24 23:41:40 +08:00
Philip Withnall
bd5922db09 Merge branch 'fix-stack-overrun' into 'master'
Avoid overrunning stack at the end of the varargs.

See merge request GNOME/glib!945
2019-06-24 13:27:33 +00:00
John Ralls
633e9e0bcb Avoid overrunning stack at the end of the varargs. 2019-06-21 16:18:40 -07:00
Philip Withnall
84d0af4226 Merge branch '1811-unicode-annotations' into 'master'
gunidecomp: Add (out) annotations to g_unichar_{de,}compose()

Closes #1811

See merge request GNOME/glib!936
2019-06-21 17:02:58 +00:00
Philip Withnall
9d668a6a86 Merge branch '872-ucs-annotations' into 'master'
Add missing (transfer) annotations to gutf8.c functions

Closes #872

See merge request GNOME/glib!938
2019-06-21 17:01:11 +00:00
Jeremy Tan
0fda1d46cb gstdio: simplify _g_win32_get_mode_alias
Do an in-place update on the wide-character mode string
2019-06-21 21:17:43 +10:00
Jeremy Tan
04dcee1814 gstdio: Ensure w32_err_to_errno is used everywhere, add ERROR_INVALID_PARAMETER handling
case switches in w32_err_to_errno have been alphabetically sorted.

The only addition is the ERROR_INVALID_PARAMETER->EINVAL case.
2019-06-21 21:17:29 +10:00
Tristan Partin
b9988e5fc9 Add g_timer_is_active
Helper function for exposing the internal state of a GTimer.
2019-06-21 10:22:41 +00:00
Philip Withnall
8f6e5f1b01 gutf8: Add various missing (transfer) annotations
Signed-off-by: Philip Withnall <withnall@endlessm.com>

Fixes: #872
2019-06-21 11:05:11 +01:00
Philip Withnall
5380f417dc gunidecomp: Fix a (nullable) annotation which should be (optional)
Signed-off-by: Philip Withnall <withnall@endlessm.com>

Helps: #872
2019-06-21 11:04:35 +01:00
Philip Withnall
79502febe0 gunidecomp: Add (out) annotations to g_unichar_{de,}compose()
The `(out)` and (unusually) `(not optional)` annotations were missing.

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

Fixes: #1811
2019-06-20 23:33:58 +01:00