From 0f10f91839aa42dfc97bbc92a4178601f4a5dffe Mon Sep 17 00:00:00 2001 From: Godzil Date: Thu, 16 May 2013 09:35:52 +0200 Subject: [PATCH] Surprisly clang started to tell me where variable may used uninitialized, correcting it! That's a good point it tell me that, but was a bit unexpected ^^ --- lang/cem/cemcom.ansi/error.c | 2 +- lang/cem/cemcom.ansi/type.c | 2 +- util/arch/archiver.c | 11 ++++++----- util/ego/ic/ic.c | 2 +- util/ego/ic/ic_aux.c | 2 +- util/ego/il/il3_subst.c | 2 +- util/ego/sr/sr_reduce.c | 5 +++-- util/ego/ud/ud_const.c | 2 +- 8 files changed, 15 insertions(+), 13 deletions(-) diff --git a/lang/cem/cemcom.ansi/error.c b/lang/cem/cemcom.ansi/error.c index abee3223f..a8f5bbce9 100644 --- a/lang/cem/cemcom.ansi/error.c +++ b/lang/cem/cemcom.ansi/error.c @@ -530,7 +530,7 @@ fatal(va_alist) /* fmt, args */ static void _error(int class, char *fn, unsigned int ln, char *fmt, va_list ap) { - char *remark; + char *remark = NULL; /* check visibility of message */ switch (class) { diff --git a/lang/cem/cemcom.ansi/type.c b/lang/cem/cemcom.ansi/type.c index 71a8e54a4..360f7fcc7 100644 --- a/lang/cem/cemcom.ansi/type.c +++ b/lang/cem/cemcom.ansi/type.c @@ -77,7 +77,7 @@ struct type *construct_type(int fund, struct type *tp, int qual, arith count, st /* fund must be a type constructor: FIELD, FUNCTION, POINTER or ARRAY. The pointer to the constructed type is returned. */ - struct type *dtp; + struct type *dtp = NULL; switch (fund) { #ifndef NOBITFIELD diff --git a/util/arch/archiver.c b/util/arch/archiver.c index e9af9e1da..0e87ad220 100644 --- a/util/arch/archiver.c +++ b/util/arch/archiver.c @@ -705,16 +705,17 @@ void do_object(int f, long size) * name table and read and write the names one by one. Update the ranlib table * accordingly. */ +#define NNAMES 100 + void do_names(struct outhead *headp) { - register char *strings; - register int nnames = headp->oh_nname; -#define NNAMES 100 + char *strings = NULL; + int nnames = headp->oh_nname; struct outname namebuf[NNAMES]; long xxx = OFF_CHAR(*headp); - if ( headp->oh_nchar != (unsigned int)headp->oh_nchar || - (strings = malloc((unsigned int)headp->oh_nchar)) == (char *)0 + if ( (headp->oh_nchar != (unsigned int)headp->oh_nchar) || + (strings = malloc((unsigned int)headp->oh_nchar)) == (char *)0 ) { error(TRUE, "string table too big\n", NULL, NULL, NULL); } diff --git a/util/ego/ic/ic.c b/util/ego/ic/ic.c index d24ad19a9..ced0977a7 100644 --- a/util/ego/ic/ic.c +++ b/util/ego/ic/ic.c @@ -299,7 +299,7 @@ line_p readoperand(short instr) /* Read the operand of the given instruction. * Create a line struct and return a pointer to it. */ - line_p lnp; + line_p lnp = NULL; short flag; VI(instr); diff --git a/util/ego/ic/ic_aux.c b/util/ego/ic/ic_aux.c index 5a6a2b57a..ff321f3f7 100644 --- a/util/ego/ic/ic_aux.c +++ b/util/ego/ic/ic_aux.c @@ -166,7 +166,7 @@ void dblockdef(dblock_p db, int n, line_p lnp) { /* Process a data block defining occurrence */ - byte m; + byte m = 0; switch(n) { case ps_hol: diff --git a/util/ego/il/il3_subst.c b/util/ego/il/il3_subst.c index fee5f774a..e9ff42588 100644 --- a/util/ego/il/il3_subst.c +++ b/util/ego/il/il3_subst.c @@ -70,7 +70,7 @@ void substitute(FILE *lf, call_p c, line_p cal, line_p firstline) * up to date. */ - line_p l, text, lab; + line_p l, text = NULL, lab = NULL; offset ab_off, lb_off; line_p startscan, ncal; short lastcid; diff --git a/util/ego/sr/sr_reduce.c b/util/ego/sr/sr_reduce.c index c6f9364d7..5a9b62b9f 100644 --- a/util/ego/sr/sr_reduce.c +++ b/util/ego/sr/sr_reduce.c @@ -78,7 +78,7 @@ static line_p newcode(code_p code, offset tmp) * a[iv] -> *tmp */ - line_p l; + line_p l = NULL; switch(code->co_instr) { case op_mli: @@ -245,7 +245,8 @@ static void incr_code(code_p code, offset tmp) * the induction variable. */ - line_p load_tmp, loc, add, store_tmp, l; + line_p load_tmp = NULL, loc = NULL, add = NULL, + store_tmp = NULL, l = NULL; add = newline(OPSHORT); SHORT(add) = ws; /* the add instruction, can be ADI,ADU or ADS */ diff --git a/util/ego/ud/ud_const.c b/util/ego/ud/ud_const.c index 25fb9f6c8..263a1a16a 100644 --- a/util/ego/ud/ud_const.c +++ b/util/ego/ud/ud_const.c @@ -54,7 +54,7 @@ bool value_known(line_p def, offset *val_out) */ short sz1, sz2; - offset v; + offset v = 0; line_p l; sz1 = ws; -- 2.34.1