Simon Marchi
5ee80104ac
gthread: ignore deprecated declarations in static inline functions
...
With a trivial file that just includes glib.h:
#include <glib.h>
Compiled with:
gcc -c test.c \
-I /tmp/glib/include/glib-2.0/ \
-I /tmp/glib/lib/x86_64-linux-gnu/glib-2.0/include \
-DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_28 \
-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_28 \
-fmax-errors=1 \
-Werror
We get:
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: In function ‘g_rec_mutex_locker_new’:
/tmp/glib/include/glib-2.0/glib/gthread.h:396:3: error: ‘g_rec_mutex_lock’ is deprecated: Not available before 2.32 [-Werror=deprecated-declarations]
396 | g_rec_mutex_lock (rec_mutex);
| ^~~~~~~~~~~~~~~~
/tmp/glib/include/glib-2.0/glib/gthread.h:196:17: note: declared here
196 | void g_rec_mutex_lock (GRecMutex *rec_mutex);
| ^~~~~~~~~~~~~~~~
compilation terminated due to -fmax-errors=1.
The problem is that the code in the static inline functions uses
g_rec_mutex_lock, introduced after 2.28. This code is compiled
regardless of if it's actually used or not.
Suppress the warning by using G_GNUC_BEGIN_IGNORE_DEPRECATIONS /
G_GNUC_END_IGNORE_DEPRECATIONS. There are precedents for doing that,
for example g_main_context_pusher_new in gmain.h.
Tested by building with all variations of GLIB_VERSION_MIN_REQUIRED /
GLIB_VERSION_MAX_ALLOWED:
for i in $(seq 26 2 64); do
gcc -c test.c \
-I/tmp/glib/include/glib-2.0 \
-I/tmp/glib/lib/x86_64-linux-gnu/glib-2.0/include \
-DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_$i \
-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_$i \
-fmax-errors=1 \
-Werror
done
Fixes : #2094
2020-05-07 11:10:21 +01:00
..
2020-01-15 23:18:33 +02:00
2019-01-16 10:24:11 -05:00
2019-01-15 15:11:43 +00:00
2020-02-07 17:12:35 +00:00
2020-02-27 10:33:45 +00:00
2019-01-15 15:11:43 +00:00
2020-02-27 14:48:36 +00:00
2020-02-27 10:33:45 +00:00
2019-08-24 19:14:05 +00:00
2017-05-24 11:58:19 +02:00
2019-07-10 10:10:58 -04:00
2020-02-27 14:48:36 +00:00
2019-10-07 14:38:24 +02:00
2019-07-29 12:27:29 +01:00
2019-07-29 12:27:29 +01:00
2017-05-24 11:58:19 +02:00
2019-07-26 02:11:35 +01:00
2019-11-20 12:12:04 +00:00
2019-11-21 11:02:14 +00:00
2018-08-22 10:37:15 +01:00
2020-01-15 13:15:54 +00:00
2017-05-24 11:58:19 +02:00
2019-09-21 10:48:23 +02:00
2017-05-24 11:58:19 +02:00
2019-11-05 10:08:45 +00:00
2018-08-22 11:18:02 +01:00
2018-06-02 09:45:55 +02:00
2019-11-04 15:10:24 +00:00
2017-05-24 11:58:19 +02:00
2019-10-11 11:47:42 +01:00
2019-05-27 17:51:40 +00:00
2017-05-24 11:58:19 +02:00
2019-09-05 13:51:27 +01:00
2017-05-24 11:58:19 +02:00
2019-04-25 12:55:04 +08:00
2019-04-12 11:12:28 +05:30
2018-08-22 11:18:02 +01:00
2019-01-28 15:24:06 +01:00
2017-05-24 11:58:19 +02:00
2017-05-24 11:58:19 +02:00
2019-09-25 15:17:37 +01:00
2019-07-29 12:27:29 +01:00
2019-11-21 09:14:39 +01:00
2019-07-29 12:27:29 +01:00
2019-01-24 11:31:38 +01:00
2017-05-24 11:58:19 +02:00
2016-09-21 18:30:52 +02:00
2020-01-21 12:07:17 +00:00
2017-05-24 11:58:19 +02:00
2020-02-26 20:06:13 +01:00
2017-05-24 11:58:19 +02:00
2019-08-08 02:32:46 +02:00
2019-05-30 10:38:45 +01:00
2019-01-15 15:11:43 +00:00
2017-05-24 11:58:19 +02:00
2020-02-24 10:21:40 +00:00
2019-05-30 10:38:45 +01:00
2019-08-24 19:14:05 +00:00
2017-05-24 11:58:19 +02:00
2017-11-12 16:36:16 +01:00
2017-05-24 11:58:19 +02:00
2017-05-24 11:58:19 +02:00
2017-05-24 11:58:19 +02:00
2017-05-24 11:58:19 +02:00
2017-05-24 11:58:19 +02:00
2020-02-24 14:12:30 +00:00
2019-08-24 19:14:05 +00:00
2019-03-17 19:05:34 +01:00
2018-04-27 16:46:19 +01:00
2019-09-05 13:51:27 +01:00
2018-08-22 11:18:02 +01:00
2019-11-05 14:28:41 -08:00
2018-08-25 23:59:45 +01:00
2019-09-05 14:16:58 +01:00
2019-12-10 17:58:16 +01:00
2019-03-06 11:41:56 +00:00
2019-03-06 11:41:56 +00:00
2019-12-11 11:48:41 +00:00
2017-11-01 12:46:38 +00:00
2019-06-18 17:29:36 +08:00
2020-04-03 13:24:40 +01:00
2019-11-26 12:17:04 +00:00
2019-12-11 11:48:41 +00:00
2018-01-04 22:19:30 +01:00
2019-08-24 19:14:05 +00:00
2019-05-30 10:38:45 +01:00
2013-01-13 13:11:57 -05:00
2020-02-07 14:09:41 +00:00
2019-11-25 13:09:25 +01:00
2020-03-18 08:50:30 +00:00
2017-05-24 11:58:19 +02:00
2020-02-11 10:53:56 +02:00
2020-01-15 16:56:34 +01:00
2019-03-15 21:30:22 +01:00
2018-08-22 11:18:02 +01:00
2019-09-18 17:06:20 +01:00
2017-05-24 11:58:19 +02:00
2019-09-16 14:03:07 +01:00
2019-08-26 18:50:16 +03:00
2019-09-05 13:51:27 +01:00
2019-10-09 16:39:31 +02:00
2017-11-28 14:16:25 +00:00
2019-06-25 09:19:49 +02:00
2019-10-31 13:54:51 +00:00
2019-06-03 10:57:18 +01:00
2019-02-01 09:10:02 -06:00
2019-11-21 13:07:08 +01:00
2017-05-24 11:58:19 +02:00
2018-12-28 13:28:43 +01:00
2017-05-24 11:58:19 +02:00
2019-03-15 21:30:22 +01:00
2017-05-24 11:58:19 +02:00
2019-10-07 17:29:34 +01:00
2017-05-24 11:58:19 +02:00
2019-08-20 17:19:26 +02:00
2017-05-24 11:58:19 +02:00
2017-05-24 11:58:19 +02:00
2019-09-21 10:48:23 +02:00
2017-05-24 11:58:19 +02:00
2019-05-02 13:53:09 +01:00
2019-05-01 13:01:14 -07:00
2019-09-05 13:51:27 +01:00
2017-05-24 11:58:19 +02:00
2019-07-10 10:10:58 -04:00
2018-08-22 11:18:02 +01:00
2018-12-18 11:18:43 +00:00
2018-11-08 16:04:51 +01:00
2018-11-08 16:04:51 +01:00
2018-07-30 23:06:23 +05:30
2018-12-17 13:53:34 +00:00
2019-08-24 19:14:05 +00:00
2017-10-06 12:49:12 +01:00
2019-04-26 12:12:31 +01:00
2019-05-30 10:38:45 +01:00
2019-05-08 13:07:55 +01:00
2019-04-26 12:12:31 +01:00
2017-05-24 11:58:19 +02:00
2019-08-24 19:14:05 +00:00
2017-05-24 11:58:19 +02:00
2019-07-29 12:27:29 +01:00
2018-08-22 11:18:02 +01:00
2020-02-07 14:09:41 +00:00
2019-11-25 13:09:25 +01:00
2018-06-12 16:13:51 +01:00
2019-08-24 19:14:05 +00:00
2019-08-24 19:14:05 +00:00
2019-10-25 16:36:45 +01:00
2019-05-30 10:38:45 +01:00
2018-10-10 19:19:18 +00:00
2020-01-19 16:57:39 +00:00
2019-09-18 10:47:23 +02:00
2018-10-10 19:19:18 +00:00
2019-11-21 10:44:48 +01:00
2018-12-17 17:16:03 +00:00
2019-10-07 17:29:34 +01:00
2019-05-30 10:38:45 +01:00
2017-10-26 12:27:17 +01:00
2017-05-24 11:58:19 +02:00
2019-05-14 12:14:54 +01:00
2019-05-14 12:14:54 +01:00
2019-09-30 12:05:55 +01:00
2019-10-28 17:36:36 +00:00
2020-02-24 12:07:25 +02:00
2020-01-19 10:47:52 +02:00
2020-01-21 11:56:34 +00:00
2020-05-07 11:10:21 +01:00
2020-01-25 11:08:22 +02:00
2017-05-24 11:58:19 +02:00
2020-01-21 11:56:34 +00:00
2019-07-29 12:27:29 +01:00
2019-07-29 12:27:29 +01:00
2020-02-24 10:26:01 +00:00
2018-04-13 15:25:26 +01:00
2014-02-20 18:27:24 -05:00
2018-07-30 21:15:22 +01:00
2019-05-30 10:39:11 +01:00
2019-05-30 10:39:11 +01:00
2019-07-23 11:41:42 +00:00
2017-05-24 11:58:19 +02:00
2020-04-03 12:48:11 +01:00
2017-05-24 11:58:19 +02:00
2019-05-08 13:07:55 +01:00
2019-05-08 13:07:55 +01:00
2019-07-10 10:10:40 -04:00
2017-05-24 11:58:19 +02:00
2019-10-08 13:50:13 +01:00
2014-06-28 12:49:38 -04:00
2019-09-05 13:51:27 +01:00
2019-05-08 13:07:55 +01:00
2019-08-24 19:14:05 +00:00
2017-05-24 11:58:19 +02:00
2017-05-24 11:58:19 +02:00
2019-11-14 18:38:03 +00:00
2020-01-15 14:07:20 +01:00
2019-09-27 15:47:03 +12:00
2018-12-17 17:16:03 +00:00
2019-11-25 10:10:36 +00:00
2017-02-06 14:40:38 +01:00
2018-05-28 09:22:55 -04:00
2020-01-07 15:06:51 +00:00
2017-05-24 11:58:19 +02:00
2018-10-23 17:01:51 +13:00
2019-10-30 15:37:39 +00:00
2018-11-06 12:49:25 +00:00
2018-11-06 12:49:25 +00:00
2019-12-04 18:38:16 +01:00
2019-10-18 13:53:18 +01:00
2019-03-08 19:46:21 +00:00
2018-10-23 17:01:51 +13:00
2019-08-24 19:14:05 +00:00
2018-10-23 17:01:51 +13:00
2017-05-24 11:58:19 +02:00
2017-05-24 11:58:19 +02:00
2019-09-17 12:24:16 +01:00
2018-04-27 16:46:19 +01:00
2017-05-24 11:58:19 +02:00
2019-08-10 21:56:33 +02:00
2020-02-18 23:24:52 +05:30
2017-07-12 22:36:30 +02:00
2016-05-23 10:52:10 -04:00
2019-10-01 20:12:16 +01:00
2018-07-12 23:48:41 +02:00
2020-04-03 13:06:18 +01:00
2016-08-13 10:31:26 +02:00