Commit Graph

19550 Commits

Author SHA1 Message Date
Christoph Reiter
947b585ca6 msvc: set the execution and source encoding to utf-8. Fixes #1294
gcc defaults to utf-8 for both (see -fexec-charset and -finput-charset in the
gcc man page) so we should use it with msvc as well.

msvc by default uses the locale encoding unless there is a BOM, see
https://msdn.microsoft.com/en-us/library/mt708821.aspx
2018-05-27 20:54:37 +02:00
Xavier Claessens
ef4d960d2c Merge branch 'msvc-glib-tests' into 'master'
msvc: build the glib tests and ignore the test outcome

See merge request GNOME/glib!22
2018-05-27 11:45:27 +00:00
Christoph Reiter
583fb1a397 win32: make g_cond_wait_until() wait at least until end_time before returning with a timeout. See #1371
The tests in test_async_queue_timed() assume that g_async_queue_timeout_pop()
and in turn g_cond_wait_until() wait at least until end_time
before returning, i.e. calling g_get_monotonic_time() after the timeout should result
in a value equal or larger than the timeout end time.

For the win32 implementation of g_cond_wait_until() this isn't the case which
makes those tests fail.

There are three reasons why the function returns early:

1) The underlying API works with milliseconds and the timeout gets rounded
   down, resulting in a too small timeout value.
2) In case the timeout is too large to be passed to the API it gets limited
   (there is also a bug because it converts INFINITE to milliseconds while
   they already are, but using INFINITE would be wrong as well, as passing
   a large timeout is not the same as blocking forever really)
3) Even with the rounding changed the underlying API still returns a bit early
   sometimes on my machine (relative to g_get_monotonic_time())

This changes the implementation to round up to the next millisecond (fixing 1)
and to wait again in case a timeout occurs but the end time hasn't been
reached yet (fixing 2 and 3).

This makes the test_async_queue_timed() tests pass.

https://bugzilla.gnome.org/show_bug.cgi?id=795569
2018-05-27 11:09:29 +02:00
Christoph Reiter
01c02ac08b g_usleep: round up the next millisecond on Windows. See #1371
The timer tests expect that a small value for sleep does not result in
no sleep at all. Round up to the next millisecond to bring it more in line
with other platforms.

This fixes the glib/timer tests.

This makes the 'threadtests' time out since that uses small usleeps a lot and
until now didn't wait at all, but now always waits a msec. Reduce the amount
of tests done on Windows to get the runtime down to something reasonable again.

https://bugzilla.gnome.org/show_bug.cgi?id=795569
2018-05-27 09:23:25 +02:00
Christoph Reiter
79af48791a msvc: build the glib tests and ignore the test outcome
This makes the tests build under VS2015/2017.
Since some of them fail, similar to the mingw build, ignore any test errors for now.
2018-05-27 08:14:06 +02:00
Philip Withnall
ab116c3111 Merge branch 'ci-timeout-mult' into 'master'
tests: Increase the timeout of the 'objects2' and 'sequence' tests

Closes #1393

See merge request GNOME/glib!23
2018-05-27 00:21:53 +00:00
Christoph Reiter
5dfdcb372f ci: unify the test timeout multiplier across jobs
Introduce a MESON_TEST_TIMEOUT_MULTIPLIER env var and use it in all test scripts.
2018-05-26 20:19:53 +02:00
Christoph Reiter
e894534314 tests: Increase the timeout of the 'objects2' and 'sequence' tests. Fixes #1393
These two still fail occasionally due to timeouts, so increase it a bit.
2018-05-26 20:19:53 +02:00
Nirbheek Chauhan
545641a8fb glib-compile-resources: Use g_fprintf() instead of fprintf()
G_GSIZE_FORMAT and friends cannot always be used with fprintf(), they
require gnu/C99 implementation.

https://bugzilla.gnome.org/show_bug.cgi?id=796283
2018-05-26 13:16:13 +05:30
Xavier Claessens
00178f8c8e Fix build error when compiling with mingw
uintptr_t must be defined when including valgrind.h, just move it as
last include solves the problem.

https://bugzilla.gnome.org/show_bug.cgi?id=796283
2018-05-26 13:09:56 +05:30
Xavier Claessens
d89c8894a8 gslice: Use g_fprintf() instead of fprintf()
G_GSIZE_FORMAT and friends cannot always be used with fprintf(), they
require gnu/C99 implementation.

