Commit Graph

21018 Commits

Author SHA1 Message Date
Philip Withnall
b4d58a7105 glib, gio: Use GLIB_DEPRECATED_MACRO instead of G_DISABLE_DEPRECATED
When defining deprecated macros, annotate them with
`GLIB_DEPRECATED_MACRO_IN_*()` and `GLIB_DEPRECATED_MACRO_IN_*_FOR()` to
conditionally emit warnings if people use them, depending on their
declared minimum and maximum GLib version requirements (see
`GLIB_VERSION_MIN_REQUIRED` and `GLIB_VERSION_MAX_ALLOWED`).

The old way of doing this was for users to define `G_DISABLE_DEPRECATED`
if they didn’t want to use deprecated APIs, but it reported errors via
missing symbols, and wasn’t version-dependent. It’s being phased out.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-05-30 10:38:45 +01:00
Philip Withnall
db270e3c2d gmacros: Add GLIB_DEPRECATED_{MACRO,ENUMERATOR,TYPE}{,_FOR}
These will be used to annotate deprecated macros, types and enumerators.

`GLIB_DEPRECATED_MACRO{,_FOR}` are based very heavily on the
corresponding macros from Clutter, written by Emmanuele Bassi.

The other deprecation annotators use the standard annotations supported
by Clang and GCC. They need to be separated as they are supported in
different versions of the compilers.

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

Fixes: #1060
2019-05-30 10:38:45 +01:00
Philip Withnall
05f7ea9fc5 gtimezone: Stop using deprecated API
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-05-30 10:38:45 +01:00
Philip Withnall
52b38ba6da tests: Don’t use a deprecated Unicode character type enumerator
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-05-30 10:38:45 +01:00
Philip Withnall
5ad9d3fd61 glib: Move some documentation comments to where the symbols are defined
This makes it easier to maintain the documentation and code at the same
time. The documentation comments haven’t been modified.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-05-30 10:38:45 +01:00
Philip Withnall
70c8a7ef8d gdesktopappinfo: Improve documentation formatting slightly
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-05-30 10:38:45 +01:00
Philip Withnall
9bfd7e2a9d gdesktopappinfo: Add deprecation version to GDesktopAppInfoLookup
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-05-30 10:38:45 +01:00
Philip Withnall
c53342c4a1 Merge branch 'ci-msys2-update-lcov' into 'master'
CI/msys2: disable coverage reporting, lcov doesn't support gcc9 yet

See merge request GNOME/glib!875
2019-05-30 09:31:55 +00:00
Christoph Reiter
ab325c24d5 CI/msys2: disable coverage reporting, lcov doesn't support gcc9 yet
https://github.com/linux-test-project/lcov/issues/58
2019-05-29 18:41:23 +02:00
Christoph Reiter
d258bb5be3 CI/msys2: update to lcov 1.14
lconv 1.13 only supports gcc <=7 and lcov 1.14 supports <=8.
msys2 was just updated to gcc9, so this wont help with coverage support, but
it's a start I guess.
2019-05-29 18:18:45 +02:00
Sebastian Dröge
0f056ebea3 Use atomic reference counting for GSource
If attached to a context already it would use a mutex instead but at
least before that the reference counting is not thread-safe currently.
2019-05-28 18:46:18 +03:00
Philip Withnall
713fec9dcb Merge branch 'fix_console_encoding' into 'master'
Add and use g_get_console_charset when printing text

Closes #1270

See merge request GNOME/glib!767
2019-05-27 17:51:40 +00:00
Patrick Storz
56149722ae Add g_get_console_charset
Queries the charset used by the associated console, which does not
necessarily match the charset of the current locale as returned by
g_get_charset.

Fixes https://gitlab.gnome.org/GNOME/glib/issues/1270
2019-05-27 17:51:40 +00:00
Philip Withnall
73f8ff82ed Merge branch 'cygwin-gunicollate-check-sizeof-wchar-t' into 'master'
gunicollate/cygwin: Don't use __STDC_ISO_10646__ for wchar_t related checks

See merge request GNOME/glib!863
2019-05-27 10:26:14 +00:00
Philip Withnall
5807da6d92 Merge branch 'deprecated-pragma-docs' into 'master'
docs: Document pitfall of deprecation pragmas

See merge request GNOME/glib!533
2019-05-27 09:50:47 +00:00
Emmanuele Bassi
50dcccc504 docs: Document pitfall of deprecation pragmas
As we discovered in GNOME/gtk#1280, GCC considers the pragmas to control
the deprecation warnings as statements. This means we cannot just use
the GLib wrappers as markers around the call site, but we must be aware
of their side effects.

