[PATCH] Get rid of some warnings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



With this and other patches floating on the list we're down to three warnings:
(this is with gcc 4.6.0, with 4.4.4 - which is standard on ubuntu
10.10 - I got more bogus warnings)

  CC     libpulsecommon_1.0_la-ipacl.lo
pulsecore/ipacl.c: In function ?pa_ip_acl_check?:
pulsecore/ipacl.c:238:20: warning: cannot optimize loop, the loop
counter may overflow [-Wunsafe-loop-optimizations]

I have no idea how to do this one. It seems safe to ignore.


  CC     libpulsecommon_1.0_la-memtrap.lo
pulsecore/memtrap.c: In function ?sigsafe_error?:
pulsecore/memtrap.c:72:5: warning: ignoring return value of ?write?,
declared with attribute warn_unused_result [-Wunused-result]

We really want to ignore the return value here, because you can't
really do anything about a failing write, as it's in a signal handler
and we're aborting anyway. That line already casts the result to
(void), but that doesn't seem to stop the warning:
pulsecore/memtrap.c:72: (void) write(STDERR_FILENO, s, strlen(s));


  CC     libbluetooth_sbc_la-sbc.lo
modules/bluetooth/sbc/sbc.c: In function ?sbc_decode?:
modules/bluetooth/sbc/sbc.c:498:10: warning: cannot optimize possibly
infinite loops [-Wunsafe-loop-optimizations]

Not our code


I think I have had enough of this. But if there are others that are
interested in fixing warnings: compiling with clang works now in git
master and gives plenty of warnings to play with ;-)


Maarten


