Commit Graph

22 Commits

Author SHA1 Message Date
Marco Trevisan (Treviño)
b9e085537d meson: Expose library build type as global variables
Given that it can be computed using an error-prone strings comparisons it
is better to provide a variable everywhere, so that we don't have the
risk of comparing values that are always false.
2022-10-31 14:08:31 +01:00
Xavier Claessens
dcfc9f689e Fix symbol visibility macros on Windows
There is currently no `dllimport` attribute on any of our function,
which prevents MSVC to optimize function calls.

To fix that issue, we need to redeclare all our visibility macros for
each of our libraries, because when compiling e.g. GIO code, we need
dllimport in GLIB headers and dllexport in GIO headers. That means they
cannot use the same GLIB_AVAILABLE_* macro.

Since that's a lot of boilerplate to copy/paste after each version bump,
this MR generate all those macros using a python script.

Also simplify the meson side by using `gnu_symbol_visibility : 'hidden'`
keyword argument instead of passing the cflag manually.

This leaves only API index to add manually into glib-docs.xml when
bumping GLib version. That file cannot be generated because Meson does
not allow passing a buit file to gnome.gtkdoc()'s main_xml kwarg
unfortunately.
2022-10-13 20:53:56 -04:00
Emmanuele Bassi
32edf9c01a Build API docs only with shared libraries
Building the references requires libraries with all their symbols
available. Passing `-Dgtk_doc=true` and `-Ddefault_library=static`
should be considered a configuration error.
2022-09-14 15:03:43 +01:00
Xavier Claessens
5942103937 meson: Use range() instead of listing all stable versions
Note that range(), like in python, has start value included and stop
value excluded. That's why we use last_version + 2.
2022-05-11 14:34:00 -04:00
Philip Withnall
25ab87d8e5 build: Drop checks and workarounds for older Meson versions
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-05-06 13:01:44 +01:00
Philip Withnall
4f79f0712c gversionmacros: Add version macros for GLib 2.74
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-28 12:55:20 +01:00
Philip Withnall
94b74c761d gversionmacros: Add version macros for GLib 2.72
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-09-17 11:35:21 +01:00
Simon McVittie
1248b642ad gversionmacros: Add version macros for GLib 2.70
Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-03-18 13:58:41 +00:00
Philip Withnall
c51a8ce8c8 gversionmacros: Add version macros for GLib 2.68
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-10-01 14:33:21 +01:00
Philip Withnall
60dd272b6a docs: Bump gtk-doc requirement for unit tests to 1.32.1
gtk-doc 1.33 hasn’t been released yet, but when it is, it’ll contain
three fixes which are necessary for correctly detecting which symbols
are undocumented/undeclared/unused in GLib:
 • gtk-doc@b866a90b
 • gtk-doc@ca42972c
 • gtk-doc@b922e148

1.32.1 is the development version number which will eventually be
released as 1.33.

Until then, we can’t run the gtk-doc tests in CI because they reliably
fail spuriously. See !1488.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-05-22 09:57:33 +01:00
Philip Withnall
0fc7f409f6 Revert "Revert "glib: annotate static inline functions with G_AVAILABLE-type macros""
This reverts commit c0146be3a4.

The revert was originally added because the original change broke
gnome-build-meta. Now that the problem has been diagnosed, the original
commit can be fixed — see the commit which follows this one.

See: !1487
2020-05-15 11:59:06 +01:00
Michael Catanzaro
c0146be3a4 Revert "glib: annotate static inline functions with G_AVAILABLE-type macros"
This reverts commit 5050298749
2020-05-12 21:28:52 +00:00
Simon Marchi
5050298749 glib: annotate static inline functions with G_AVAILABLE-type macros
The public functions exposed as static inlines currently don't have
annotations to describe when they were introduced.  This means that
compiling this file:

    #include <glib.h>

    void foo (void)
    {
      g_rec_mutex_locker_new (NULL);
    }

with:

    gcc -c test.c \
      -I/tmp/glib/include/glib-2.0 \
      -I/tmp/glib/lib/x86_64-linux-gnu/glib-2.0/include \
      -Werror \
      -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_28 \
      -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_28

will not produce any error message, despite using
`g_rec_mutex_locker_new`, a function that was introduced after 2.28.

This patch adds some annotations to all the publicly exposed static
inline functions I could find.

I could not use the existing G_AVAILABLE* macros, because they may
expand to `extern`.  This would then clash with the `static` keyword and
produce:

    ../glib/gthread.h:397:1: error: multiple storage classes in declaration specifiers
      397 | static inline GRecMutexLocker *
          | ^~~~~~

So I opted for adding a new set of macros,
GLIB_AVAILABLE_STATIC_INLINE_IN_2_XY.

With this patch applied, the example from above produces the expected
warning:

    test.c: In function ‘foo’:
    test.c:5:3: error: ‘g_rec_mutex_locker_new’ is deprecated: Not available before 2.60 [-Werror=deprecated-declarations]
        5 |   g_rec_mutex_locker_new (NULL);
          |   ^~~~~~~~~~~~~~~~~~~~~~
    In file included from /tmp/glib/include/glib-2.0/glib/gasyncqueue.h:32,
                     from /tmp/glib/include/glib-2.0/glib.h:32,
                     from test.c:1:
    /tmp/glib/include/glib-2.0/glib/gthread.h:398:1: note: declared here
      398 | g_rec_mutex_locker_new (GRecMutex *rec_mutex)
          | ^~~~~~~~~~~~~~~~~~~~~~
2020-05-12 12:42:50 +01:00
Philip Withnall
fb1e416a32 gversionmacros: Add version macros for GLib 2.66
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-03-04 14:46:28 +00:00
Xavier Claessens
5bd78907a7 doc: Add gtk-doc subproject fallback
Now that we require Meson 0.52 to build the doc, we can also pull
gtk-doc as subproject when missing from the system. This requires
to pull gtk-doc master because needed changes there haven't been release
yet.
2020-01-29 15:54:53 +01:00
Xavier Claessens
ed0e06097c doc: Requires Meson >=0.52.0 to build documentation 2020-01-29 15:54:53 +01:00
Philip Withnall
b698327b99 Merge branch 'cherry-pick-6ea0dcc6' into 'master'
doc: Add missing --ignore-decorators

Closes #1953

See merge request GNOME/glib!1260
2019-12-03 12:48:37 +00:00
Xavier Claessens
160143ae27 gtk-doc: Ensure we have recent enough version
Older versions won't produce errors, but will silently miss
documentation for a few symbols.
2019-12-01 08:25:04 -05:00
Xavier Claessens
7b65b77a65 doc: Add missing --ignore-decorators
(cherry picked from commit 6ea0dcc6c9af0c0e8cfebc77412838f5174b7dbc)
2019-11-29 18:43:10 +00:00
Philip Withnall
3b1e301ab5 gversionmacros: Add version macros for GLib 2.64
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-09-17 12:24:16 +01:00
Philip Withnall
1741fc2c6e build: Drop use of G_DISABLE_DEPRECATED from the build system
It’s no longer used in any of the headers. See preceding commits.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-05-30 10:38:45 +01:00
Philip Withnall
6761bb2f57 build: Factor out common gtkdoc flags
Those lists were getting very long. We can’t quite entirely automate the
list generation since Meson doesn’t have a range() function, but we can
at least combine three of them into one.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-03-06 11:59:03 +00:00