Let's document this, to avoid falling into the trap.
2019-05-24 18:17:13 +01:00
Philip Withnall
3053c19b54 Post-release version bump
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-05-24 18:12:31 +01:00
Philip Withnall
e10eff122c 2.61.1
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-05-24 17:38:59 +01:00
Ondrej Holy
d8f8f4d637 gfile: Limit access to files when copying
file_copy_fallback creates new files with default permissions and
set the correct permissions after the operation is finished. This
might cause that the files can be accessible by more users during
the operation than expected. Use G_FILE_CREATE_PRIVATE for the new
files to limit access to those files.
2019-05-24 09:58:18 +02:00
Philip Withnall
ec17786ad1 Merge branch '1450-test-summaries' into 'master'
gtestutils: Add g_test_summary() to add summary metadata to unit tests

Closes #1450

See merge request GNOME/glib!847
2019-05-23 13:47:03 +00:00
Philip Withnall
970599ab7a Merge branch 'osx-psn' into 'master'
gapplication: skip unexpected -psn_ parameter

Closes #1784

See merge request GNOME/glib!864
2019-05-23 10:16:01 +00:00
Christoph Reiter
0030408299 gunicollate/cygwin: Don't use __STDC_ISO_10646__ for wchar_t related checks
The code in gunicollate uses __STDC_ISO_10646__ to check that wchar.h is avilable,
that it includes the wide character related functions and that sizeof(wchar_t) == 4.

cygwin defines __STDC_ISO_10646__ and has sizeof(wchar_t) == 2 and the C standard text isn't
that clear on whether wchar_t should always be 4 bytes in this case, so we better not use if for
assuming the size here.

Instead of relying on __STDC_ISO_10646__ add HAVE_WCHAR_H and SIZEOF_WCHAR_T macros.
With HAVE_WCHAR_H defined we assume wchar_t exists and wchar.h exists. With SIZEOF_WCHAR_T we
guard the parts where the size of wchar_t is assumed to be 4 (currently all of them).

Note that this doesn't make the collate tests pass under cygwin, they fail before and after this patch for me.

See !755 for related discussions.
2019-05-22 19:44:13 +02:00
Christoph Reiter
16e632432e Merge branch 'cygwin-fix-glib-os' into 'master'
build: define G_OS_UNIX, not G_OS_WIN32 under cygwin

See merge request GNOME/glib!862
2019-05-22 08:27:22 +00:00
Ignacio Casal Quinteiro
e367a4f66f gapplication: skip unexpected -psn_ parameter
When an application is launched using Launch Services
osx will add an extra parameter which we were not
handling and then gapplication would abort. Instead we make
an initial parsing and like this we avoid the abort if this
parameter is provided

Fixes https://gitlab.gnome.org/GNOME/glib/issues/1784
2019-05-22 09:11:26 +02:00
Philip Withnall
415e5693f5 Merge branch 'clear-signal-handler-use' into 'master'
gdbusserver: Use g_clear_signal_handler

See merge request GNOME/glib!860
2019-05-21 17:54:24 +00:00
Marco Trevisan (Treviño)
5deaf0bfdf gdbusserver: Use g_clear_signal_handler 2019-05-21 12:10:01 -05:00
Christoph Reiter
767e6a4cac build: define G_OS_UNIX, not G_OS_WIN32 under cygwin
This makes glib build under msys2 for me.
2019-05-21 18:54:34 +02:00
Philip Withnall
4da8b7b35a gtestutils: Add g_test_summary() to add summary metadata to unit tests
This is a new function along the same lines as g_test_bug(): to allow
developers to annotate unit tests with information about the test (what
it tests, how it tests it) for future developers to read and learn from.

It will also output this summary as a comment in the test’s TAP output,
which might clarify test results.

Includes a unit test.

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

Fixes: #1450
2019-05-21 12:33:15 +01:00
Philip Withnall
81dbc7b07b tests: Set locale in gtestutils tests to allow UTF-8 output
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-05-21 12:29:39 +01:00
Philip Withnall
dfa7a5b5b5 Merge branch '1780-fix-ghashprinter' into 'master'
Update gdb pretty-printer for GHashTable

Closes #1780

See merge request GNOME/glib!852
2019-05-21 11:16:37 +00:00
Philip Withnall
f7a41aa43b Merge branch 'floating-ref-warning' into 'master'
Document the best practices for binding GInitiallyUnowned

See merge request GNOME/glib!836
2019-05-21 11:08:20 +00:00
Emmanuele Bassi
8b2f6a5523 Please don't use GInitiallyUnowned and floating refs
This place is not a place of honor… No highly esteemed API is implemented
here… Nothing valued is here.
2019-05-21 11:34:04 +01:00
Emmanuele Bassi
a734a92408 Document the best practice for binding InitiallyUnowned
Right now, the documentation is less than explicit on how language
bindings should handle GInitiallyUnowned.
2019-05-21 11:34:04 +01:00
Philip Withnall
95144006e3 Merge branch 'clear-signal-handler' into 'master'
Clear signal handler

