This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v2 09/22] sim/erc32: Removed type mismatch compiler warnings


On 19 Feb 2015 23:31, Jiri Gaisler wrote:
> +	tmp = getline(&lbuf, &len, fp);
> +	if ((strlen(lbuf) > 0) && (lbuf[strlen(lbuf) - 1] == '\n')) {

you need to check the return value of tmp before using lbuf

> +    if (lbuf) free(lbuf);

no need for the if check ... free(NULL) required to work in POSIX

> +    uint32          len, i, clen, j, tmp;
> ...
> +		tmp = system(&cmdsave[clen]);

the return value of system() is int, not uint32 ...

then again, you aren't checking the return value.  i guess you just want to 
silence the warning ?  that doesn't work in gcc.  you'll want to do:
	if (system(&cmdsave[clen])) {
		/* Silence unused return value warning.  */
	}
-mike

Attachment: signature.asc
Description: Digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]