Commit Graph

1751 Commits

Author SHA1 Message Date
Nirbheek Chauhan
625bfa0b36 meson: Fix comment explaining gdb hacks
https://bugzilla.gnome.org/show_bug.cgi?id=788772
2017-11-02 10:03:22 +05:30
Jan Alexander Steffens (heftig)
430e2dd3f5 meson: Fix GDB scripts install_dir for *nix
Disable installation on Windows for now as this would use a colon in the
directory name.

https://bugzilla.gnome.org/show_bug.cgi?id=788772
2017-11-02 09:58:17 +05:30
Philip Withnall
c74ab4a1db gobject: Fix typo in documentation for g_param_spec_get_default_value()
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-11-01 11:13:27 +00:00
Sam Spilsbury
34148fc9b9 mkenums: Don't raise when unlinking a file that does not exist
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=789637
2017-10-31 15:23:16 +00:00
Philip Withnall
3eacec1587 Use hash tables as sets in various places
Where we were already treating GHashTables as sets, modify them to use
the set-specific APIs g_hash_table_add() and g_hash_table_contains(), to
make that usage more obvious and less prone to being broken.

Heavily based on patches by Garrett Regier <garrettregier@gmail.com>.

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

https://bugzilla.gnome.org/show_bug.cgi?id=749371
2017-10-26 12:27:17 +01:00
Stef Walter
7641aedd5b Clarify documentation of GValueTransform
Note in documentation of GValueTransform that dest_value
is already initialized.

https://bugzilla.gnome.org/show_bug.cgi?id=632953
2017-10-26 12:11:01 +01:00
Philip Withnall
9a319a126e glib-genmarshal/glib-mkenums: Add comment clarifying licensing
Clarify the licensing of the code generated by the two scripts in a
comment in the header of each generated file. The intention is that the
license of GLib does *not* apply to the generated files; but that they
are subject to the linking restrictions of the LGPL, since they link to
GLib and GLib is licensed under the LGPL. The generated files themselves
are under the license of whatever project they’re generated for.

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

https://bugzilla.gnome.org/show_bug.cgi?id=788990
2017-10-25 12:39:23 +01:00
Emmanuele Bassi
9023fa350d Sort the list of files being processed by glib-mkenums
We should ensure a stable order when processing the files, regardless of
the order they were submitted on the command line, to increase the
chances of a reproducible build.

The old Perl-based version of glib-mkenums was fixed in commit 8686e430
to do the same.

https://bugzilla.gnome.org/show_bug.cgi?id=691436
2017-10-24 14:09:31 +01:00
Philip Withnall
fcfbaf8566 glib-mkenums: Add default comment template if none is provided
The fallback code for providing a default comment template only worked
if a template file was provided. It didn’t work if individual templates
were provided on the command line (and --comment wasn’t).

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

https://bugzilla.gnome.org/show_bug.cgi?id=788990
2017-10-19 11:29:04 +01:00
Philip Withnall
df7e4db65a glib-mkenums: Fix typo in version string
This is glib-mkenums, not glib-genmarshal.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-10-17 14:02:27 +01:00
Andrew Potter
5564ddef12 gdate: add g_date_copy()
This will allow passing invalid GDates through GValues.

https://bugzilla.gnome.org/show_bug.cgi?id=760109
2017-10-11 12:13:20 +01:00
Jan Alexander Steffens (heftig)
30b25a6fd9 meson: Fix permissions of installed scripts
configure_file preserves the attributes, so the templates need to be
executable for the (installed) outputs to be executable.

https://bugzilla.gnome.org/show_bug.cgi?id=787671
2017-10-11 09:49:26 +01:00
Philip Withnall
9cbff9f768 gclosure: Fix (transfer) annotations on GClosure constructors
They return floating references. The convention established by GVariant
is to annotate these as (transfer none) so that the caller does a
ref+sink on them, rather than just a ref.

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

https://bugzilla.gnome.org/show_bug.cgi?id=677233
2017-10-06 11:17:33 +01:00
Chun-wei Fan
a7a6449f4d meson: Install items according to their relevance
The m4 and bash completion items are usable and relevant
depending on the host system's configuration.  So, we check for the
presence of the programs that these items depend on, and only install
them when those programs are found.

For the Valgrind suppression files, we don't install them on Windows as
Valgrind is currently not supported on Windows.

Als fix the path where the GDB helpers are installed, as the path is
incorrectly constructed.

This will fix the "install" stage when building on Visual Studio at
least as there are some post-install steps that are related to them,
which will make use of these programs.

https://bugzilla.gnome.org/show_bug.cgi?id=783270
2017-09-14 16:02:03 +08:00
Nicolas Dufresne
0d9c5122bc valuearray: Skip g_value_array_free() in bindings
Calling this function can easily lead to an interpreter crash.

https://bugzilla.gnome.org/show_bug.cgi?id=780202
2017-09-11 21:11:55 +01:00
Mikhail Zabaluev
0ea004c6f9 gobject: Skip more non-introspectable data/qdata methods
https://bugzilla.gnome.org/show_bug.cgi?id=756588
2017-09-11 20:34:46 +01:00
Mikhail Zabaluev
1e45c0a0e1 gobject: Add missing (nullable) and (out) annotations on the data/qdata API
https://bugzilla.gnome.org/show_bug.cgi?id=756588
2017-09-11 20:34:45 +01:00
Federico Mena Quintero
51e852e5d0 validate_pspec_to_install(): Factor out function to validate a GParamSpec
This was duplicated also in g_object_interface_install_property().

Now, validations specific to classes happen in
validate_and_install_class_property() - specifically, the checks for
the presence of the get_property() and set_property() methods.

https://bugzilla.gnome.org/show_bug.cgi?id=787551
2017-09-11 12:44:45 -05:00
Federico Mena Quintero
20720eaf1e validate_and_install_property(): Check pspec-specific fields in the same order as g_object_interface_install_property()
https://bugzilla.gnome.org/show_bug.cgi?id=787551
2017-09-11 12:44:45 -05:00
Federico Mena Quintero
95f44b280f validate_and_install_property(): Validate presence of get/set_property methods last
https://bugzilla.gnome.org/show_bug.cgi?id=787551
2017-09-11 12:44:45 -05:00
Federico Mena Quintero
1b08414f06 g_object_interface_install_property(): Do interface-specific validations first
https://bugzilla.gnome.org/show_bug.cgi?id=787551
2017-09-11 12:44:45 -05:00
Federico Mena Quintero
e667d0d4c0 install_property_internal(): Propagate failure when installing duplicated properties
https://bugzilla.gnome.org/show_bug.cgi?id=787551
2017-09-11 12:44:41 -05:00
Federico Mena Quintero
9dd9fe4feb validate_and_install_class_property(): Factor out function to add a new property to a class
This was duplicated between g_object_class_install_property() and
g_object_class_install_properties().

https://bugzilla.gnome.org/show_bug.cgi?id=787551
2017-09-11 11:26:01 -05:00
Federico Mena Quintero
85ef144334 GObjectClass: extract class type and parent type at the beginning
https://bugzilla.gnome.org/show_bug.cgi?id=787551
2017-09-11 11:26:01 -05:00
Federico Mena Quintero
7d9a6c8687 GObjectClass: Validate installing property/properties in the same way
Then we'll be able to factor out duplicated code.

https://bugzilla.gnome.org/show_bug.cgi?id=787551
2017-09-11 11:26:01 -05:00
Emmanuele Bassi
100b83a7fa genmarshal Only wrap body prototypes in C++ guards
Commit 31ae2c5598 added the C++ guards
around all prototypes, including inside the header file. The header
file, though, already has C++ guards, so while it's harmless to have
them there, it's also unnecessary.

We should only emit C++ guards around the prototypes we include in the
generated source.
2017-08-25 09:53:56 +01:00
Ernestas Kulik
00f5d2ffa2 gobject: add autoptr support for GClosure
This commit defines a g_autoptr() cleanup function for use with
GClosure.

https://bugzilla.gnome.org/show_bug.cgi?id=786360
2017-08-16 16:19:28 +03:00
Mihai Moldovan
31ae2c5598 glib-genmarshal: wrap prototypes in G_{BEGIN,END}_DECLS.
Since --header --body has been deprecated and replaced with --body
--prototypes, the generated body is not wrapped with G_{BEGIN,END}_DECLS
any longer. Projects using C++ break due to that. Automatically wrap
prototypes individually in G_{BEGIN,END}_DECLS instead.

https://bugzilla.gnome.org/show_bug.cgi?id=785554
2017-08-07 17:07:06 +01:00
Alberts Muktupāvels
8cc9950202 glib-mkenums: fix parsing of flags annotation
https://bugzilla.gnome.org/show_bug.cgi?id=779332
2017-08-01 10:24:44 +01:00
Emmanuele Bassi
ca69df0f16 Revert "glib-mkenums: fix parsing of /*< flags >*/ annotation"
This reverts commit 1672678bc4.

A more comprehensive fix will follow.
2017-08-01 10:11:09 +01:00
Christoph Reiter
867b5e6f90 glib-mkenums: Python2: use locale encoding when redirecting stdout
In case of Python 2 and stdout being redirected to a file, sys.stdout.encoding
is None and it defaults ASCII for encoding text.

To match the behaviour of Python 3, which uses the locale encoding also when
redirecting to a file, wrap sys.stdout with a StreamWriter using the
locale encoding.

https://bugzilla.gnome.org/show_bug.cgi?id=785113
2017-07-26 22:27:48 +02:00
Christoph Reiter
b92e15c75d glib-mkenums: fix encoding error when writing files
Instead of using NamedTemporaryFile, which doesn't take an encoding in Python 2
use mkstemp() to create a file and open it with io.open(), with a proper
encoding set.

https://bugzilla.gnome.org/show_bug.cgi?id=785113
2017-07-22 20:47:43 +02:00
Christoph Reiter
d88d1ba7e8 glib-mkenums: Don't use FileNotFoundError, it's Python 3 only.
https://bugzilla.gnome.org/show_bug.cgi?id=785113
2017-07-19 14:21:24 +02:00
Christoph Reiter
c2dace6b8b glib-mkenums: Use utf-8 for reading files
On Windows open() defaults to ANSI and on Python 2 it doesn't take
an encoding. Use io.open() instead which provides the same interface
on both Python versions.

https://bugzilla.gnome.org/show_bug.cgi?id=785113
2017-07-19 14:21:20 +02:00
Emmanuele Bassi
2219cfb92d mkenums: Keep compatibility with Python 2.x
Since every other tool in GLib is allowed to be used with Python 2.x,
glib-mkenums should follow suit.
2017-07-17 16:29:40 +01:00
Emmanuele Bassi
f18556749c mkenums: Skip unparsed lines
The old glib-mkenums just skipped lines it could not understand.
2017-07-17 16:11:19 +01:00
Emmanuele Bassi
4f17d1049f mkenums: Add missing --fprod handler
We are not generating the template for the --fprod command line
argument.
2017-07-17 11:15:06 +01:00
Emmanuele Bassi
3c03cc8f68 meson: Simplify the use of built tools
The Meson build has fallen a bit behind the Autotools one, when it comes
to the internally built tools like glib-mkenums and glib-genmarshals.

We don't need to generate gmarshal.strings any more, and since the
glib-genmarshal tool is now written in Python it can also be used when
cross-compiling, and without indirection, just like we use glib-mkenums.

We can also coalesce various rules into a simple array iteration, with
minimal changes to glib-mkenums, thus making the build a bit more
resilient and without unnecessary duplication.
2017-07-17 11:05:07 +01:00
Emmanuele Bassi
7ee050dc4b mkenums: Use the same reporting functions from genmarshal
We can reuse the same code to make error reporting stand out a bit more,
with colors and potentially with the ability to make warnings fatal.
2017-07-17 10:32:33 +01:00
Emmanuele Bassi
69515e9f5c mkenums: Skip files not found
The old glib-mkenums was more forgiving, and simply ignored any files it
could not find.

