Commit Graph

97 Commits

Author SHA1 Message Date
Alex Richardson
d0e03f0930 GType: introduce GTYPE_TO_POINTER/GPOINTER_TO_TYPE
On CHERI-enabled systems we use uintptr_t as the underlying storage for
GType and therefore casting to gsize strips the upper bits from a pointer.
Fix this by casting via uintptr_t instead and introduce a new set of
macros to convert between GType and pointers.
2023-10-25 12:01:02 +01:00
Emmanuele Bassi
47faa032cb docs: Remove duplicate docblocks
The g_cclosure_marshal_* symbols are already documented in gmarshal.c.
2023-10-23 10:25:31 +01:00
Matthias Clasen
bedf11b330 docs: Move the GClosure SECTION
Move the contents to the struct docs.

Helps: #3037
2023-10-16 23:35:05 +01:00
Philip Withnall
c09216f810 gclosure: Use (transfer floating) for closure construction functions
They return floating references, so that should be reflected in the
introspection annotations.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-12-02 11:59:16 +00:00
Simon McVittie
65016fddd9 Replace all uses of G_VA_COPY with Standard C va_copy
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-10-26 18:07:55 +01:00
Michael Catanzaro
0ffe86a1f7 Replace most GObject warnings with criticals
All of these warnings indicate programmer error, so critical is most
appropriate here.

Exceptions: deprecation warnings are just warnings. Also, warnings that
are worded with uncertainty can remain warnings rather than criticals.
2022-08-09 13:18:47 -05:00
Philip Withnall
26409f19cd Add SPDX license headers for LGPL-2.1-or-later to various files
These have all been added manually, as I’ve finished all the files which
I can automatically detect.

All the license headers in this commit are for LGPL-2.1-or-later, and
all have been double-checked against the license paragraph in the file
header.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: #1415
2022-06-01 12:44:23 +01:00
Evan Welsh
0de8ec87d2 Revert "Merge branch 'fix/gclosure-invoke-type-annotation' into 'main'"
This reverts merge request !2181
2021-08-29 20:56:08 +00:00
Emmanuele Bassi
f62622fc7b docs: Start stanzas with a single paragraph
When rendering the contents of the GLib documentation stored inside the
introspection data, a common behaviour is to take the first paragraph as
a summary of the symbol being documented.

The documentation is assumed to be in Markdown format, which means:

 - paragraphs must be separated by newlines
 - lines that have an indentation of four or more spaces are considered
   code blocks
 - lines that start with a `#` are considered titles

This means we need to slightly tweak the documentation in our sources to
ensure that it can be rendered appropriately by tools that are not
gtk-doc.