https://bugzilla.gnome.org/show_bug.cgi?id=796283
2018-05-26 13:09:56 +05:30
Xavier Claessens
bd61ed4fab Merge branch 'msvc-ci' into 'master'
ci: Add a VS2017 job

See merge request GNOME/glib!2
2018-05-26 01:50:18 +00:00
Philip Withnall
0c1494ca1f Merge branch 'docpriv' into 'master'
doc: Interface for derivable object

See merge request GNOME/glib!6
2018-05-25 20:38:00 +00:00
Pavlo Solntsev
9e62a425bd doc: Interface for derivable object 2018-05-25 12:50:21 -05:00
Philip Withnall
d9df5d72e1 Merge branch '1354-volume-nullable' into 'master'
Resolve "Missing nullable annotation on the return value of gio_volume_get_mount"

Closes #1354

See merge request GNOME/glib!4
2018-05-25 14:15:18 +00:00
Xavier Claessens
ef52658bb6 Merge branch 'macosx-remove-fixme' into 'master'
Meson: Remove FIXME about missing checks for macosx <= 10.3

Closes #1380

See merge request GNOME/glib!11
2018-05-25 14:02:03 +00:00
Xavier Claessens
d64ce3a538 Meson: Remove FIXME about missing checks for macosx <= 10.3
Our minimum requirement is already greater than that, so we don't need
to add checks there. We can always add -Wl,-framework,CoreFoundation
flag.

Fixes #1380.
2018-05-25 09:50:52 -04:00
Philip Withnall
89c6d64a97 Merge branch 'master' into 'master'
macros: Double-cast func for g_autolist to avoid warning

Closes #1382 and #1390

See merge request GNOME/glib!8
2018-05-25 13:13:33 +00:00
Philip Withnall
d981b997ca Merge branch 'wunused' into 'master'
build: Add -Wunused to the set of standard warnings

See merge request GNOME/glib!9
2018-05-25 13:05:09 +00:00
Philip Withnall
170cf5a397 build: Add -Wunused to the set of standard warnings
This may catch problems like #1390 in future.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-05-25 13:38:29 +01:00
Jan Alexander Steffens (heftig)
c7d11d3418
macros: Double-cast func for g_autolist to avoid warning
For g_autolist and g_autoslist, the cleanup func was cast to
GDestroyNotify before being passed to g_(s)list_free_full. This cast
provokes GCC 8 to emit a warning if the return type is not void:

    …/gmacros.h:462:99: warning: cast between incompatible function types
    from … to 'void (*)(void *)' [-Wcast-function-type]

Cast to 'void (*)(void)' first, which suppresses the warning as
recommended by the GCC documentation. g_autoptr remains untouched.

Fixes https://gitlab.gnome.org/GNOME/glib/issues/1382
2018-05-25 14:14:40 +02:00
Colin Walters
b41bff1fe9
gmacros: Add G_GNUC_UNUSED for autoptr funcs (notably GLists)
In commit f49a93b207
from bug https://bugzilla.gnome.org/show_bug.cgi?id=791342
we added two new static inline cleanup helpers in case a type was
used inside a list.

These functions will commonly be unused.

In rpm-ostree, we run a build using `CC=clang -Werror=unused` because
it catches `g_autofree char *foo = NULL;` as unused, but GCC doesn't.
When trying to update to F28 with a newer glib, our CI fell over on this.

Mark all of the autocleanups as "maybe unused".
2018-05-25 14:04:58 +02:00
Christoph Reiter
e7259c52ba ci: Add a VS2017 job
Thanks to Xavier Claessens for figuring out what is needed.
2018-05-25 11:44:14 +02:00
Chun-wei Fan
bbcce75d4e glib/valgrind.h: Disable inline ASM on MSVC x64 builds
Visual Studio x64 builds do not allow inline assembly code, so we need
to re-add the code that disables inline assembly when we build with
Visual Studio for x64 builds, as we did before.  This is necessary when
we update the included valgrind.h.
2018-05-25 17:16:22 +08:00
Xavier Claessens
8f2d68da65 Merge branch 'macosx-objc' into 'master'
Macosx fixes

Closes #528 and #1381

See merge request GNOME/glib!3
2018-05-25 03:13:38 +00:00
Xavier Claessens
c627fb4926 Fix missing osx files when running "make dist"
Fixes #528, #1381.
2018-05-25 03:06:07 +00:00
Xavier Claessens
d3735df34f Revert "Revert "Meson: Fix cocoa and carbon support""
This reverts commit e25a2f95b3.
2018-05-25 03:06:07 +00:00
Xavier Claessens
ead46cdc7e Revert "Revert "Rename objective-c files from .c to .m""
This reverts commit 2e9f3a9afe.
2018-05-25 03:06:07 +00:00
Emmanuele Bassi
534e939500 Merge branch 'coverage-regex' into 'master'
ci: Add a regex to parse line coverage statistics from genhtml output