We're going to print a warning, as in the future we may want to allow
more strictness.
2017-07-17 10:24:32 +01:00
Emmanuele Bassi
77a3a96218 mkenums: Change ordering for template file and arguments
This is a bit of a hack to maintain some semblance of backward
compatibility with the old, Perl-based glib-mkenums. The old tool had an
implicit ordering on the arguments and templates; each argument was
parsed in order, and all the strings appended. This allowed developers
to write:

  glib-mkenums \
    --fhead ... \
    --template a-template-file.c.in \
    --ftail ...

And have the fhead be prepended to the file-head stanza in the template,
as well as the ftail be appended to the file-tail stanza in the
template.  Short of throwing away ArgumentParser and going over
sys.argv[] element by element, we can simulate that behaviour by
ensuring some ordering in how we build the template strings:

  - the head stanzas are always prepended to the template
  - the prod stanzas are always appended to the template
  - the tail stanzas are always appended to the template

Within each instance of the command line argument, we append each value
to the array in the order in which it appears on the command line.

This change fixes the libqmi build.
2017-07-17 09:37:21 +01:00
Emmanuele Bassi
35db045729 mkenums: Fix typo
There's a stray '~' that needs to be removed.
2017-07-16 17:25:08 +01:00
Emmanuele Bassi
69389bdc34 mkenums: Do not check for None
The symprefix variable can only be a string.
2017-07-16 12:06:34 +01:00
Emmanuele Bassi
af4a6457eb mkenums: Some arguments can be used multiple times
Some of the arguments that affect the generated result in glib-mkenums
can be used multiple times, to avoid embedding unnecessary newlines in
their values.

This change fixes the NetworkManager build.
2017-07-16 11:56:52 +01:00
Emmanuele Bassi
d19f53a767 Add more compatibility mode hacks
When using the `--header --body` compatibility mode, we need to emit
things we generally define in the header, such as the aliases for
standard marshallers, and aliases for deprecated tokens.

This fixes dbus-binding-tool, which is using `--header --body` and
deprecated tokens.

See: https://bugs.freedesktop.org/show_bug.cgi?id=101799
2017-07-16 11:15:07 +01:00
Christoph Reiter
fbf3511309 meson: fix typo in install path for gobject_gdb.py 2017-07-16 00:23:16 +02:00
Tim-Philipp Müller
8451f0b817 glib-mkenums: unescape \n etc. in command line arguments
Fixes generation of GStreamer enumtype files with autotools build.

https://bugzilla.gnome.org/show_bug.cgi?id=779332
2017-07-15 13:02:40 -04:00
Igor Gnatenko
a882c974d3 mkenums: pass string for re.sub() for real
Signed-off-by: Igor Gnatenko <ignatenko@src.gnome.org>
2017-07-15 15:33:17 +02:00
Igor Gnatenko
1a182df5d1 mkenums: don't try to call undefined function
argparse will take care about everything

Signed-off-by: Igor Gnatenko <ignatenko@src.gnome.org>
2017-07-15 15:33:17 +02:00
Igor Gnatenko
615238d0a4 mkenums: make string raw for real regex
Signed-off-by: Igor Gnatenko <ignatenko@src.gnome.org>
2017-07-15 15:33:17 +02:00
Igor Gnatenko
d753a411c0 mkenums: trivial style fixes
Signed-off-by: Igor Gnatenko <ignatenko@src.gnome.org>
2017-07-15 15:33:17 +02:00
Igor Gnatenko
112908d9e4 mkenums: fix main incompatibility with python2
Signed-off-by: Igor Gnatenko <ignatenko@src.gnome.org>
2017-07-15 15:27:31 +02:00
Emmanuele Bassi
4395a89777 Use env to run the Python-based tools
Otherwise overriding the Python interpreter with `--with-python` won't
work correctly.
2017-07-14 21:21:33 +01:00
Emmanuele Bassi
0f18a2ebda meson: Substitute the Python shebang
Just like we do with Autotools. This allows building glib-mkenums and
glib-genmarshal on older platforms that only have Python 2.
2017-07-14 20:43:19 +01:00
Emmanuele Bassi
065a8a488a meson: Use the appropriate interface and binary ages
We need to build them out of the project version, and then propagate
them.
2017-07-14 14:21:57 +01:00
Matthias Clasen
b8c8bb73b0 Fix glib-genmarshal build with meson
This is no longer built from a C source, but a python file.
2017-07-13 19:35:09 -04:00
Tim-Philipp Müller
dbf0a56670 glib-mkenums: pick up /*< nick=xyz >*/ annotation again
... in glib-mkenums python port.

Was parsed correctly but then skipped due to inverted condition.

https://bugzilla.gnome.org/show_bug.cgi?id=779332
2017-07-13 19:03:39 -04:00
Matej Knopp
dc9b01fd64 glib-mkenums: add back missing --fprod option
... in glib-mkenums python port.

https://bugzilla.gnome.org/show_bug.cgi?id=779332
https://bugzilla.gnome.org/show_bug.cgi?id=783198
2017-07-13 19:03:39 -04:00
Matej Knopp
29f9fe041b glib-mkenums: Fix parsing of multiline comments
... in glib-mkenums python port.

https://bugzilla.gnome.org/show_bug.cgi?id=779332
https://bugzilla.gnome.org/show_bug.cgi?id=783198
2017-07-13 19:03:39 -04:00
Tim-Philipp Müller
1672678bc4 glib-mkenums: fix parsing of /*< flags >*/ annotation
Fixes get_type function generation for:

 - GMountMountFlags
 - GDriveStartFlags
 - GResourceLookupFlags
 - GSocketMsgFlags
 - GTlsDatabaseVerifyFlags
 - GTestDBusFlags

which were registered as enum types before, which broke
some unit tests.

Problem is that the flags annotation has no value, so
options.get('flags') would always return None even if
it was present.

https://bugzilla.gnome.org/show_bug.cgi?id=779332
2017-07-13 19:03:39 -04:00
Nirbheek Chauhan
2d72a9e1d1 glib-mkenums: misc fixes to python port 2017-07-13 19:03:39 -04:00
Nirbheek Chauhan
dd8ff54736 meson: Use Python port of glib-mkenums
This reduces the build-time dependencies of glib to only Python 3,
Meson, and git. Git is also optional if you provide a tarball in
which the subproject directories already exist.

The Python port was done by Jussi Pakkanen on bugzilla:
https://bugzilla.gnome.org/show_bug.cgi?id=779332

This version contains some fixes from that and also changes all
instances of `@` to `\u0040` because Meson does not yet provide a
configure_file() mode that ignores unknown @MACRO@ values.
2017-07-13 19:03:39 -04:00
Nirbheek Chauhan
ee94ad776e meson: Use proxy-libintl if gettext is not found
This is a stub-only library that can be used while building against
MSVC and contains no i18n machinery at all.

The dependencies added indirectly use the libintl.h header, and when
built as a subproject, the header won't be in a path known the
pre-processor.
2017-07-13 19:03:39 -04:00
Tim-Philipp Müller
2f29ee1735 meson: add -fvisibility=hidden explicitly to selected targets
Don't use it project-wide for building everything. Otherwise
symbols for shared modules won't be exposed, e.g. in the
resourceplugin used by the gio resource unit test.
2017-07-13 19:03:39 -04:00
Tim-Philipp Müller
34e4e25d53 meson: gio/tests: add more missing tests 2017-07-13 19:03:39 -04:00
Tim-Philipp Müller
33fb1bbb61 meson: gio, gobject: use files() for headers list
Since these variables are referenced from other directories
such as the tests/ subdir as well.
2017-07-13 19:03:39 -04:00
Tim-Philipp Müller
d29f022b0b meson: add support for dtrace/systemtap
Still at least one FIXME. And untested so far. It builds.
2017-07-13 19:03:39 -04:00
Nirbheek Chauhan
e2da3cb599 meson: Port to latest master (2.51.0)
Also remove headers from some gio sources. Headers do not need to be
added to the list of sources.

+ various smaller self-explanatory fixes.
2017-07-13 19:03:39 -04:00
Patrick Griffis
d10be6102f meson: Minor modernizations 2017-07-13 19:03:39 -04:00
Patrick Griffis
a690e2a375 meson: More build fixes
- Fix installing various data files
- Build translations
2017-07-13 19:03:39 -04:00
Nirbheek Chauhan
fe2a9887a8 meson: Improve MSVC and MinGW support and fix dependencies everywhere
Disable gio tests on Windows, fix .gitignore to not ignore
config.h.meson, and add more things to it.

Rename the library file naming and versioning to match what Autotools
outputs, e.g., libglib-2.0.so.0.5000.2 on Linux, libglib-2.0-0.dll  and
glib-2.0-0.dll on Windows with MSVC.

Several more tiny fixes, more executables built and installed, install
pkg-config and m4 files, fix building of gobject tests.

Changes to gdbus-codegen to support out-of-tree builds without
environment variables set (which you can't in Meson). We now add the
build directory to the Python module search path.
2017-07-13 19:03:39 -04:00
Tim-Philipp Müller
213957970e meson: Fix glib, add gobject, gio, gthread, gmodule, etc
Several small fixes to the build files.

Lots of tests have also been added, and glib tests pass now.
2017-07-13 19:03:39 -04:00
Matthias Clasen
41385745e7 Revert "mkenums: Support public/private trigraph"
This reverts commit 9ba17d511e.

This conflicts with the python port in the meson branch.
2017-07-13 19:03:00 -04:00
Emmanuele Bassi
c6793d1cfb Allow whitespace between marshallers list tokens
Some (older) list files use whitespace, and we need to take that into
account when splitting off the various tokens.
2017-07-11 18:25:26 +01:00
Emmanuele Bassi
30b961607a Avoid a leak for arguments in va_list marshallers
We need to revers a check on whether the list of arguments needs
unboxing.
2017-07-11 12:24:10 +01:00
Emmanuele Bassi
ea365530d2 Do not mix declarations and statements
Projects using glib-genmarshal may still wish to support C89.
2017-07-11 12:15:44 +01:00
Emmanuele Bassi
9c66e65b29 Remove unused marshallers-related files
We don't use gmarshal.list any more, and the generated gmarshal.strings
file is not used after the Python port of glib-genmarshal.

https://bugzilla.gnome.org/show_bug.cgi?id=784528
2017-07-10 16:47:48 +01:00
Emmanuele Bassi
f7643a7df7 Re-enable signal tests when cross-compiling
The glib-genmarshal tool has been rewritten in Python, which means we
can run it when cross-compiling.

https://bugzilla.gnome.org/show_bug.cgi?id=784528
2017-07-10 16:47:48 +01:00
Emmanuele Bassi
93f16a45ab Rewrite glib-genmarshal in Python
We're in the process or rewriting other tools in Python to reduce the
number of dependencies of GLib.

Additionally, making glib-genmarshal a Python script reduces the
complexity when cross-compiling, as we don't need a native build to
generate the marshallers.

https://bugzilla.gnome.org/show_bug.cgi?id=784528
2017-07-10 16:47:47 +01:00
Philip Withnall
a131134918 build: Drop nmake/MSC build system for GLib
It hasn’t been seriously maintained for the best part of 10 years and is
very outdated. The recommended way to build GLib on Windows is now
Visual Studio:

https://wiki.gnome.org/Projects/GTK%2B/Win32/MSVCCompilationOfGTKStack#GLib

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

https://bugzilla.gnome.org/show_bug.cgi?id=722047
2017-07-10 11:22:40 +01:00
Colin Walters
017f78d77f gtype: Add private DEFINE_TYPE with prelude to workaround gtype deadlocks
And use it in GSocket, as it had a real-world case reported.

https://bugzilla.gnome.org/show_bug.cgi?id=674885
2017-06-14 14:45:45 -04:00
Sébastien Wilmet
6b948d9613 gobject/: LGPLv2+ -> LGPLv2.1+
All gobject/*.{c,h} files have been processed.

gmarshal.c and gmarshal.h don't have a license header.

https://bugzilla.gnome.org/show_bug.cgi?id=776504
2017-05-24 11:58:19 +02:00
Sébastien Wilmet
308bc41fb9 gobject/tests/: LGPLv2+ -> LGPLv2.1+
A lot of tests in gobject/tests/ don't have a license header. And some
tests are licensed under a BSD-style license.

https://bugzilla.gnome.org/show_bug.cgi?id=776504
2017-05-24 11:58:19 +02:00
Emmanuele Bassi
9ba17d511e mkenums: Support public/private trigraph
It is possible, when using GTK-Doc, to mark sections of an enumeration
type as "private": the values are there, but they are not documented,
and GTK-Doc won't complain about missing symbols:

    typedef enum {
      /*< private >*/
      MY_FOO_PRIVATE,

      /*< public >*/
      MY_FOO_VALUE_A,
      MY_FOO_VALUE_B,

      /*< private >*/
      MY_FOO_VALUE_C,
      MY_FOO_VALUE_D
    } MyFooValue;

