[Sound-open-firmware] [PATCH v2] sof: check for missing prototypes

Pierre-Louis Bossart pierre-louis.bossart at linux.intel.com
Wed Sep 27 20:15:04 CEST 2017


using gcc -Wmissing-prototypes helps identify a series of
missing include files or static declarations.

the -Wmissing-prototypes option is not enforced yet, there are
remaining issues with the Tensilica HAL that will need to be fixed
separately.

To turn it on, modify configure.ac
 # General compiler flags
-CFLAGS="${CFLAGS:+$CFLAGS } -O2 -g -Wall -Werror -Wl,-EL -fno-inline-functions -nostdlib"
+CFLAGS="${CFLAGS:+$CFLAGS } -O2 -g -Wall -Werror -Wl,-EL -fno-inline-functions -nostdlib -Wmissing-prototypes"

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart at linux.intel.com>
---
 src/arch/xtensa/task.c           | 1 +
 src/audio/src_core.c             | 6 +++---
 src/include/reef/init.h          | 2 ++
 src/include/reef/interrupt.h     | 2 +-
 src/ipc/pmc-ipc.c                | 1 +
 src/lib/lib.c                    | 1 +
 src/lib/schedule.c               | 8 +++++---
 src/math/numbers.c               | 1 +
 src/math/trig.c                  | 1 +
 src/platform/baytrail/platform.c | 1 +
 src/platform/baytrail/timer.c    | 2 +-
 11 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/src/arch/xtensa/task.c b/src/arch/xtensa/task.c
index 7e74c07..349f8ab 100644
--- a/src/arch/xtensa/task.c
+++ b/src/arch/xtensa/task.c
@@ -33,6 +33,7 @@
 #include <reef/interrupt.h>
 #include <platform/platform.h>
 #include <reef/debug.h>
+#include <arch/task.h>
 #include <stdint.h>
 #include <errno.h>
 
diff --git a/src/audio/src_core.c b/src/audio/src_core.c
index bce3586..5b804d6 100644
--- a/src/audio/src_core.c
+++ b/src/audio/src_core.c
@@ -52,21 +52,21 @@ int sof_rates[SOF_RATES_LENGTH] = {8000, 11025, 12000, 16000, 18900,
 	192000};
 
 /* Calculates the needed FIR delay line length */
-int src_fir_delay_length(struct src_stage *s)
+static int src_fir_delay_length(struct src_stage *s)
 {
 	return s->subfilter_length + (s->num_of_subfilters - 1) * s->idm
 		+ s->blk_in;
 }
 
 /* Calculates the FIR output delay line length */
-int src_out_delay_length(struct src_stage *s)
+static int src_out_delay_length(struct src_stage *s)
 {
 
 	return (s->num_of_subfilters - 1) * s->odm + 1;
 }
 
 /* Returns index of a matching sample rate */
-int src_find_fs(int fs_list[], int list_length, int fs)
+static int src_find_fs(int fs_list[], int list_length, int fs)
 {
 	int i;
 
diff --git a/src/include/reef/init.h b/src/include/reef/init.h
index c2eaf87..9d97b48 100644
--- a/src/include/reef/init.h
+++ b/src/include/reef/init.h
@@ -38,4 +38,6 @@ int main(int argc, char *argv[]);
 
 int arch_init(struct reef *reef);
 
+void __memmap_init(void);
+
 #endif
diff --git a/src/include/reef/interrupt.h b/src/include/reef/interrupt.h
index 3c78e77..ea7d057 100644
--- a/src/include/reef/interrupt.h
+++ b/src/include/reef/interrupt.h
@@ -79,7 +79,7 @@ static inline void interrupt_global_enable(uint32_t flags)
 	arch_interrupt_global_enable(flags);
 }
 
-uint32_t platform_interrupt_get_enabled();
+uint32_t platform_interrupt_get_enabled(void);
 void platform_interrupt_clear(uint32_t irq, uint32_t mask);
 void platform_interrupt_mask(uint32_t irq, uint32_t mask);
 void platform_interrupt_unmask(uint32_t irq, uint32_t mask);
