all: Enable more C warnings at build time

And fix the issues:
* Proper forward declaration
* static functions marked properly
* absolute includes
* declaration order
This commit is contained in:
Edward Hervey 2013-08-16 15:05:54 +02:00
parent 3e5c921217
commit 15ea3bd8aa
18 changed files with 73 additions and 66 deletions

View file

@ -170,7 +170,7 @@ NO_WARNINGS=""
AG_GST_CHECK_GST_DEBUG_DISABLED([NO_WARNINGS="-Wno-unused"], [NO_WARNINGS=""])
dnl define an ERROR_CFLAGS Makefile variable
AG_GST_SET_ERROR_CFLAGS($GST_GIT, [$NO_WARNINGS])
AG_GST_SET_ERROR_CFLAGS($GST_GIT, [-Wmissing-declarations -Wmissing-prototypes -Wredundant-decls -Wundef -Wwrite-strings -Wformat-security -Wold-style-definition -Winit-self -Wmissing-include-dirs -Waddress -Waggregate-return -Wno-multichar -Wnested-externs $NO_WARNINGS])
dnl define correct level for debugging messages
AG_GST_SET_LEVEL_DEFAULT($GST_GIT)

View file

@ -24,9 +24,9 @@
#include <glib-object.h>
#include <gst/gst.h>
#include "gst-validate-element-monitor.h"
#include "gst-validate-runner.h"
#include "gst-validate-scenario.h"
#include <gst/validate/gst-validate-element-monitor.h>
#include <gst/validate/gst-validate-runner.h>
#include <gst/validate/gst-validate-scenario.h>
G_BEGIN_DECLS

View file

@ -27,6 +27,9 @@
#include "gst-validate-override-registry.h"
#include "gst-validate-report.h"
/* public symbol */
int gst_validate_create_overrides (void);
int
gst_validate_create_overrides (void)
{

View file

@ -25,7 +25,7 @@
#include <glib-object.h>
#include <gst/gst.h>
#include "gst-validate-monitor.h"
#include <gst/validate/gst-validate-monitor.h>
G_BEGIN_DECLS

View file

@ -24,8 +24,9 @@
#include <glib-object.h>
#include <gst/gst.h>
#include "gst-validate-monitor.h"
#include "gst-validate-runner.h"
#include <gst/validate/gst-validate-monitor.h>
#include <gst/validate/gst-validate-runner.h>
G_BEGIN_DECLS

View file

@ -73,7 +73,7 @@ _reporter_iface_init (GstValidateReporterInterface * iface)
G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GstValidateMonitor, gst_validate_monitor,
G_TYPE_OBJECT, _do_init);
void
static void
_target_freed_cb (GstValidateMonitor * monitor, GObject * where_the_object_was)
{
GST_DEBUG_OBJECT (monitor, "Target was freed");
@ -158,6 +158,8 @@ gst_validate_monitor_init (GstValidateMonitor * monitor)
g_queue_init (&monitor->overrides);
}
#if 0
/* This shouldn't be used. it's a base class */
/**
* gst_validate_monitor_new:
* @element: (transfer-none): a #GObject to run Validate on
@ -177,6 +179,7 @@ gst_validate_monitor_new (GObject * object)
return monitor;
}
#endif
static gboolean
gst_validate_monitor_do_setup (GstValidateMonitor * monitor)

View file

@ -24,10 +24,14 @@
#include <glib-object.h>
#include <gst/gst.h>
#include "gst-validate-report.h"
#include "gst-validate-reporter.h"
#include "gst-validate-runner.h"
#include "gst-validate-override.h"
typedef struct _GstValidateMonitor GstValidateMonitor;
typedef struct _GstValidateMonitorClass GstValidateMonitorClass;
#include <gst/validate/gst-validate-report.h>
#include <gst/validate/gst-validate-reporter.h>
#include <gst/validate/gst-validate-runner.h>
#include <gst/validate/gst-validate-override.h>
G_BEGIN_DECLS
@ -68,9 +72,6 @@ G_BEGIN_DECLS
* GST_VALIDATE_AREA_ ## area ## _ ## subarea
*/
typedef struct _GstValidateMonitor GstValidateMonitor;
typedef struct _GstValidateMonitorClass GstValidateMonitorClass;
/**
* GstValidateMonitor:
*

View file

@ -24,9 +24,10 @@
#include <glib-object.h>
#include <gst/gst.h>
#include "gst-validate-report.h"
#include "gst-validate-monitor.h"
#include "gst-validate-override.h"
#include <gst/validate/gst-validate-report.h>
#include <gst/validate/gst-validate-monitor.h>
#include <gst/validate/gst-validate-override.h>
G_BEGIN_DECLS

View file

@ -24,13 +24,14 @@
#include <glib-object.h>
#include <gst/gst.h>
#include "gst-validate-report.h"
typedef struct _GstValidateOverride GstValidateOverride;
#include <gst/validate/gst-validate-report.h>
#include <gst/validate/gst-validate-monitor.h>
G_BEGIN_DECLS
typedef struct _QstQaOverride GstValidateOverride;
typedef struct _GstValidateMonitor GstValidateMonitor;
typedef void (*GstValidateOverrideBufferHandler)(GstValidateOverride * override,
GstValidateMonitor * pad_monitor, GstBuffer * buffer);
typedef void (*GstValidateOverrideEventHandler)(GstValidateOverride * override,
@ -42,7 +43,7 @@ typedef void (*GstValidateOverrideGetCapsHandler)(GstValidateOverride * override
typedef void (*GstValidateOverrideSetCapsHandler)(GstValidateOverride * override,
GstValidateMonitor * pad_monitor, GstCaps * caps);
struct _QstQaOverride {
struct _GstValidateOverride {
GHashTable *level_override;
/* Pad handlers */

