[Freewnn-users 156] Re: FreeWnn-1.1.1a022 openSUSE版をbuildしたときの warning message

Back to archive index

1xx itsan****@gmail*****
2013年 8月 23日 (金) 20:27:23 JST


2013年8月23日 11:31 1xx <itsan****@gmail*****>:
>
> FreeWnn-1.1.1a022 openSUSE版をbuildしたときの
> warning messageを公開します。
> https://dl.dropboxusercontent.com/u/86335040/FreeWnn/warn.txt

Wnn directoryの中で起きているwarning messageを観察してみました。
cWnn, kWnn directoryはWnn directoryのほぼcopyだと考えられるので、
見ていません。

先に指摘した
>(ポインタへのポインタを
>単なるポインタ型の引数に代入している個所など)
は実際には存在しないことを確認しました。

jishoop.cとinclude/jdata.hの構造体uind1, uind2は変更したいけど、
変更すると影響が大きそうで怖いですね。

jutil/wdreg.cでw_char *を期待しているところへ""を与えるのは
危険だと思います。
修正は簡単なのですぐにでも修正したくなります。
ちょっと修正コードを考えてみます。


make[2]: Entering directory
`/home/mitsutoshi/rpmbuild/BUILD/FreeWnn-1.1.1-a022/Wnn/jlib'
rm -f jl.o
/bin/sh ../..//libtool --mode=compile gcc -c -O2 -g -m64
-fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector
-funwind-tables -fasynchronous-unwind-tables   -Dlinux -D_GNU_SOURCE
-D_POSIX_SOURCE -D_BSD_SOURCE  -DHAVE_CONFIG_H -I../..//Wnn/include
-I../../ -DLIBDIR=\"/etc/FreeWnn\" -DJAPANESE -DCHINESE -DKOREAN
-DLATIN -DWRITE_CHECK  jl.c
mkdir .libs
 gcc -c -O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2
-fstack-protector -funwind-tables -fasynchronous-unwind-tables -Dlinux
-D_GNU_SOURCE -D_POSIX_SOURCE -D_BSD_SOURCE -DHAVE_CONFIG_H
-I../..//Wnn/include -I../../ -DLIBDIR=\"/etc/FreeWnn\" -DJAPANESE
-DCHINESE -DKOREAN -DLATIN -DWRITE_CHECK jl.c  -fPIC -DPIC -o
.libs/jl.o
jl.c: In function ‘get_pwd’:
jl.c:1678:13: warning: ignoring return value of ‘fgets’, declared with
attribute warn_unused_result [-Wunused-result]
       fgets (pwd, WNN_PASSWD_LEN, fp);
             ^
jl.c: In function ‘create_file’:
jl.c:3170:21: warning: ignoring return value of ‘chown’, declared with
attribute warn_unused_result [-Wunused-result]
               chown (n + 1, getuid (), -1);     /* H.T. */
                     ^
jl.c:3222:21: warning: ignoring return value of ‘chown’, declared with
attribute warn_unused_result [-Wunused-result]
               chown (n + 1, getuid (), -1);
                     ^
jl.c: In function ‘make_dir1’:
jl.c:3315:13: warning: ignoring return value of ‘chown’, declared with
attribute warn_unused_result [-Wunused-result]
       chown (dirname + 1, getuid (), -1);
             ^
返却値のある関数の返却値を捨ててしまっています。
まあ、無視しても大きな問題にはならないと思います。

/bin/sh ../..//libtool --mode=compile gcc -c -O2 -g -m64
-fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector
-funwind-tables -fasynchronous-unwind-tables   -Dlinux -D_GNU_SOURCE
-D_POSIX_SOURCE -D_BSD_SOURCE  -DHAVE_CONFIG_H -I../..//Wnn/include
-I../../ -DLIBDIR=\"/etc/FreeWnn\" -DJAPANESE -DCHINESE -DKOREAN
-DLATIN -DWRITE_CHECK  js.c
 gcc -c -O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2
-fstack-protector -funwind-tables -fasynchronous-unwind-tables -Dlinux
-D_GNU_SOURCE -D_POSIX_SOURCE -D_BSD_SOURCE -DHAVE_CONFIG_H
-I../..//Wnn/include -I../../ -DLIBDIR=\"/etc/FreeWnn\" -DJAPANESE
-DCHINESE -DKOREAN -DLATIN -DWRITE_CHECK js.c  -fPIC -DPIC -o
.libs/js.o
In file included from js.c:99:0:
../etc/bdic.c: In function ‘check_backup’:
../etc/bdic.c:417:12: warning: ignoring return value of ‘link’,
declared with attribute warn_unused_result [-Wunused-result]
       link (p, n);
            ^
../etc/bdic.c: In function ‘make_backup_file’:
../etc/bdic.c:482:8: warning: ignoring return value of ‘link’,
declared with attribute warn_unused_result [-Wunused-result]
   link (p2, p);
        ^
../etc/bdic.c: In function ‘move_tmp_to_org’:
../etc/bdic.c:536:12: warning: ignoring return value of ‘link’,
declared with attribute warn_unused_result [-Wunused-result]
       link (tmp_name, org_name);

返却値のある関数の返却値を捨ててしまっています。
無視しても大きな問題にはならないと思います。


/bin/sh ../..//libtool --mode=compile gcc -c -O2 -g -m64
-fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector
-funwind-tables -fasynchronous-unwind-tables   -Dlinux -D_GNU_SOURCE
-D_POSIX_SOURCE -D_BSD_SOURCE  -DHAVE_CONFIG_H -I../..//Wnn/include
-I../../ -DLIBDIR=\"/etc/FreeWnn\" -DJAPANESE
../..//Wnn/etc/`basename sstrings.o .o`.c
 gcc -c -O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2
-fstack-protector -funwind-tables -fasynchronous-unwind-tables -Dlinux
-D_GNU_SOURCE -D_POSIX_SOURCE -D_BSD_SOURCE -DHAVE_CONFIG_H
-I../..//Wnn/include -I../../ -DLIBDIR=\"/etc/FreeWnn\" -DJAPANESE
../..//Wnn/etc/sstrings.c  -fPIC -DPIC -o .libs/sstrings.o
../..//Wnn/etc/sstrings.c: In function ‘wnn_sStrncpy’:
../..//Wnn/etc/sstrings.c:103:3: warning: passing argument 1 of
‘eeuc_to_ieuc’ from incompatible pointer type [enabled by default]
   eeuc_to_ieuc (s1, s2, n / sizeof (w_char));
   ^
In file included from ../..//Wnn/etc/sstrings.c:48:0:
../..//Wnn/include/etc.h:34:12: note: expected ‘short unsigned int *’
but argument is of type ‘char *’
 extern int eeuc_to_ieuc FRWNN_PARAMS((w_char *, unsigned char *,
register int));
            ^
../..//Wnn/etc/sstrings.c:103:3: warning: passing argument 2 of
‘eeuc_to_ieuc’ from incompatible pointer type [enabled by default]
   eeuc_to_ieuc (s1, s2, n / sizeof (w_char));
   ^
In file included from ../..//Wnn/etc/sstrings.c:48:0:
../..//Wnn/include/etc.h:34:12: note: expected ‘unsigned char *’ but
argument is of type ‘short unsigned int *’
 extern int eeuc_to_ieuc FRWNN_PARAMS((w_char *, unsigned char *,
register int));

ポインタの型違いを指摘されています。

make[2]: Entering directory
`/home/mitsutoshi/rpmbuild/BUILD/FreeWnn-1.1.1-a022/Wnn/jserver'
gcc -c -O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2
-fstack-protector -funwind-tables -fasynchronous-unwind-tables
-Dlinux -D_GNU_SOURCE -D_POSIX_SOURCE -D_BSD_SOURCE  -DHAVE_CONFIG_H
-I../..//Wnn/include -I../../ -I. -DLIBDIR=\"/etc/FreeWnn\" -DJSERVER
-DWRITE_CHECK  -DSERVER_INIT_FILE=\"/ja/jserverrc\"  ./`basename de.o
.o`.c
./de.c: In function ‘main’:
./de.c:259:10: warning: ignoring return value of ‘setuid’, declared
with attribute warn_unused_result [-Wunused-result]
   setuid (geteuid ());
          ^
返却値のある関数の返却値を捨ててしまっています。
無視しても大きな問題にはならないと思います。


gcc -O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2
-fstack-protector -funwind-tables -fasynchronous-unwind-tables
-Dlinux -D_GNU_SOURCE -D_POSIX_SOURCE -D_BSD_SOURCE  -DHAVE_CONFIG_H
-I../..//Wnn/include -I../../ -I. -DLIBDIR=\"/etc/FreeWnn\" -DJSERVER
-DWRITE_CHECK    -c -o jishoop.o jishoop.c
jishoop.c: In function ‘word_delete1’:
jishoop.c:534:27: warning: comparison between pointer and integer
[enabled by default]
       if (tary[ind1].pter == NULL)
                           ^
intとpointerの比較に対する警告です。
tary[ind1].pterはstruct uind1 *taryと定義されており
struct uind1はinclude/jdata.hで

struct uind1
{
  int pter1;                    /* pointer to uind1 */
  int pter;                     /* pinter to uind2 */
  unsigned int yomi1;
  unsigned int yomi2;
};

struct uind2
{
  int next;                     /* pointer to uind2 */
  int serial;
  int kanjipter;
  w_char kosuu;
  w_char yomi[1];               /* actually it is variable length */
};

と定義されています。
このuind1, uind2でpointerをint型で持っていることが心配です。
ただ、修正するのも大変そうなんですよね。
uind1は後述するjutil/dtoa.cの中でfread()で呼ばれており、
file formatとしてこの形で決まってしまっています。


gcc -O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2
-fstack-protector -funwind-tables -fasynchronous-unwind-tables
-Dlinux -D_GNU_SOURCE -D_POSIX_SOURCE -D_BSD_SOURCE  -DHAVE_CONFIG_H
-I../..//Wnn/include -I../../ -I. -DLIBDIR=\"/etc/FreeWnn\" -DJSERVER
-DWRITE_CHECK    -c -o jishoop.o jishoop.c
jishoop.c: In function ‘word_delete1’:
jishoop.c:534:27: warning: comparison between pointer and integer
[enabled by default]
       if (tary[ind1].pter == NULL)
                           ^
gcc -O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2
-fstack-protector -funwind-tables -fasynchronous-unwind-tables
-Dlinux -D_GNU_SOURCE -D_POSIX_SOURCE -D_BSD_SOURCE  -DHAVE_CONFIG_H
-I../..//Wnn/include -I../../ -I. -DLIBDIR=\"/etc/FreeWnn\" -DJSERVER
-DWRITE_CHECK    -c -o rd_jishoop.o rd_jishoop.c
gcc -O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2
-fstack-protector -funwind-tables -fasynchronous-unwind-tables
-Dlinux -D_GNU_SOURCE -D_POSIX_SOURCE -D_BSD_SOURCE  -DHAVE_CONFIG_H
-I../..//Wnn/include -I../../ -I. -DLIBDIR=\"/etc/FreeWnn\" -DJSERVER
-DWRITE_CHECK    -c -o readfile.o readfile.c
readfile.c: In function ‘readdict’:
readfile.c:221:3: warning: passing argument 1 of ‘fread_cur’ from
incompatible pointer type [enabled by default]
   if (vfread (jt1->comment, 2, jt1->maxcomment, fp) != jt1->maxcomment)
   ^
In file included from readfile.c:55:0:
de_header.h:549:12: note: expected ‘char *’ but argument is of type
‘short unsigned int *’
 extern int fread_cur (char *, register int, register int);
            ^
readfile.c:228:3: warning: passing argument 1 of ‘fread_cur’ from
incompatible pointer type [enabled by default]
   if (vfread (jt1->hinsi_list, 2, jt1->maxhinsi_list, fp) !=
jt1->maxhinsi_list)
   ^
In file included from readfile.c:55:0:
de_header.h:549:12: note: expected ‘char *’ but argument is of type
‘short unsigned int *’
 extern int fread_cur (char *, register int, register int);
            ^
readfile.c:241:3: warning: passing argument 1 of ‘fread_cur’ from
incompatible pointer type [enabled by default]
   if (vfread (jt1->hinsi, 2, jt1->maxserial, fp) != jt1->maxserial)
   ^
In file included from readfile.c:55:0:
de_header.h:549:12: note: expected ‘char *’ but argument is of type
‘short unsigned int *’
 extern int fread_cur (char *, register int, register int);
            ^
readfile.c:262:42: warning: passing argument 1 of ‘fread_cur’ from
incompatible pointer type [enabled by default]
   if (vfread (jt1->table, sizeof (struct uind1), jt1->maxtable, fp)
!= jt1->maxtable)
                                          ^
readfile.c:75:74: note: in definition of macro ‘vfread’
 #define vfread(A, B, C, fp)
((fp)?fread((A),(B),(C),(fp)):fread_cur((A),(B),(C)))
                                                                          ^
In file included from readfile.c:55:0:
de_header.h:549:12: note: expected ‘char *’ but argument is of type
‘struct uind1 *’
 extern int fread_cur (char *, register int, register int);
            ^
readfile.c:268:48: warning: passing argument 1 of ‘fread_cur’ from
incompatible pointer type [enabled by default]
   if (vfread (jt1->ri1[D_YOMI], sizeof (struct rind1),
jt1->maxri1[D_YOMI], fp) != jt1->maxri1[D_YOMI])
                                                ^
readfile.c:75:74: note: in definition of macro ‘vfread’
 #define vfread(A, B, C, fp)
((fp)?fread((A),(B),(C),(fp)):fread_cur((A),(B),(C)))
                                                                          ^
In file included from readfile.c:55:0:
de_header.h:549:12: note: expected ‘char *’ but argument is of type
‘struct rind1 *’
 extern int fread_cur (char *, register int, register int);
            ^
readfile.c:274:49: warning: passing argument 1 of ‘fread_cur’ from
incompatible pointer type [enabled by default]
   if (vfread (jt1->ri1[D_KANJI], sizeof (struct rind1),
jt1->maxri1[D_KANJI], fp) != jt1->maxri1[D_KANJI])
                                                 ^
readfile.c:75:74: note: in definition of macro ‘vfread’
 #define vfread(A, B, C, fp)
((fp)?fread((A),(B),(C),(fp)):fread_cur((A),(B),(C)))
                                                                          ^
In file included from readfile.c:55:0:
de_header.h:549:12: note: expected ‘char *’ but argument is of type
‘struct rind1 *’
 extern int fread_cur (char *, register int, register int);
            ^
readfile.c:286:40: warning: passing argument 1 of ‘fread_cur’ from
incompatible pointer type [enabled by default]
   if (vfread (jt1->ri2, sizeof (struct rind2), jt1->maxri2, fp) != jt1->maxri2)
                                        ^
readfile.c:75:74: note: in definition of macro ‘vfread’
 #define vfread(A, B, C, fp)
((fp)?fread((A),(B),(C),(fp)):fread_cur((A),(B),(C)))
                                                                          ^
In file included from readfile.c:55:0:
de_header.h:549:12: note: expected ‘char *’ but argument is of type
‘struct rind2 *’
 extern int fread_cur (char *, register int, register int);
            ^
readfile.c: In function ‘readhindo’:
readfile.c:920:3: warning: passing argument 1 of ‘fread_cur’ from
incompatible pointer type [enabled by default]
   if (vfread (hjt1->comment, 2, hjt1->maxcomment, fp) != hjt1->maxcomment)
   ^
In file included from readfile.c:55:0:
de_header.h:549:12: note: expected ‘char *’ but argument is of type
‘short unsigned int *’
 extern int fread_cur (char *, register int, register int);

pointerの型違いを指摘されています。

gcc -O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2
-fstack-protector -funwind-tables -fasynchronous-unwind-tables
-Dlinux -D_GNU_SOURCE -D_POSIX_SOURCE -D_BSD_SOURCE  -DHAVE_CONFIG_H
-I../..//Wnn/include -I../../ -I. -DLIBDIR=\"/etc/FreeWnn\" -DJSERVER
-DWRITE_CHECK    -c -o jikouho.o jikouho.c
jikouho.c: In function ‘jkt_get_syo’:
jikouho.c:474:49: warning: passing argument 4 of ‘qsort’ from
incompatible pointer type [enabled by default]
   qsort ((char *) *dsd_sbn, cnt, sizeof (struct DSD_SBN), cmp_dsd_sbn);
                                                 ^
In file included from jikouho.c:42:0:
/usr/include/stdlib.h:760:13: note: expected ‘__compar_fn_t’ but
argument is of type ‘int (*)(struct DSD_SBN *, struct DSD_SBN *)’
 extern void qsort (void *__base, size_t __nmemb, size_t __size,
             ^
gcc -O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2
-fstack-protector -funwind-tables -fasynchronous-unwind-tables
-Dlinux -D_GNU_SOURCE -D_POSIX_SOURCE -D_BSD_SOURCE  -DHAVE_CONFIG_H
-I../..//Wnn/include -I../../ -I. -DLIBDIR=\"/etc/FreeWnn\" -DJSERVER
-DWRITE_CHECK    -c -o jikouho_d.o jikouho_d.c
jikouho_d.c: In function ‘jkt_get_dai’:
jikouho_d.c:139:49: warning: passing argument 4 of ‘qsort’ from
incompatible pointer type [enabled by default]
   qsort ((char *) *dsd_dbn, cnt, sizeof (struct DSD_DBN), cmp_dsd_dbn);
                                                 ^
In file included from jikouho_d.c:42:0:
/usr/include/stdlib.h:760:13: note: expected ‘__compar_fn_t’ but
argument is of type ‘int (*)(struct DSD_DBN *, struct DSD_DBN *)’
 extern void qsort (void *__base, size_t __nmemb, size_t __size,
             ^
qsortの第4引数に与える比較関数へのポインタの型が違うと指摘されています。
正しくは http://www.kouno.jp/home/c_faq/c13.html#9
に書かれたとおりにするのが良いのでしょうが、大きな問題ではないと思います。

gcc -c -O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2
-fstack-protector -funwind-tables -fasynchronous-unwind-tables
-Dlinux -D_GNU_SOURCE -D_POSIX_SOURCE -D_BSD_SOURCE  -DHAVE_CONFIG_H
-I../..//Wnn/include -I../../ -I. -DLIBDIR=\"/etc/FreeWnn\" -DJSERVER
-DWRITE_CHECK   ../..//Wnn/etc/`basename sstrings.o .o`.c
../..//Wnn/etc/sstrings.c: In function ‘wnn_sStrncpy’:
../..//Wnn/etc/sstrings.c:103:3: warning: passing argument 1 of
‘eeuc_to_ieuc’ from incompatible pointer type [enabled by default]
   eeuc_to_ieuc (s1, s2, n / sizeof (w_char));
   ^
In file included from ../..//Wnn/etc/sstrings.c:48:0:
../..//Wnn/include/etc.h:34:12: note: expected ‘short unsigned int *’
but argument is of type ‘char *’
 extern int eeuc_to_ieuc FRWNN_PARAMS((w_char *, unsigned char *,
register int));
            ^
../..//Wnn/etc/sstrings.c:103:3: warning: passing argument 2 of
‘eeuc_to_ieuc’ from incompatible pointer type [enabled by default]
   eeuc_to_ieuc (s1, s2, n / sizeof (w_char));
   ^
In file included from ../..//Wnn/etc/sstrings.c:48:0:
../..//Wnn/include/etc.h:34:12: note: expected ‘unsigned char *’ but
argument is of type ‘short unsigned int *’
 extern int eeuc_to_ieuc FRWNN_PARAMS((w_char *, unsigned char *,
register int));
            ^

pointerの型違いを指摘されています。


gcc -c -O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2
-fstack-protector -funwind-tables -fasynchronous-unwind-tables
-Dlinux -D_GNU_SOURCE -D_POSIX_SOURCE -D_BSD_SOURCE  -DHAVE_CONFIG_H
-I../..//Wnn/include -I../../ -I. -DLIBDIR=\"/etc/FreeWnn\" -DJSERVER
-DWRITE_CHECK   ../..//Wnn/etc/`basename bdic.o .o`.c
../..//Wnn/etc/bdic.c: In function ‘check_backup’:
../..//Wnn/etc/bdic.c:417:12: warning: ignoring return value of
‘link’, declared with attribute warn_unused_result [-Wunused-result]
       link (p, n);
            ^
../..//Wnn/etc/bdic.c: In function ‘make_backup_file’:
../..//Wnn/etc/bdic.c:482:8: warning: ignoring return value of ‘link’,
declared with attribute warn_unused_result [-Wunused-result]
   link (p2, p);
        ^
../..//Wnn/etc/bdic.c: In function ‘move_tmp_to_org’:
../..//Wnn/etc/bdic.c:536:12: warning: ignoring return value of
‘link’, declared with attribute warn_unused_result [-Wunused-result]
       link (tmp_name, org_name);
            ^
返却値のある関数の返却値を捨ててしまっています。
無視しても大きな問題にはならないと思います。

gcc -c -O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2
-fstack-protector -funwind-tables -fasynchronous-unwind-tables
-Dlinux -D_GNU_SOURCE -D_POSIX_SOURCE -D_BSD_SOURCE  -DHAVE_CONFIG_H
-I../../  -I../..//Wnn/include -DLIBDIR=\"/etc/FreeWnn\" -DJAPANESE
../..//Wnn/etc/`basename sstrings.o .o`.c
../..//Wnn/etc/sstrings.c: In function ‘wnn_sStrncpy’:
../..//Wnn/etc/sstrings.c:103:3: warning: passing argument 1 of
‘eeuc_to_ieuc’ from incompatible pointer type [enabled by default]
   eeuc_to_ieuc (s1, s2, n / sizeof (w_char));
   ^
In file included from ../..//Wnn/etc/sstrings.c:48:0:
../..//Wnn/include/etc.h:34:12: note: expected ‘short unsigned int *’
but argument is of type ‘char *’
 extern int eeuc_to_ieuc FRWNN_PARAMS((w_char *, unsigned char *,
register int));
            ^
../..//Wnn/etc/sstrings.c:103:3: warning: passing argument 2 of
‘eeuc_to_ieuc’ from incompatible pointer type [enabled by default]
   eeuc_to_ieuc (s1, s2, n / sizeof (w_char));
   ^
In file included from ../..//Wnn/etc/sstrings.c:48:0:
../..//Wnn/include/etc.h:34:12: note: expected ‘unsigned char *’ but
argument is of type ‘short unsigned int *’
 extern int eeuc_to_ieuc FRWNN_PARAMS((w_char *, unsigned char *,
register int));
            ^
pointerの型違いを指摘されています。

gcc -O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2
-fstack-protector -funwind-tables -fasynchronous-unwind-tables
-Dlinux -D_GNU_SOURCE -D_POSIX_SOURCE -D_BSD_SOURCE  -DHAVE_CONFIG_H
-I../../  -I../..//Wnn/include -DLIBDIR=\"/etc/FreeWnn\" -DJAPANESE
-c -o wdreg.o wdreg.c
wdreg.c: In function ‘main’:
wdreg.c:188:15: warning: passing argument 4 of
‘js_dic_file_create_client’ from incompatible pointer type [enabled by
default]
               if (js_dic_file_create_client (env, fname,
WNN_REV_DICT, "", "", "") == -1)
               ^
In file included from ../..//Wnn/include/jllib.h:40:0,
                 from wdreg.c:61:
../..//Wnn/include/jslib.h:433:12: note: expected ‘short unsigned int
*’ but argument is of type ‘char *’
 extern int js_dic_file_create_client FRWNN_PARAMS((struct wnn_env
*env, char *fn, int type, w_char *comment, char *passwd, char
*hpasswd));
            ^
wdreg.c:203:15: warning: passing argument 4 of ‘js_dic_file_create’
from incompatible pointer type [enabled by default]
               if (js_dic_file_create (env, fname, WNN_REV_DICT, "",
"", "") == -1)
               ^
In file included from ../..//Wnn/include/jllib.h:40:0,
                 from wdreg.c:61:
../..//Wnn/include/jslib.h:432:12: note: expected ‘short unsigned int
*’ but argument is of type ‘char *’
 extern int js_dic_file_create FRWNN_PARAMS((struct wnn_env *env, char
*fn, int type, w_char *comment, char *passwd, char *hpasswd));
            ^

jutil/wdreg.c の中で
jlib/js.cの関数js_dic_file_create_client (), js_dic_file_create ()を呼んでいます。

int
js_dic_file_create_client (env, fn, type, com, passwd, hpasswd)
     struct wnn_env *env;
     int type;
     char *fn;
     w_char *com;
     char *passwd, *hpasswd;

int
js_dic_file_create (env, fn, type, comment, passwd, hpasswd)
     struct wnn_env *env;
     char *fn;
     w_char *comment;
     char *passwd, *hpasswd;
     int type;

w_char *を期待しているところへ""を与えるのは非常に危険だと思います。

gcc -O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2
-fstack-protector -funwind-tables -fasynchronous-unwind-tables
-Dlinux -D_GNU_SOURCE -D_POSIX_SOURCE -D_BSD_SOURCE  -DHAVE_CONFIG_H
-I../../  -I../..//Wnn/include -DLIBDIR=\"/etc/FreeWnn\" -DJAPANESE
-c -o ujisf.o ujisf.c
ujisf.c: In function ‘sort’:
ujisf.c:811:55: warning: passing argument 4 of ‘qsort’ from
incompatible pointer type [enabled by default]
   qsort ((char *) jeary, jt.maxserial, sizeof (struct je *), sort_func_je);
                                                       ^
In file included from ujisf.c:42:0:
/usr/include/stdlib.h:760:13: note: expected ‘__compar_fn_t’ but
argument is of type ‘int (*)(char *, char *)’
 extern void qsort (void *__base, size_t __nmemb, size_t __size,
             ^
ujisf.c: In function ‘sort_kanji’:
ujisf.c:826:55: warning: passing argument 4 of ‘qsort’ from
incompatible pointer type [enabled by default]
   qsort ((char *) jeary, jt.maxserial, sizeof (struct je *),
sort_func_je_kanji);
                                                       ^
In file included from ujisf.c:42:0:
/usr/include/stdlib.h:760:13: note: expected ‘__compar_fn_t’ but
argument is of type ‘int (*)(char *, char *)’
 extern void qsort (void *__base, size_t __nmemb, size_t __size,
             ^
qsortの第4引数に与える比較関数へのポインタの型が違うと指摘されています。
正しくは http://www.kouno.jp/home/c_faq/c13.html#9
に書かれたとおりにするのが良いのでしょうが、大きな問題ではないと思います。

gcc -O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2
-fstack-protector -funwind-tables -fasynchronous-unwind-tables
-Dlinux -D_GNU_SOURCE -D_POSIX_SOURCE -D_BSD_SOURCE  -DHAVE_CONFIG_H
-I../../  -I../..//Wnn/include -DLIBDIR=\"/etc/FreeWnn\" -DJAPANESE
-c -o oldatonewa.o oldatonewa.c
oldatonewa.c: In function ‘main’:
oldatonewa.c:99:9: warning: ignoring return value of ‘fgets’, declared
with attribute warn_unused_result [-Wunused-result]
   fgets (buffer, LINE_SIZE, stdin);
         ^
返却値のある関数の返却値を捨ててしまっています。

int
main (void)
{
  char buffer[LINE_SIZE];

  fgets (buffer, LINE_SIZE, stdin); /* <-  */
  printf ("\\total %s", buffer);
  for (; fgets (buffer, LINE_SIZE, stdin) != NULL;)
    {
      get_line1 (buffer);
    }
  exit (0);
}
入力dataのformatをある程度決め打ちしています。
エラーチェックした方が良いとは思います。

gcc -O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2
-fstack-protector -funwind-tables -fasynchronous-unwind-tables
-Dlinux -D_GNU_SOURCE -D_POSIX_SOURCE -D_BSD_SOURCE  -DHAVE_CONFIG_H
-I../../  -I../..//Wnn/include -DLIBDIR=\"/etc/FreeWnn\" -DJAPANESE
-c -o dtoa.o dtoa.c
dtoa.c: In function ‘input_dic’:
dtoa.c:275:9: warning: ignoring return value of ‘fread’, declared with
attribute warn_unused_result [-Wunused-result]
   fread (jt.hinsi, 2, jt.maxserial, ifpter);
         ^
dtoa.c:280:9: warning: ignoring return value of ‘fread’, declared with
attribute warn_unused_result [-Wunused-result]
   fread (jt.kanji, 1, jt.maxkanji, ifpter);
         ^
dtoa.c:282:9: warning: ignoring return value of ‘fread’, declared with
attribute warn_unused_result [-Wunused-result]
   fread (jt.table, sizeof (struct uind1), jt.maxtable, ifpter);
         ^
dtoa.c:283:9: warning: ignoring return value of ‘fread’, declared with
attribute warn_unused_result [-Wunused-result]
   fread (jt.ri1[D_YOMI], sizeof (struct rind1), jt.maxri1[D_YOMI], ifpter);
         ^
dtoa.c:284:9: warning: ignoring return value of ‘fread’, declared with
attribute warn_unused_result [-Wunused-result]
   fread (jt.ri1[D_KANJI], sizeof (struct rind1), jt.maxri1[D_KANJI], ifpter);
         ^
dtoa.c:285:9: warning: ignoring return value of ‘fread’, declared with
attribute warn_unused_result [-Wunused-result]
   fread (jt.hontai, 1, jt.maxhontai, ifpter);
         ^
dtoa.c:286:9: warning: ignoring return value of ‘fread’, declared with
attribute warn_unused_result [-Wunused-result]
   fread (jt.ri2, sizeof (struct rind2), jt.maxserial, ifpter);
         ^

fread()の返却値を捨てています。
先述したstruct uind1がここでfile formatとして読み込まれています。
変更すると互換性を失ってしまう悩ましい個所です。

gcc -O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2
-fstack-protector -funwind-tables -fasynchronous-unwind-tables
-Dlinux -D_GNU_SOURCE -D_POSIX_SOURCE -D_BSD_SOURCE  -DHAVE_CONFIG_H
-I../../  -I../..//Wnn/include -DLIBDIR=\"/etc/FreeWnn\" -DJAPANESE
-c -o atod.o atod.c
atod.c: In function ‘sdic_sort’:
atod.c:600:65: warning: passing argument 4 of ‘qsort’ from
incompatible pointer type [enabled by default]
       qsort ((char *) jeary, (int) jt.maxserial, sizeof (struct je
*), sort_func_sdic);
                                                                 ^
In file included from atod.c:47:0:
/usr/include/stdlib.h:760:13: note: expected ‘__compar_fn_t’ but
argument is of type ‘int (*)(char *, char *)’
 extern void qsort (void *__base, size_t __nmemb, size_t __size,
             ^
qsortの第4引数に与える比較関数へのポインタの型が違うと指摘されています。
正しくは http://www.kouno.jp/home/c_faq/c13.html#9
に書かれたとおりにするのが良いのでしょうが、大きな問題ではないと思います。

atod.c: In function ‘get_pwd’:
atod.c:833:9: warning: ignoring return value of ‘fgets’, declared with
attribute warn_unused_result [-Wunused-result]
   fgets (pwd, WNN_PASSWD_LEN, fp);
         ^
fgets ()の返却値を捨ててしまっています。
get_pwd ()関数はvoid返却値関数なのでこれをint返却値型にすれば
errorを外出しにできるかもしれません。

gcc -O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2
-fstack-protector -funwind-tables -fasynchronous-unwind-tables
-Dlinux -D_GNU_SOURCE -D_POSIX_SOURCE -D_BSD_SOURCE  -DHAVE_CONFIG_H
-I../../  -c ../..//PubdicPlus/pod.c
../..//PubdicPlus/pod.c: In function ‘sortkind’:
../..//PubdicPlus/pod.c:834:40: warning: passing argument 4 of ‘qsort’
from incompatible pointer type [enabled by default]
   qsort (kinds, nkinds, sizeof (struct kindpack), kindcompar);
                                        ^
In file included from ../..//PubdicPlus/pod.c:33:0:
/usr/include/stdlib.h:760:13: note: expected ‘__compar_fn_t’ but
argument is of type ‘int (*)(struct kindpack *, struct kindpack *)’
 extern void qsort (void *__base, size_t __nmemb, size_t __size,
             ^
../..//PubdicPlus/pod.c: In function ‘main’:
../..//PubdicPlus/pod.c:1682:52: warning: passing argument 4 of
‘qsort’ from incompatible pointer type [enabled by default]
           qsort (pdic, ndicentries, sizeof (struct dicpack *), dichindocompar);
                                                    ^
In file included from ../..//PubdicPlus/pod.c:33:0:
/usr/include/stdlib.h:760:13: note: expected ‘__compar_fn_t’ but
argument is of type ‘int (*)(struct dicpack **, struct dicpack **)’
 extern void qsort (void *__base, size_t __nmemb, size_t __size,
             ^
../..//PubdicPlus/pod.c:1686:52: warning: passing argument 4 of
‘qsort’ from incompatible pointer type [enabled by default]
           qsort (pdic, ndicentries, sizeof (struct dicpack *), diccompar);
                                                    ^
In file included from ../..//PubdicPlus/pod.c:33:0:
/usr/include/stdlib.h:760:13: note: expected ‘__compar_fn_t’ but
argument is of type ‘int (*)(struct dicpack **, struct dicpack **)’
 extern void qsort (void *__base, size_t __nmemb, size_t __size,
             ^
qsortの第4引数に与える比較関数へのポインタの型が違うと指摘されています。
正しくは http://www.kouno.jp/home/c_faq/c13.html#9
に書かれたとおりにするのが良いのでしょうが、大きな問題ではないと思います。

gcc -O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2
-fstack-protector -funwind-tables -fasynchronous-unwind-tables
-Dlinux -D_GNU_SOURCE -D_POSIX_SOURCE -D_BSD_SOURCE  -DHAVE_CONFIG_H
-I../../  -I../..//Wnn/include -I../..//Wnn/romkan
-DLIBDIR=\"/etc/FreeWnn\" -DJAPANESE   -c -o uif.o uif.c
uif.c: In function ‘reconnect_jserver_body’:
uif.c:1142:3: warning: passing argument 1 of ‘Sstrcpy’ from
incompatible pointer type [enabled by default]
   Sstrcpy (kana_buf, servername);
   ^
In file included from uif.c:64:0:
sheader.h:412:12: note: expected ‘short unsigned int *’ but argument
is of type ‘short unsigned int **’
 extern int Sstrcpy (register w_char *, register UCHAR *);
            ^
uif.c:1147:16: warning: passing argument 3 of ‘kana_in’ from
incompatible pointer type [enabled by default]
                UNDER_LINE_MODE, kana_buf, 1024) == -1)
                ^
In file included from uif.c:64:0:
sheader.h:296:12: note: expected ‘short unsigned int *’ but argument
is of type ‘short unsigned int **’
 extern int kana_in (char *, int, w_char *, int);
            ^
uif.c:1149:3: warning: passing argument 1 of ‘wchartochar’ from
incompatible pointer type [enabled by default]
   wchartochar (kana_buf, hostname);
   ^
In file included from uif.c:64:0:
sheader.h:373:12: note: expected ‘short unsigned int *’ but argument
is of type ‘short unsigned int **’
 extern int wchartochar (w_char *, UCHAR *);
            ^
uif.c: In function ‘henkan_off’:
uif.c:1271:13: warning: ignoring return value of ‘write’, declared
with attribute warn_unused_result [-Wunused-result]
       write (ptyfd, outbuf, i);
             ^
pointerの型違いを指摘されています。

gcc -O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2
-fstack-protector -funwind-tables -fasynchronous-unwind-tables
-Dlinux -D_GNU_SOURCE -D_POSIX_SOURCE -D_BSD_SOURCE  -DHAVE_CONFIG_H
-I../../  -I../..//Wnn/include -I../..//Wnn/romkan
-DLIBDIR=\"/etc/FreeWnn\" -DJAPANESE   -c -o jhlp.o jhlp.c
jhlp.c: In function ‘exec_cmd’:
jhlp.c:1664:14: warning: ignoring return value of ‘setgid’, declared
with attribute warn_unused_result [-Wunused-result]
       setgid (getgid ());
              ^
jhlp.c:1665:14: warning: ignoring return value of ‘setuid’, declared
with attribute warn_unused_result [-Wunused-result]
       setuid (getuid ());
              ^
jhlp.c: In function ‘do_end’:
jhlp.c:2160:9: warning: ignoring return value of ‘chdir’, declared
with attribute warn_unused_result [-Wunused-result]
   chdir ("/tmp");               /* to avoid making too many mon.out files */
         ^
jhlp.c: In function ‘do_main’:
jhlp.c:1243:15: warning: ignoring return value of ‘write’, declared
with attribute warn_unused_result [-Wunused-result]
         write (ptyfd, buf, ml);
               ^
関数の返却値を捨てています。
uum/jhlpp.cを見たのですが、ゴチャッとしていて複雑です。
これらの関数に更にエラーチェックを入れるのは益が少ないかもしれません。

gcc -c -O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2
-fstack-protector -funwind-tables -fasynchronous-unwind-tables
-Dlinux -D_GNU_SOURCE -D_POSIX_SOURCE -D_BSD_SOURCE  -DHAVE_CONFIG_H
-I../../  -I../..//Wnn/include -I../..//Wnn/romkan
-DLIBDIR=\"/etc/FreeWnn\" -DJAPANESE  ../..//Wnn/etc/`basename
sstrings.o .o`.c
../..//Wnn/etc/sstrings.c: In function ‘wnn_sStrncpy’:
../..//Wnn/etc/sstrings.c:103:3: warning: passing argument 1 of
‘eeuc_to_ieuc’ from incompatible pointer type [enabled by default]
   eeuc_to_ieuc (s1, s2, n / sizeof (w_char));
   ^
In file included from ../..//Wnn/etc/sstrings.c:48:0:
../..//Wnn/include/etc.h:34:12: note: expected ‘short unsigned int *’
but argument is of type ‘char *’
 extern int eeuc_to_ieuc FRWNN_PARAMS((w_char *, unsigned char *,
register int));
            ^
../..//Wnn/etc/sstrings.c:103:3: warning: passing argument 2 of
‘eeuc_to_ieuc’ from incompatible pointer type [enabled by default]
   eeuc_to_ieuc (s1, s2, n / sizeof (w_char));
   ^
In file included from ../..//Wnn/etc/sstrings.c:48:0:
../..//Wnn/include/etc.h:34:12: note: expected ‘unsigned char *’ but
argument is of type ‘short unsigned int *’
 extern int eeuc_to_ieuc FRWNN_PARAMS((w_char *, unsigned char *,
register int));
            ^
pointerの型違いを指摘されています。

gcc -c -O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2
-fstack-protector -funwind-tables -fasynchronous-unwind-tables
-Dlinux -D_GNU_SOURCE -D_POSIX_SOURCE -D_BSD_SOURCE  -DHAVE_CONFIG_H
-I../../cWnn/include -I../.. -DLIBDIR=\"/etc/FreeWnn\" -DCHINESE
sstrings.c
sstrings.c: In function ‘wnn_sStrncpy’:
sstrings.c:103:3: warning: passing argument 1 of ‘eeuc_to_ieuc’ from
incompatible pointer type [enabled by default]
   eeuc_to_ieuc (s1, s2, n / sizeof (w_char));
   ^
In file included from sstrings.c:48:0:
../../cWnn/include/etc.h:34:12: note: expected ‘short unsigned int *’
but argument is of type ‘char *’
 extern int eeuc_to_ieuc FRWNN_PARAMS((w_char *, unsigned char *,
register int));
            ^
sstrings.c:103:3: warning: passing argument 2 of ‘eeuc_to_ieuc’ from
incompatible pointer type [enabled by default]
   eeuc_to_ieuc (s1, s2, n / sizeof (w_char));
   ^
In file included from sstrings.c:48:0:
../../cWnn/include/etc.h:34:12: note: expected ‘unsigned char *’ but
argument is of type ‘short unsigned int *’
 extern int eeuc_to_ieuc FRWNN_PARAMS((w_char *, unsigned char *,
register int));
            ^
pointerの型違いを指摘されています。

Wnn directoryの中で起きているwarningは以上です。

-- 
1xx <ItSAN****@gmail*****> <https://twitter.com/ItSANgo>
<http://d.hatena.ne.jp/Itisango/>




freewnn-users メーリングリストの案内
Back to archive index