[Pkg-alsa-devel] Bug#300792: alsa-lib: FTBFS (ppc64/gcc-4.0): static declaration of 'shm_sum_discard' follows non-static declaration

Andreas Jochens Andreas Jochens <aj@andaco.de>, 300792@bugs.debian.org
Mon, 21 Mar 2005 22:42:00 +0100


Package: alsa-lib
Severity: normal
Tags: patch

When building 'alsa-lib' on ppc64 with gcc-4.0,
I get the following error:

pcm_dmix.c: At top level:
pcm_dmix.c:92: error: static declaration of 'shm_sum_discard' follows non-static declaration
pcm_dmix.c:84: error: previous implicit declaration of 'shm_sum_discard' was here
pcm_dmix.c:221:2: warning: #warning Please, recode mix_areas1() routine to your architecture...
pcm_dmix.c: In function 'mix_areas1':
pcm_dmix.c:247: error: invalid lvalue in assignment
pcm_dmix.c:248: error: invalid lvalue in assignment
pcm_dmix.c:249: error: invalid lvalue in assignment
pcm_dmix.c:253:2: warning: #warning Please, recode mix_areas2() routine to your architecture...
pcm_dmix.c: In function 'mix_areas2':
pcm_dmix.c:279: error: invalid lvalue in assignment
pcm_dmix.c:280: error: invalid lvalue in assignment
pcm_dmix.c:281: error: invalid lvalue in assignment
make[3]: *** [pcm_dmix.lo] Error 1
make[3]: Leaving directory `/alsa-lib-1.0.8/src/pcm'

With the attached patch 'alsa-lib' can be compiled
on ppc64 using gcc-4.0.

Regards
Andreas Jochens

diff -urN ../tmp-orig/alsa-lib-1.0.8/src/conf.c ./src/conf.c
--- ../tmp-orig/alsa-lib-1.0.8/src/conf.c	2004-10-05 17:33:04.000000000 +0200
+++ ./src/conf.c	2005-03-21 22:30:08.619865849 +0100
@@ -2486,6 +2486,8 @@
 				snd_config_searcha, snd_config_searchva);
 }
 
+static int snd_config_hooks(snd_config_t *config, snd_config_t *private_data);
+
 /**
  * \brief Searches for a node in a configuration tree and expands hooks.
  * \param config Handle to the root of the configuration (sub)tree to search.
@@ -2496,7 +2498,6 @@
  */
 int snd_config_search_hooks(snd_config_t *config, const char *key, snd_config_t **result)
 {
-	static int snd_config_hooks(snd_config_t *config, snd_config_t *private_data);
 	SND_CONFIG_SEARCH(config, key, result, \
 					err = snd_config_hooks(config, NULL); \
 					if (err < 0) \
@@ -2504,6 +2505,8 @@
 			 );
 }
 
+static int snd_config_hooks(snd_config_t *config, snd_config_t *private_data);
+
 /**
  * \brief Searches for a node in a configuration tree, expanding aliases and hooks.
  * \param root Handle to the root configuration node containing alias
@@ -2516,7 +2519,6 @@
  */
 int snd_config_searcha_hooks(snd_config_t *root, snd_config_t *config, const char *key, snd_config_t **result)
 {
-	static int snd_config_hooks(snd_config_t *config, snd_config_t *private_data);
 	SND_CONFIG_SEARCHA(root, config, key, result,
 					snd_config_searcha_hooks,
 					err = snd_config_hooks(config, NULL); \
diff -urN ../tmp-orig/alsa-lib-1.0.8/src/pcm/pcm_dmix.c ./src/pcm/pcm_dmix.c
--- ../tmp-orig/alsa-lib-1.0.8/src/pcm/pcm_dmix.c	2005-01-11 18:42:49.000000000 +0100
+++ ./src/pcm/pcm_dmix.c	2005-03-21 22:07:17.000000000 +0100
@@ -53,12 +53,13 @@
  *
  */
 
+static int shm_sum_discard(snd_pcm_direct_t *dmix);
+
 /*
  *  sum ring buffer shared memory area 
  */
 static int shm_sum_create_or_connect(snd_pcm_direct_t *dmix)
 {
-	static int shm_sum_discard(snd_pcm_direct_t *dmix);
 	struct shmid_ds buf;
 	int tmpid, err;
 	size_t size;
@@ -244,9 +245,9 @@
 		} while (*sum != old_sample);
 		if (!--size)
 			return;
-		((char *)src) += src_step;
-		((char *)dst) += dst_step;
-		((char *)sum) += sum_step;
+		src = ((char *)src) + src_step;
+		dst = ((char *)dst) + dst_step;
+		sum = ((char *)sum) + sum_step;
 	}
 }
 
@@ -276,9 +277,9 @@
 		} while (*sum != old_sample);
 		if (!--size)
 			return;
-		((char *)src) += src_step;
-		((char *)dst) += dst_step;
-		((char *)sum) += sum_step;
+		src = ((char *)src) + src_step;
+		dst = ((char *)dst) + dst_step;
+		sum = ((char *)sum) + sum_step;
 	}
 }