Commit Graph

17926 Commits

Author SHA1 Message Date
Iñigo Martínez
a66f2f80e0 gdbus-codegen: Split C header and code generation functions
The generation of the C header and code preambles have been split
in order to be able to generate both files separately in the future.

The functions for generating preambles and postambles have also been
renamed following the function names used in the glib-genmarshal
rewrite, so that they stay consistent.

https://bugzilla.gnome.org/show_bug.cgi?id=791015
2018-01-15 16:06:01 +01:00
Iñigo Martínez
c658d03b76 gdbus-codegen: Add support for pragma inclusion guard
The #pragma once is widely supported preprocessor directive that can
be used instead of include guards.

This adds support for using optionally this directive instead of
include guards.

https://bugzilla.gnome.org/show_bug.cgi?id=791015
2018-01-15 16:05:26 +01:00
Iñigo Martínez
e59bce3c74 gdbus-codegen: Move from optparse to argparse
The optparse module is deprecated since version 2.7 and the
development continues with the argparse.

The code has been moved from optparse to argparse when parsing
command-line options. This has also led to the deprecation of the
`--xml-files`, and positional arguments should be used instead.

https://bugzilla.gnome.org/show_bug.cgi?id=791015
2018-01-15 16:03:39 +01:00
Iñigo Martínez
dcc1fe09d0 gdbus-codegen: Use Color's print_* methods
`glib-genmarshal` and `glib-mkenums` use a `Color` class which
implements a number of print_* methods to print colored messages
to the standard error output.

In order to be consistent with those programs' output,
`gdbus-codegen` has also started using that same class and methods.

https://bugzilla.gnome.org/show_bug.cgi?id=791015
2018-01-15 16:03:03 +01:00
Iain Lane
e2054240c2 gdatetime: Mark the usecs as volatile
On i386, we were seeing that this calculation was producing an incorrect
result, probably because usec was being stored in an 80-bit register
before being written back into a 64-bit float in memory. If we mark the
variables as volatile, they are not stored in registers and we avoid
this bug.
2018-01-15 11:54:47 +00:00
Robert Ancell
d870628782 gdatetime: Avoid repeated floating point multiplies with ISO 8601 parsing
This avoids any potential rounding errors.

https://bugzilla.gnome.org/show_bug.cgi?id=792410
2018-01-15 11:54:47 +00:00
Philip Withnall
e430541378 docs: Remove XML-style comments from documentation strings
gtk-doc doesn’t support them any more since it was ported to Markdown,
so they end up appearing in the generated documentation, which isn’t
great.