diff --git a/src/ipc/pmc-ipc.c b/src/ipc/pmc-ipc.c
index b8183c0..fdb8d4b 100644
--- a/src/ipc/pmc-ipc.c
+++ b/src/ipc/pmc-ipc.c
@@ -37,6 +37,7 @@
 #include <reef/wait.h>
 #include <reef/trace.h>
 #include <platform/interrupt.h>
+#include <platform/pmc.h>
 #include <platform/shim.h>
 
 
diff --git a/src/lib/lib.c b/src/lib/lib.c
index e1b1d9a..a1c9933 100644
--- a/src/lib/lib.c
+++ b/src/lib/lib.c
@@ -31,6 +31,7 @@
 #include <stdint.h>
 #include <stdlib.h>
 #include <reef/reef.h>
+#include <reef/alloc.h>
 
 #if 0 // TODO: only compile if no arch memcpy is available.
 
diff --git a/src/lib/schedule.c b/src/lib/schedule.c
index 142a2fb..427ca2e 100644
--- a/src/lib/schedule.c
+++ b/src/lib/schedule.c
@@ -159,7 +159,7 @@ static uint32_t sch_work(void *data, uint32_t delay)
  * Schedule task with the earliest deadline from task list.
  * Can run in IRQ context.
  */
-struct task *schedule_edf(void)
+static struct task *schedule_edf(void)
 {
 	struct task *task;
 	struct task *next_plus1_task = NULL;
@@ -201,8 +201,9 @@ struct task *schedule_edf(void)
 	return next_plus1_task;
 }
 
+#if 0 /* FIXME: is this needed ? */
 /* delete task from scheduler */
-int schedule_task_del(struct task *task)
+static int schedule_task_del(struct task *task)
 {
 	uint32_t flags;
 	int ret = 0;
@@ -225,6 +226,7 @@ out:
 	spin_unlock_irq(&sch->lock, flags);
 	return ret;
 }
+#endif
 
 /*
  * Add a new task to the scheduler to be run and define a scheduling
@@ -285,7 +287,7 @@ void schedule_task_complete(struct task *task)
 	spin_unlock_irq(&sch->lock, flags);
 }
 
-void scheduler_run(void *unused)
+static void scheduler_run(void *unused)
 {
 	struct task *next_task;
 
diff --git a/src/math/numbers.c b/src/math/numbers.c
index 579de5d..93d41ea 100644
--- a/src/math/numbers.c
+++ b/src/math/numbers.c
@@ -34,6 +34,7 @@
  * pseudocode in
  * https://en.wikipedia.org/wiki/Euclidean_algorithm#Implementations
  */
+#include <reef/math/numbers.h>
 
 int gcd(int a, int b)
 {
diff --git a/src/math/trig.c b/src/math/trig.c
index 8101980..79eb480 100644
--- a/src/math/trig.c
+++ b/src/math/trig.c
@@ -32,6 +32,7 @@
 
 #include <stdint.h>
 #include <reef/audio/format.h>
+#include <reef/math/trig.h>
 
 
 #define SINE_C_Q20 341782638 /* 2*SINE_NQUART/pi in Q12.20 */
diff --git a/src/platform/baytrail/platform.c b/src/platform/baytrail/platform.c
index e3daf48..b701196 100644
--- a/src/platform/baytrail/platform.c
+++ b/src/platform/baytrail/platform.c
@@ -40,6 +40,7 @@
 #include <reef/mailbox.h>
 #include <reef/dai.h>
 #include <reef/dma.h>
+#include <reef/interrupt.h>
 #include <reef/reef.h>
 #include <reef/work.h>
 #include <reef/clock.h>
diff --git a/src/platform/baytrail/timer.c b/src/platform/baytrail/timer.c
index 513ede1..9256dd9 100644
--- a/src/platform/baytrail/timer.c
+++ b/src/platform/baytrail/timer.c
@@ -44,7 +44,7 @@ struct timer_data {
 
 static struct timer_data xtimer[1] = {};
 
-void platform_timer_64_handler(void *arg)
+static void platform_timer_64_handler(void *arg)
 {
 	struct timer *timer = arg;
 	struct timer_data *tdata = timer->timer_data;
-- 
2.11.0



More information about the Sound-open-firmware mailing list