general: Stop checking G_HAVE_GNUC_VARARGS now that we depend on c99

Cleaning up a bit the code now that we can rely on C99 which specifies
varargs for macros.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8990>
This commit is contained in:
Thibault Saunier 2025-05-16 13:32:08 +02:00 committed by GStreamer Marge Bot
parent 8b12aea4c7
commit 313435f6cb
8 changed files with 2 additions and 1222 deletions

View File

@ -51,7 +51,6 @@ G_BEGIN_DECLS
* Reports a new issue in the GstValidate reporting system with @m
* as the source of that issue.
*/
#ifdef G_HAVE_ISO_VARARGS
#define GST_VALIDATE_REPORT(m, issue_id, ...) \
G_STMT_START { \
gst_validate_report (GST_VALIDATE_REPORTER (m), \
@ -66,20 +65,6 @@ G_BEGIN_DECLS
__VA_ARGS__ ); \
} G_STMT_END
#else /* G_HAVE_GNUC_VARARGS */
#ifdef G_HAVE_GNUC_VARARGS
#define GST_VALIDATE_REPORT(m, issue_id, args...) \
G_STMT_START { \
gst_validate_report (GST_VALIDATE_REPORTER (m), \
issue_id, ##args ); \
} G_STMT_END
#define GST_VALIDATE_REPORT_ACTION(m, a, issue_id, args...) \
G_STMT_START { \
gst_validate_report_action (GST_VALIDATE_REPORTER (m), a, \
issue_id, ##args ); \
} G_STMT_END
#endif /* G_HAVE_ISO_VARARGS */
#endif /* G_HAVE_GNUC_VARARGS */
GST_VALIDATE_API
GType gst_validate_reporter_get_type (void);

View File

@ -30,7 +30,6 @@
#define LAST_CONTAINER_QDATA g_quark_from_string("ges-structured-last-container")
#define LAST_CHILD_QDATA g_quark_from_string("ges-structured-last-child")
#ifdef G_HAVE_ISO_VARARGS
#define REPORT_UNLESS(condition, errpoint, ...) \
G_STMT_START { \
if (!(condition)) { \
@ -41,20 +40,6 @@
} \
} \
G_STMT_END
#else /* G_HAVE_GNUC_VARARGS */
#ifdef G_HAVE_GNUC_VARARGS
#define REPORT_UNLESS(condition, errpoint, args...) \
G_STMT_START { \
if (!(condition)) { \
gchar *tmp = gst_info_strdup_printf(##args); \
*error = g_error_new_literal (GES_ERROR, 0, tmp); \
g_free (tmp); \
goto errpoint; \
} \
} \
G_STMT_END
#endif /* G_HAVE_ISO_VARARGS */
#endif /* G_HAVE_GNUC_VARARGS */
#define GET_AND_CHECK(name,type,var,label) G_STMT_START {\
gboolean found = FALSE; \

View File

@ -36,7 +36,6 @@ GST_DEBUG_CATEGORY_STATIC (nle_validate_debug);
void nle_validate_init (void);
#ifdef G_HAVE_ISO_VARARGS
#define REPORT_UNLESS(condition, errpoint, ...) \
G_STMT_START { \
if (!(condition)) { \
@ -48,20 +47,6 @@ void nle_validate_init (void);
} \
} \
G_STMT_END
#else /* G_HAVE_GNUC_VARARGS */
#ifdef G_HAVE_GNUC_VARARGS
#define REPORT_UNLESS(condition, errpoint, args...) \
G_STMT_START { \
if (!(condition)) { \
res = GST_VALIDATE_EXECUTE_ACTION_ERROR_REPORTED; \
gst_validate_report_action(GST_VALIDATE_REPORTER(scenario), action, \
SCENARIO_ACTION_EXECUTION_ERROR, ##args); \
goto errpoint; \
} \
} \
G_STMT_END
#endif /* G_HAVE_ISO_VARARGS */
#endif /* G_HAVE_GNUC_VARARGS */
#define NLE_START_VALIDATE_ACTION(funcname) \
static gint \

View File

@ -299,44 +299,12 @@ GST_DEBUG_CATEGORY_EXTERN (libzvbi_debug);
#ifndef GST_DISABLE_GST_DEBUG
/* Logging stuff. */
#ifdef G_HAVE_ISO_VARARGS
#define VBI_CAT_LEVEL_LOG(level,object,...) G_STMT_START{ \
if (G_UNLIKELY ((level) <= GST_LEVEL_MAX && (level) <= _gst_debug_min)) { \
gst_debug_log (libzvbi_debug, (level), __FILE__, GST_FUNCTION, __LINE__, \
(GObject *) (object), __VA_ARGS__); \
} \
}G_STMT_END
#else /* G_HAVE_GNUC_VARARGS */
#ifdef G_HAVE_GNUC_VARARGS
#define VBI_CAT_LEVEL_LOG(level,object,args...) G_STMT_START{ \
if (G_UNLIKELY ((level) <= GST_LEVEL_MAX && (level) <= _gst_debug_min)) { \
gst_debug_log (libzvbi_debug, (level), __FILE__, GST_FUNCTION, __LINE__, \
(GObject *) (object), ##args ); \
} \
}G_STMT_END
#else /* no variadic macros, use inline */
static inline void
VBI_CAT_LEVEL_LOG_valist (GstDebugCategory * cat,
GstDebugLevel level, gpointer object, const char *format, va_list varargs)
{
if (G_UNLIKELY ((level) <= GST_LEVEL_MAX && (level) <= _gst_debug_min)) {
gst_debug_log_valist (cat, level, "", "", 0, (GObject *) object, format,
varargs);
}
}
static inline void
VBI_CAT_LEVEL_LOG (GstDebugLevel level,
gpointer object, const char *format, ...)
{
va_list varargs;
va_start (varargs, format);
GST_CAT_LEVEL_LOG_valist (libzvbi_debug, level, object, format, varargs);
va_end (varargs);
}
#endif
#endif /* G_HAVE_ISO_VARARGS */
#else
static inline void
VBI_CAT_LEVEL_LOG (GstDebugLevel level,

View File

@ -92,28 +92,9 @@ void gst_gl_async_debug_thaw (GstGLAsyncDebug
*
* Stores a debug message in @ad for later output
*/
#ifdef G_HAVE_ISO_VARARGS
#define GST_GL_ASYNC_CAT_LEVEL_LOG(ad,cat,level,object,format,...) \
gst_gl_async_debug_store_log_msg (ad, cat, level, __FILE__, GST_FUNCTION, \
__LINE__, object, format, __VA_ARGS__)
#else /* G_HAVE_ISO_VARARGS */
#if G_HAVE_GNUC_VARARGS
#define GST_GL_ASYNC_CAT_LEVEL_LOG(ad,cat,level,object,format,args...) \
gst_gl_async_debug_store_log_msg (ad, cat, level, __FILE__, GST_FUNCTION, \
__LINE__, object, format, ##args)
#else /* G_HAVE_GNUC_VARARGS */
static inline void
GST_GL_ASYNC_CAT_LEVEL_LOG(GstGLAsyncDebug * ad, GstDebugCategory * cat,
GstDebugLevel level, GObject * object, const gchar * format, ...)
{
va_list varargs;
va_start (varargs, format);
GST_GL_ASYNC_CAT_LEVEL_LOG_valist (ad, cat, level, object, format, varargs);
va_end (varargs);
}
#endif /* G_HAVE_GNUC_VARARGS */
#endif /* G_HAVE_ISO_VARARGS */
#if !defined(GST_DISABLE_GST_DEBUG)
@ -147,34 +128,9 @@ void gst_gl_async_debug_store_log_msg_valist (GstGLAsyncDebug * ad,
#define gst_gl_async_debug_output_log_msg(ad) G_STMT_START{ }G_STMT_END
#define gst_gl_async_debug_store_log_msg_valist(ad,cat,level,file,function,line,object,format,args) G_STMT_START{ }G_STMT_END
#ifdef G_HAVE_ISO_VARARGS
#define gst_gl_insert_debug_marker(...) G_STMT_START{ }G_STMT_END
#define gst_gl_async_debug_store_log_msg(...) G_STMT_START{ }G_STMT_END
#else /* G_HAVE_ISO_VARARGS */
#if G_HAVE_GNUC_VARARGS
#define gst_gl_insert_debug_marker(args...) G_STMT_START{ }G_STMT_END
#define gst_gl_async_debug_store_log_msg(args...) G_STMT_START{ }G_STMT_END
#else /* G_HAVE_GNUC_VARARGS */
static inline void
gst_gl_insert_debug_marker (GstGLContext * context, const gchar * format, ...)
{
}
static inline void
gst_gl_async_debug_store_log_msg (GstGLAsyncDebug * ad,
GstDebugCategory * cat, GstDebugLevel level, const gchar * file,
const gchar * function, gint line, GstObject * object,
const gchar * format, ...)
{
}
#endif /* G_HAVE_GNUC_VARARGS */
#endif /* G_HAVE_ISO_VARARGS */
#endif /* GST_DISABLE_GST_DEBUG */
G_END_DECLS

View File

@ -95,8 +95,6 @@ guint64 gst_gl_query_result (GstGLQuery * query);
gst_gl_async_debug_thaw (&(query)->debug); \
} G_STMT_END
#ifdef G_HAVE_ISO_VARARGS
#define gst_gl_query_start_log(query,cat,level,object,format,...) \
G_STMT_START { \
GST_GL_ASYNC_CAT_LEVEL_LOG (&(query)->debug, cat, level, object, format, __VA_ARGS__); \
@ -112,51 +110,6 @@ guint64 gst_gl_query_result (GstGLQuery * query);
gst_gl_async_debug_thaw (&(query)->debug); \
} G_STMT_END
#else /* G_HAVE_ISO_VARARGS */
#if G_HAVE_GNUC_VARARGS
#define gst_gl_query_start_log(query,cat,level,object,format,args...) \
G_STMT_START { \
GST_GL_ASYNC_CAT_LEVEL_LOG (&(query)->debug, cat, level, object, format, ##args); \
gst_gl_async_debug_freeze (&(query)->debug); \
gst_gl_query_start (query); \
gst_gl_async_debug_thaw (&(query)->debug); \
} G_STMT_END
#define gst_gl_query_counter_log(query,cat,level,object,format,args...) \
G_STMT_START { \
GST_GL_ASYNC_CAT_LEVEL_LOG (&(query)->debug, cat, level, object, format, ##args); \
gst_gl_async_debug_freeze (&(query)->debug); \
gst_gl_query_counter (query); \
gst_gl_async_debug_thaw (&(query)->debug); \
} G_STMT_END
#else /* G_HAVE_GNUC_VARARGS */
static inline void
gst_gl_query_start_log(GstGLQuery * query, GstDebugCategory * cat,
GstDebugLevel level, GObject * object, const gchar * format, ...)
{
va_list varargs;
va_start (varargs, format);
gst_gl_query_start_log_valist (query, cat, level, object, format, varargs);
va_end (varargs);
}
static inline void
gst_gl_query_counter_log(GstGLQuery * query, GstDebugCategory * cat,
GstDebugLevel level, GObject * object, const gchar * format, ...)
{
va_list varargs;
va_start (varargs, format);
gst_gl_query_counter_log_valist (query, cat, level, object, format, varargs);
va_end (varargs);
}
#endif /* G_HAVE_GNUC_VARARGS */
#endif /* G_HAVE_ISO_VARARGS */
G_END_DECLS
#endif /* __GST_GL_QUERY_H__ */

View File

@ -831,8 +831,6 @@ gst_gl_context_clear_shader (GstGLContext * context)
g_return_if_fail (shader->priv->program_handle != 0); \
location = _get_uniform_location (shader, name);
#ifdef G_HAVE_ISO_VARARGS
#define set_uniform_v(gl_suffix, c_type, debug_stride, debug_str, ...) \
void \
G_PASTE(gst_gl_shader_set_uniform_,gl_suffix) (GstGLShader * shader, \
@ -861,44 +859,6 @@ G_PASTE(gst_gl_shader_set_uniform_,gl_suffix) (GstGLShader * shader, \
shader->context->gl_vtable->G_PASTE(Uniform,gl_suffix) (location, __VA_ARGS__); \
}
#else /* G_HAVE_ISO_VARARGS */
#if G_HAVE_GNUC_VARARGS
#define set_uniform_v(gl_suffix, c_type, debug_stride, debug_str, args...) \
void \
G_PASTE(gst_gl_shader_set_uniform_,gl_suffix) (GstGLShader * shader, \
const gchar * name, guint count, const c_type * value) \
{ \
guint i; \
set_uniform_pre_check(shader, name) \
for (i = 0; i < count; i++) { \
const c_type * item = &value[i * debug_stride]; \
GST_TRACE_OBJECT (shader, "Setting uniform %s (%i) index %i to " \
debug_str, name, location, i, ##args); \
} \
shader->context->gl_vtable->G_PASTE(Uniform,gl_suffix) (location, count, value); \
}
#define set_uniform_func_decl(gl_suffix, args...) \
void \
G_PASTE(gst_gl_shader_set_uniform_,gl_suffix) (GstGLShader * shader, \
const gchar * name, ##args)
#define set_uniform_body(gl_suffix, debug_str, args...) \
{ \
set_uniform_pre_check(shader, name) \
GST_TRACE_OBJECT (shader, "Setting uniform %s (%i) = " debug_str, \
name, location, ##args); \
shader->context->gl_vtable->G_PASTE(Uniform,gl_suffix) (location, ##args); \
}
#else
#error "No vararg support in C macros. What kind of C compiler is this?!"
#endif /* G_HAVE_GNUC_VARARGS */
#endif /* G_HAVE_ISO_VARARGS */
/* *INDENT-OFF* */
/**
* gst_gl_shader_set_uniform_1f:

File diff suppressed because it is too large Load Diff