Mostly, they were used to split up things invisibly, which we can do in
other ways.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Reviewed-by: nobody
2018-01-12 15:29:29 +00:00
Philip Withnall
d3b07453ab docs: Add a link to the Wikipedia page on TOCTTOU races
Try and make it a bit more obvious that g_file_query_exists() is
generally A Bad Idea.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Reviewed-by: nobody
2018-01-12 12:10:16 +00:00
Philip Withnall
373bf178b6 docs: Fix syntax in GDBusInterfaceSkeleton documentation
gtk-doc was mis-parsing the combination of ` and :: and truncating some
of the documentation. Avoid that by using the D-Bus style of separating
interface and signal names using a dot.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Reviewed-by: nobody
2018-01-11 16:03:05 +00:00
Philip Withnall
9c638bbf04 docs: Fix a typo in the GDBusProxy documentation
Signed-off-by: Philip Withnall <withnall@endlessm.com>
Reviewed-by: nobody
2018-01-11 15:31:17 +00:00
Garrett Regier
6aa19a26cf gsequence: Add seq_is_end()
This avoids calling is_end() when the
GSequence is already determined, thus
avoids having to walk the tree.

https://bugzilla.gnome.org/show_bug.cgi?id=749583
2018-01-11 12:47:18 +00:00
Garrett Regier
ee8f7be3df gsequence: Kill check_iter_access()
Generally the GSequence has already been
determined by the caller. This saves quite
a few calls to get_sequence().

https://bugzilla.gnome.org/show_bug.cgi?id=749583
2018-01-11 12:46:57 +00:00
Philip Withnall
d020766325 docs: Fix typos in GConvert documentation
Signed-off-by: Philip Withnall <withnall@endlessm.com>
Reviewed-by: nobody
2018-01-11 11:54:14 +00:00
Tim-Philipp Müller
59c5b939e2 glib: fix compiler warning for g_unsetenv_utf8() on windows
"warning: 'void' function returning a value". Neither
g_unsetenv_utf8() nor g_unsetenv() return anything.
2018-01-10 17:24:36 +00:00
Tim-Philipp Müller
b241e3a5cc meson: only add -fno-strict-aliasing if supported by compiler
Fixes warning spam on MSVC builds.

https://bugzilla.gnome.org/show_bug.cgi?id=791622
2018-01-10 17:00:14 +00:00
Tim-Philipp Müller
f25c7a2a6e meson: fix G_DIR_SEPARATOR* define on Windows
Must double escape, once for Meson, once for the C string constant.

https://bugzilla.gnome.org/show_bug.cgi?id=757284
2018-01-10 15:57:46 +00:00
Tim-Philipp Müller
e7c044629f meson: change error() to warning() when checking if membarrier is needed
If we don't know the exact architecture that's not fatal, might just
be suboptimal, same as with autotools.

https://bugzilla.gnome.org/show_bug.cgi?id=792338
2018-01-10 15:49:27 +00:00
Christian Hergert
17e03effda gbookmarkfile: check length before dereferencing groups
There is no requirement that groups is NULL terminated, so we should check
that the bounds are within the specified length before checking for a
NULL terminating value.

https://bugzilla.gnome.org/show_bug.cgi?id=792351
2018-01-09 15:29:36 -08:00
Bastien Nocera
181d1c3052 GNetworkMonitor: Rename "network-changed" signal argument
Because the argument being called "available" and the property being
called "network-available" is confusing.

Also remove the details of what that value means, as it's already
described in the property, and duplicating the explanation makes it look
like it might have a different meaning.

https://bugzilla.gnome.org/show_bug.cgi?id=792370
2018-01-09 16:24:27 +00:00
Philip Withnall
c4ad10fede docs: Mention D-Bus reply types are tuples
The g_dbus_connection_call() documentation doesn’t make it clear that
the reply type is always a tuple.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Reviewed-by: nobody
2018-01-09 15:17:02 +00:00
Simon McVittie
2685a533af gdbus-threading test: Allow even longer for test_method_calls_in_thread
This should take 4 seconds + overhead, but on a slow or heavily
loaded system, there's no guarantee that it won't take significantly
longer.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=792364
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=884660
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-01-09 13:10:38 +00:00
Iñigo Martínez
a3d223d0e9 gdbus-codegen: Split license string
The license string which is embedded in the C header and body
preambles has been moved to a global variable. This way it can be
reused in both sections.

https://bugzilla.gnome.org/show_bug.cgi?id=791015
2018-01-09 13:13:08 +01:00
Mikhail Zabaluev
6dafc1ce13 Move G_DIR_SEPARATOR* and G_SEARCHPATH_SEPARATOR* into glibconfig.h
As platform-dependent macros, they belong in glibconfig.h.
This also makes it one less place where g-ir-scanner picks definitions
from the wrong ifdef branch; see
https://bugzilla.gnome.org/show_bug.cgi?id=696935

Meson configuration support is also added in this commit.

https://bugzilla.gnome.org/show_bug.cgi?id=757284
2018-01-09 12:08:40 +00:00
Michael Catanzaro
045b805199 tlsclientconnection: Deprecate ssl3 property and functions
I originally planned to introduce a new property and functions to
replace these, with the same behavior but less-confusing names. But that
might not be the best approach in the long run. Instead, let's just
deprecate them without replacement.

TLS 1.2 intolerance is no longer a thing in the wild, and no known
GTlsBackend supports TLS 1.3 yet. But you might need to use this
property in the future, even though it's deprecated, if your
GTlsBackend has added support for TLS 1.3 and you need to talk to a
server that is TLS 1.3 intolerant.

Independently of all that, these APIs simply no longer do what their
names suggest, so deprecation is sensible regardless.

https://bugzilla.gnome.org/show_bug.cgi?id=792217
2018-01-08 19:17:01 -06:00
Michael Catanzaro
9e5254ebce tlsclientconnection: Update use-ssl3 documentation
The property documentation correctly indicates how this code works
nowadays, but the function documentation is obsolete and misleading.
Update it.

https://bugzilla.gnome.org/show_bug.cgi?id=792217
2018-01-08 19:17:01 -06:00
Matthias Clasen
0d69e553fd Fix the build
autogen was failing due to this variable being
defined multiple times.
2018-01-08 14:25:17 -05:00
Matthias Clasen
7a2cc0f607 Updates for 2.55.1 2018-01-08 14:00:44 -05:00
Mikhail Zabaluev
ef65c160dc gbookmarkfile: fix up annotations
https://bugzilla.gnome.org/show_bug.cgi?id=756011
2018-01-08 18:26:25 +00:00
Florian Müllner
a55bfeee41 gdesktopappinfo: Add g_desktop_app_info_get_locale_string()
Custom desktop file fields may be translated, but there is currently
no non-hacky way to look up the localized value; fill get gap with
a small wrapper around g_key_file_get_locale_string().

https://bugzilla.gnome.org/show_bug.cgi?id=779413
2018-01-08 16:28:34 +01:00
Philip Withnall
84350cb566 gopenuriportal: Fix mismatched types in callback
The source object for this asynchronous operation is the GXdpOpenURI,
not a GDBusConnection. This was causing crashes in method calls on the
connection, unsurprisingly.

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

https://bugzilla.gnome.org/show_bug.cgi?id=791720
2018-01-08 15:16:19 +00:00
Philip Withnall
eba53aa07e build: Add missing test GSchema XML file to dist list
This was introduced in bug #742997, but not added to the Makefile.am, so
it’s missing from tarballs.

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

https://bugzilla.gnome.org/show_bug.cgi?id=792322
2018-01-08 12:05:21 +00:00
Philip Withnall
e42ff0105d docs: Mention that we build with strict-aliasing disabled
Hopefully discouraging people from overriding that and building with it
enabled.

Pro-tip: GLib will break.

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

https://bugzilla.gnome.org/show_bug.cgi?id=791622
2018-01-08 12:00:39 +00:00
Philip Withnall
ade324f6fa build: Enable -fno-strict-aliasing
GLib makes various assumptions about aliasing throughout its codebase,
and compiling with -fstrict-aliasing has been demonstrated to cause
problems (for example, bug #791622). Explicitly disable strict aliasing
as a result.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-01-08 11:50:31 +00:00
Philip Withnall
97d24b93ab glib: Fix strict-aliasing warnings with g_clear_pointer()
gpointer* cannot be aliased with arbitrary types. In order to fix
-Wstrict-aliasing=2 warnings with the g_clear_pointer() macro, we need
to cast through char*, which is allowed to alias with anything.

Even if we don’t make GLib strict-aliasing safe, it’s important to
ensure this macro is safe, since it could be used from projects which do
compile with -fstrict-aliasing.

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

https://bugzilla.gnome.org/show_bug.cgi?id=791622
2018-01-08 11:50:31 +00:00
Philip Withnall
d8fe926ba4 Fix various strict aliasing problems with sockaddr
Fix various strict aliasing problems caused by casting between (struct
sockaddr *) and (struct sockaddr_storage *): the correct code here is to
keep the two in a union.

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

https://bugzilla.gnome.org/show_bug.cgi?id=791622
2018-01-08 11:50:26 +00:00
Philip Withnall
8f7cc8cb75 gkeyfile: Document need for KEEP_TRANSLATIONS with get_locale_string()
When using g_key_file_get_locale_string() or get_locale_string_list(),
the GKeyFile must have been loaded with G_KEY_FILE_KEEP_TRANSLATIONS if
the lookup locale differs from the one which was current when the key
file was loaded.

Document that.

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

https://bugzilla.gnome.org/show_bug.cgi?id=792324
2018-01-08 10:55:42 +00:00
Tim-Philipp Müller
7c8906dcda meson: skip optional linux deps that default to true when building on Windows
As 'auto' dependency checking has been declared undesirable,
skip checking of optional dependencies where the option
defaults to true, but where the option doesn't make sense for
the operating system we're building for. Example: selinux only
makes sense on Linux, people compiling on Windows or macOS
shouldn't have to specify -Dselinux=false to get glib to build.

https://bugzilla.gnome.org/show_bug.cgi?id=792129
2018-01-07 12:02:59 +00:00
Simon McVittie
7f3bfcb891 cancellable: Don't assert if finalization races with cancellation
Commit 281e3010 narrowed the race between GCancellable::cancelled and
GCancellableSource's finalize(), but did not prevent it: there was
nothing to stop cancellation from occurring after the refcount drops
to 0, but before g_source_unref_internal() bumps it back up to 1 to
run finalize().

GCancellable cannot be expected to detect that situation, because the
only way it has to detect last-unref is finalize(), but in that
situation finalize() hasn't happened yet.

Instead of detecting last-unref, relax the precondition a little
to make it detect finalization: priv is only poisoned (set to NULL)
after the finalize() function has been called, so we can assume that
GCancellable has already seen finalize() by then.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=791754
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=884654
2018-01-05 20:42:06 +00:00
Simon McVittie
a4686b8ea1 g_source_set_ready_time: Move no-op fast-path under the lock
If we don't take the lock, then we don't have the necessary
"happens before" relationships to avoid this situation:

* source->priv->ready_time was equal to ready_time until recently
* another thread has set source->priv->ready_time to a different value
* that write hasn't become visible to this thread yet
* result: we should reset the ready_time, but we don't

Signed-off-by: Simon McVittie <smcv@collabora.com>
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=791754
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=884654
2018-01-05 20:42:06 +00:00
Philip Withnall
ca1aaccbff docs: Remove redundant sentence from g_prefix_error() documentation
Signed-off-by: Philip Withnall <withnall@endlessm.com>
Reviewed-by: nobody
2018-01-05 19:36:07 +00:00
Philip Withnall
32b2ab9492 docs: Fix some odd grammar in the GDBusError documentation
Signed-off-by: Philip Withnall <withnall@endlessm.com>
Reviewed-by: nobody
2018-01-05 19:29:35 +00:00
Philip Withnall
7c2fd10fe4 docs: Remove some latent DocBook usage in the GObjectClass documentation
Replace it with gtk-doc syntax.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-01-05 16:44:18 +00:00
Christoph Reiter
2939585bd6 meson: work around meson not passing on the threads dependency when link_with is used
When using link_with with declare_dependency() or executable() the threads
dependency is not passed on. To work around the issue add the threads dependency
manually. See https://github.com/mesonbuild/meson/issues/1426

This makes the static build on Linux work.

https://bugzilla.gnome.org/show_bug.cgi?id=788806
2018-01-05 15:29:00 +01:00
Arnaud Bonatti
6d009bc56a Add ‘gsettings list-schemas --print-paths’ option
Prints next to the name of non-relocatable schemas their paths.

https://bugzilla.gnome.org/show_bug.cgi?id=792064
2018-01-05 13:01:03 +00:00
Michael Catanzaro
617d40c13b Bump to version 2.55.1
So that GIO modules may begin using the static linking support.
2018-01-04 16:34:33 -06:00
Christoph Reiter
cf93b27ceb meson: fix static build under Windows
Properly define GLIB/GOBJECT_STATIC_COMPILATION when static build is enabled.
Use library() instead of shared_library() to allow selecting static builds.

https://bugzilla.gnome.org/show_bug.cgi?id=784995
2018-01-04 22:21:40 +01:00
Christoph Reiter
aa7c5cbdcb meson: build Windows resource files
configure_file() forces utf-8 atm but .rc files are not utf-8.
To work around the issue just remove the only non-ASCII char.

https://bugzilla.gnome.org/show_bug.cgi?id=784995
2018-01-04 22:19:30 +01:00
Xavier Claessens
0e7b82abb9 GTypeModule: Allow registering static types
This makes easier to write a module that can be both dynamic and static.
It will allow to statically build modules from glib-networking, for
example.

A module can rename its g_io_module_load() function to
g_io_<modulename>_load(), and then an application which links statically
against that module can call g_io_<modulename>_load(NULL) to register
types and extension points from the module. If a module is loaded
dynamically, its load() function will continue to be called with a
non-NULL GIOModule instance.

https://bugzilla.gnome.org/show_bug.cgi?id=684282
2018-01-04 11:04:07 -05:00
Xavier Claessens
7f69b828fc GIOModule: Use unique names for load/unload symbols
GIO modules should include their name into their exported symbols to
make them unique. This avoids symbol clash when building modules
statically.

extract_name() function is copied from GStreamer which recently
switched to the same symbol naming scheme.

https://bugzilla.gnome.org/show_bug.cgi?id=684282
2018-01-04 11:01:40 -05:00
Philip Withnall
e91c118418 Revert "gmain: only signal GWakeup right before or during a blocking poll"
This reverts commit 9ba95e25b7.

It is causing undiagnosed problems with WebKit and other users of GLib.
See https://bugzilla.gnome.org/show_bug.cgi?id=761102#c44 and
https://bugzilla.gnome.org/show_bug.cgi?id=761102#c46.

Reverting it until someone works out what the problem is.

https://bugzilla.gnome.org/show_bug.cgi?id=761102
2018-01-03 11:27:25 +00:00