Commit Graph

29721 Commits

Author SHA1 Message Date
Mark Doffman
cff3cc7ad9 tools/quote-file.sh tools/compiler.c tools/generate.c
2008-02-22  Mark Doffman  <mark.doffman@codethink.co.uk>

    * tools/quote-file.sh
    * tools/compiler.c
    * tools/generate.c

      Move to using the 'C' struct compiler code.

WARNING: This commit does not compile. It is a partial change.

svn path=/trunk/; revision=135
2024-02-08 13:53:59 +00:00
Mark Doffman
eb13d2e55b girepository/ginfo.c tools/generate.c
2008-02-21  Mark Doffman  <mark.doffman@codethink.co.uk>

    * girepository/ginfo.c
    * tools/generate.c

    Change the way that external references with no namespace
    are dealt with. External references with no namespace
    are placed into the XML as-if they are a local reference.
    This is temporary, but helps with roundtrip tests.

WARNING: This commit does not compile. It is a partial change.

svn path=/trunk/; revision=134
2024-02-08 13:53:59 +00:00
Mark Doffman
e56744c907 girepository/ginfo.c girepository/girepository.h tools/generate.c
2008-02-21  Mark Doffman  <mark.doffman@codethink.co.uk>

    * girepository/ginfo.c
    * girepository/girepository.h
    * tools/generate.c

      Add a function to check if an enum is registered or not.
      Previously anything testing this relied on the g-type
      string offset having a value of 0.

    * girepository/gmetadata.c
    * girepository/gmetadata.h
    * tools/generate.c

      Remove unneccesary or erroneous checks. There were two
      metadata validation checks which made sure that the blob
      sizes were the same as some magic numbers compiled into the code.
      This is wrong as it breaks any forwards compatibility that may
      be possible.

      Checks were also present that made sure that unregistered type
      blobs had a value of 0 in the g-type offset field. This is
      unneccessary. If a type blob is unregistered then any value
      in its g-type field is simply invalid.

WARNING: This commit does not compile. It is a partial change.

svn path=/trunk/; revision=132
2024-02-08 13:53:59 +00:00
Mark Doffman
9e6472853a girepository/ginvoke.c girepository/girepository.h
2008-02-21  Mark Doffman  <mark.doffman@codethink.co.uk>

    * girepository/ginvoke.c
    * girepository/girepository.h
    * girepository/gmetadata.c
    * girepository/gmetadata.h
    * tools/generate.c
    * tools/gidlparser.c

      Modify TYPE_TAG_INTERFACE to TYPE_TAG_SYMBOL
      to avoid confusion with the interface blob.

    * tools/generate.c
    * tools/gidlparser.c

      Remove magic numbers and replace with type-tag
      enumeration symbols.

    * girepository/gmetadata.c
      Add validate declaration.

WARNING: This commit does not compile. It is a partial change.

svn path=/trunk/; revision=129
2024-02-08 13:53:59 +00:00
Rob Taylor
a7d0962d46 Added: Added: Renamed to tools/Makefile.am: Renamed to tools/compiler.c:
2008-02-08  Rob Taylor  <rob.taylor@codethink.co.uk>

	* Makefile.am:
	* configure.ac:
	* gidl/Makefile.am: Added:
	* girepository/Makefile.am: Added:
	* src/Makefile.am: Renamed to tools/Makefile.am:
	* src/compiler.c: Renamed to tools/compiler.c:
	* src/g-idl-offsets.pl: Renamed to tools/g-idl-offsets.pl:
	* src/generate.c: Renamed to tools/generate.c:
	* src/gidlmodule.c: Renamed to tools/gidlmodule.c:
	* src/gidlmodule.h: Renamed to tools/gidlmodule.h:
	* src/gidlnode.c: Renamed to tools/gidlnode.c:
	* src/gidlnode.h: Renamed to tools/gidlnode.h:
	* src/gidlparser.c: Renamed to tools/gidlparser.c:
	* src/gidlparser.h: Renamed to tools/gidlparser.h:
	* src/gidlwriter.c: Renamed to tools/gidlwriter.c:
	* src/gidlwriter.h: Renamed to tools/gidlwriter.h:
	* src/ginfo.c: Renamed to girepository/ginfo.c:
	* src/ginvoke.c: Renamed to girepository/ginvoke.c:
	* src/girepository.c: Renamed to girepository/girepository.c:
	* src/girepository.h: Renamed to girepository/girepository.h:
	* src/gmetadata.c: Renamed to girepository/gmetadata.c:
	* src/gmetadata.h: Renamed to girepository/gmetadata.h:
	* src/scanner.c: Renamed to tools/scanner.c:
	* src/scanner.h: Renamed to tools/scanner.h:
	* src/scannerlexer.l: Renamed to tools/scannerlexer.l:
	* src/scannerparser.y: Renamed to tools/scannerparser.y:
	* tests/invoke/Makefile.am:
	Split src/ into girepository/ and tools/

	* Makefile.am:
	* configure.ac:
	* girepository/Makefile.am:
	* tests/Makefile.am:
	* tests/invoke/Makefile.am:
	* tests/parser/Makefile.am:
	* tests/roundtrips.sh:
	* tools/Makefile.am:
	Make distcheck work.

