Commit Graph

17 Commits

Author SHA1 Message Date
Marco Trevisan (Treviño)
47cf6387ad girepository/compiler: Free the parser when not needed
The compiler code was full of leaks and nothing really checked on them.

While it's not a big deal per se, per the nature of it, it's still
better to ensure that memory management is well done so that there are
no problems when using it with sanitizers.

So, the source of the problems was not freeing the parser, but that
wasn't enough, more to come...
2024-05-16 22:51:12 +01:00
Simon McVittie
1a8e2228f6 girepository: Provide placeholders for positional parameters
Otherwise, correct invocation isn't clear from the --help output.

This does not introduce new translated strings: FILE was already
translated.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-28 11:27:15 +00:00
Simon McVittie
9541b43eef girepository: Provide placeholders for --includedir
If we don't do this, the --help text is formatted as though the option
did not expect an argument.

This does not introduce new translated strings: DIRECTORY was already
translated.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-28 11:26:59 +00:00
Philip Withnall
bd17a09862 girepository: Combine input file validation code paths in utilities
The code and strings are the same, so let’s simplify things and reduce
LoC for no functional change.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-02-26 18:10:56 +00:00
Philip Withnall
08b3f14a32 compiler: Correctly use g_strerror() instead of strerror()
This ensures the return value is always UTF-8.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-02-26 18:10:56 +00:00
Philip Withnall
57a8834d7b girepository: Add translation support to utility tools
This fixes a few formatting and newline issues in the strings at the
same time, but nothing major.

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

Fixes: #3263
2024-02-26 18:10:56 +00:00
Philip Withnall
fe2c18a835 Merge branch 'wip/smcv/gi-unused-options' into 'main'
gi- tools: Remove unused options, improve --debug/--verbose

See merge request GNOME/glib!3926
2024-02-15 11:11:56 +00:00
Simon McVittie
e6d2c2c040 g-ir-compiler: Only accept one input file
The positional parameters are declared as G_OPTION_ARG_FILENAME_ARRAY,
but only the first one is used.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-14 11:11:14 +00:00
Simon McVittie
d40e1b9db3 gi-compile-repository: Make file-scoped variables static
This means the compiler will warn us if they become unused.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-14 10:36:34 +00:00
Simon McVittie
3f6de0706e girparser: Don't rely on gi-compile-repository exporting debug level
It seems cleaner to store this in the parser, rather than having the
compiler export a global variable that the parser must read.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-14 10:36:34 +00:00
Simon McVittie
a41496643b gi-compile-repository: Remove unused variable
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-14 10:21:44 +00:00
Simon McVittie
d3325bf879 gi-compile-repository: Remove unused --module option
This hasn't actually done anything since commit 45a04358
"[gircompiler] Clean up parsing" (originally
gobject-introspection@8942500c).

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-14 10:20:08 +00:00
Philip Withnall
a59499ab0a Merge branch 'no-override-g-ir-compiler' into 'main'
build: Only override g-ir-compiler when GIR generation is enabled

See merge request GNOME/glib!3876
2024-02-09 20:18:39 +00:00
Evan Welsh
e36839818a build: Only override g-ir-compiler when GIR generation is enabled
GLib is used a subproject with GObject Introspection and overriding
this binary breaks that usage. For now we will make overriding the
binary conditional until Meson is updated to handle the binary changes.
2024-02-09 06:56:38 -08:00
Philip Withnall
5cc5f413f5 gitypelib: Switch to refcounting
Since `GITypelib` is exposed in the public libgirepository API, it needs
to be a boxed type. So we either need to add a `copy` method to mirror
the existing `free` method, or switch to refcounting. The latter option
seems better, since a `GITypelib` contains internal state about open
`GModule`s and the semantics for copying that would be potentially
complex.

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

Helps: #3155
2024-02-07 21:07:18 +00:00
Evan Welsh
3bd7635516 girepository: Cleanup compiler.c formatting 2024-01-31 11:13:16 +00:00
Evan Welsh
5d997cad03 girepository: Update gi-compile-repository and use it to compile GIRs
Adapt gi-compile-repository sources to compile against the updated
libgirepository that is included with GLib.

This also renames "g-ir-compiler" to "gi-compile-repository" to avoid
overwriting the existing binary and to simplify the binary name going
forward.
2024-01-31 11:13:16 +00:00