See issue: #2365
2021-08-02 13:22:23 +01:00
Ole André Vadla Ravnås
9c01c1ebee gclosure: Fix the invoke() return_value annotation
The return value must be initialized by the caller, as is clear from
GLib's internal callers, and e.g. dummy_closure_marshal() on the callee
side.
2021-07-09 02:43:54 +02:00
Philip Withnall
08d04d0428 gobject: Drop unnecessary volatile qualifiers from internal variables
These variables were already (correctly) accessed atomically. The
`volatile` qualifier doesn’t help with that.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: #600
2020-11-20 14:40:19 +00:00
Benjamin Otte
3f2a8d53f0 closure: Support generic marshals for interface returns
Use the newly added g_type_interface_instantiable_prerequisite() to
allow closure return values being interfaces by looking up the
instantiable type for the interface and using its GValue accessors.
2020-11-02 17:36:18 +00:00
Philip Withnall
00bfb3ab44 tree: Fix various typos and outdated terminology
This was mostly machine generated with the following command:
```
codespell \
    --builtin clear,rare,usage \
    --skip './po/*' --skip './.git/*' --skip './NEWS*' \
    --write-changes .
```
using the latest git version of `codespell` as per [these
instructions](https://github.com/codespell-project/codespell#user-content-updating).

Then I manually checked each change using `git add -p`, made a few
manual fixups and dropped a load of incorrect changes.

There are still some outdated or loaded terms used in GLib, mostly to do
with git branch terminology. They will need to be changed later as part
of a wider migration of git terminology.

If I’ve missed anything, please file an issue!

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-06-12 15:01:08 +01:00
Benjamin Otte
276e927fd4 Revert last 4 commits
This reverts commits:
  5899c61ed2
  e994d45352
  eb20dec144
  ebec0dd359
which wer accidentally pushed to master instead of a branch
2019-11-26 00:54:15 +01:00
Benjamin Otte
e994d45352 closure: Support generic marshals for interface returns
Use the newly added g_type_interface_instantiable_prerequisite() to
allow closure return values being interfaces by looking up the
instantiable type for the interface and usings its GValue accessors.
2019-11-25 20:06:39 +01:00
Philip Withnall
59a23bf24d gclosure: Minor documentation formatting improvements
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-08-16 10:59:45 +01:00
Philip Withnall
5b7c109e1c gclosure: Clarify when destroy notifiers are called in documentation
They’re called in finalize, not invalidate.

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

https://gitlab.gnome.org/GNOME/glib/issues/277
2018-08-16 10:58:43 +01:00
Xavier Claessens
707106c7a5 Fix Windows build errors in valgrind.h
valgrind.h is a verbatim copy taken from Valgrind project. Previously
that file had local changes that got dropped by last update. To avoid
regressing again, do not edit valgrind.h anymore and instead add a
gvalgrind.h wrapper that gets included instead.

This fix 2 errors:
- uintptr_t is not defined when including valgrind.h on mingw.
- MSVC compiler is not supported on amd64-Win64 platform.
2018-05-28 09:22:55 -04:00
Xavier Claessens
2d4b05bbf8 Revert "Fix build error when compiling with mingw"
This reverts commit 00178f8c8e.
2018-05-28 09:22:55 -04:00
Xavier Claessens
00178f8c8e Fix build error when compiling with mingw
uintptr_t must be defined when including valgrind.h, just move it as
last include solves the problem.

https://bugzilla.gnome.org/show_bug.cgi?id=796283
2018-05-26 13:09:56 +05:30
Philip Withnall
16e58dc901 gclosure: Expand documentation and fix some typos
The critical omission from the GClosure documentation is that you need
to call g_closure_set_marshal() when implementing a custom GClosure.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Reviewed-by: nobody
2018-04-26 18:04:47 +01:00
Philip Withnall
06719a86b2 docs: Drop unnecessary <!-- -->s from gtk-doc comments
Putting a <!-- --> in plural<!-- -->s was an old hack used to fix
linking the symbol with gtk-doc when gtk-doc didn’t know about plural
forms. gtk-doc does now know about plural forms, so the hack can be
removed.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-11-29 17:50:27 +00: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
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
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
Rico Tzschichholz
e3189527dc gio/gobject: Various introspection fixes 2016-02-03 18:13:49 +01: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
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
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
Xavier Claessens
6a97275c45 docs: fix many documentation issues in gobject/ 2015-02-05 16:01:17 +01:00
Michael Catanzaro
29c48f623f Fix typo 2014-07-05 20:27:58 -05: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
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
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
e7fd3de86d Eradicate links and xrefs
These are all replaced by markdown ref links.
2014-02-08 12:26:56 -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
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
Daniel Mustieles
078dbda148 Updated FSF's address 2014-01-31 14:31:55 +01:00
Matthias Clasen
f2e00a07f4 Improvde #include order consistency
This was mostly fixed already, just re-fix a few details here.
https://bugzilla.gnome.org/show_bug.cgi?id=71704
2013-01-01 13:54:54 -05:00
Mark Nauwelaerts
10fc00b385 gclosure: do not copy and leak when generically marshalling return value
https://bugzilla.gnome.org/show_bug.cgi?id=674800
2012-08-05 12:52:38 +01:00
Jasper St. Pierre
825fdfdc9a gclosure: Support return values of GVariants
https://bugzilla.gnome.org/show_bug.cgi?id=673803
2012-04-09 23:41:00 -04:00
Chun-wei Fan
b72bb9dd08 Use G_VA_COPY instead of va_copy()
va_vopy() is not universally available in all compilers, so make use of
the existing G_VA_COPY macro which either calls va_copy() if it is
available, or emulates it if otherwise.
2012-03-08 14:51:22 +08:00
Alexander Larsson
1c4f0ca483 Add _g_closure_is_void to check for NULL vfuncs
https://bugzilla.gnome.org/show_bug.cgi?id=661140
2012-03-02 17:13:03 +01:00
Alexander Larsson
588af03a28 Add optional support for varargs marshallers to GClosure
These closures support being invoked on a va_args which can
be useful as you can then avoid boxing the va_args into
GValues in certain cases.

https://bugzilla.gnome.org/show_bug.cgi?id=661140
2012-03-02 17:13:03 +01:00
Alexander Larsson
d5fbbe400a Add GRealClosure and move meta_marshallers there
This means we're not abusing the notifiers for meta_marshallres,
and we're able to later cleanly add other fields to GClosure.

We still have to leave the ABI intact for the GClosure->meta_marshal
bit, as old G_CLOSURE_N_NOTIFIERS macro instances still accesses it.
However, we always set it to zero to keep those macros working.

https://bugzilla.gnome.org/show_bug.cgi?id=661140
2012-03-02 17:13:03 +01:00
Chun-wei Fan
49b93a0bba gobjet/gclosure.c: Fix styling issues
...so that it looks more consistent with the rest.
2011-10-06 16:02:18 +08:00