See merge request GNOME/glib!5
2018-05-25 02:00:33 +00:00
Philip Withnall
524d96fd92 ci: Add a regex to parse line coverage statistics from genhtml output
GitLab can then use this to annotate each pipeline with its code
coverage statistics. It can only use one figure, so we choose lines
(rather than function or branch coverage) since it’s the most intuitive
figure.

This parses the ‘lines’ line from output like:

Overall coverage rate:
  lines......: 76.7% (108959 of 142122 lines)
  functions..: 80.7% (10294 of 12763 functions)
  branches...: 51.3% (50226 of 97953 branches)

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-05-24 23:44:53 +01:00
Philip Withnall
41ec0b9c60 gio: Add missing (nullable) annotations to GDrive, GMount, GVolume
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://gitlab.gnome.org/GNOME/glib/issues/1354
2018-05-24 23:29:17 +01:00
Christoph Reiter
f92d179f77 tests/strfuncs: drop some redundant test code
The loop was testing that all strings in the hash table are valid
utf-8, but the loop filling the hash table is already doing that.

https://bugzilla.gnome.org/show_bug.cgi?id=795569
2018-05-24 23:17:08 +02:00
Christoph Reiter
dad754f5bc tests/strfuncs: mingw-w64 prints 3 digits for the %e exponent
Filed and fixed upstream: https://sourceforge.net/p/mingw-w64/bugs/732/

Once we get a new release in MSYS2 or when we get better gnulib integration
this special case needs to be removed again, but for now this will do.

https://bugzilla.gnome.org/show_bug.cgi?id=795569
2018-05-24 23:17:08 +02:00
Christoph Reiter
044e65ee28 tests/strfuncs: handle unknown error codes when testing g_strerror
The tests checks that g_strerror returns unique error messages for
all error codes between 1-200, but under Windows only a small range of them
is actually used: https://msdn.microsoft.com/en-us/library/t3ayayh1.aspx

Change the test to check that the returned message is either unique or
matches the error message for unknown codes instead.

https://bugzilla.gnome.org/show_bug.cgi?id=795569
2018-05-24 23:17:08 +02:00
Christoph Reiter
3e5477b04b tests/logging: Don't hardcode the result of logging a pointer
The output of the %p type is implementation defined and on Windows we get
leading zeros depending on the pointer type size. Instead of adding
ifdeffery use g_snprintf() to generate the expected message.

https://bugzilla.gnome.org/show_bug.cgi?id=795569
2018-05-24 23:17:03 +02:00
Peter Bloomfield
1a6be02260 gmem.h: Use typeof() in g_steal_pointer() macro
g_steal_pointer is both an inline function, returning gpointer, and a
macro that casts the return value to the type of its argument. The first
version of the macro uses '0 ? (*(pp)) : (g_steal_pointer) (pp)' to cast
the return value to the type of *pp, but this fails to yield warnings
about incompatible pointer types with current gcc. Apparently the
ternary operator is optimized away before the type of the expression is
determined.

The typeof() (or __typeof__()) operator allows an explicit cast.

https://bugzilla.gnome.org/show_bug.cgi?id=742456

https://bugzilla.gnome.org/show_bug.cgi?id=796341
2018-05-23 17:49:31 +01:00
Matthias Clasen
d5869fc597 2.57.1 2018-05-22 17:21:16 -04:00
Matthias Clasen
2e9f3a9afe Revert "Rename objective-c files from .c to .m"
This reverts commit e400af99d4.
2018-05-22 17:21:16 -04:00
Matthias Clasen
e25a2f95b3 Revert "Meson: Fix cocoa and carbon support"
This reverts commit 2e3769a4f7.
2018-05-22 17:21:16 -04:00
Руслан Ижбулатов
52c45a102b W32: check filename for being NULL in g_stat()
Previous version of this function started with a call to g_utf8_to_utf16(),
which also served as a NULL check, since g_utf8_to_utf16() just returns NULL
on NULL strings. Current version of this function does some filename string
checks first and converts it to utf16 only after these checks are done, and
these checks do not take into account the possibility of filename being NULL.

