Commit Graph

18 Commits

Author SHA1 Message Date
Aleksandr Mezin
f346b9c8ce glib-genmarshal: close output file
Close output file to ensure all buffered output actually gets written.

Otherwise, glib-genmarshal output is sometimes empty (for example, when trying
to build gdk-pixbuf on Windows, with Meson installed from .msi package).

argparse.FileType doesn't get closed automagically when the script exits:
https://bugs.python.org/issue13824

Fixes https://gitlab.gnome.org/GNOME/glib/-/issues/2341
2021-03-03 12:24:29 +06:00
Philip Withnall
3f411a36af glib-genmarshal: Avoid a param ref for static param valist arguments
When building a valist marshaller, we can avoid reffing a GParamSpec
if the argument is known to always be static. The marshaller we ship in
`gmarshal.c` got this right, but marshallers generated by
glib-genmarshal were missing the optimisation. Fix that, and add a unit
test.

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

Fixes: #1792
2019-06-18 11:59:11 +01:00
Philip Withnall
1e10d6b6dd glib-genmarshal: Avoid a string copy for static string valist arguments
When building a valist marshaller, we can avoid a string copy if the
argument is known to always be static. The marshaller we ship in
`gmarshal.c` got this right, but marshallers generated by
glib-genmarshal were missing the optimisation. Fix that, and add a unit
test.

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

Fixes: #1792
2019-06-08 00:31:03 +01:00
Philip Withnall
f044ddc1ee glib-genmarshal: Fix ref-sinking of GVariants in valist marshallers
The old (Perl) implementation of glib-genmarshal used
g_variant_ref_sink() to correctly handle floating inputs; the Python
version should do the same.

Includes a unit test.

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

Fixes: #1793
2019-06-08 00:30:59 +01:00
Kentaro Hayashi
807648663d gobject: Fix redundant warning message in glib-genmarshal
glib-genmarshal shows redundant "time" warning message against combination with --header and --body option.

Before:

  WARNING: Using --header and --body at the same time time is deprecated; use --body --prototypes instead

After:

  WARNING: Using --header and --body at the same time is deprecated; use --body --prototypes instead

https://bugzilla.gnome.org/show_bug.cgi?id=795429
Signed-off-by: Kentaro Hayashi <hayashi@clear-code.com>
2018-04-23 16:16:36 +01:00
Emmanuele Bassi
bf0be21208 Do not generate marshaller aliases in source files
When generating the body of the marshallers, we need to skip aliases to
standard marshallers provided by GLib itself.

https://bugzilla.gnome.org/show_bug.cgi?id=790829
2017-12-21 13:54:24 +00: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
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
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
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
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
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
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
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