From 3923f936294f9f900dc8c6a1c0fe84f0e2852dca Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Tue, 29 Mar 2011 22:03:54 +0200 Subject: [PATCH 1/1] Mark a couple of functions as const. Probably does not matter much.. --- Makefile.in | 1 + afs.c | 4 ++-- aft.c | 2 +- fec.c | 2 +- gcc-compat.h | 1 + imdct.c | 2 +- mood.c | 8 ++++---- wma_common.c | 2 +- 8 files changed, 12 insertions(+), 10 deletions(-) diff --git a/Makefile.in b/Makefile.in index 8ecc1b8f..ca79f8b9 100644 --- a/Makefile.in +++ b/Makefile.in @@ -32,6 +32,7 @@ DEBUG_CPPFLAGS += -Wmissing-format-attribute # DEBUG_CPPFLAGS += -Wextra # DEBUG_CPPFLAGS += -Wold-style-definition # DEBUG_CPPFLAGS += -Wdeclaration-after-statement +# DEBUG_CPPFLAGS += -Wsuggest-attribute=const # many warnings about trivial stuff # CPPFLAGS += -Wconversion diff --git a/afs.c b/afs.c index ac75164c..755537da 100644 --- a/afs.c +++ b/afs.c @@ -1148,7 +1148,7 @@ void afs_event(enum afs_events event, struct para_buffer *pb, * * This table does not honor events. */ -int images_event_handler(__a_unused enum afs_events event, +__a_const int images_event_handler(__a_unused enum afs_events event, __a_unused struct para_buffer *pb, __a_unused void *data) { return 1; @@ -1163,7 +1163,7 @@ int images_event_handler(__a_unused enum afs_events event, * * This table does not honor events. */ -int lyrics_event_handler(__a_unused enum afs_events event, +__a_const int lyrics_event_handler(__a_unused enum afs_events event, __a_unused struct para_buffer *pb, __a_unused void *data) { return 1; diff --git a/aft.c b/aft.c index 157b5a62..be4d572e 100644 --- a/aft.c +++ b/aft.c @@ -723,7 +723,7 @@ static int get_local_time(uint64_t *seconds, char *buf, size_t size, } \ } -static short unsigned get_duration_width(int seconds) +__a_const static short unsigned get_duration_width(int seconds) { short unsigned width; unsigned hours = seconds / 3600, mins = (seconds % 3600) / 60; diff --git a/fec.c b/fec.c index 233a8780..e5c2a3b8 100644 --- a/fec.c +++ b/fec.c @@ -74,7 +74,7 @@ static unsigned char gf_mul_table[GF_SIZE + 1][GF_SIZE + 1]; #define gf_mul(x,y) gf_mul_table[x][y] /* Compute x % GF_SIZE without a slow divide. */ -static inline unsigned char modnn(int x) +__a_const static inline unsigned char modnn(int x) { while (x >= GF_SIZE) { x -= GF_SIZE; diff --git a/gcc-compat.h b/gcc-compat.h index 45d9c9ba..ba1d82ea 100644 --- a/gcc-compat.h +++ b/gcc-compat.h @@ -9,6 +9,7 @@ * the number of the first variadic parameter. */ # define __printf(p,q) __attribute__ ((format (printf, p, q))) +# define __a_const __attribute__ ((const)) /* * as direct use of __printf(p,q) confuses doxygen, here are two extra macros * for those values p,q that are actually used by paraslash. diff --git a/imdct.c b/imdct.c index e9264993..32928487 100644 --- a/imdct.c +++ b/imdct.c @@ -80,7 +80,7 @@ static fftsample_t *cos_tabs[] = { cos_4096, cos_8192, cos_16384, cos_32768, cos_65536, }; -static int split_radix_permutation(int i, int n) +__a_const static int split_radix_permutation(int i, int n) { int m; if (n <= 2) diff --git a/mood.c b/mood.c index 732df0a3..d82d5a52 100644 --- a/mood.c +++ b/mood.c @@ -79,13 +79,13 @@ struct mood { static struct mood *current_mood; /** - * Rough approximation to sqrt. + * Rough approximation to sqrt. * - * \param x Integer of which to calculate the sqrt. + * \param x Integer of which to calculate the sqrt. * - * \return An integer res with res * res <= x. + * \return An integer res with res * res <= x. */ -static uint64_t int_sqrt(uint64_t x) +__a_const static uint64_t int_sqrt(uint64_t x) { uint64_t op, res, one = 1; op = x; diff --git a/wma_common.c b/wma_common.c index 781db5f4..137d288d 100644 --- a/wma_common.c +++ b/wma_common.c @@ -142,7 +142,7 @@ const uint8_t log2_tab[256] = { * * \return An integer approximation of log2(v). */ -int wma_log2(unsigned int v) +__a_const int wma_log2(unsigned int v) { int n = 0; if (v & 0xffff0000) { -- 2.39.2