Hi!

----

Attached (as "astksh20130409_clang_missingwariabledeclaration_fixes001.diff.gz")
is a small patch to fix some warning by "clang"'s
"-Wmissing-variable-declarations" warning (see
http://clang-developers.42468.n3.nabble.com/Wmissing-variable-declaration-td3461884.html)
for a short description - basically it complains about global
variables which were not declared using |extern| before the
declaration of the real variable (the warning is mainly used for large
codebases like FreeBSD, Mozilla etc. to ensure codebase health).

The reported warnings for ast-ksh.2013-04-09 are:
-- snip -
ratz.c:1684:12: warning: no previous extern declaration for non-static
variable 'inflate_copyright' [-Wmissing-variable-declarations]
const char inflate_copyright[] =
           ^
--
src/cmd/INIT/ratz.c:1684:12: warning: no previous extern declaration
for non-static variable 'inflate_copyright'
[-Wmissing-variable-declarations]
const char inflate_copyright[] =
           ^
--
lctab.c:7:22: warning: no previous extern declaration for non-static
variable 'attribute_es' [-Wmissing-variable-declarations]
const Lc_attribute_t attribute_es[] =
                     ^
--
src/lib/libast/cdt/dthash.c:451:24: warning: no previous extern
declaration for non-static variable 'Dthash'
[-Wmissing-variable-declarations]
__DEFINE__(Dtmethod_t*,Dthash,&_Dtset);
                       ^
--
src/lib/libast/cdt/dttree.c:701:24: warning: no previous extern
declaration for non-static variable 'Dttree'
[-Wmissing-variable-declarations]
__DEFINE__(Dtmethod_t*,Dttree,&_Dtoset);
                       ^
--
src/lib/libast/aso/aso-sem.c:191:11: warning: no previous extern
declaration for non-static variable '_aso_meth_semaphore'
[-Wmissing-variable-declarations]
Asometh_t       _aso_meth_semaphore = { "semaphore",
ASO_PROCESS|ASO_THREAD, aso_init_semaphore, aso_lock_semaphore };
                ^
--
src/lib/libast/aso/aso-fcntl.c:186:11: warning: no previous extern
declaration for non-static variable '_aso_meth_fcntl'
[-Wmissing-variable-declarations]
Asometh_t       _aso_meth_fcntl = { "fcntl", ASO_PROCESS,
aso_init_fcntl, aso_lock_fcntl };
                ^
--
src/cmd/ksh93/bltins/enum.c:185:17: warning: no previous extern
declaration for non-static variable 'ENUM_disc'
[-Wmissing-variable-declarations]
const Namdisc_t ENUM_disc        = {  0, put_enum, get_enum,
get_nenum, 0,0,clone_enum };
                ^
--
src/cmd/ksh93/bltins/print.c:75:24: warning: no previous extern
declaration for non-static variable 'Pmap'
[-Wmissing-variable-declarations]
const struct printmap  Pmap[] =
                       ^
--
src/cmd/ksh93/sh/nvtype.c:1480:10: warning: no previous extern
declaration for non-static variable 'foo'
[-Wmissing-variable-declarations]
Fields_t foo[]=
         ^
--
src/cmd/ksh93/sh/xec.c:670:11: warning: no previous extern declaration
for non-static variable 'coused' [-Wmissing-variable-declarations]
uintmax_t       coused;
                ^
--
src/cmd/ksh93/data/msg.c:82:12: warning: no previous extern
declaration for non-static variable 'e_nointerp'
[-Wmissing-variable-declarations]
const char e_nointerp[]         = "%s: interpreter not found";
           ^
src/cmd/ksh93/data/msg.c:146:13: warning: no previous extern
declaration for non-static variable 'e_newtty'
[-Wmissing-variable-declarations]
        const char e_newtty[]   = "Switching to new tty driver...";
                   ^
src/cmd/ksh93/data/msg.c:147:13: warning: no previous extern
declaration for non-static variable 'e_oldtty'
[-Wmissing-variable-declarations]
        const char e_oldtty[]   = "Reverting to old tty driver...";
                   ^
--
src/cmd/ksh93/data/builtins.c:1801:12: warning: no previous extern
declaration for non-static variable 'sh_optuniverse'
[-Wmissing-variable-declarations]
const char sh_optuniverse[]     = " [name]";
           ^
--
src/cmd/ksh93/bltins/poll.c:245:24: warning: no previous extern
declaration for non-static variable 'pfnm'
[-Wmissing-variable-declarations]
struct pollflagnamemap pfnm[]=
-- snip --

Note that my patch doesn't fix all warnings because I don't have the
current ast-open sources to test for any regressions... I'll do more
cleanup later (ast-open doesn't currently build on Linux with clang
for other reasons anyway) ...

----

Bye,
Roland

-- 
  __ .  . __
 (o.\ \/ /.o) [email protected]
  \__\/\/__/  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
  /O /==\ O\  TEL +49 641 3992797
 (;O/ \/ \O;)

Attachment: astksh20130409_clang_missingwariabledeclaration_fixes001.diff.gz
Description: GNU Zip compressed data

_______________________________________________
ast-developers mailing list
[email protected]
http://lists.research.att.com/mailman/listinfo/ast-developers

Reply via email to