See merge request GNOME/glib!819
2019-05-21 09:40:19 +00:00
Marco Trevisan (Treviño)
20306597f5 tests, signals: Add tests for g_clear_signal_handler 2019-05-20 13:33:41 -05:00
Marco Trevisan (Treviño)
409c1522bc gisgnal: Add g_clear_signal_handler
It allows to disconnect a signal handler from GObject instance and at the same
time to nullify the signal handler.

Provided also a macro for handler type conversion.
2019-05-20 13:33:41 -05:00
Philip Withnall
32ea5b7e1f Merge branch 'wip/desrt/more-ghash-valgrind' into 'master'
ghash: fix bug introduced by valgrind fix

See merge request GNOME/glib!848
2019-05-20 15:50:32 +00:00
Allison Karlitskaya
115033338b ghash: fix small array handling in g_hash_table_remove_all_nodes()
Factor out the code for setting up the hash table size, mask and mod,
detecting valgrind and allocating the arrays for hashes, keys, and
values.

Make use of this new function from g_hash_table_remove_all_nodes().

The handling of have_big_keys and have_big_values was never correct in
this function because it reallocated the array without changing the
flags in the struct.  Any calls in to the hashtable from destroy
notifies would find the table in an inconsistent state.

Many thanks to Thomas Haller who is essentially responsible for all the
real work in this patch: both discovering and identifying the original
problem, as well as finding the solution to it.
2019-05-20 17:03:49 +02:00
Allison Karlitskaya
9add93e5a4 ghash: Be more explicit about memory in g_hash_table_destroy_all_nodes()
Make it clear that there is a reference transfer going on here, rather
than relying on the fields being overwritten on each branch of the
conditional below.
2019-05-20 17:03:49 +02:00
Allison Karlitskaya
b3fbf6c18b ghash: do less work when destroying the table
We were calling g_hash_table_set_shift() to reinitialise the hash table
even in the case of destroying it.  Only do that for the non-destruction
case, and fill the relevant fields with zeros for the destruction case.
This has a nice side effect of causing more certain crashes in case of
invalid reuse of the table after (or during) destruction.
2019-05-20 17:03:49 +02:00
Allison Karlitskaya
c5462cb3c1 ghash: Improve internal documentation
The changes introduced by 18745ff674 made
the comment at the top of g_hash_table_remove_all_nodes() no longer
correct.  Fix that inaccuracy and add more documentation all-around.
2019-05-20 17:03:49 +02:00
Allison Karlitskaya
96ce92025d ghash: fix bug introduced by valgrind fix
g_hash_table_new_full() had an invocation of
g_hash_table_realloc_key_or_value_array() with the @is_big argument
incorrectly hardcoded to FALSE, even though later in the function the
values of have_big_keys and have_big_values would be set conditionally.

This never caused problems before because on 64bit platforms, this would
result in the allocation of a guint-sized array (which would be fine, as
have_big_keys and have_big_values would always start out as false) and
on 32bit platforms, this function ignored the value and always allocated
a gpointer-sized array.

Since merge request GNOME/glib!845 we have the possibility for
have_big_keys and have_big_values to start out as TRUE on 64bit
platforms.  We need to make sure we pass the argument through correctly.
2019-05-20 17:03:49 +02:00
Emmanuele Bassi
a8c265c6b1 Merge branch '1782-cross-docs' into 'master'
docs: Fix typo in Meson cross-compilation instructions

Closes #1782

See merge request GNOME/glib!854
2019-05-20 11:28:32 +00:00
Philip Withnall
0470cccec8 docs: Fix typo in Meson cross-compilation instructions
Meson accepts `--cross-file`, but not `--cross_file`.

Spotted by Carlo Bramini.

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

Fixes: #1782
2019-05-20 12:11:24 +01:00
Philip Withnall
13da7e5c2e Merge branch 'wip/ignazp/gtask-wait-time-fix' into 'master'
gtask: fix task_wait_time estimation

Closes #1683

See merge request GNOME/glib!644
2019-05-20 11:07:54 +00:00
Philip Withnall
f093ef6a6f gobject: Fix apostrophe usage in a few small bits of documentation
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-05-17 17:39:40 +01:00
zb3
d1d81c8a07 Update gdb pretty-printer for GHashTable
Fixes #1780
2019-05-17 17:46:24 +02:00
Philip Withnall
522e74982e Merge branch '1441-1619-deprecate-gtester' into 'master'
Deprecate gtester and use TAP output for tests by default

Closes #1619 and #1441

See merge request GNOME/glib!842
2019-05-17 12:12:53 +00:00
Philip Withnall
9c4026d673 gsettings: Add missing ‘Deprecated’ tag to g_settings_list_keys() docs
It was already deprecated in the header, but the tag was missing from
the documentation.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-05-17 13:06:08 +01:00
Philip Withnall
d2b419c81f gsettings: Document that lists are returned in no defined order
The caller cannot assume that the lists returned by various GSettings
functions (for example, lists of keys or schemas) will be returned in
any particular order.

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

Helps: #1781
2019-05-17 13:03:27 +01:00