Fix this by explicitly checking for NULL.
2018-05-22 16:43:35 +00:00
Xavier Claessens
2e3769a4f7 Meson: Fix cocoa and carbon support
- Compiler checks were failing because it were using C compiler to build
objc code.
- xdgmime is needed on osx too.
- -DGIO_COMPILATION must be passed to objc compiler too.
- gapplication doesn't build on osx, it is excluded in autotools too.

We have to be careful when we use add_project_link_arguments(): All
targets are built using link arguments for the C language, except for
libgio on osx which use the objc language, because it contains some ".m"
source files. See https://github.com/mesonbuild/meson/issues/3585.

https://bugzilla.gnome.org/show_bug.cgi?id=796214
2018-05-22 11:51:59 -04:00
Xavier Claessens
e400af99d4 Rename objective-c files from .c to .m
Those files got renamed to .c to work around an automake issue, but
Meson needs them to have .m extension. Better rename them at build time
in Makefile.am since that's where the workaround is needed.

https://bugzilla.gnome.org/show_bug.cgi?id=672777
2018-05-22 11:49:24 -04:00
Nirbheek Chauhan
458b6288bf gengiotypefuncs.py: Read and parse files in binary mode
Fixes this build error on macOS when inside an ssh terminal:

Traceback (most recent call last):
  File "[...]/gio/tests/gengiotypefuncs.py", line 23, in <module>
    for line in f:
  File "[...]/lib/python3.6/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 2625: ordinal not in range(128)

https://bugzilla.gnome.org/show_bug.cgi?id=796328
2018-05-22 14:34:17 +05:30
Nirbheek Chauhan
74af384153 meson: Add exception for atomic ops test for Android
Some compilers, particularly Android on armv5 and old versions of Clang
provide atomic ops, but don't define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
so we need to define it ourselves.

This matches what configure does, with the exception that now it's only
done for Android since clang defines __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
now.

https://bugzilla.gnome.org/show_bug.cgi?id=796325
2018-05-22 14:34:16 +05:30
Philip Withnall
0b60f2589f build: Remove an unnecessary ‘dnl’ from meson.build
Signed-off-by: Philip Withnall <withnall@endlessm.com>
Reviewed-by: nobody
2018-05-22 09:48:42 +01:00
Philip Withnall
c16e8af351 build: Migrate G_ATOMIC_LOCK_FREE docs from configure.ac to meson.build
The explanation of how G_ATOMIC_LOCK_FREE is meant to be used is useful.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Reviewed-by: nobody
2018-05-22 09:48:04 +01:00
Mathieu Duponchelle
3c9a7ec270 meson: do not run atomic test with msvc
The latest patches have fixed the atomic check, which
uses __sync_bool_compare_and_swap , and thus fails on
MSVC.

As a result, in gatomic.c, we ended up trying to include
pthread.h, which failed.

This mimics the old behaviour a bit more closely, where
G_ATOMIC_LOCK_FREE was always defined in the win32
glibconfig.h

https://bugzilla.gnome.org/show_bug.cgi?id=796220
2018-05-22 09:44:34 +01:00
Nirbheek Chauhan
7551267f19 meson: Fix checks for posix_memalign and stpcpy
The 'no-builtin' checks were just plain wrong. For accurate detection of
functions, use has_function with a header in the prefix. This fixes
posix_memalign detection on Android and on MinGW32, MSYS-MinGW-w64, and
old versions of MSYS2-MinGW-w64.

Using the header in the `prefix:` is generally a good idea because of
how macOS does targetting of specific macOS releases at compile time.

This also allows cross-files to override the result by setting
`has_function_stpcpy = false`, etc in [extra properties]

https://bugzilla.gnome.org/show_bug.cgi?id=795876
2018-05-21 21:10:53 +05:30
Xavier Claessens
e2c154d9d8 Meson: Remove legacy code used to write pc files
We are using meson's generator now so those variables are not used
anymore.

https://bugzilla.gnome.org/show_bug.cgi?id=796264
2018-05-20 08:16:11 -04:00
Christoph Reiter
eceac66e86 meson: Don't skip snprintf/vsnprintf checks under MinGW
The comment stated that the test isn't good enough, but it correctly
detects a C99 printf when I build with -D__USE_MINGW_ANSI_STDIO=1
and an incompatible printf without it.

Using mingw-w64 from current MSYS2.

https://bugzilla.gnome.org/show_bug.cgi?id=795569
2018-05-18 18:54:57 +02:00