svn path=/trunk/; revision=104
2024-02-08 13:53:59 +00:00
Gustavo J. A. M. Carneiro
2b0304b865 reviewed by: Johan Dahlin <johan@gnome.org>
2007-12-06  Gustavo J. A. M. Carneiro  <gjc@gnome.org>

	reviewed by: Johan Dahlin  <johan@gnome.org>

	* configure.ac:
	* gobject-introspection.pc.in:
	* src/Makefile.am:
	* src/compiler.c: (format_output), (write_out_metadata), (main):
	* src/gen-introspect.c: (main):
	* src/gen-introspect.h:
	* src/generate.c: (write_callable_info), (write_repository),
	(load_metadata), (main):
	* src/gidlmodule.c: (g_idl_module_new),
	(g_idl_module_build_metadata):
	* src/gidlmodule.h:
	* src/gidlparser.c: (start_element_handler):
	* src/ginfo.c: (g_info_new), (g_info_from_entry),
	(g_base_info_get_name), (g_base_info_get_namespace),
	(g_base_info_is_deprecated), (g_base_info_get_annotation),
	(g_base_info_get_metadata), (g_function_info_get_symbol),
	(g_function_info_get_flags), (g_function_info_get_property),
	(g_function_info_get_vfunc), (signature_offset), (g_type_info_new),
	(g_callable_info_may_return_null),
	(g_callable_info_get_caller_owns), (g_callable_info_get_n_args),
	(g_callable_info_get_arg), (g_arg_info_get_direction),
	(g_arg_info_is_return_value), (g_arg_info_is_dipper),
	(g_arg_info_is_optional), (g_arg_info_may_be_null),
	(g_arg_info_get_ownership_transfer), (g_type_info_is_pointer),
	(g_type_info_get_tag), (g_type_info_get_param_type),
	(g_type_info_get_interface), (g_type_info_get_array_length),
	(g_type_info_is_zero_terminated),
	(g_type_info_get_n_error_domains), (g_type_info_get_error_domain),
	(g_error_domain_info_get_quark), (g_error_domain_info_get_codes),
	(g_value_info_get_value), (g_field_info_get_flags),
	(g_field_info_get_size), (g_field_info_get_offset),
	(g_registered_type_info_get_type_name),
	(g_registered_type_info_get_type_init),
	(g_struct_info_get_n_fields), (g_struct_info_get_field),
	(g_struct_info_get_n_methods), (g_struct_info_get_method),
	(find_method), (g_struct_info_find_method),
	(g_enum_info_get_n_values), (g_enum_info_get_value),
	(g_object_info_get_parent), (g_object_info_get_type_name),
	(g_object_info_get_type_init), (g_object_info_get_n_interfaces),
	(g_object_info_get_interface), (g_object_info_get_n_fields),
	(g_object_info_get_field), (g_object_info_get_n_properties),
	(g_object_info_get_property), (g_object_info_get_n_methods),
	(g_object_info_get_method), (g_object_info_find_method),
	(g_object_info_get_n_signals), (g_object_info_get_signal),
	(g_object_info_get_n_vfuncs), (g_object_info_get_vfunc),
	(g_object_info_get_n_constants), (g_object_info_get_constant),
	(g_interface_info_get_n_prerequisites),
	(g_interface_info_get_prerequisite),
	(g_interface_info_get_n_properties),
	(g_interface_info_get_property), (g_interface_info_get_n_methods),
	(g_interface_info_get_method), (g_interface_info_find_method),
	(g_interface_info_get_n_signals), (g_interface_info_get_signal),
	(g_interface_info_get_n_vfuncs), (g_interface_info_get_vfunc),
	(g_interface_info_get_n_constants),
	(g_interface_info_get_constant), (g_property_info_get_flags),
	(g_signal_info_get_flags), (g_signal_info_get_class_closure),
	(g_signal_info_true_stops_emit), (g_vfunc_info_get_flags),
	(g_vfunc_info_get_offset), (g_vfunc_info_get_signal),
	(g_constant_info_get_value), (g_union_info_get_n_fields),
	(g_union_info_get_field), (g_union_info_get_n_methods),
	(g_union_info_get_method), (g_union_info_is_discriminated),
	(g_union_info_get_discriminator_offset),
	(g_union_info_get_discriminator):
	* src/ginvoke.c: (g_function_info_invoke):
	* src/girepository.c: (g_irepository_register),
	(g_irepository_unregister), (g_irepository_get_default),
	(count_interfaces), (g_irepository_get_n_infos), (find_interface),
	(g_irepository_get_info), (g_irepository_find_by_name),
	(g_irepository_get_shared_library),
	(g_irepository_build_search_path), (g_irepository_register_file),
	(g_irepository_error_quark):
	* src/girepository.h:
	* src/gmetadata.c: (g_metadata_get_dir_entry),
	(g_metadata_check_sanity), (validate_header),
	(validate_array_type_blob), (validate_iface_type_blob),
	(validate_param_type_blob), (validate_error_type_blob),
	(validate_type_blob), (validate_arg_blob),
	(validate_signature_blob), (validate_function_blob),
	(validate_callback_blob), (validate_constant_blob),
	(validate_value_blob), (validate_field_blob),
	(validate_property_blob), (validate_signal_blob),
	(validate_vfunc_blob), (validate_struct_blob),
	(validate_enum_blob), (validate_object_blob),
	(validate_interface_blob), (validate_errordomain_blob),
	(validate_union_blob), (validate_blob), (validate_directory),
	(validate_annotations), (g_metadata_validate), (_g_metadata_init),
	(g_metadata_new_from_memory), (g_metadata_new_from_const_memory),
	(g_metadata_new_from_mapped_file), (g_metadata_free),
	(g_metadata_set_module), (g_metadata_get_namespace):
	* src/gmetadata.h:
	* tests/Makefile.am:
	* tests/invoke/Makefile.am:
	* tests/invoke/invoke-namespace-find.sh:
	* tests/invoke/invoke.c: (main):

	Add a namespace/shared library mapping. fixes #313268.