2011/3/19 Maarten Bosmans <mkbosmans at gmail.com>:
> Mostly warnings about unused stuff.
> Furthermore, the first hunk is a fix for the change in 177948a6.
> Finally, comment in AEC_dtd was translated and the code simplified slightly.
>
> CC ? ? module_bluetooth_device_la-module-bluetooth-device.lo
> modules/bluetooth/module-bluetooth-device.c: In function ?a2dp_process_render?:
> modules/bluetooth/module-bluetooth-device.c:1335:30: warning: pointer targets in passing argument 6 of ?sbc_encode?
> differ in signedness [-Wpointer-sign]
> ../src/modules/bluetooth/sbc/sbc.h:92:9: note: expected ?ssize_t *? but argument is of type ?size_t *?
>
> CC ? ? module_rygel_media_server_la-module-rygel-media-server.lo
> modules/module-rygel-media-server.c:383:13: warning: ?append_property_dict_entry_object_array? defined but not used [-Wunused-function]
>
> CC ? ? module_echo_cancel_la-adrian-aec.lo
> modules/echo-cancel/adrian-aec.h:360:15: warning: ?AEC_getambient? defined but not used [-Wunused-function]
> modules/echo-cancel/adrian-aec.h:368:14: warning: ?AEC_setgain? defined but not used [-Wunused-function]
> modules/echo-cancel/adrian-aec.h:374:14: warning: ?AEC_setaes? defined but not used [-Wunused-function]
> modules/echo-cancel/adrian-aec.h:377:16: warning: ?AEC_max_dotp_xf_xf? declared ?static? but never defined [-Wunused-function]
>
> CC ? ? module_echo_cancel_la-module-echo-cancel.lo
> modules/echo-cancel/module-echo-cancel.c: In function ?time_callback?:
> modules/echo-cancel/module-echo-cancel.c:266:12: warning: variable ?fs? set but not used [-Wunused-but-set-variable]
>
> CC ? ? module-virtual-sink.lo
> modules/module-virtual-sink.c: In function ?sink_input_pop_cb?:
> modules/module-virtual-sink.c:206:15: warning: variable ?current_latency? set but not used [-Wunused-but-set-variable]
> ---
> ?src/modules/bluetooth/module-bluetooth-device.c | ? ?2 +-
> ?src/modules/echo-cancel/adrian-aec.c ? ? ? ? ? ?| ? 16 ++++++----------
> ?src/modules/echo-cancel/adrian-aec.h ? ? ? ? ? ?| ? ?7 +++----
> ?src/modules/echo-cancel/module-echo-cancel.c ? ?| ? ?4 ++--
> ?src/modules/module-rygel-media-server.c ? ? ? ? | ? ?1 +
> ?src/modules/module-virtual-sink.c ? ? ? ? ? ? ? | ? ?2 +-
> ?src/pulse/gccmacro.h ? ? ? ? ? ? ? ? ? ? ? ? ? ?| ? ?2 +-
> ?7 files changed, 15 insertions(+), 19 deletions(-)
>
> diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c
> index 5561054..ac0f16f 100644
> --- a/src/modules/bluetooth/module-bluetooth-device.c
> +++ b/src/modules/bluetooth/module-bluetooth-device.c
> @@ -1326,7 +1326,7 @@ static int a2dp_process_render(struct userdata *u) {
> ? ? to_write = a2dp->buffer_size - sizeof(*header) - sizeof(*payload);
>
> ? ? while (PA_LIKELY(to_encode > 0 && to_write > 0)) {
> - ? ? ? ?size_t written;
> + ? ? ? ?ssize_t written;
> ? ? ? ? ssize_t encoded;
>
> ? ? ? ? encoded = sbc_encode(&a2dp->sbc,
> diff --git a/src/modules/echo-cancel/adrian-aec.c b/src/modules/echo-cancel/adrian-aec.c
> index 6793e59..04b31e9 100644
> --- a/src/modules/echo-cancel/adrian-aec.c
> +++ b/src/modules/echo-cancel/adrian-aec.c
> @@ -107,8 +107,7 @@ AEC* AEC_init(int RATE, int have_vector)
> ?// mapped to 1.0 with a limited linear function.
> ?static float AEC_dtd(AEC *a, REAL d, REAL x)
> ?{
> - ?float stepsize;
> - ?float ratio, M;
> + ?float ratio, stepsize;
>
> ? // fast near-end and far-end average
> ? a->dfast += ALPHAFAST * (fabsf(d) - a->dfast);
> @@ -129,16 +128,13 @@ static float AEC_dtd(AEC *a, REAL d, REAL x)
> ? // ratio of NFRs
> ? ratio = (a->dfast * a->xslow) / (a->dslow * a->xfast);
>
> - ?// begrenzte lineare Kennlinie
> - ?M = (STEPY2 - STEPY1) / (STEPX2 - STEPX1);
> - ?if (ratio < STEPX1) {
> + ?// Linear interpolation with clamping at the limits
> + ?if (ratio < STEPX1)
> ? ? stepsize = STEPY1;
> - ?} else if (ratio > STEPX2) {
> + ?else if (ratio > STEPX2)
> ? ? stepsize = STEPY2;
> - ?} else {
> - ? ?// Punktrichtungsform einer Geraden
> - ? ?stepsize = M * (ratio - STEPX1) + STEPY1;
> - ?}
> + ?else
> + ? ?stepsize = STEPY1 + (STEPY2 - STEPY1) * (ratio - STEPX1) / (STEPX2 - STEPX1);
>
> ? return stepsize;
> ?}
> diff --git a/src/modules/echo-cancel/adrian-aec.h b/src/modules/echo-cancel/adrian-aec.h
> index 235984b..9c722b9 100644
> --- a/src/modules/echo-cancel/adrian-aec.h
> +++ b/src/modules/echo-cancel/adrian-aec.h
> @@ -357,7 +357,7 @@ static ?REAL AEC_nlms_pw(AEC *a, REAL d, REAL x_, float stepsize);
> ?*/
> ? int AEC_doAEC(AEC *a, int d_, int x_);
>
> -static ?float AEC_getambient(AEC *a) {
> +PA_GCC_UNUSED static ?float AEC_getambient(AEC *a) {
> ? ? return a->dfast;
> ? };
> ?static ?void AEC_setambient(AEC *a, float Min_xf) {
> @@ -365,16 +365,15 @@ static ?void AEC_setambient(AEC *a, float Min_xf) {
> ? ? a->delta = (NLMS_LEN-1) * Min_xf * Min_xf;
> ? ? a->dotp_xf_xf += a->delta; ?// add new delta
> ? };
> -static ?void AEC_setgain(AEC *a, float gain_) {
> +PA_GCC_UNUSED static ?void AEC_setgain(AEC *a, float gain_) {
> ? ? a->gain = gain_;
> ? };
> ?#if 0
> ? void AEC_openwdisplay(AEC *a);
> ?#endif
> -static ?void AEC_setaes(AEC *a, float aes_y2_) {
> +PA_GCC_UNUSED static ?void AEC_setaes(AEC *a, float aes_y2_) {
> ? ? a->aes_y2 = aes_y2_;
> ? };
> -static ?double AEC_max_dotp_xf_xf(AEC *a, double u);
>
> ?#define _AEC_H
> ?#endif
> diff --git a/src/modules/echo-cancel/module-echo-cancel.c b/src/modules/echo-cancel/module-echo-cancel.c
> index a3ad169..56fa89e 100644
> --- a/src/modules/echo-cancel/module-echo-cancel.c
> +++ b/src/modules/echo-cancel/module-echo-cancel.c
> @@ -263,7 +263,7 @@ static void time_callback(pa_mainloop_api *a, pa_time_event *e, const struct tim
> ? ? struct userdata *u = userdata;
> ? ? uint32_t old_rate, base_rate, new_rate;
> ? ? int64_t diff_time;
> - ? ?size_t fs;
> + ? ?//size_t fs;
> ? ? struct snapshot latency_snapshot;
>
> ? ? pa_assert(u);
> @@ -281,7 +281,7 @@ static void time_callback(pa_mainloop_api *a, pa_time_event *e, const struct tim
> ? ? /* calculate drift between capture and playback */
> ? ? diff_time = calc_diff(u, &latency_snapshot);
>
> - ? ?fs = pa_frame_size(&u->source_output->sample_spec);
> + ? ?//fs = pa_frame_size(&u->source_output->sample_spec);
> ? ? old_rate = u->sink_input->sample_spec.rate;
> ? ? base_rate = u->source_output->sample_spec.rate;
>
> diff --git a/src/modules/module-rygel-media-server.c b/src/modules/module-rygel-media-server.c
> index 9d23e8a..f34142c 100644
> --- a/src/modules/module-rygel-media-server.c
> +++ b/src/modules/module-rygel-media-server.c
> @@ -380,6 +380,7 @@ static void append_variant_item_display_name(DBusMessage *m, DBusMessageIter *it
> ? ? append_variant_string(m, iter, display_name);
> ?}
>
> +PA_GCC_UNUSED
> ?static void append_property_dict_entry_object_array(DBusMessage *m, DBusMessageIter *iter, const char *name, const char *path[], unsigned n) {
> ? ? DBusMessageIter sub;
>
> diff --git a/src/modules/module-virtual-sink.c b/src/modules/module-virtual-sink.c
> index cc13490..f772314 100644
> --- a/src/modules/module-virtual-sink.c
> +++ b/src/modules/module-virtual-sink.c
> @@ -203,7 +203,7 @@ static int sink_input_pop_cb(pa_sink_input *i, size_t nbytes, pa_memchunk *chunk
> ? ? size_t fs;
> ? ? unsigned n, c;
> ? ? pa_memchunk tchunk;
> - ? ?pa_usec_t current_latency;
> + ? ?pa_usec_t current_latency PA_GCC_UNUSED;
>
> ? ? pa_sink_input_assert_ref(i);
> ? ? pa_assert(chunk);
> diff --git a/src/pulse/gccmacro.h b/src/pulse/gccmacro.h
> index 57e8050..5749a6b 100644
> --- a/src/pulse/gccmacro.h
> +++ b/src/pulse/gccmacro.h
> @@ -49,7 +49,7 @@
> ?#ifdef __GNUC__
> ?#define PA_GCC_UNUSED __attribute__ ((unused))
> ?#else
> -/** Macro for not used parameter */
> +/** Macro for not used function, variable or parameter */
> ?#define PA_GCC_UNUSED
> ?#endif
>
> --
> 1.7.1
>
>



[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux