bug-grep
[Top][All Lists]
Advanced

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

gcc warnings in grep snapshot


From: Bruno Haible
Subject: gcc warnings in grep snapshot
Date: Fri, 23 Jan 2009 11:50:08 +0100
User-agent: KMail/1.9.9

Hi,

The grep-2.5.4-20090122 snapshot on alpha.gnu.org exhibits the following 
warnings,
when compiled with CPPFLAGS=-Wall on a Linux/x86 system.

$ ./configure CPPFLAGS=-Wall
$ make
...
savedir.c: In function ‘isdir1’:
savedir.c:91: warning: implicit declaration of function ‘isdir’

Suggestion: Add a declaration of the isdir function.

...
grep.c: In function ‘parse_grep_colors’:
grep.c:1709: warning: suggest explicit braces to avoid ambiguous ‘else’

Suggestion: Add braces.

...
In file included from ../lib/regex.h:2,
                 from search.c:37:
../lib/posix/regex.h:536:1: warning: "__restrict_arr" redefined
In file included from /usr/include/features.h:330,
                 from /usr/include/sys/types.h:27,
                 from search.c:25:
/usr/include/sys/cdefs.h:334:1: warning: this is the location of the previous 
definition

Suggestion: Use the same logic for restrict and restrict_arr as in 
gnulib/lib/regex.h.

...
search.c: In function ‘check_multibyte_string’:
search.c:169: warning: passing argument 1 of ‘wcrtomb’ discards qualifiers from 
pointer target type

Suggestion: Fix that code. It is completely broken: It assumes that for a pair
of upper-case and lower-case wide characters, the multibyte representation of 
the
two characters has the same length. This is not true in Turkish tr_TR.UTF-8 
locales
for the characters 'İ' and 'i'.

...
kwset.c: In function ‘kwsalloc’:
kwset.c:96: warning: call to function ‘xmalloc’ without a real prototype
kwset.c:40: note: ‘xmalloc’ was declared here

Suggestion: Change kwset.c:40 to
  #include "xalloc.h"

...
dfa.c: In function ‘update_mb_len_index’:
dfa.c:430: warning: pointer targets in passing argument 1 of ‘mbrlen’ differ in 
signedness
dfa.c: In function ‘lex’:
dfa.c:774: warning: pointer targets in passing argument 1 of 
‘update_mb_len_index’ differ in signedness
dfa.c:922: warning: pointer targets in passing argument 1 of 
‘update_mb_len_index’ differ in signedness
dfa.c:928: warning: pointer targets in passing argument 1 of 
‘update_mb_len_index’ differ in signedness
dfa.c:938: warning: pointer targets in passing argument 1 of 
‘update_mb_len_index’ differ in signedness
dfa.c:946: warning: pointer targets in passing argument 1 of 
‘update_mb_len_index’ differ in signedness
dfa.c:961: warning: pointer targets in passing argument 1 of 
‘update_mb_len_index’ differ in signedness
dfa.c:1049: warning: pointer targets in passing argument 1 of 
‘update_mb_len_index’ differ in signedness
dfa.c:1052: warning: pointer targets in passing argument 1 of 
‘update_mb_len_index’ differ in signedness
dfa.c:1076: warning: pointer targets in passing argument 1 of 
‘update_mb_len_index’ differ in signedness
dfa.c:1080: warning: pointer targets in passing argument 1 of 
‘update_mb_len_index’ differ in signedness
dfa.c:1081: warning: pointer targets in passing argument 1 of 
‘update_mb_len_index’ differ in signedness
dfa.c:1084: warning: pointer targets in passing argument 1 of 
‘update_mb_len_index’ differ in signedness
dfa.c:1096: warning: pointer targets in passing argument 1 of 
‘update_mb_len_index’ differ in signedness
dfa.c:1097: warning: pointer targets in passing argument 1 of 
‘update_mb_len_index’ differ in signedness

Suggestion: Change the first argument type of update_mb_len_index to 'char 
const *'.

dfa.c: In function ‘match_mb_charset’:
dfa.c:2561: warning: pointer targets in passing argument 2 of 
‘__builtin_strncpy’ differ in signedness

Suggestion: Change the second argument of strncpy, adding a cast.

dfa.c:2568: warning: pointer targets in passing argument 2 of 
‘__builtin_strncpy’ differ in signedness

Likewise.

dfa.c:2581: warning: pointer targets in passing argument 2 of 
‘__builtin_strncpy’ differ in signedness

Likewise.

dfa.c: In function ‘dfaexec’:
dfa.c:2834: warning: pointer targets in assignment differ in signedness
...

Suggestion: add a cast.


Find attached a patch that solves all the warnings except for the broken
check_multibyte_string.

Bruno

Attachment: grep-2.5.4-20090122-warnings.diff
Description: Text Data


reply via email to

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