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 ^^
This commit is contained in:
Godzil 2013-05-16 09:35:52 +02:00 committed by Manoël Trapier
parent c59e2f03ab
commit 0f10f91839
8 changed files with 15 additions and 13 deletions

View File

@ -530,7 +530,7 @@ fatal(va_alist) /* fmt, args */
static void _error(int class, char *fn, unsigned int ln, char *fmt, va_list ap) static void _error(int class, char *fn, unsigned int ln, char *fmt, va_list ap)
{ {
char *remark; char *remark = NULL;
/* check visibility of message */ /* check visibility of message */
switch (class) { switch (class) {

View File

@ -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 /* fund must be a type constructor: FIELD, FUNCTION, POINTER or
ARRAY. The pointer to the constructed type is returned. ARRAY. The pointer to the constructed type is returned.
*/ */
struct type *dtp; struct type *dtp = NULL;
switch (fund) { switch (fund) {
#ifndef NOBITFIELD #ifndef NOBITFIELD

View File

@ -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 * name table and read and write the names one by one. Update the ranlib table
* accordingly. * accordingly.
*/ */
#define NNAMES 100
void do_names(struct outhead *headp) void do_names(struct outhead *headp)
{ {
register char *strings; char *strings = NULL;
register int nnames = headp->oh_nname; int nnames = headp->oh_nname;
#define NNAMES 100
struct outname namebuf[NNAMES]; struct outname namebuf[NNAMES];
long xxx = OFF_CHAR(*headp); long xxx = OFF_CHAR(*headp);
if ( headp->oh_nchar != (unsigned int)headp->oh_nchar || if ( (headp->oh_nchar != (unsigned int)headp->oh_nchar) ||
(strings = malloc((unsigned int)headp->oh_nchar)) == (char *)0 (strings = malloc((unsigned int)headp->oh_nchar)) == (char *)0
) { ) {
error(TRUE, "string table too big\n", NULL, NULL, NULL); error(TRUE, "string table too big\n", NULL, NULL, NULL);
} }

View File

@ -299,7 +299,7 @@ line_p readoperand(short instr)
/* Read the operand of the given instruction. /* Read the operand of the given instruction.
* Create a line struct and return a pointer to it. * Create a line struct and return a pointer to it.
*/ */
line_p lnp; line_p lnp = NULL;
short flag; short flag;
VI(instr); VI(instr);

View File

@ -166,7 +166,7 @@ void dblockdef(dblock_p db, int n, line_p lnp)
{ {
/* Process a data block defining occurrence */ /* Process a data block defining occurrence */
byte m; byte m = 0;
switch(n) { switch(n) {
case ps_hol: case ps_hol:

View File

@ -70,7 +70,7 @@ void substitute(FILE *lf, call_p c, line_p cal, line_p firstline)
* up to date. * up to date.
*/ */
line_p l, text, lab; line_p l, text = NULL, lab = NULL;
offset ab_off, lb_off; offset ab_off, lb_off;
line_p startscan, ncal; line_p startscan, ncal;
short lastcid; short lastcid;

View File

@ -78,7 +78,7 @@ static line_p newcode(code_p code, offset tmp)
* a[iv] -> *tmp * a[iv] -> *tmp
*/ */
line_p l; line_p l = NULL;
switch(code->co_instr) { switch(code->co_instr) {
case op_mli: case op_mli:
@ -245,7 +245,8 @@ static void incr_code(code_p code, offset tmp)
* the induction variable. * 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); add = newline(OPSHORT);
SHORT(add) = ws; /* the add instruction, can be ADI,ADU or ADS */ SHORT(add) = ws; /* the add instruction, can be ADI,ADU or ADS */

View File

@ -54,7 +54,7 @@ bool value_known(line_p def, offset *val_out)
*/ */
short sz1, sz2; short sz1, sz2;
offset v; offset v = 0;
line_p l; line_p l;
sz1 = ws; sz1 = ws;