speechd-discuss
[Top][All Lists]
Advanced

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

[PATCH] Fix most warnings with gcc 4.4 on Linux


From: Boris Dusek
Subject: [PATCH] Fix most warnings with gcc 4.4 on Linux
Date: Wed, 8 Sep 2010 10:33:34 +0200

Hello Chris,

On Sep 8, 2010, at 5:40 AM, Christopher Brannon wrote:

>> when building the Ubuntu package for 0.7.1 Beta 2, I noticed lot of warnings 
>> in
> 
> Hello Boris,
> This looks great!

thanks

>> diff --git a/src/server/options.h b/src/server/options.h
>> index bcc10c4..c08a63e 100644
>> --- a/src/server/options.h
>> +++ b/src/server/options.h
>> @@ -23,23 +23,9 @@
> *SNIP*
>> +const struct option *const spd_long_options;
>> 
>> -static char* spd_short_options = "dsal:c:S:p:P:C:vDh";
>> +const char *const spd_short_options;
> 
> It isn't necessary to export these two variables, since they are only
> referenced in options.c.

well in my case there was warning about these two variables being defined but
not used, so it must be included in some other file than just options.c. That
is why I fixed it, also I think headers should contain only declarations,
not definitions (with the exception of macros, templates and intentionally
inlined functions, e.g. for performance reasons).

> Also, I'm still seeing errors on i686 with -Wall.  These are different
> From the remaining errors that you discussed in your message.  Here's my
> log.

I did not compile on i686, and since I have just the Ubuntu builddeps installed
(by apt-get build-dep speech-dispatcher), chances are good I do not have ivona
installed :-) I don't have time currently to fix these and test properly, so I
just commented below, it would be great if someone could post a patch fixing
(some of) those.

> festival.c: In function `_festival_speak':
> festival.c:630:3: warning: format `%ld' expects type `long int', but argument 
> 3 has type `unsigned int'
> festival.c:630:3: warning: format `%ld' expects type `long int', but argument 
> 3 has type `unsigned int'

I saw these 2, but I do not know the C(++) rules for integer conversions with
multiplication and how signed and unsigned works with that, so I did not want
to just fix it without being sure the fix is correct.

> In file included from ibmtts.c:55:0:
> /opt/IBM/ibmtts/inc/eci.h:366:1: warning: useless storage class specifier in 
> empty declaration

don't have IBMTTS installed, so I can't comment. And this seems like the
perfect example of warning from 3rd-party header we can't fix :-)

> espeak.c: In function `module_speak':
> espeak.c:402:4: warning: format `%d' expects type `int', but argument 2 has 
> type `wchar_t'

probably best to cast to long and use %ld

> espeak.c: In function `espeak_play_file':
> espeak.c:1149:2: warning: format `%ld' expects type `long int', but argument 
> 3 has type `sf_count_t'
> espeak.c:1149:2: warning: format `%ld' expects type `long int', but argument 
> 3 has type `sf_count_t'

probably best to cast sf_count_t to long

> In file included from ivona.c:83:0:
> ivona_client.c: In function `ivona_get_msgpart':
> ivona_client.c:156:3: warning: pointer targets in passing argument 3 of 
> `module_get_message_part' differ in signedness
> module_utils.h:169:5: note: expected `unsigned int *' but argument is of type 
> `int *'

pos should be declared unsigned int

> ivona.c: In function `_ivona_speak':
> ivona.c:341:7: warning: passing argument 2 of `ivona_get_msgpart' from 
> incompatible pointer type
> ivona_client.c:84:5: note: expected `char *' but argument is of type `char 
> (*)[64]'
> ivona.c:364:10: warning: passing argument 2 of `ivona_get_msgpart' from 
> incompatible pointer type
> ivona_client.c:84:5: note: expected `char *' but argument is of type `char 
> (*)[64]'

Bohdan fixed that.

Boris


reply via email to

[Prev in Thread] Current Thread [Next in Thread]