The glib-mkenums parser also allows skipping enumeration values, using a
slightly different syntax:

    typedef enum P
      MY_BAR_PRIVATE, /*< skip >*/
      MY_BAR_VALUE_A,
      MY_BAR_VALUE_B
    } MyBarValue;

The annotation must sit on the same line as the enumeration value.

Both GTK-Doc and glib-mkenum use the same trigraph syntax, but slightly
different keys. This makes combining them slightly redundant, but
feasible.

All would be well and good, except that glib-mkenum will generate a
warning for lines it does not understand — and that includes the GTK-Doc
annotation trigraph, which, when confronted with the MyFooValue
enumeration above, will result in a warning like:

    glib-mkenums: myfoo.h:2: Failed to parse `  /*< private >*/ '
    glib-mkenums: myfoo.h:5: Failed to parse `  /*< public >*/ '
    glib-mkenums: myfoo.h:9: Failed to parse `  /*< private >*/ '

Of course, we could make glib-mkenum ignore any trigraph comment on a
stand alone line, but it would probably be better to ensure that both
glib-mkenums and gtk-doc behave consistently with each other, and
especially with the maintainer's intent of hiding some values from the
user, and reserving them for internal use.

So we should ensure that glib-mkenums automatically skips all the
enumeration values after a "private" flag has been set, until it reaches
a "public" stanza.

https://bugzilla.gnome.org/show_bug.cgi?id=782162
2017-05-16 11:23:50 +01:00
Mohammed Sadiq
274f336f6a docs: Trivial typo fixes
The presence of space was resulting in wrongly rendered documentation
in devhelp (and probably in other documentations).

https://bugzilla.gnome.org/show_bug.cgi?id=782068
2017-05-16 11:22:54 +01:00
Emmanuele Bassi
17a3c782db genmarshal: Always generate the prototypes in the body
This way code that does not manually include the generated marshallers
header and wishes to build with `-Wmissing-prototypes` will not generate
a compiler warning.

https://bugzilla.gnome.org/show_bug.cgi?id=781755
2017-04-28 17:39:14 +01:00
Emmanuele Bassi
616cff7c87 genmarshal: Use fewer magic numbers
https://bugzilla.gnome.org/show_bug.cgi?id=781755
2017-04-28 17:39:14 +01:00
Emmanuele Bassi
a8b5192d16 genmarshal: Constify global variables
https://bugzilla.gnome.org/show_bug.cgi?id=781755
2017-04-28 17:39:14 +01:00
Emmanuele Bassi
1ffad8fed9 genmarshal: Conform --help output to conventions
The convention for arguments taking a value is:

  --argument=VALUE

with the `VALUE` in caps.

https://bugzilla.gnome.org/show_bug.cgi?id=781755
2017-04-28 17:39:14 +01:00
Emmanuele Bassi
f952fdf3fc Drop trailing semi-colon from G_DEFINE_ macro
It's unnecessary, and only adds visual noise; we have been fairly
inconsistent in the past, but the semi-colon-less version clearly
dominates in the code base.

https://bugzilla.gnome.org/show_bug.cgi?id=669355
2017-04-10 10:38:31 +01:00
Tim-Philipp Müller
a83ccc535f gobject: remove duplicate GType sanity check
This is going to be checked again by g_object_new_with_properties()
and g_object_new_valist() anyway, so might just as well leave it
to those functions to do the check and only do it once. It doesn't
matter which function emits the critical warning in the end either,
as one has to look at a stack trace to find out what code triggered
it in any case.

https://bugzilla.gnome.org/show_bug.cgi?id=780908
2017-04-08 01:20:29 -04:00
Philip Withnall
2f2c2b6362 gobject: Fix Since/Deprecated versions for GParameter replacement API
This slipped through the review cracks.

https://bugzilla.gnome.org/show_bug.cgi?id=709865
2017-03-31 11:09:53 +01:00
Fabian Orccon
e2c3b7f634 gobject: Deprecate g_object_newv
g_object_newv uses a GParameter as argument. Since GParameter
is deprecated due to this type is not introspectible,
g_object_newv is deprecated now.

https://bugzilla.gnome.org/show_bug.cgi?id=709865
2017-03-31 11:00:23 +01:00
Fabian Orccon
2646c21735 gobject: Deprecate GParameter
GParameter is a rarely used type and not introspectible.

https://bugzilla.gnome.org/show_bug.cgi?id=709865
2017-03-31 11:00:23 +01:00
Fabian Orccon
942edbc700 tests: Add test for gobject properties for g_object_newv/setv/getv
https://bugzilla.gnome.org/show_bug.cgi?id=709865
2017-03-31 11:00:23 +01:00
Fabian Orccon
c6d373bfe7 gobject: Add g_object_setv and g_object_getv functions
https://bugzilla.gnome.org/show_bug.cgi?id=709865
2017-03-31 10:38:30 +01:00
Fabian Orccon
26b211ef89 gobject: Add g_object_new_with_properties
g_object_new_with_properties is an alternative to g_object_newv.
The last one, takes an array of GParameter. However, GParameter
is a rarely used type and this type is not introspectible, so
it will not work properly in bindings.

https://bugzilla.gnome.org/show_bug.cgi?id=709865
2017-03-31 10:38:30 +01:00
Fabian Orccon
19e81dedc9 gobject: Add helper functions to handle warnings in g_object_new/set/get
g_object_new_is_valid_property
g_object_get_is_valid_property
g_object_set_is_valid_property

https://bugzilla.gnome.org/show_bug.cgi?id=709865
2017-03-31 10:38:30 +01:00
Garrett Regier
6c95cd22e9 gobject: Add to_string() functions for Enum and Flags types
These are useful for debugging.

https://bugzilla.gnome.org/show_bug.cgi?id=447907
2017-03-30 09:52:28 +01:00
Simon McVittie
8686e43058 glib-mkenums: Sort input files for more deterministic output
This should be helpful for reproducible builds
<https://reproducible-builds.org/>.

Perl's sorting is not locale-sensitive unless the lexical scope has
'use locale', which this one does not, so we do not need to force
locale-agnostic sorting.

Signed-off-by: Simon McVittie <smcv@debian.org>
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=769983
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=809152
2017-03-04 22:05:44 +00:00
Simon McVittie
e3f59e482b Install gdb Python helpers as data, not as executable scripts
They do not start with the #!/usr/bin/python that would be necessary
to make them run with Python rather than a shell, and they would
not be useful to run anyway: they are libraries to be imported,
not scripts to be run.

Signed-off-by: Simon McVittie <smcv@debian.org>
2017-03-03 20:08:42 +00:00
Chun-wei Fan
6dfc6fee7b Visual Studio builds: Move project files to win32/
It was suggested that the project files be moved here as we don't actually
need to go two directory layers from $(srcroot), and would help us to
standardize on things in the future across the board.
2017-01-09 14:00:46 +08:00
Philip Withnall
953c182d25 gobject: Document behaviour of GType checking macros on NULL
The macros differ in their handling of NULL values — some macros ignore
them and pass through (e.g. G_TYPE_CHECK_INSTANCE_CAST) while others
will explicitly emit a warning if passed NULL (e.g.
G_TYPE_CHECK_INSTANCE).

Document their behaviour, so people don’t end up putting unnecessary
NULL checks in their code when doing checked type casts.

https://bugzilla.gnome.org/show_bug.cgi?id=735731
2017-01-07 23:43:06 +00:00
Simon McVittie
e5ed410c8c Avoid calling Standard C string/array functions with NULL arguments
glibc string.h declares memcpy() with attribute(nonnull(1,2)), causing
calls with NULL arguments to be treated as undefined behaviour.
This is consistent with ISO C99 and C11, which state that passing 0
to string functions as an array length does not remove the requirement
that the pointer to the array is a valid pointer.
gcc -fsanitize=undefined catches this while running OSTree's test suite.

Similarly, running the GLib test suite reports similar issues for
qsort(), memmove(), memcmp().

Signed-off-by: Simon McVittie <smcv@debian.org>
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=775510
Reviewed-by: Colin Walters
2016-12-02 19:10:39 +00:00
Simon McVittie
5e7eaaaaee GParam: make G_PARAM_USER_MASK unsigned
UBSan considers left-shifting a negative number to be undefined
behaviour (per
<http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_081.html> it is
implementation-defined in C89, but according to
<https://llvm.org/bugs/show_bug.cgi?id=17490> it is undefined in C99).

Signed-off-by: Simon McVittie <smcv@debian.org>
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=775510
Reviewed-by: Colin Walters
2016-12-02 19:10:26 +00:00
Philip Withnall
3e7b5cbef8 glib: Namespace global tapset variables by soname
global variables in SystemTap are shared between all SystemTap scripts;
so if scripts are loaded for two versions of GLib (for example, a stable
and a development version), those global variables will conflict.

Avoid that by including the soname’s version in the global variable
names.

https://bugzilla.gnome.org/show_bug.cgi?id=770646
2016-11-23 10:50:39 +00:00
Christian Hergert
18a33f72db introspection: use (nullable) or (optional) instead of (allow-none)
If we have an input parameter (or return value) we need to use (nullable).
However, if it is an (inout) or (out) parameter, (optional) is sufficient.

It looks like (nullable) could be used for everything according to the
Annotation documentation, but (optional) is more specific.
2016-11-22 14:14:37 -08:00
Philip Withnall
9f4d5e8b91 gsignal: Mention handler ID type in signal connection macro docs
gtk-doc doesn’t make the return type clear, because these are macros
rather than inline functions, so people often have to guess at the
return type (or look it up from g_signal_connect_closure(), but that’s
hard work).

Make it clear that the return type for handler IDs is gulong. While
there, fix the capitalisation of ‘id’ to ‘ID’ in a few places.
2016-11-10 16:12:41 +00:00
Tim-Philipp Müller
932eb87083 glib-mkenums: fix variable declaration
Inconsequential, just sync up declaration with actual
name of variable to avoid confusion.

https://bugzilla.gnome.org/show_bug.cgi?id=770175
2016-11-08 15:21:03 +00:00
Hannes Müller
7470cc902b Avoid warning for G_PARAM_DEPRECATED with GCC 6 [-Wpedantic]
Refer to https://bugzilla.gnome.org/show_bug.cgi?id=767882
Related to GCC https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71803
2016-10-24 06:10:14 -04:00
Tim-Philipp Müller
ac54db2ee2 glib-mkenums: add --output option to write output to a file
https://bugzilla.gnome.org/show_bug.cgi?id=770175
2016-10-12 17:05:07 -04:00
Tim-Philipp Müller
0fbc98097f glib-genmarshal: add --output option to write output to a file
https://bugzilla.gnome.org/show_bug.cgi?id=770175
2016-10-12 15:56:49 -04:00
Matthias Clasen
53d5a9f6fb Fix the signals test
The test setup here is not really independent, so the addition
of the custom-marshaller test was breaking some of the other
tests. Fix things up.
2016-08-27 22:54:39 -04:00
Benjamin Otte
edfbfc1827 tests: Add test showing default marshaller override
https://bugzilla.gnome.org/show_bug.cgi?id=769076
2016-08-25 13:26:58 -04:00
Matthias Clasen
ef16cbee5b Don't set a va marshaller if a marshaller was set
Otherwise we get warnings when the caller later tries to set a
va marshaller with g_signal_set_va_marshaller.

https://bugzilla.gnome.org/show_bug.cgi?id=769076
2016-08-25 13:26:58 -04:00
Philip Withnall
a5044a8e78 build: Fix SystemTap build to disable semaphores as before
At some point, upstream SystemTap changed from using a
STAP_HAS_SEMAPHORES preprocessor variable for this, to using
_SDT_HAS_SEMAPHORES instead. We need to update our build system to
disable that as well.

The original discussion about use of semaphores is here:

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

This was breaking the build with -flto enabled, either because -flto
doesn’t work with semaphores.

https://bugzilla.gnome.org/show_bug.cgi?id=768198
2016-08-13 09:32:12 +02:00
Emmanuele Bassi
5ff8579527 Fix debug builds under MSVC
The C spec leaves conditional evaluation inside a macro expansion as
undefined behaviour. This means we cannot use constructs like:

  GOBJECT_IF_DEBUG(OBJECTS, {
    ...
  #ifdef BLAH
    ...
  #endif
    ...});

Because compilers are entirely justified to ignore the conditional, or,
like in the case of MSVC, error out.

https://bugzilla.gnome.org/show_bug.cgi?id=769504
2016-08-04 10:18:46 +01:00
Alberts Muktupāvels
ad669500a6 gobject: add g_autoptr support for GTypeModule
https://bugzilla.gnome.org/show_bug.cgi?id=769033
2016-07-21 17:03:06 +03:00
Kang Hu
42dad59cc1 gobject: add GOBJECT_IF_DEBUG macro for debugging gobjects and gsignals.
historically, DEBUG_CODE(gtype.c) and IF_DEBUG(gobject.c, gsignal.c)
macros are used to support debugging messages about object bookkeeping
and signal emission.
DEBUG_CODE has never been used in gtype.c. IF_DEBUG, when used, must be
accompanied by an extra #ifdef G_ENABLE_DEBUG. this is cumbersome.

this patch add a new macro GOBJECT_IF_DEBUG based on DEBUG_CODE as
a replacement for both DEBUG_CODE and IF_DEBUG.

https://bugzilla.gnome.org/show_bug.cgi?id=729914
2016-07-16 20:54:44 -04:00
Philip Withnall
c4695f192c build: Rename SystemTap scripts to include the LT version
In a vague attempt at ensuring the .stp scripts can be closely
associated with the .so files which they hard-code references to, rename
the scripts so they include the LT version — so that they are the .so
file name plus .stp.

This does not fix the fact that our .stp scripts will not work on
multiarch systems, as they are installed in an architecture-independent
directory (/usr/share/systemtap/tapset). At the moment, it is
recommended that any distribution who package the .stp files should
install them in the architecture-specific subdirectories of this (for
example, /usr/share/systemtap/tapset/x86-64).

A better long-term solution for this is under discussion upstream:
https://sourceware.org/bugzilla/show_bug.cgi?id=20264

https://bugzilla.gnome.org/show_bug.cgi?id=662802
2016-06-29 14:43:52 +01:00
Ryan Lortie
7563ab4734 build: simplify dtrace configuration
The ability to pass libtool via $(CC) to dtrace and have it respect this
appears to be a feature that is only present in the systemtap version of
the tool.  In particular, FreeBSD (which seems to be using a copy of the
tool from Solaris) doesn't support this.

The result is that, with $(CC) ignored, and a .lo file specified in -o,
we get an ELF written to the .lo.

Instead of trying to have dtrace run libtool we can have libtool run
dtrace.  dtrace is really just a compiler that produces an object file
here, and it even understands -o, so libtool can make the appropriate
adjustments.

There appears to be some prior art for this approach.  A quick search
shows that at least QEMU is using this approach.  It also appears to
work on Linux with systemtap's dtrace and on FreeBSD.

This may regress cross-compilation because the dtrace command will have
no way of knowing which compiler we intend for it to use to produce the
object file.  I say "may" because I don't know if dtrace ever worked in
the first place under cross-compilation.

https://bugzilla.gnome.org/show_bug.cgi?id=725902
2016-06-20 12:35:47 -04:00
Gerald Combs
05d429af9d gsignal: Remove a UTF-8 ellipsis from docs
Some compilers have trouble with such sequences. Visual C++ may or may
not generate a warning in this particular case depending on if the
local code page supports an ellipsis.

https://bugzilla.gnome.org/show_bug.cgi?id=767218
2016-06-03 16:09:43 -04:00
Tom Tromey
b7145a1d72 Rename gdb macros with _gdb suffix to avoid ns clashes
glib installs a gdb helper file named `glib.py`.
Then the "hook" file updates `sys.path` and does `import glib`.

This will fail if glib has already been imported into gdb, say
using `from gi.repository import GLib`.  This is due to a namespace clash.

One fix would be to rename the gdb helper files to not clash with
other Python modules.  This should be done for all such helper files.

https://bugzilla.gnome.org/show_bug.cgi?id=760186
2016-05-23 10:52:10 -04:00
Kjell Ahlstedt
05e5da9a83 gvalue: Fix description of g_value_type_transformable()
Types are transformable if they are compatible *or* a transformation function
is registered.

https://bugzilla.gnome.org/show_bug.cgi?id=742898
2016-04-28 12:05:50 +02:00
Sebastian Dröge
4e3cd88c2b gparamspecs: GTypes are stored in v_pointer, not v_long
v_long is 32 bits on Win64, v_pointer is 64 bits. On most other platforms the
size of long and pointer is the same, so it's usually not a problem.

https://bugzilla.gnome.org/show_bug.cgi?id=758738
2016-04-27 10:28:09 +03:00
Phillip Wood
38c4e31c8a Fix documentation typos
Character entities are not supposed to be supported by gtk-doc¹ and
fix the spelling of ‘optional’

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

https://bugzilla.gnome.org/show_bug.cgi?id=758174
2016-04-11 23:31:38 -04:00
Colin Walters
14885a5b19 build: Also dist Systemtap files always for gobject/
Mirrors
https://git.gnome.org/browse/glib/commit/?id=ad2092bc680e434c3d17600988ec9b20f52eebef
except I didn't also change gobject/.

https://bugzilla.gnome.org/show_bug.cgi?id=763821
2016-03-23 09:02:35 -04:00
Rico Tzschichholz
e3189527dc gio/gobject: Various introspection fixes 2016-02-03 18:13:49 +01:00
Philip Withnall
8c263008bb build: Calculate ABS_GLIB_RUNTIME_LIBDIR at build time
Rather than calculating it at configure time. This means it can expand
$libdir properly, and use the Make $(realpath) function rather than
invoking the non-portable `readlink -f`.

This fixes problems where `readlink` would be called on an invalid path
(due to a variable not being expanded) and would evaluate to "", which
would then cause things to be installed in the wrong place.

https://bugzilla.gnome.org/show_bug.cgi?id=744772
2016-01-24 14:44:44 +00:00
Emmanuele Bassi
85a23529ab Revert "make *_get_instance_private const-compliant"
This reverts commit a3a9664ed2.

Constifying the autogenerated get_instance_private functio makes C++
compilers and GCC with -Wcast-qual warn during compilation of GLib and
projects depending on GLib.

Since using const with GObject instances is not a common coding
practice, it's better to revert than trying to make every sigle GType
function const-safe (and possibly add more compiler warnings in the
process).

https://bugzilla.gnome.org/show_bug.cgi?id=745068
2016-01-18 18:48:42 +00:00
Emmanuele Bassi
617189f28c Revert "G_DECLARE_*: be const-compliant"
This reverts commit 52f23db74a.

Constifying these macros make C++ compilers and GCC with -Wcast-qual
warn during compilation of GLib and projects depending on GLib.

Since using const with GObject instances is not a common coding
practice, it's better to revert than trying to make every sigle GType
function const-safe (and possibly add more compiler warnings in the
process).

https://bugzilla.gnome.org/show_bug.cgi?id=745068
2016-01-18 18:46:12 +00:00
Simon Feltman
1513efc904 Add GParamSpec object ref management annotations
Add ref-func, unref-func, set-value-func, and get-value-func annotations to
GParamSpec so that it can be managed generically as a fundamental type with
introspection.

https://bugzilla.gnome.org/show_bug.cgi?id=710243
2015-12-16 07:47:54 -05:00
Philip Withnall
25a7c817d3 glib: Add missing (nullable) and (optional) annotations
Add various (nullable) and (optional) annotations which were missing
from a variety of functions. Also port a couple of existing (allow-none)
annotations in the same files to use (nullable) and (optional) as
appropriate instead.

Secondly, add various (not nullable) annotations as needed by the new
default in gobject-introspection of marking gpointers as (nullable). See
https://bugzilla.gnome.org/show_bug.cgi?id=729660.

This includes adding some stub documentation comments for the
assertion macro error functions, which weren’t previously documented.
The new comments are purely to allow for annotations, and hence are
marked as (skip) to prevent the symbols appearing in the GIR file.

https://bugzilla.gnome.org/show_bug.cgi?id=719966
2015-11-07 10:48:32 +01:00
Xavier Claessens
2331437df3 Doc: fix some gtk-doc warnings
https://bugzilla.gnome.org/show_bug.cgi?id=755364
2015-10-30 10:30:55 -04:00
Murray Cumming
adfd184776 Fix tiny typo. 2015-10-28 10:50:40 +01:00
Dan Winship
263aac125e .gitignore updates 2015-10-23 11:28:03 -04:00
Matthias Clasen
2ac7c5a6fb Use -Wl,-znodelete for all our libraries
Now that we initialize the quark tables from a constructor,
reloading libglib is just as bad as reloading libgobject,
so add the linker option to the LDFLAGS for all our libraries.

https://bugzilla.gnome.org/show_bug.cgi?id=755609
2015-10-20 08:18:22 -04:00
Ignacio Casal Quinteiro
7a29771a74 gobject: use a DllMain to initialize gobject on windows
It seems that VS 2015 optimizes out the constructor on windows,
so it is better to use a DllMain to initialize the library
and keep using a normal constructor on the other platforms.
This research was done by  Arnav Singh.

https://bugzilla.gnome.org/show_bug.cgi?id=752837
2015-10-11 10:29:10 +02:00
Philip Withnall
144d38fb9d gparamspecs: Mark g_param_spec_string()’s default value as (nullable) 2015-10-08 12:57:33 +01:00
Matthias Clasen
8d83aace10 Call glib_init from the gobject constructor
We are using quarks in the gobject constructor, among other things,
so we need to ensure that glib is being initialized first.

https://bugzilla.gnome.org/show_bug.cgi?id=756139
2015-10-07 23:39:29 -04:00
Philip Withnall
4f6dc30232 glib-genmarshal: Fix memory leak with --prefix
If --prefix is specified, marshaller_prefix is allocated and never
freed. It does not actually have to be allocated — just use the static
string from argv.

Coverity CID: 1325370
2015-10-03 11:33:00 +01:00
Dan Winship
4b2d92a864 Allow passing unset GValues to g_value_unset()
This makes it more useful as an autocleanup func.

Also, add a minimal test of g_value_init/g_value_reset/g_value_unset.

https://bugzilla.gnome.org/show_bug.cgi?id=755766
2015-10-02 10:07:53 -04:00
Dan Winship
b4a3c1bb11 Revert "gvalue: Add g_value_clear method"
This reverts commit 1233962b54.
2015-10-02 10:07:53 -04:00
Dan Winship
4c870904cd Revert "gvalue: Use g_value_clear as clear function"
This reverts commit 3bb2e8dfc9.
2015-10-02 10:07:53 -04:00
Dan Winship
8ed9e8c79f Revert "gvalue: Improve _unset() documentation"
This reverts commit 3c0d38d68b.
2015-10-02 10:07:53 -04:00
Emmanuele Bassi
037991211d Revert "Apply the previous change to gmarshal.c"
This reverts commit 43e8bfca0c.

https://bugzilla.gnome.org/show_bug.cgi?id=755922
2015-10-01 11:58:37 +01:00
Emmanuele Bassi
cc818f5fe4 Revert "glib-genmarshal: Treat all parameters the same"
This reverts commit 8e362161d9.

There is a fundamental difference between g_value_peek_pointer() and
g_value_get_pointer(), and it's not just complexity: the latter checks
if the GValue holds a pointer type, whereas the former doesn't.

https://bugzilla.gnome.org/show_bug.cgi?id=755922
2015-10-01 11:54:11 +01:00
Nicolas Dufresne
3c0d38d68b gvalue: Improve _unset() documentation
g_value_unset() only works with initialized value and will assert
if the GValue is zero-filled (or initialized with G_VALUE_INIT). Document
this behaviour and refer to g_value_clear() for a method that work on
both initialized and zero-filled GValue.

https://bugzilla.gnome.org/show_bug.cgi?id=755766
2015-09-29 08:30:21 -04:00
Nicolas Dufresne
3bb2e8dfc9 gvalue: Use g_value_clear as clear function
This change allow leaving a scope before g_value_init() has been
called. This would happen if you do:

  {
    g_auto(GValue) value = G_VALUE_INIT;
  }

Or have a return statement (due to failure) before the part of
your code where you set this GValue.

https://bugzilla.gnome.org/show_bug.cgi?id=755766
2015-09-29 08:26:14 -04:00
Nicolas Dufresne
1233962b54 gvalue: Add g_value_clear method
This method is similar to g_value_unset() but will accept
an uninitialized (zero-filled) GValue structure.

https://bugzilla.gnome.org/show_bug.cgi?id=755766
2015-09-29 08:26:14 -04:00
Matthias Clasen
43e8bfca0c Apply the previous change to gmarshal.c
Since gmarshal.c is no longer generated, we have to manually
apply this change to the builtin marshallers.
2015-09-29 07:04:36 -04:00
Matthias Clasen
8e362161d9 glib-genmarshal: Treat all parameters the same
There's no need to use a more expensive getter when swapping,
so just use the g_marshal_ getters there too.
2015-09-29 07:04:35 -04:00
Xavier Claessens
b81f3ced71 Move GStrv typedef to glib.h instead of gobject.h
GStrv was historically only needed for the boxed G_TYPE_STRV,
but it is now useful for g_auto(GStrv) as well. This is not
an ABI change.

https://bugzilla.gnome.org/show_bug.cgi?id=755355
2015-09-22 11:18:30 -04:00
Xavier Claessens
32811598f3 doc: clarify that _get_instance_private() is NULL-safe
https://bugzilla.gnome.org/show_bug.cgi?id=755083
2015-09-22 11:15:19 -04:00
Benjamin Otte
58eae7782a tests: Do last commit's fix for enums, too
We don't want to treat enums as ints but as ints.
2015-09-16 18:45:48 +02:00
Benjamin Otte
605ff1efe7 tests: Make testcase not pass 0 as a flags value
This will not catch the case where we fail in libffi and always use 0.
In fact, be a real annoying person and use (1 << 31) as a flags value to
test signedness, too.

Also update the testcase to actually use flags everywhere and ot uint.

https://bugzilla.gnome.org/show_bug.cgi?id=754882
2015-09-16 18:45:48 +02:00
Ray Strode
7b685eab88 ffi: Marshal flags like enums
Flags are enums.
Fixes broken marshalling on BE 64bit architectures.

https://bugzilla.gnome.org/show_bug.cgi?id=754882
2015-09-16 18:45:48 +02:00
Matthias Clasen
3bd1618ea9 Disable deprecation warnings for the stable release again
Keeping these enabled causes too many people to file
bugs against gobject, and not enough people to send
patches to port away from deprecated properties.
2015-09-14 18:42:12 -04:00
Alexander Larsson
69002f726d signal: return TRUE from g_signal_has_handler_pending for custom class closure
This is almost always what you want, because if you're using this you
want to know if any "custom code" (i.e. not the default class closure)
is going to be run if you emit this signal.

I looked at all the existing uses of this and they were all broken in the
presence of g_signal_override_class_closure().

https://bugzilla.gnome.org/show_bug.cgi?id=754986
2015-09-14 13:19:51 +02:00
Nicola Fontana
a51a877d27 GParamSpec: do not use static GParamSpecTypeInfo
g_param_type_register_static() has read-only access the pspec_info
argument: no need to keep the original struct around.

https://bugzilla.gnome.org/show_bug.cgi?id=696426
2015-09-13 02:15:04 -04:00
Michael Catanzaro
ee6740aa78 Fix a typo 2015-09-10 20:46:37 -05:00
Rico Tzschichholz
5a84f84325 gparam: Fix Since tag of g_param_spec_get_name_quark 2015-09-08 14:15:44 +02:00
Matthias Clasen
00933dfc9c Speed up property change notification a bit
Avoid the quark lock and hash table lookup for every
emission of ::notify.
2015-09-07 20:56:10 -04:00
Matthias Clasen
41c0d15a6d Add a method to get the pspec name quark
This lets us avoid the quark lookup in the hot
property change notification path.
2015-09-07 20:54:01 -04:00
Matthias Clasen
a62ad79f5c Clean up locking in g_object_notify_queue_add
Instaed of returning with the lock held, simply assert
that this cannot happen:

https://bugzilla.gnome.org/show_bug.cgi?id=749678#c4
2015-09-07 19:57:53 -04:00
Matthias Clasen
087d75e3c3 Make g_set_object more symmetric
As argued in bug 748633, and order of ref, assign, unref is
preferable.
2015-09-07 19:43:19 -04:00
Matthias Clasen
44af2b1c17 Simplify g_param_spec_get_redirect_target a bit more
It is enough to look for exact matches here, so no need to
dive into g_type_instance_is_a and take locks, etc.
2015-09-07 03:02:11 -04:00
Matthias Clasen
f1f80111c9 Simplify g_param_spec_get_redirect_target
There is no need to do a type check in a g_return_if_fail if the
type check is tne next thing the function does anyway.
2015-09-07 02:33:50 -04:00
Chun-wei Fan
041e77249a Cleanup and Enhance the MSVC Project Generation
Make use of the common autotools module that is used to generate the MSVC
project files from their respective templates so that the main build files
beccome cleaner, and enhance them in a way that the headers that should be
installed can be written to the property sheets during 'make dist', so that
the chances of missing headers for MSVC builds can be greatly reduced.

Also use this autotools module to fill in the projects for
glib-compile-schemas and glib-compile-resources.

https://bugzilla.gnome.org/show_bug.cgi?id=735429
2015-09-03 19:10:06 +08:00
Emmanuele Bassi
5ce70917df Drop binary checks when cross-compiling
We don't need to run binaries we just built in order to successfully
build GLib and friends any more.

Since commit b74e2a7, we don't need to run glib-genmarshal when building
GIO; since commit f9eb9eed, all our tests (including the ones that do
need to run binaries we just built) are only built when running "make
check", instead of unconditionally at every build.

This means that we don't need to check for existing, native binaries
when cross-compiling, and fail the configuration step if they are not
found — which also means that you don't need to natively build GLib for
your toolchain, in order to cross-compile GLib.

We can also use the cross-compilation conditional, and skip those tests
that require a binary we just built in order to build.

https://bugzilla.gnome.org/show_bug.cgi?id=753745
2015-09-01 10:40:24 -04:00
Iain Lane
16721468e5 gsignal: Don't crash when operating on signals on the wrong object 2015-09-01 14:30:43 +01:00
Iain Lane
261250c46e Test that disconnecting from the wrong thing warns and doesn't crash
This broke in 916297be79 (≥ 2.45.3)
2015-09-01 14:30:37 +01:00
Philip Withnall
ef1ba452b3 gsignal: Document memory management best practices for signal handlers
It’s quite common to see naked g_signal_connect() calls without a paired
g_signal_handler_disconnect(). This is commonly a bug which could lead
to uses of the callback user data after it’s been freed.

Document the best practices for avoiding this kind of bug by properly
disconnecting all signal handlers.

https://bugzilla.gnome.org/show_bug.cgi?id=741779
2015-08-19 12:56:38 +01:00
Philip Withnall
c5cd1c5f02 gobject: Add cross-links from GObject reference docs to tutorials
Add some brief links from the GObject reference documentation to the
existing tutorial and overview sections on GObjects.

https://bugzilla.gnome.org/show_bug.cgi?id=743018
2015-08-19 12:54:50 +01:00
Philip Withnall
9874fe3c40 gobject: Cross-link from GType reference docs to GType conventions page
Make it a little easier to find the GType conventions page, which I
guess should be the canonical guide to how to name things.

This adds a brief mention of the valid characters in a type name to the
conventions page.

https://bugzilla.gnome.org/show_bug.cgi?id=743018
2015-08-19 12:54:50 +01:00
Christian Hergert
cb86c222cc gtypemodule: use G_GNUC_UNUSED in G_DEFINE_DYNAMIC_TYPE_EXTENDED
We already do this in the normal case, might as well support it for the
dynamic type module case as well. This prevents seeing a warning when not
using the get_instance_private() in the dynamic type.
2015-06-27 22:41:13 -07:00
Michael Catanzaro
9f90ee5eec genmarshal: silence register storage class warnings
Using the register keyword triggers warnings on noteworthy compilers
(clang), since it's deprecated in C++ and at danger of being removed
from the language. There is no reason to use it since it isn't 1980
anymore.

https://bugzilla.gnome.org/show_bug.cgi?id=750918
2015-06-13 23:09:24 -05:00
Stefan Ekenberg
338741fff5 Prevent race condition in g_io_condition_get_type
Prevents race condition in function g_io_condition_get_type by ensuring
that the initialization section for 'etype' is executed only once
during a program's life time, and that concurrent threads are blocked
until initialization completes. This changes solves the problem that
concurrent threads could execute the check 'etype == 0' before any of
them had initialized it, which in turn meant that multiple threads
would then attempt to register the "GIOCondition" type.

https://bugzilla.gnome.org/show_bug.cgi?id=750386
2015-06-04 22:30:50 -04:00
Garrett Regier
bdc3f149ec binding: Simplify the default transform func
https://bugzilla.gnome.org/show_bug.cgi?id=750369
2015-06-03 17:46:57 -07:00
Garrett Regier
ace7f6861e binding: Remove conditional from the default transform function
Avoiding checking for INVERT_BOOLEAN each and
instead choose the correct function in constructed().

https://bugzilla.gnome.org/show_bug.cgi?id=750369
2015-06-03 17:46:57 -07:00
Garrett Regier
36593a3aba binding: Remove GObject data usage
It isn't actually doing anything, instead it is
being managed without actually being used.
This has the result that GBinding is now more
thread-safe.

https://bugzilla.gnome.org/show_bug.cgi?id=745013
2015-06-03 17:46:57 -07:00
Matthias Clasen
916297be79 Add a global signal handler table
Add a global lookup table for signal handlers. We already give
them a unique ID, so there is no good reason to pay for
non-constant lookups when disconnecting handlers.

https://bugzilla.gnome.org/show_bug.cgi?id=737009
2015-05-27 14:41:19 -04:00
Matthias Clasen
8a97dc5652 Add a performance test for signal connection
This test checks the performance of connecting, disconnecting and
blocking many handlers. Various cases are checked: disconnect in
the same order, in the inverse order, at random. Connect to one
signal on a single object, to two signals on the same object, or
to the same signal on two different objects.

https://bugzilla.gnome.org/show_bug.cgi?id=737009
2015-05-27 14:41:19 -04:00
Emmanuele Bassi
5e7e058a9c docs: Add an example of G_DEFINE_BOXED_TYPE
Mention that the GType of the boxed type is stored inside the
g_define_type_id variable.

See bug: https://bugzilla.gnome.org/show_bug.cgi?id=723394
2015-05-25 14:02:43 +01:00
Garrett Regier
f1c2e70345 Connect to the detailed notify signal in GBinding
This avoids the notify handler being called for each
and every emitted notify.

https://bugzilla.gnome.org/show_bug.cgi?id=749353
2015-05-14 03:58:53 -07:00
Garrett Regier
b07ba8ed3b Fix g_binding_unbind() when the source and target are the same
It tried to remove a weak ref, but it is only taken if the
source and target object are different.

https://bugzilla.gnome.org/show_bug.cgi?id=749352
2015-05-14 03:58:53 -07:00
Garrett Regier
29d380cc5b gtype: Bump allowed number of children
Restricting the number of children to be less than 4095 can
be an issue when generating types. This is also an issue for
the Lua bindings as each Lua state will create a new GType each
time the Lua code is executed.

https://bugzilla.gnome.org/show_bug.cgi?id=747882
2015-05-12 05:30:46 -07:00
Simon McVittie
45dae4b506 tests: replace most g_print() with g_printerr()
I searched all files that mention g_test_run, and replaced most
g_print() calls. This avoids interfering with TAP. Exceptions:

* gio/tests/network-monitor: a manual mode that is run by
  "./network-monitor --watch" is unaffected
* glib/gtester.c: not a test
* glib/gtestutils.c: not a test
* glib/tests/logging.c: specifically exercising g_print()
* glib/tests/markup-parse.c: a manual mode that is run by
  "./markup-parse --cdata-as-text" is unaffected
* glib/tests/testing.c: specifically exercising capture of stdout
  in subprocesses
* glib/tests/utils.c: captures a subprocess's stdout
* glib/tests/testglib.c: exercises an assertion failure in g_print()

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=725981
Reviewed-by: Colin Walters <walters@verbum.org>
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-05-11 20:24:56 +01:00
Philip Withnall
073a81d1da gsignal: Mark the return value of g_signal_emitv() as (inout) (optional)
https://bugzilla.gnome.org/show_bug.cgi?id=719966
2015-04-27 12:35:54 +01:00
Ryan Lortie
69fd1fd1d0 GClosure: add valgrind hints
GClosure has been in the "allocate area before the pointer" game since
before we did this with GTypeInstance.  At the time that this was done
for GClosure, we didn't have valgrind.h in GLib.

Now that we do, we should add similar valgrind hints as the ones we did
for GTypeInstance.  This substantially reduces reports of "possibly
lost" on pretty much any program that makes use of signals.

https://bugzilla.gnome.org/show_bug.cgi?id=739850
2015-03-23 10:54:25 -04:00
Ryan Lortie
d9de830b65 Convert remaining uses of 'Rename to:'
This was replaced by (rename-to) in 2013 (see bug 676133).

They're also causing gtk-doc trouble, so let's get rid of them.
2015-03-12 16:55:22 -04:00
Philip Withnall
6d030ea0ae gobject: Mark a helper variable as const
It’s only used for argv values, which are not modified here.

https://bugzilla.gnome.org/show_bug.cgi?id=614684
2015-03-04 08:55:30 +00:00
Philip Withnall
4aedc85fb3 gobject: Mention g_clear_object() in g_object_unref() documentation
https://bugzilla.gnome.org/show_bug.cgi?id=741779
2015-03-03 18:40:33 +00:00
Philip Withnall
c639b628ec gparamspecs: Recommend use of most specific GParamSpec types
It’s quite common to see a g_param_spec_pointer() used for GObject or
boxed types which, while not incorrect, does make memory management
unsafe, since no copying or reference counting can be performed
automatically.

Similarly, people often use g_param_spec_boolean() when an enum would be
more appropriate, cf.
    http://blog.ometer.com/2011/01/20/boolean-parameters-are-wrong/
Using enums also means that the set of allowable values can be extended
in future if needed.

In the hope that people who write code like that read the documentation,
mention the more specific types in the documentation.

https://bugzilla.gnome.org/show_bug.cgi?id=741779
2015-03-03 18:40:33 +00:00
Marc-Antoine Perennou
a3a9664ed2 make *_get_instance_private const-compliant
This is pure read-only access to an external struct
so void warnings for people calling it from const
contexts such as accessors

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

Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
2015-02-27 08:51:08 +01:00
Marc-Antoine Perennou
52f23db74a G_DECLARE_*: be const-compliant
switching to the old macros boilerplate to G_DECLARE_*
a lot of warnings start to pop when *_IS_A_* or such are
called from a const context.
Fix this by taking const pointers as parameters

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

Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
2015-02-27 08:51:08 +01:00
David King
d36f6a9633 gobject.h: Use correct format specifier for __LINE__
GCC 5.0, with its new -Wformat-signedness, warns about the sign being
different between a type and the format string in printf-format
messages, leading to compiler warnings with G_OBJECT_WARN_INVALID_PSPEC.
In other uses of __LINE__ inside GLib, %d is used, and GCC seems to
expect a format specifier of %d as well:
https://gcc.gnu.org/onlinedocs/cpp/Standard-Predefined-Macros.html

https://bugzilla.gnome.org/show_bug.cgi?id=744263
2015-02-26 12:32:43 +01:00
Emmanuele Bassi
5e994b1e9b gobject: Add missing autocleanup for GInitiallyUnowned
We are missing the auto cleanup function for this type, which means
G_DECLARE_* macros won't work with classes inheriting from
GInitiallyUnowned.
2015-02-20 19:54:07 +00:00
Bastien Nocera
43df97ab86 goption: Add boxed type for GOptionGroup
This would allow bindings to use _get_option_group() functions, which
would then allow them to use GOption parsing.

This also adds introspection annotations to
g_option_context_add_group(), g_option_context_set_main_group() and
g_option_context_get_main_group().

https://bugzilla.gnome.org/show_bug.cgi?id=743349
2015-02-11 15:32:00 +01:00
Sébastien Wilmet
3f6d233e87 docs: code example for enumeration types
I had to read the GTK+ code recently to have an example.

https://bugzilla.gnome.org/show_bug.cgi?id=736914
2015-02-08 16:06:17 +01:00
Xavier Claessens
3d39b8eb01 Add G_DECLARE_INTERFACE
https://bugzilla.gnome.org/show_bug.cgi?id=743939
2015-02-06 12:18:37 +01:00
Xavier Claessens
6a97275c45 docs: fix many documentation issues in gobject/ 2015-02-05 16:01:17 +01:00
Ryan Lortie
8d96932cb8 docs: add a bunch of pointless documentation
Document each of the baked-in CClosure marshallers that we have in
gobject, along with their #GVaClosureMarshal equivalents.

Based on a patch from Xavier Claessens <xavier.claessens@collabora.com>.
2015-02-04 15:37:27 +01:00
Xavier Claessens
2b536d3cbb docs: fix typos in G_DECLARE_*_TYPE
https://bugzilla.gnome.org/show_bug.cgi?id=743656
2015-02-03 15:57:54 +01:00
Chun-wei Fan
6161b285da gtype.h: Fix Build on non-GCC
Use the (private) _GLIB_DEFINE_AUTOPTR_CHAINUP macro for
G_DECLARE_DERIVABLE_TYPE and G_DECLARE_FINAL_TYPE so that we will
attempt to typedef and define items necessary for GCC
__attribute__((cleanup)) on, well, GCC only.

This fixes the build on non-GCC.

https://bugzilla.gnome.org/show_bug.cgi?id=743640
2015-02-03 20:20:46 +08:00
Chun-wei Fan
407adc6ea1 gobject\gtype.h: Make up for Missing '\'
The macro definition for G_DECLARE_DERIVABLE_TYPE was missing a '\' when
we wanted to ignore deprecation warnings for it.
2015-02-02 11:16:29 +08:00
Ryan Lortie
8ea414c8c6 G_DECLARE_*_TYPE: add auto cleanup support
Automatically add support for the new cleanup macros to the type
declaration macros.

This is an API break because now your parent class needs to support
cleanup if you want to use G_DECLARE_*_TYPE.  These macros are only 1
day old, however, so that's probably not a big problem (and we are
already busy adding the macros all over GLib and Gtk+).

https://bugzilla.gnome.org/show_bug.cgi?id=743640
2015-01-30 16:52:36 +01:00
Ryan Lortie
3d5de34def gobject: add support for g_auto() and g_autoptr()
Add support to libgobject types for the new cleanup macros.

https://bugzilla.gnome.org/show_bug.cgi?id=743640
2015-01-30 16:52:36 +01:00
Ryan Lortie
b5e1ea6fee DECLARE_TYPE: ignore deprecations in inlines
Prevent complaints about deprecations in the inline functions emitted by
the new G_DECLARE_*_TYPE macros.
2015-01-30 16:49:53 +01:00
Ryan Lortie
9d0389b3b5 G_DECLARE_FINAL_TYPE: trivial fix in docs comment
https://bugzilla.gnome.org/show_bug.cgi?id=743640
2015-01-30 16:49:53 +01:00
Christian Hergert
f3c604d273 G_DECLARE_DERIVED_TYPE: allow forward declarations
This allows multiple declarations such as:

 typedef struct _Foo Foo;

as is needed when you have systems with circular referencing.

https://bugzilla.gnome.org/show_bug.cgi?id=743596
2015-01-28 13:22:23 +00:00
Ryan Lortie
3b4cb28e17 gtype: add type declaration macros for headers
Add G_DECLARE_DERIVABLE_TYPE() and G_DECLARE_FINAL_TYPE() to allow
skipping almost all of the typical GObject boilerplate code.

These macros make some assumptions about GObject best practice that mean
that they may not be usable with older classes that have to preserve
API/ABI compatibility with a time before these practices existed.

https://bugzilla.gnome.org/show_bug.cgi?id=389585
2015-01-27 11:07:52 +00:00
Philip Withnall
1cf7f5a240 gobject: Fix a typo in a documentation comment 2015-01-25 17:09:35 +00:00
Thomas Haller
c447bc7f93 gobject: don't use G_STRLOC in G_OBJECT_WARN_INVALID_PSPEC() macro
Using G_STRLOC ends up embedding unique strings of the form
__FILE__:__LINE__ in the compiled binary. We can avoid these
by passing __FILE__ and __LINE__ separately when constructing
the warning text.
This probably reduces the size of the binary as __FILE__ is
likely already contained as string otherwise.

Note that for GCC 2.x this changes behavior because G_STRLOC
also contained __PRETTY_FUNCTION__.

https://bugzilla.gnome.org/show_bug.cgi?id=741654
2014-12-18 15:02:16 +01:00
Philip Withnall
d951db4236 gobject: Add g_set_object() convenience function to set GObject pointers
Along the same lines as g_clear_object(), g_set_object() is a
convenience function to update a GObject pointer, handling reference
counting transparently and correctly.

Specifically, it handles the case where a pointer is set to its current
value. If handled naïvely, that could result in the object instance
being finalised. In the following code, that happens when
(my_obj == new_value) and the object has a single reference:
    g_clear_object (&my_obj);
    my_obj = g_object_ref (new_value);

It also simplifies boilerplate code such as set_property()
implementations, which are otherwise long and boring.

Test cases included.

https://bugzilla.gnome.org/show_bug.cgi?id=741589
2014-12-18 11:32:56 +00:00
Ryan Lortie
c476f7cd26 gsignal: add a clarification to the docs
As evidenced by a mistake that I made recently, this documentation could
use a little bit of clarification.
2014-11-28 16:22:16 -05:00
Jasper St. Pierre
91802bbf2b gparam: Make the documentation clearer for CONSTRUCT_ONLY properties
It's not that the properly will only be set on construction, it's that
it *can* only be set upon construction.
2014-11-22 19:47:43 -08:00
Volker Sobek
1edd463137 docs: Update GParamFlags docs.
Remove reference to G_PARAM_READWRITE from GParamFlags' description,
since commit 6c395244a5 added G_PARAM_READWRITE to GParamFlags.

https://bugzilla.gnome.org/show_bug.cgi?id=726037
2014-11-10 23:25:23 +01:00
Benjamin Otte
36d8b941d4 signal: Keep only one list of emissions
There is no need to keep 2 lists.

This simplifies the code and gets rid of the only user inside glib of
G_HAVE_GROWING_STACK.

https://bugzilla.gnome.org/show_bug.cgi?id=736284
2014-10-12 00:27:06 +02:00
Matthias Clasen
58ec89ea7c Fix a return_if_fail confusion
This slipped through my editing of the patch.
2014-10-11 15:53:13 -04:00
Owen W. Taylor
011bf876e7 Add simple instance count facility
Add GOBJECT_DEBUG=instance-count which enables internal accounting
of the number of instances of each GType, and g_type_get_instance_count()
to retrieve the result.

https://bugzilla.gnome.org/show_bug.cgi?id=354457
2014-10-11 13:54:29 -04:00
Edward Hervey
3e2735f468 gtype: Fast-path for g_type_is_a
Do I really need to explain why ?

https://bugzilla.gnome.org/show_bug.cgi?id=732085
2014-08-08 11:13:38 +02:00
Andre Moreira Magalhaes (andrunko)
4b5bdf6ceb Do not crash when checking whether an instance type is of a given fundamental.
Not all instances have a TypeNode associated (e.g. GstEvent), so lets check if node is available
before trying to use it.

This crash can be easily reproduced by creating an event with gst_event_new_eos and using
G_IS_OBJECT on the event instance.

https://bugzilla.gnome.org/show_bug.cgi?id=733982
2014-08-08 11:13:01 +02:00
Alexander Larsson
b1dd594a22 Remove atomics from g_clear_object/g_clear_pointer
Practically no caller of these functions require atomic behaviour,
but the atomics are much slower than normal operations, which makes
it desirable to get rid of them. We have not done this before because
that would be a break of the ABI.

However, I recently looked into this and it seems that even if the
atomics *are* used for g_clear_* it is not ever safe to use this.  The
atomics protects two threads that are racing to free a global/shared
object from freeing the object twice. However, any *user* of the global
object have no protection from the object being freed while in use,
because there is no paired operation the reads and refs the object
as an atomic unit (nor can such an operation be implemented using
purely atomic ops).

So, since nothing could safely have used the atomic aspects of these
functions I consider it acceptable to just remove it.

https://bugzilla.gnome.org/show_bug.cgi?id=733969
2014-07-30 15:11:01 +02:00
Javier Jardón
60fe7b46d2 docs: Use "Returns:" instead "Return:" 2014-07-10 17:09:30 +01:00
Michael Catanzaro
29c48f623f Fix typo 2014-07-05 20:27:58 -05:00
Kang Hu
baef9d1811 gobject: move _g_type_debug_flags from gtype.h to gtype-private.h
_g_type_debug_flags is used internally to suport GOBJECT_DEBUG
environment variable. it should never be exposed to the outside.

https://bugzilla.gnome.org/show_bug.cgi?id=729914
2014-06-28 14:00:32 -04:00
Ryan Lortie
dce88768dc all: remove use of 'register' keyword
We should have done this a decade ago...

https://bugzilla.gnome.org/show_bug.cgi?id=730293
2014-06-28 13:07:52 -04:00
Ryan Lortie
6677906436 GObject: tweak property deprecation warnings
Don't emit property deprecation warnings for construct properties that
are being set to their default value during construction, but _do_ emit
them in all cases when the property was explicitly given to
g_object_new().

https://bugzilla.gnome.org/show_bug.cgi?id=732184
2014-06-27 14:44:36 -04:00
Emmanuele Bassi
f948a71483 gtype: Remove unused header
GType does not use GBSearchArray any more.
2014-06-25 11:56:12 +01:00
Ryan Lortie
d0e7061785 GObject: warn on use of deprecated properties
By default G_PARAM_DEPRECATED means absolutely nothing.  We only emit a
warning if G_ENABLE_DIAGNOSTIC is set to '1' and then, only on sets.

Turn the logic on its head: emit the warning by default, unless
G_ENABLE_DIAGNOSTIC is set to 0.  In order to avoid a torrent of output, only
emit a warning once per property name.

https://bugzilla.gnome.org/show_bug.cgi?id=732184
2014-06-24 16:18:30 -04:00
Edward Hervey
c5c3c320a2 gvalue: New g_value_init_from_instance
Used for the commonly used case (in signal emission) where we
initialize and set a GValue for an instance

Includes a fast-path for GObject

Overall makes it 6 times faster than the previous combination
of g_value_init + g_value_set_instance

Makes signal emission around 10% faster

https://bugzilla.gnome.org/show_bug.cgi?id=731950
2014-06-24 14:21:10 -04:00
Philip Withnall
248ca72782 gsignal: Add an example to the g_signal_connect_swapped() documentation
The precise behaviour of and motivation behind swapping parameters was
not entirely clear before.

https://bugzilla.gnome.org/show_bug.cgi?id=732068
2014-06-23 12:30:51 +01:00
Philip Withnall
0950369899 gclosure: Remove an unused alloca() and assignment
Coverity issue: #1159511

https://bugzilla.gnome.org/show_bug.cgi?id=732005
2014-06-22 12:57:57 +01:00
Matthias Clasen
7991178a75 Try to make gobject.py work with both pythons
This change was suggested on the fedora test list, and has been
reported to work.
2014-06-16 15:25:42 -04:00
Colin Walters
09498e52bb gparam: Remove unnecessary conditionals around preconditions
These cause a static analyzer to think we're trying to actually handle
them being NULL, which is not the case.  They both must not be NULL,
period.

No idea why the code was like this originally.

Reviewed by mclasen on IRC.
2014-06-12 13:38:27 -04:00
Ryan Lortie
fcdd25a96e gparam: change value of G_PARAM_EXPLICIT_NOTIFY
GParamSpec has a possibility of user-introduced flags, and we didn't
respect that with the addition of _EXPLICIT_NOTIFY.

Change the documentation for the maximum number of user flags to 10,
just to pick a somewhat random number.  The documentation here was never
correct anyway -- it previously claimed that as many as 38 flags were
possible.

Meanwhile, move G_PARAM_EXPLICIT_NOTIFY next to _DEPRECATED in order to
avoid conflicts with low-numbered user flags (which are in use by at
least evolution-data-server).

https://bugzilla.gnome.org/show_bug.cgi?id=731341
2014-06-10 19:04:35 -04:00
Ryan Lortie
545b44444b gtype: remove interface-after-init exceptions
A year ago, we tried to remove support for adding interfaces on
already-initialised types.  There were problems with the C++ and C#
bindings at the time, so we added exceptions to give them a bit more
time to catch up.

It's already one cycle after when these exceptions were planned to be
removed, so let's take them out now.

https://bugzilla.gnome.org/show_bug.cgi?id=697229
2014-06-09 14:18:15 -04:00
Ryan Lortie
f2f66bfe45 docs: warn about installing properties after init
Leave ourselves a little wiggle room: if people install properties after
initialisation then we reserve the right to handle that in a way that
may not be threadsafe.

https://bugzilla.gnome.org/show_bug.cgi?id=698614
2014-06-06 16:44:47 -04:00
Ryan Lortie
85e9455f68 Revert "GObject: prevent installing properties after init"
This reverts commit ddb0ce1421.

Conflicts:
	gobject/gobject.c

https://bugzilla.gnome.org/show_bug.cgi?id=698614
2014-06-06 16:44:47 -04:00
Ryan Lortie
d558e87c65 gtype: guard uses of new fundamental type check
g_type_is_fundamentally_a (see bug 730984) is a new API/ABI and is
marked with a version macro.  We should therefore avoid its
unconditional use from G_IS_OBJECT() and G_IS_PARAM_SPEC() which are
APIs that have been around for a long time.

This prevents deprecation warnings from being emitted when these
functions are used with an older GLIB_VERSION_MAX_ALLOWED and also
prevents linking to the new ABI in that case (so that it's possible to
use the resulting binary with an older version of GLib).

https://bugzilla.gnome.org/show_bug.cgi?id=731335
2014-06-06 10:49:29 -04:00
Ryan Lortie
0208861a13 test: add test for explicit-notify properties
https://bugzilla.gnome.org/show_bug.cgi?id=731200
2014-06-06 10:25:48 -04:00
Ryan Lortie
bbdb2345fc gobject: add 'explicit notify' GParamSpec flag
Add a flag to prevent the automatic emission of the "notify" signal
during g_object_set_property().

If this flag is set then the class must explicitly emit the notify
for themselves.  This is already standard practice on most classes, but
we cannot simply remove the existing behaviour because there are surely
many cases where it is needed.

https://bugzilla.gnome.org/show_bug.cgi?id=731200
2014-06-06 10:25:48 -04:00
Matthias Clasen
adfaf0e456 docs: GType documentation cleanup
Still some markup left.
2014-05-31 20:55:00 -04:00
Emmanuele Bassi
24ab95582b docs: Replace <function> XML tag with back ticks
https://bugzilla.gnome.org/show_bug.cgi?id=731050
2014-05-31 19:22:15 +01:00
Matthias Clasen
ab18d71e6f Minor documentation additions and corrections
Going for 100%.
2014-05-31 10:54:02 -04:00
Matthias Clasen
ad5b4bf92e Document g_signal_handlers_destroy 2014-05-31 10:54:02 -04:00
Edward Hervey
f8595a490f GParamSpec: Use new fundamental instance check
https://bugzilla.gnome.org/show_bug.cgi?id=730984
2014-05-31 15:46:21 +02:00
Edward Hervey
faceb8960b gobject: Use fast fundamental instance type check
Speeds up g_object_ref/_unref by 50%-65% (i.e. takes 60-65% of the time
it used to take).

https://bugzilla.gnome.org/show_bug.cgi?id=730984
2014-05-31 15:46:21 +02:00
Edward Hervey
6072e3650f gtype: Add check for fundamental instance type
When checking whether an instance is of a given fundamental type (such
as G_TYPE_OBJECT), we can avoid over 60%+ of the cost of checking types.

https://bugzilla.gnome.org/show_bug.cgi?id=730984
2014-05-31 15:45:29 +02:00
Matthias Clasen
03a48e1ade Fix the closure test in continuous
This test has the same problem as the mapping-test - it uses
SIGUSR1 without checking the signal mask. Apply the same fix
here.
2014-05-30 10:22:35 -04:00
Marek Kasik
6a8c2685be gobject: unref unused class
If g_type_class_ref() returns a class which is not
a GObjectClass we need to unref it before return in
object_interface_check_properties().

https://bugzilla.gnome.org/show_bug.cgi?id=706983
2014-05-22 11:00:14 +02:00
Matthias Clasen
4360756c69 Avoid overeager warning about deprecated properties
Construct properties are always set during construction.
It makes no sense to warn about this even if the property
is marked as deprecated; the deprecation warning should
only be issues for explicit uses of the property after
construction.

https://bugzilla.gnome.org/show_bug.cgi?id=730045
2014-05-13 08:08:38 -04:00
Matthias Clasen
4dba2eb486 Remove some markup from docs 2014-05-13 08:08:37 -04:00
Tom Tromey
20cda557e5 gobject.py: Port to gdb 7.7 frame filter API
https://bugzilla.gnome.org/show_bug.cgi?id=623552
2014-05-10 19:49:22 +10:00
Sébastien Wilmet
430e6fd6ad doc: various improvements
- GSubprocessLauncher exists since 2.40, not 2.36
- more logical order for g_markup functions
- fix short description of GMarkup
- GMarkupParser: specify that some parameters are NULL-terminated.
- g_string_new (NULL); is possible.
- other trivial fixes.

https://bugzilla.gnome.org/show_bug.cgi?id=728983
2014-05-09 18:47:42 +02:00
Mathieu Bridon
24fdee7a78 Fix some typos in documentation 2014-05-05 18:30:56 +08:00
Philip Withnall
704852ff09 gobject: Document that classes/objects/interfaces are zero-filled
On initialisation, GObject guarantees to zero-fill
class/object/interface structures. Document this so people don’t spend
forever writing:
    my_object->priv->some_member = NULL;
    my_object->priv->some_other_member = NULL;

https://bugzilla.gnome.org/show_bug.cgi?id=729167
2014-04-29 10:40:20 +01:00
Volker Sobek
4441595378 docs: Remove <!-- --> comment before plural s
These did show up in the html. Since symbol names are checked for a
trailing plural s when generating the docs, the links stay functional
after removing these comments.

https://bugzilla.gnome.org/show_bug.cgi?id=728380
2014-04-24 13:42:37 +02:00
Volker Sobek
9f0ad54c80 docs: Use markdown links in all .c and .h files
Commit e7fd3de86d already did most of this.

https://bugzilla.gnome.org/show_bug.cgi?id=728285
2014-04-15 22:19:07 +02:00
Emmanuele Bassi
6c395244a5 gparam: Add G_PARAM_READWRITE to GParamFlags
Using a #define for an enumeration value buys us nothing, and it's
mostly historical baggage that makes binding GObject needlessly
complicated.

https://bugzilla.gnome.org/show_bug.cgi?id=726037
2014-04-10 20:00:23 +01:00
Alexandre Rostovtsev
2b178c762f gobject: try to link with -Wl,-z,nodelete
Since the type system does not support reloading its data and assumes
that libgobject remains loaded for the lifetime of the process, we
should link libgobject with a flag indicating that it can't be unloaded.

https://bugzilla.gnome.org/show_bug.cgi?id=707298
2014-04-10 01:38:41 -04:00
Paolo Borelli
4a4b044321 Add a small note to g_cclosure_marshal_generic docs
reviewed-by: Emmanuele Bassi
2014-04-03 11:37:32 +02:00
Dan Winship
d8c14f1378 gbinding: warn on failed value transformation
GBinding warned if g_value_transform() returned FALSE, but it didn't
warn if there was no transformation available at all. Fix that and
test it.

https://bugzilla.gnome.org/show_bug.cgi?id=726574
2014-03-17 17:43:19 -04:00
Sebastian Dröge
012011538f gtype – Mark _get_instance_private() function as G_GNUC_UNUSED
clang likes to complain about it being unused.

https://bugzilla.gnome.org/show_bug.cgi?id=723899
2014-03-08 09:01:52 -05:00
Matthias Clasen
7a6dfd75d6 GObject: Remove more leftover markup from headers 2014-03-07 06:10:36 -05:00
Matthias Clasen
49cc207e35 docs: Ditch more markup
Some markup was hiding in docs in headers. Drop it there, too.
2014-03-02 18:23:43 -05:00
William Jon McCann
20f4d1820b docs: use "Returns:" consistently
Instead of "Return value:".
2014-02-19 19:41:52 -05:00
Ryan Lortie
7cbff954b9 win32: fixup lib.exe invocation
We have a configure.ac check for lib.exe that attempts to enable
creation of .lib files for our 5 public libraries.  That has been broken
for a long time for two reasons:

 1) the Makefiles hardcode 'lib' instead of 'lib.exe'

 2) we dropped generation of .def files quite some time ago (except for
    in gthread where we have the two-symbol file under version control)

Add new rules for creating .def files from dumpbin.exe (which you should
have if you have lib.exe) and fix the .lib rules to use lib.exe.

Add a bit of $(AM_V_GEN) all around, as well.

https://bugzilla.gnome.org/show_bug.cgi?id=722033
2014-02-15 16:55:25 -05:00
Dan Winship
5cab3fcec1 gobject: re-allow finalization from constructor()
Although returning NULL from constructor is strongly discouraged, some
old libraries need to keep doing it for ABI-compatibility reasons.
Given this, it's rude to forbid finalization from within
constructor(), since it would otherwise work correctly now anyway (and
the critical when returning NULL should discourage any new uses of
returning NULL from constructor()).

https://bugzilla.gnome.org/show_bug.cgi?id=661576
2014-02-15 10:20:53 -05:00
Matthias Clasen
bc6ee788b4 docs: let go of &ast;
Since we are no longer using sgml mode, using /&ast; &ast;/ to
escape block comments inside examples does not work anymore.
Switch to using line comments with //
2014-02-14 21:33:36 -05:00
Matthias Clasen
35066ed6c6 Docs: Drop entities, switch away from sgml mode
Since all element markup is now gone from the doc comments,
we can turn off the gtk-doc sgml mode, which means that from
now on, docbook markup is no longer allowed in doc comments.

To make this possible, we have to replace all remaining
entities in doc comments by their replacement text, &amp; -> &
and so on.
2014-02-09 02:07:26 -05:00
Matthias Clasen
e7fd3de86d Eradicate links and xrefs
These are all replaced by markdown ref links.
2014-02-08 12:26:56 -05:00
Matthias Clasen
5baa0f2af5 Stop using <para> for ids
Instead, use the id support in markdown headings.
2014-02-06 16:48:49 -05:00
Matthias Clasen
3232425785 Docs: replace <literal> by ` 2014-02-06 08:07:16 -05:00
Matthias Clasen
a35d8a4c77 Docs: use quotes instead of firstterm 2014-02-06 08:07:16 -05:00
Matthias Clasen
cb588d4532 Convert external links to markdown syntax 2014-02-05 21:23:28 -05:00
Ryan Lortie
78ec35f7ab gobject: box GVariantDict
We will want to use this in GApplication for a signal and a property.

https://bugzilla.gnome.org/show_bug.cgi?id=625408
2014-02-04 12:24:19 +00:00
Matthias Clasen
adf892e96a Annotate all examples with their language
The C ones, at least.
2014-02-01 15:11:49 -05:00
Matthias Clasen
42cf80780b Docs: Big entity cleanup
Strip lots of entity use from |[ ]| examples (which are now
implicit CDATA). Also remove many redundant uses of <!-- -->.
2014-02-01 12:00:30 -05:00
Matthias Clasen
60b623d3fb GObject: Convert docs to markdown
In particular, convert lists to markdown syntax.
2014-02-01 10:22:45 -05:00
Matthias Clasen
a4c33c6f8b Docs: Don't use the code tag 2014-01-31 22:05:04 -05:00
Matthias Clasen
17f51583a8 Docs: Convert examples to |[ ]| 2014-01-31 21:56:33 -05:00
Matthias Clasen
4d12e0d66f Docs: Don't use the emphasis tag
Most of the time, the text read just as well without the extra
boldness.
2014-01-31 20:34:33 -05:00
Matthias Clasen
c575d24dfb Docs: Don't use the note tag
More markup avoidance.
2014-01-31 18:20:06 -05:00
Daniel Mustieles
078dbda148 Updated FSF's address 2014-01-31 14:31:55 +01:00
Matthias Clasen
3d42934b71 Docs: don't use the structname tag
Just avoid explicit docbook markup.
2014-01-31 00:29:14 -05:00
Matthias Clasen
6f3c465535 Docs: don't use structfield tags
They don't add anything over @foo, and we want to avoid explicit
docbook markup as far as possible.
2014-01-30 23:59:06 -05:00
Matthias Clasen
acfb76afe2 Docs: don't use <footnote>
It basically does not work in the HTML output.
2014-01-30 23:52:58 -05:00
Rico Tzschichholz
ee38a1af80 gobject: Add missing transfer annotation to g_boxed_copy 2014-01-23 17:22:19 +01:00
A. Walton
deb8a9325b Clarify type transformability and comparability
If two GValues are transformable, it implies they are compatible,
so you do not need to check for compatibility yourself. Bump the
documentation to reflect this fact.

https://bugzilla.gnome.org/show_bug.cgi?id=707111
2014-01-19 23:51:51 -05:00
Jasper St. Pierre
243bec9d0d gobject.py: Simplify or_join_array 2013-12-31 15:40:40 -05:00
Jasper St. Pierre
bfbe7127d5 gobject.py: Simplify and reduce code a bit 2013-12-31 15:40:40 -05:00
Jasper St. Pierre
4e512a1af8 gobject.py: Remove old hack for stripping IA__ symbols
We don't use IA__ symbols anymore; they've been replaced with -Bsymbolic
2013-12-31 15:40:10 -05:00
Jasper St. Pierre
b4af2d685e gobject.py: Fix indentation 2013-12-31 15:40:10 -05:00
Tim Lunn
d33f72097f Make gdb pretty-printers compatible with Python3
On some systems gdb is linked against python3 where "long" no longer
exists. In this case should be using int.

https://bugzilla.gnome.org/show_bug.cgi?id=720635
2013-12-18 07:22:16 +11:00
Damien Lespiau
91d4659bbf gobject.py: Don't install frame filters when GDB does not support them
Stock GDB (both versions 7.0 and 7.1) does not come with the new
backtrace code and python API. To prevent an ugly python backtrace when
auto-loading gobject.py, let's catch the exception and not register the
FrameWrapper and the FrameFilter.

https://bugzilla.gnome.org/show_bug.cgi?id=613732
2013-12-17 10:51:48 -05:00
Matthias Clasen
c34cc2348c Simplify subprocesses in tests
Use the new way of running tests in a subprocess without
registering extra 'subprocess' test cases where appropriate.
2013-12-15 11:50:00 -05:00
Colin Walters
8f4dc7012e gsignal: Signal connection ids are always > 0 if successful
Note this explicitly so that people can rely on doing:

if (mystruct->sigid > 0)
  g_signal_disconnect (mystruct->object, mystruct->sigid);

https://bugzilla.gnome.org/show_bug.cgi?id=719809
2013-12-03 19:23:49 -05:00
Matthias Clasen
2baa50ee4f Remove g_trap_instance_signals as well
This is another crude conditional breakpoint mechanism and can
be done better with actual conditional breakpoints or with systemtap
tracepoints.

https://bugzilla.gnome.org/show_bug.cgi?id=719687
2013-12-03 06:00:47 -05:00