On Sat, Oct 13, 2012 at 4:40 PM, Glenn Fowler <[email protected]> wrote:
> ast-ksh 2012-10-12 alpha posted
Here are come interesting warnings from the "clang" compiler...
1. The following warnings mean that the matching branches of the
|if|-statement are never taken:
1a) It looks |n| should be |ssize_t| instead of |size_t|, right ?
-- snip --
/home/test001/work/ast_ksh_20121012/build_clang/src/cmd/ksh93/bltins/print.c:636:7:
warning: comparison of unsigned expression < 0 is always false
[-Wtautological-compare]
if(n < 0)
~ ^ ~
1 warning generated.
-- snip --
1b) Same issue... maybe |n| and |m| should be |ssize_t| instead of
|size_t| (and what about |offset| ?) ?
-- snip --
/home/test001/work/ast_ksh_20121012/build_clang/src/cmd/ksh93/sh/nvtype.c:943:22:
warning: comparison of unsigned expression < 0 is always false
[-Wtautological-compare]
if((n=dp->strsize)<0)
~~~~~~~~~~~~~~~^~
1 warning generated.
-- snip --
1c) No clue what's the right action should be here:
-- snip --
/home/test001/work/ast_ksh_20121012/build_clang/src/lib/libast/vmalloc/malloc.c:1397:68:
warning: comparison of unsigned expression >= 0 is always true
[-Wtautological-compare]
if (v && vm &&
vm->meth.meth == VM_MTDEBUG && (n = atou(&v)) >= 0)
~~~~~~~~~~~~~~ ^ ~
1 warning generated.
-- snip --
2. "warning: control reaches end of non-void" ... which means the
functions may return a "random" value:
-- snip --
+ cc '-DSHOPT_CMDLIB_BLTIN=0' '-DSH_CMDLIB_DIR="/usr/ast/bin"'
'-DSHOPT_CMDLIB_HDR="/home/test001/work/ast_ksh_20121012/build_clang/tmp_gnulinux_builtin_header.h"'
-DSHOPT_SYSRC '-D_map_libc=1' -O2 -fstrict-aliasing -Wstrict-aliasing
-Wsequence-point -Wno-parentheses -Wno-unused -Wno-trigraphs -Waddress
-I. -I/home/test001/work/ast_ksh_20121012/build_clang/src/cmd/ksh93
-Iinclude
-I/home/test001/work/ast_ksh_20121012/build_clang/src/cmd/ksh93/include
-I/home/test001/work/ast_ksh_20121012/build_clang/arch/linux.i386-64/include/ast
-DSHOPT_STATS -DSHOPT_NAMESPACE -DSHOPT_PFSH -DSHOPT_MULTIBYTE
-DSHOPT_COSHELL -DSHOPT_AUDIT '-D_API_ast=20121001' -D_PACKAGE_ast
-DSHOPT_DYNAMIC -DSHOPT_POLL -D_BLD_shell -DSHOPT_KIA -DKSHELL
-DSHOPT_EDPREDICT -DSHOPT_FIXEDARRAY
'-DERROR_CONTEXT_T=Error_context_t' -DSHOPT_SUID_EXEC -DSHOPT_BRACEPAT
-c /home/test001/work/ast_ksh_20121012/build_clang/src/cmd/ksh93/sh/init.c
/home/test001/work/ast_ksh_20121012/build_clang/src/cmd/ksh93/sh/init.c:754:8:
warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
static astbin_update(Shell_t *shp, const char *from, const char *to)
~~~~~~ ^
/home/test001/work/ast_ksh_20121012/build_clang/src/cmd/ksh93/sh/init.c:800:1:
warning: control reaches end of non-void function [-Wreturn-type]
}
^
/home/test001/work/ast_ksh_20121012/build_clang/src/cmd/ksh93/sh/init.c:1910:1:
warning: control reaches end of non-void function [-Wreturn-type]
}
^
-- snip --
----
Bye,
Roland
--
__ . . __
(o.\ \/ /.o) [email protected]
\__\/\/__/ MPEG specialist, C&&JAVA&&Sun&&Unix programmer
/O /==\ O\ TEL +49 641 3992797
(;O/ \/ \O;)
_______________________________________________
ast-developers mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-developers