Commit Graph

11 Commits

Author SHA1 Message Date
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