svn path=/trunk/; revision=66
2024-02-08 13:53:59 +00:00
Torsten Schönfeld
00a6f8ada0 Hush compiler warnings about return values, signedness mismatches, unused
* src/compiler.c, src/generate.c, src/gidlnode.c,
	src/gidlparser.c, src/ginfo.c, src/girepository.c,
	tests/invoke/invoke.c, test/invoke/testfns.c: Hush compiler
	warnings about return values, signedness mismatches, unused
	variables, and unhandles enum values in switch statements.

	* tests/invoke/Makefile.am: Don't install the invoke test program.
	Add -I ../../src to the cflags used for the test functions files.
2024-02-08 13:53:59 +00:00
Matthias Clasen
94d45e70a0 Fix a segfault 2024-02-08 13:53:59 +00:00
Matthias Clasen
b1cf4d87c9 Add struct offsets to field and vfunc elements.
2005-05-22  Matthias Clasen  <mclasen@redhat.com>

	* tests/*: Add struct offsets to field and vfunc
	elements.

	* src/generate.c (write_vfunc_info): Write offset
	information for vfuncs.

	* src/gidlnode.c (g_idl_node_build_metadata): Write
	the struct offsets into the metadata.

	* src/gidlparser.c: Parse the offset attributes of
	field and vfunc elements.

	* src/gidlnode.h: Add offset members to field and
	vfunc nodes.
2024-02-08 13:53:59 +00:00
Matthias Clasen
1ae704b2b7 Basic type cleanup 2024-02-08 13:53:59 +00:00
Matthias Clasen
45405a6143 Add gdk-pixbuf.gidl as an example, and fix the code to handle it. 2024-02-08 13:53:59 +00:00
Matthias Clasen
45cf94a492 Add union.test.
2005-05-15  Matthias Clasen  <mclasen@redhat.com>

        * tests/roundtrips.sh (SIMPLE_TESTS): Add union.test.

        * tests/union.test: Add a union test.

        * src/generate.c: Handle unions.

        * src/girepository.h:
        * src/ginfo.c: Add GIUnionInfo and functions to access it.

        * src/gidlnode.c: Handle GIdlNodeUnion nodes.

        * src/gidlparser.c (start_union): Parse <union> elements.

        * src/gidlnode.h: Add a GIdlNodeUnion.

        * gidl.dtd: Add a <union> element.

        * src/gmetadata.c (g_metadata_check_sanity): Check
        union_blob_size.

        * src/gmetadata.h: Add union_blob_size to Header,
        add a UnionBlob.

        * metadata-format.txt: Add a UnionBlob.
2024-02-08 13:53:59 +00:00
Matthias Clasen
264b3adc76 Update testcases.
2005-05-13  Matthias Clasen  <mclasen@redhat.com>

	* tests/*: Update testcases.

	* src/generate.c (write_callable_info): Don't forget to
	write transfer and null-ok attributes for return types
	and parameters.

	* src/girepository.h:
	* src/ginfo.c (g_callable_info_may_return_null):
	New function to find out if a function may return NULL.
2024-02-08 13:53:59 +00:00
Johan Dahlin
02ef0d66f2 Generate consistent end tags.
* src/generate.c: Generate consistent end tags.

	* tests/*: Update
2024-02-08 13:53:59 +00:00
Matthias Clasen
b0fa1e8965 Some fixes 2024-02-08 13:53:58 +00:00
Matthias Clasen
bf4631bf28 Clean up handling of names. All elements have a "name", only the elements
2005-05-09  Matthias Clasen  <mclasen@redhat.com>

	* gidl.dtd: Clean up handling of names. All elements
	have a "name", only the elements corresponding to
	actual callable functions (function, method, constructor),
	have an additional "symbol" attribute holding the
	dlsym()-able function name.

	* src/generate.c: Adapt to generate xml matching the
	new dtd.

	* src/gidlparser.c:
	* src/gidlnode.c: Adapt to parse the new dtd.

	* tests/*.test: Adjust to the new dtd.

	* metadata-format.txt:
	* src/gmetadata.h: Remove the short_name field
	from the ValueBlob.
	* src/gmetadata.c: Shrink size of ValueBlob to 12.
	* src/girepository.h:
	* src/ginfo.c (g_value_info_get_short_name): Removed
2024-02-08 13:53:58 +00:00
Matthias Clasen
f1ad63b762 Import the GObject introspection prototype 2024-02-08 13:53:58 +00:00
Matthias Clasen
34f49b2ca9 Initial revision 2024-02-08 13:53:58 +00:00
Philip Withnall
86cd95f1ae Merge branch 'gi-info-new' into 'main'
gibaseinfo: Rename gi_info_new() to gi_base_info_new()

See merge request GNOME/glib!3903
2024-02-08 10:34:40 +00:00
Philip Withnall
beb59595b7 gibaseinfo: Rename gi_info_new() to gi_base_info_new()
It’s actually a factory method rather than a constructor, since
`GIBaseInfo` is abstract, but despite that, changing the name so it sits
inside the `GIBaseInfo` class makes sense. There is no `GIInfo` type.

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

Helps: #3155
2024-02-08 10:34:40 +00:00
Philip Withnall
a7a6b93cf6 Merge branch 'th/meson-werror-fixes-2' into 'main'
[th/meson-werror-fixes-2] more workarounds for compiler warnings in meson compiler checks

See merge request GNOME/glib!3904
2024-02-08 10:28:01 +00:00
Philip Withnall
e1cff511e5 Merge branch '3155-union-tests' into 'main'
gitypes: Fix integer values of GIInfoType and add unit tests for GIUnionInfo

See merge request GNOME/glib!3888
2024-02-08 10:25:13 +00:00
Philip Withnall
78698af73f Merge branch '3246-object-info-docs' into 'main'
girepository: Fix declaration of ‘find using interfaces’ methods

Closes #3246

See merge request GNOME/glib!3883
2024-02-08 10:19:16 +00:00
Philip Withnall
62abd578cd Merge branch '3155-typelib-boxed' into 'main'
gitypelib: Switch to refcounting

See merge request GNOME/glib!3900
2024-02-08 10:18:40 +00:00
Philip Withnall
a138589d57 Merge branch 'repository-n-elements' into 'main'
girepository: Add length ‘out’ arguments to several getter methods

See merge request GNOME/glib!3901
2024-02-08 10:18:12 +00:00
Philip Withnall
6fe7edbc8d Merge branch 'girepository-migration-docs' into 'main'
docs: Add migration guide for libgirepository

See merge request GNOME/glib!3881
2024-02-08 10:10:40 +00:00
Philip Withnall
01cf3a03c2 Merge branch 'wip/smcv/lint' into 'main'
Incorporate some lint checks into `meson test`

See merge request GNOME/glib!3898
2024-02-08 01:03:01 +00:00
Simon McVittie
e87db7dbf2 CI: Run all style/lint checks before failing
Even if we get warnings from the first lint check, we probably want to
see the warnings from later lint checks too, to reduce the number of
round-trips.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-08 00:18:23 +00:00
Simon McVittie
a7702505e0 CI: Extend submodule workaround to most jobs that run the test suite
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-08 00:18:23 +00:00
Simon McVittie
d7601f7eed Incorporate some lint checks into meson test
This will make it easier and more obvious for developers to run them
locally: I'm sure I'm not the only developer who had assumed that
`.gitlab-ci/` is private to the CI environment and inappropriate (or
perhaps even destructive) to run on a developer/user system.

The lint checks are automatically skipped (with TAP SKIP syntax) if we
are not in a git checkout, or if git or the lint tool is missing. They
can also be disabled explicitly with `meson test --no-suite=lint`,
which downstream distributions will probably want to do.

By default, most lint checks are reported as an "expected failure"
(with TAP TODO syntax) rather than a hard failure, because they do not
indicate a functional problem with GLib and there is a tendency for
lint tools to introduce additional checks or become more strict over
time. Developers can override this by configuring with `-Dwerror=true`
(which also makes compiler warnings into fatal errors), or by running
the test suite like `LINT_WARNINGS_ARE_ERRORS=1 meson test --suite=lint`.

One exception to this is tests/check-missing-install-tag.py, which is
checking a functionally significant feature of our build system, and
seems like it is unlikely to have false positives: if that one fails,
it is reported as a hard failure.

run-style-check-diff.sh and run-check-todos.sh are not currently given
this treatment, because they require search-common-ancestor.sh, which
uses Gitlab-CI-specific information to find out which commits are in-scope
for checking.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-08 00:18:23 +00:00
Philip Withnall
6929632ecb gitypelib: Add boxed type
This is needed because `GITypelib` is exposed in the public
libgirepository API, so needs to be introspectable.

This should fix a couple of warnings about `gi_repository_require()` and
related APIs not being introspectable as they return an unintrospectable
type.

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

Helps: #3155
2024-02-07 21:07:18 +00: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
Thomas Haller
89e85717c9 build: workaround compiler warning -Wnon-null in meson detection
Otherwise, `CFLAGS='-Wall -Werror' meson build` fails detection with:

  Running compile:
  Working directory:  /data/src/glib/build/meson-private/tmpmw16de74
  Code:
   #include <fcntl.h>
                    #include <sys/types.h>
                    #include <sys/stat.h>
                    void some_func (void) {
                      open(0, O_DIRECTORY, 0);
                    }
  -----------
  Command line: `cc /data/src/glib/build/meson-private/tmpmw16de74/testfile.c -o /data/src/glib/build/meson-private/tmpmw16de74/output.obj -c -Werror -Wall -D_FILE_OFFSET_BITS=64 -O0 -std=gnu99` -> 1
  stderr:
  /data/src/glib/build/meson-private/tmpmw16de74/testfile.c: In function 'some_func':
  /data/src/glib/build/meson-private/tmpmw16de74/testfile.c:5:21: error: argument 1 null where non-null expected [-Werror=nonnull]
      5 |                     open(0, O_DIRECTORY, 0);
        |                     ^~~~
  In file included from /usr/include/features.h:503,
                   from /usr/include/fcntl.h:25,
                   from /data/src/glib/build/meson-private/tmpmw16de74/testfile.c:1:
  /usr/include/fcntl.h:212:12: note: in a call to function 'open' declared 'nonnull'
    212 | extern int __REDIRECT (open, (const char *__file, int __oflag, ...), open64)
        |            ^~~~~~~~~~
  cc1: all warnings being treated as errors
  -----------
  Checking if "open() option O_DIRECTORY" compiles: NO
2024-02-07 20:40:59 +01:00
Thomas Haller
bcb6431bff build: workaround compiler warning -Wunused-variable in meson detection
Otherwise, `CFLAGS='-Wall -Werror' meson build` fails detection with:

  Running compile:
  ...
  Command line: `cc /data/src/glib/build/meson-private/tmplkxa94er/testfile.c -o /data/src/glib/build/meson-private/tmplkxa94er/output.exe -Werror -Wall -D_FILE_OFFSET_BITS=64 -O0 -std=gnu99` -> 1
  stderr:
  /data/src/glib/build/meson-private/tmplkxa94er/testfile.c: In function 'main':
  /data/src/glib/build/meson-private/tmplkxa94er/testfile.c:3:24: error: unused variable 'codeset' [-Werror=unused-variable]
      3 |                  char *codeset = nl_langinfo (CODESET);
        |                        ^~~~~~~
  cc1: all warnings being treated as errors
  -----------
  Checking if "nl_langinfo and CODESET" : links: NO
2024-02-07 20:40:59 +01:00
Thomas Haller
509e599eed build: workaround compiler warning in meson detection of nl_langinfo()
Otherwise, `CFLAGS='-Wall -Werror' meson build` fails detection with:

  Running compile:
  Working directory:  /data/src/glib/build/meson-private/tmpa3ebpbos
  Code:
   #include <langinfo.h>
                 int main (int argc, char ** argv) {
                   char *str;
                   str = nl_langinfo (PM_STR);
                   str = nl_langinfo (D_T_FMT);
                   str = nl_langinfo (D_FMT);
                   str = nl_langinfo (T_FMT);
                   str = nl_langinfo (T_FMT_AMPM);
                   str = nl_langinfo (MON_1);
                   str = nl_langinfo (ABMON_12);
                   str = nl_langinfo (DAY_1);
                   str = nl_langinfo (ABDAY_7);
                   return 0;
                 }
  -----------
  Command line: `cc /data/src/glib/build/meson-private/tmpa3ebpbos/testfile.c -o /data/src/glib/build/meson-private/tmpa3ebpbos/output.exe -Werror -Wall -D_FILE_OFFSET_BITS=64 -O0 -std=gnu99` -> 1
  stderr:
  /data/src/glib/build/meson-private/tmpa3ebpbos/testfile.c: In function 'main':
  /data/src/glib/build/meson-private/tmpa3ebpbos/testfile.c:3:24: error: variable 'str' set but not used [-Werror=unused-but-set-variable]
      3 |                  char *str;
        |                        ^~~
  cc1: all warnings being treated as errors
  -----------
  Checking if "nl_langinfo (PM_STR)" : links: NO
2024-02-07 20:40:59 +01:00
Thomas Haller
4bdadb6ccc build: workaround compiler warning in meson detection of __uint128_t
Otherwise, `CFLAGS='-Wall -Werror' meson build` fails detection with:

  Code:
   int main() {
  static __uint128_t v1 = 100;
  static __uint128_t v2 = 10;
  static __uint128_t u;
  u = v1 / v2;
  }
  -----------
  Command line: `cc /data/src/glib/build/meson-private/tmp451h9ogd/testfile.c -o /data/src/glib/build/meson-private/tmp451h9ogd/output.obj -c -Werror -Wall -D_FILE_OFFSET_BITS=64 -O0 -std=gnu99` -> 1
  stderr:
  /data/src/glib/build/meson-private/tmp451h9ogd/testfile.c: In function 'main':
  /data/src/glib/build/meson-private/tmp451h9ogd/testfile.c:4:20: error: variable 'u' set but not used [-Werror=unused-but-set-variable]
      4 | static __uint128_t u;
        |                    ^
  cc1: all warnings being treated as errors
  -----------
  Checking if "__uint128_t available" compiles: NO
2024-02-07 20:40:59 +01:00
Thomas Haller
d0afd2b783 build: drop unused variable from "C99 snprintf" meson check
Otherwise, `CFLAGS='-Wall -Werror' meson build` fails detection with:

  Running compile:
  ...
  int
  main(void)
  {
    doit();
    exit(1);
  }
  -----------
  Command line: `cc /data/src/glib/build/meson-private/tmp7n5yqh0h/testfile.c -o /data/src/glib/build/meson-private/tmp7n5yqh0h/output.exe -Werror -Wall -D_FILE_OFFSET_BITS=64 -O0 -std=gnu99` -> 1
  stderr:
  /data/src/glib/build/meson-private/tmp7n5yqh0h/testfile.c: In function 'doit':
  /data/src/glib/build/meson-private/tmp7n5yqh0h/testfile.c:10:11: error: unused variable 'args' [-Werror=unused-variable]
     10 |   va_list args;
        |           ^~~~
  /data/src/glib/build/meson-private/tmp7n5yqh0h/testfile.c:13:33: error: '1234567' directive output truncated writing 7 bytes into a region of size 5 [-Werror=format-truncation=]
     13 |   r = snprintf(buffer, 5, "1234567");
        |                            ~~~~~^~
  /data/src/glib/build/meson-private/tmp7n5yqh0h/testfile.c:13:7: note: 'snprintf' output 8 bytes into a destination of size 5
     13 |   r = snprintf(buffer, 5, "1234567");
        |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  cc1: all warnings being treated as errors
  -----------
  Could not compile test file /data/src/glib/build/meson-private/tmp7n5yqh0h/testfile.c: 1

  Checking if "C99 snprintf" runs: DID NOT COMPILE
2024-02-07 20:40:59 +01:00
Thomas Haller
5525672a5f build: avoid "-Werror=format-extra-args" warnings in detecting printf for gnulib
Otherwise, `CFLAGS='-Wall -Werror' meson build` fails detection with:

  Running compile:
  Working directory:  /data/src/glib/build/meson-private/tmpoozk2y4b
  Code:

  #include <stdio.h>
  #include <string.h>
  static char buf[100];
  static double zero = 0.0;
  int main ()
  {
    if (sprintf (buf, "%010f", 1.0 / zero, 33, 44, 55) < 0
        || (strcmp (buf, "       inf") != 0
            && strcmp (buf, "  infinity") != 0))
      return 1;
    return 0;
  }

  -----------
  Command line: `cc /data/src/glib/build/meson-private/tmpoozk2y4b/testfile.c -o /data/src/glib/build/meson-private/tmpoozk2y4b/output.exe -Werror -Wall -D_FILE_OFFSET_BITS=64 -O0 -std=gnu99` -> 1
  stderr:
  /data/src/glib/build/meson-private/tmpoozk2y4b/testfile.c: In function 'main':
  /data/src/glib/build/meson-private/tmpoozk2y4b/testfile.c:8:21: error: too many arguments for format [-Werror=format-extra-args]
      8 |   if (sprintf (buf, "%010f", 1.0 / zero, 33, 44, 55) < 0
        |                     ^~~~~~~
  cc1: all warnings being treated as errors
  -----------
  Could not compile test file /data/src/glib/build/meson-private/tmpoozk2y4b/testfile.c: 1

  Checking if "printf supports the zero flag correctly" runs: DID NOT COMPILE
2024-02-07 20:40:59 +01:00
Marco Trevisan
bc0e53aa27 Merge branch 'callable-docs' into 'main'
gicallableinfo: Clarify docs for callables with no return type

See merge request GNOME/glib!3902
2024-02-07 18:12:30 +00:00
Philip Withnall
389e8a439b gicallableinfo: Clarify docs for callables with no return type
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-02-07 15:59:56 +00:00
Philip Withnall
8f6926d4ce girepository: Document NULL-termination/length semantics for methods
This doesn’t change the existing behaviour, just documents it a bit more
clearly.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-02-07 15:47:13 +00:00
Philip Withnall
01f9796532 girepository: Add length ‘out’ arguments to several getter methods
This makes them consistent with the other getter methods in
`GIRepository` which return lists/arrays. It’s useful to return the
length, as that means the caller doesn’t have to work it out by
iterating over the entire array.

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

Helps: #3155
2024-02-07 15:47:13 +00:00
Philip Withnall
8dee910d77 Merge branch 'th/meson-werror-fixes' into 'main'
[th/meson-werror-fixes] some fixes for meson detection failure with -Werror

See merge request GNOME/glib!3895
2024-02-07 14:26:30 +00:00
Michael Catanzaro
b7ef29560d Merge branch 'statvfs-type' into 'main'
glocalfile: Support statvfs.f_type

See merge request GNOME/glib!3893
2024-02-07 14:24:52 +00:00
Michael Catanzaro
d753985708 Merge branch 'minor-fixes' into 'main'
Minor fixes/docs changes to GFileDescriptorBased and GTask

See merge request GNOME/glib!3894
2024-02-07 14:21:11 +00:00
Thomas Haller
a91219f164 build: fix compiler warnings in gnulib printf meson build checks
Otherwise, `CFLAGS='-Wall -Werror' meson build` fails detection with:

  ...
    if (sprintf (buf, "%.4000d %d", 1, 33, 44) < 4000 + 3)
      result |= 1;
    if (sprintf (buf, "%.4000f %d", 1.0, 33, 44) < 4000 + 5)
      result |= 2;
    if (sprintf (buf, "%.511f %d", 1.0, 33, 44) < 511 + 5
        || buf[0] != '1')
      result |= 4;
    if (sprintf (buf, "%.999f %d", 1.0, 33, 44) < 999 + 5
        || buf[0] != '1')
      result |= 4;
    return result;
  }

  -----------
  Command line: `cc /data/src/glib/build/meson-private/tmpu3dav6iy/testfile.c -o /data/src/glib/build/meson-private/tmpu3dav6iy/output.exe -Wall -Werror -D_FILE_OFFSET_BITS=64 -O0 -std=gnu99` -> 1
  stderr:
  /data/src/glib/build/meson-private/tmpu3dav6iy/testfile.c: In function 'main':
  /data/src/glib/build/meson-private/tmpu3dav6iy/testfile.c:12:21: error: too many arguments for format [-Werror=format-extra-args]
     12 |   if (sprintf (buf, "%.4000d %d", 1, 33, 44) < 4000 + 3)
        |                     ^~~~~~~~~~~~
  /data/src/glib/build/meson-private/tmpu3dav6iy/testfile.c:14:21: error: too many arguments for format [-Werror=format-extra-args]
     14 |   if (sprintf (buf, "%.4000f %d", 1.0, 33, 44) < 4000 + 5)
        |                     ^~~~~~~~~~~~
  /data/src/glib/build/meson-private/tmpu3dav6iy/testfile.c:16:21: error: too many arguments for format [-Werror=format-extra-args]
     16 |   if (sprintf (buf, "%.511f %d", 1.0, 33, 44) < 511 + 5
        |                     ^~~~~~~~~~~
  /data/src/glib/build/meson-private/tmpu3dav6iy/testfile.c:19:21: error: too many arguments for format [-Werror=format-extra-args]
     19 |   if (sprintf (buf, "%.999f %d", 1.0, 33, 44) < 999 + 5
        |                     ^~~~~~~~~~~
  cc1: all warnings being treated as errors
  -----------
  Could not compile test file /data/src/glib/build/meson-private/tmpu3dav6iy/testfile.c: 1
2024-02-07 14:46:57 +01:00
Thomas Haller
a65fa9a33f build: fix compiler warning in gl_cv_func_frexpl_works meson build check
Otherwise, `CFLAGS='-Wall -Werror' meson build` fails with:

  ...
  Command line: `cc ./glib/build/meson-private/tmp7iwplrgi/testfile.c -o ./glib/build/meson-private/tmp7iwplrgi/output.obj -c -O3 -Werror -Wall -D_FILE_OFFSET_BITS=64 -O0 -std=gnu99` -> 1
  stderr:
  ./glib/build/meson-private/tmp7iwplrgi/testfile.c: In function 'main':
  ./glib/build/meson-private/tmp7iwplrgi/testfile.c:83:21: error: unused variable 'y' [-Werror=unused-variable]
     83 |         long double y = frexpl (x, &exp);
        |                     ^
  cc1: all warnings being treated as errors
  -----------
  Checking if "frexpl prototype can be re-listed" compiles: NO

  glib/gnulib/meson.build:316:2: ERROR: Problem encountered: frexpl() is missing or broken beyond repair, and we have nothing to replace it with
2024-02-07 14:46:57 +01:00
Thomas Haller
90817d0fab build: workaround meson's cc.has_member() causing compiler warning.
Otherwise, `CFLAGS='-Wall -Werror' meson build` fails with:

  ...
  #include <sys/stat.h>
          void bar(void) {
              struct stat foo;
              foo.st_mtim.tv_nsec;

          }
  -----------
  Command line: `cc /data/src/glib/build/meson-private/tmpbjjq3ikp/testfile.c -o /data/src/glib/build/meson-private/tmpbjjq3ikp/output.obj -c -O3 -Werror -Wall -D_FILE_OFFSET_BITS=64 -O0 -std=gnu99` -> 1
  stderr:
  /data/src/glib/build/meson-private/tmpbjjq3ikp/testfile.c: In function 'bar':
  /data/src/glib/build/meson-private/tmpbjjq3ikp/testfile.c:45:24: error: statement with no effect [-Werror=unused-value]
     45 |             foo.st_mtim.tv_nsec;
        |             ~~~~~~~~~~~^~~~~~~~
  cc1: all warnings being treated as errors
  -----------
  Checking whether type "struct stat" has member "st_mtim.tv_nsec" : NO
2024-02-07 14:46:51 +01:00
Philip Withnall
27fb6ffce2 Merge branch 'wip/smcv/reuse' into 'main'
reuse: Fix screen-scraping expression for version 2.x

See merge request GNOME/glib!3897
2024-02-07 13:03:12 +00:00
Philip Withnall
ced299c7ad Merge branch 'reuse-updates' into 'main'
reuse: Add dep5 lines for gnulib and libcharset

See merge request GNOME/glib!3896
2024-02-07 12:50:40 +00:00