View file

@ -25,13 +25,14 @@
#include <glib-object.h>
#include <gst/gst.h>
#include "gst-validate-monitor.h"
typedef struct _GstValidatePadMonitor GstValidatePadMonitor;
typedef struct _GstValidatePadMonitorClass GstValidatePadMonitorClass;
#include <gst/validate/gst-validate-monitor.h>
#include <gst/validate/gst-validate-element-monitor.h>
G_BEGIN_DECLS
/* forward declaratin */
typedef struct _GstValidateElementMonitor GstValidateElementMonitor;
#define GST_TYPE_VALIDATE_PAD_MONITOR (gst_validate_pad_monitor_get_type ())
#define GST_IS_VALIDATE_PAD_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VALIDATE_PAD_MONITOR))
#define GST_IS_VALIDATE_PAD_MONITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_VALIDATE_PAD_MONITOR))
@ -43,9 +44,6 @@ typedef struct _GstValidateElementMonitor GstValidateElementMonitor;
#define GST_VALIDATE_PAD_MONITOR_GET_PAD(m) (GST_PAD_CAST (GST_VALIDATE_MONITOR_GET_OBJECT (m)))
typedef struct _GstValidatePadMonitor GstValidatePadMonitor;
typedef struct _GstValidatePadMonitorClass GstValidatePadMonitorClass;
/**
* GstValidatePadMonitor:

View file

@ -23,13 +23,15 @@
#define __GST_VALIDATE_REPORT_H__
#include <glib-object.h>
typedef struct _GstValidateReport GstValidateReport;
typedef guintptr GstValidateIssueId;
#include <gst/gst.h>
#include <gst/validate/gst-validate-reporter.h>
G_BEGIN_DECLS
/* forward declaration */
typedef struct _GstValidateReporter GstValidateReporter;
GType gst_validate_report_get_type (void);
#define GST_TYPE_VALIDATE_REPORT (gst_validate_report_get_type ())
@ -60,7 +62,6 @@ typedef enum {
GST_VALIDATE_AREA_OTHER=100,
} GstValidateReportArea;
typedef guintptr GstValidateIssueId;
#define GST_VALIDATE_ISSUE_ID_UNKNOWN 0
#define GST_VALIDATE_ISSUE_ID_SHIFT 16
@ -129,7 +130,7 @@ typedef struct {
#define GST_VALIDATE_ISSUE_AREA(i) (GST_VALIDATE_ISSUE_ID_AREA (gst_validate_issue_get_id (i)))
typedef struct {
struct _GstValidateReport {
gint refcount;
/* issue: The issue this report corresponds to (to get dsecription, summary,...) */
@ -147,7 +148,7 @@ typedef struct {
/* message: issue-specific message. Gives more detail on the actual
* issue. Can be NULL */
gchar *message;
} GstValidateReport;
};
#define GST_VALIDATE_ISSUE_FORMAT G_GUINTPTR_FORMAT " (%s) : %s(%" G_GUINTPTR_FORMAT "): %s"
#define GST_VALIDATE_ISSUE_ARGS(i) gst_validate_issue_get_id (i), gst_validate_report_level_get_name (i->default_level), \
@ -161,20 +162,20 @@ typedef struct {
r->message
void gst_validate_report_init (void);
GstValidateIssue * gst_validate_issue_from_id (GstValidateIssueId issue_id);
GstValidateIssueId gst_validate_issue_get_id (GstValidateIssue * issue);
GstValidateIssue *gst_validate_issue_from_id (GstValidateIssueId issue_id);
GstValidateIssueId gst_validate_issue_get_id (GstValidateIssue * issue);
void gst_validate_issue_register (GstValidateIssue * issue);
GstValidateIssue * gst_validate_issue_new (GstValidateIssueId issue_id, gchar * summary,
gchar * description,
GstValidateReportLevel default_level);
GstValidateIssue *gst_validate_issue_new (GstValidateIssueId issue_id, gchar * summary,
gchar * description,
GstValidateReportLevel default_level);
GstValidateReport * gst_validate_report_new (GstValidateIssue * issue,
GstValidateReporter * reporter,
const gchar * message);
GstValidateReport *gst_validate_report_new (GstValidateIssue * issue,
GstValidateReporter * reporter,
const gchar * message);
void gst_validate_report_unref (GstValidateReport * report);
GstValidateReport * gst_validate_report_ref (GstValidateReport * report);
GstValidateReport *gst_validate_report_ref (GstValidateReport * report);
GstValidateIssueId gst_validate_report_get_issue_id (GstValidateReport * report);
GstValidateIssueId gst_validate_report_get_issue_id (GstValidateReport * report);
void gst_validate_report_check_abort (GstValidateReport * report);
void gst_validate_report_printf (GstValidateReport * report);

View file

@ -37,6 +37,8 @@ typedef struct _GstValidateReporterPrivate
char *name;
} GstValidateReporterPrivate;
G_DEFINE_INTERFACE (GstValidateReporter, gst_validate_reporter, G_TYPE_OBJECT);
static void
gst_validate_reporter_default_init (GstValidateReporterInterface * iface)
{
@ -50,8 +52,6 @@ gst_validate_reporter_default_init (GstValidateReporterInterface * iface)
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
}
G_DEFINE_INTERFACE (GstValidateReporter, gst_validate_reporter, G_TYPE_OBJECT);
static void
_free_priv (GstValidateReporterPrivate * priv)
{

View file

@ -20,15 +20,15 @@
#ifndef _GST_VALIDATE_REPORTER_
#define _GST_VALIDATE_REPORTER_
#include <glib-object.h>
#include "gst-validate-runner.h"
#include "gst-validate-report.h"
G_BEGIN_DECLS
typedef struct _GstValidateReporter GstValidateReporter;
typedef struct _GstValidateReporterInterface GstValidateReporterInterface;
#include <glib-object.h>
#include <gst/validate/gst-validate-report.h>
#include <gst/validate/gst-validate-runner.h>
G_BEGIN_DECLS
/* GstValidateReporter interface declarations */
#define GST_TYPE_VALIDATE_REPORTER (gst_validate_reporter_get_type ())
#define GST_VALIDATE_REPORTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VALIDATE_REPORTER, GstValidateReporter))

View file

@ -23,10 +23,10 @@
# include "config.h"
#endif
#include "gst-validate-runner.h"
#include "gst-validate-report.h"
#include "gst-validate-monitor-factory.h"
#include "gst-validate-override-registry.h"
#include "gst-validate-runner.h"
/**
* SECTION:gst-validate-runner

View file

@ -25,13 +25,13 @@
#include <glib-object.h>
#include <gst/gst.h>
#include "gst-validate-report.h"
typedef struct _GstValidateRunner GstValidateRunner;
typedef struct _GstValidateRunnerClass GstValidateRunnerClass;
#include <gst/validate/gst-validate-report.h>
G_BEGIN_DECLS
/* forward declaration */
typedef struct _GstValidateScenario GstValidateScenario;
#define GST_TYPE_VALIDATE_RUNNER (gst_validate_runner_get_type ())
#define GST_IS_VALIDATE_RUNNER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VALIDATE_RUNNER))
#define GST_IS_VALIDATE_RUNNER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_VALIDATE_RUNNER))
@ -41,9 +41,6 @@ typedef struct _GstValidateScenario GstValidateScenario;
#define GST_VALIDATE_RUNNER_CAST(obj) ((GstValidateRunner*)(obj))
#define GST_VALIDATE_RUNNER_CLASS_CAST(klass) ((GstValidateRunnerClass*)(klass))
typedef struct _GstValidateRunner GstValidateRunner;
typedef struct _GstValidateRunnerClass GstValidateRunnerClass;
/* TODO hide this to be opaque? */
/**
* GstValidateRunner:

View file

@ -50,8 +50,6 @@ enum
PROP_LAST
};
static void gst_validate_scenario_class_init (GstValidateScenarioClass * klass);
static void gst_validate_scenario_init (GstValidateScenario * scenario);
static void gst_validate_scenario_dispose (GObject * object);
static void gst_validate_scenario_finalize (GObject * object);
@ -566,7 +564,7 @@ failed:
goto done;
}
gboolean
static gboolean
gst_validate_scenario_load (GstValidateScenario * scenario,
const gchar * scenario_name)
{

View file

@ -24,7 +24,8 @@
#include <glib.h>
#include <glib-object.h>
#include "gst-validate-runner.h"
#include <gst/validate/gst-validate-runner.h>
G_BEGIN_DECLS

View file

@ -6,5 +6,7 @@
#include <gst/validate/gst-validate-file-checker.h>
#include <gst/validate/gst-validate-monitor-factory.h>
#include <gst/validate/gst-validate-override-registry.h>
#include <gst/validate/gst-validate-report.h>
#include <gst/validate/gst-validate-reporter.h>
void gst_validate_init (void);