Re: another -Wunsequenced topic

From: Tim Kientzle <tim_at_kientzle.com>
Date: Sat, 29 Jun 2013 08:59:01 -0700
Thanks!  I've committed all of these except the change
to contrib/bmake/ which should probably be submitted
upstream first.

Tim


On Jun 29, 2013, at 7:16 AM, dt71_at_gmx.com wrote:

> Here's a patch to fix several compilation errors coming from -Wunsequenced warnings:
> 
> Index: bin/ed/re.c
> ===================================================================
> --- bin/ed/re.c	(revision 252372)
> +++ bin/ed/re.c	(working copy)
> _at__at_ -89,7 +89,7 _at__at_
> 		default:
> 			break;
> 		case '[':
> -			if ((nd = parse_char_class(++nd)) == NULL) {
> +			if ((nd = parse_char_class(nd + 1)) == NULL) {
> 				errmsg = "unbalanced brackets ([])";
> 				return NULL;
> 			}
> Index: contrib/bmake/meta.c
> ===================================================================
> --- contrib/bmake/meta.c	(revision 252372)
> +++ contrib/bmake/meta.c	(working copy)
> _at__at_ -1249,7 +1249,7 _at__at_
> 				warnx("%s: %d: line truncated at %u", fname, lineno, x);
> 				break;
> 			    }
> -			    cp = strchr(++cp, '\n');
> +			    cp = strchr(cp + 1, '\n');
> 			} while (cp);
> 			if (buf[x - 1] == '\n')
> 			    buf[x - 1] = '\0';
> Index: lib/libfetch/fetch.c
> ===================================================================
> --- lib/libfetch/fetch.c	(revision 252372)
> +++ lib/libfetch/fetch.c	(working copy)
> _at__at_ -376,7 +376,7 _at__at_
>  		/* password */
> 		if (*q == ':')
> -			q = fetch_pctdecode(u->pwd, ++q, URL_PWDLEN);
> +			q = fetch_pctdecode(u->pwd, q + 1, URL_PWDLEN);
>  		p++;
> 	} else {
> Index: lib/libutil/login_times.c
> ===================================================================
> --- lib/libutil/login_times.c	(revision 252372)
> +++ lib/libutil/login_times.c	(working copy)
> _at__at_ -96,7 +96,7 _at__at_
> 	else
> 	    m.lt_start = 0;
> 	if (*p == '-')
> -	    p = parse_time(++p, &m.lt_end);
> +	    p = parse_time(p + 1, &m.lt_end);
> 	else
> 	    m.lt_end = 1440;
> Index: usr.sbin/newsyslog/newsyslog.c
> ===================================================================
> --- usr.sbin/newsyslog/newsyslog.c	(revision 252372)
> +++ usr.sbin/newsyslog/newsyslog.c	(working copy)
> _at__at_ -1083,7 +1083,7 _at__at_
> 		 * at any time, etc).
> 		 */
> 		if (strcasecmp(DEBUG_MARKER, q) == 0) {
> -			q = parse = missing_field(sob(++parse), errline);
> +			q = parse = missing_field(sob(parse + 1), errline);
> 			parse = son(parse);
> 			if (!*parse)
> 				warnx("debug line specifies no option:\n%s",
> _at__at_ -1096,7 +1096,7 _at__at_
> 		} else if (strcasecmp(INCLUDE_MARKER, q) == 0) {
> 			if (verbose)
> 				printf("Found: %s", errline);
> -			q = parse = missing_field(sob(++parse), errline);
> +			q = parse = missing_field(sob(parse + 1), errline);
> 			parse = son(parse);
> 			if (!*parse) {
> 				warnx("include line missing argument:\n%s",
> _at__at_ -1138,7 +1138,7 _at__at_
> 			defconf_p = working;
> 		}
> -		q = parse = missing_field(sob(++parse), errline);
> +		q = parse = missing_field(sob(parse + 1), errline);
> 		parse = son(parse);
> 		if (!*parse)
> 			errx(1, "malformed line (missing fields):\n%s",
> _at__at_ -1172,7 +1172,7 _at__at_
> 			} else
> 				working->gid = (gid_t)-1;
> -			q = parse = missing_field(sob(++parse), errline);
> +			q = parse = missing_field(sob(parse + 1), errline);
> 			parse = son(parse);
> 			if (!*parse)
> 				errx(1, "malformed line (missing fields):\n%s",
> _at__at_ -1187,7 +1187,7 _at__at_
> 			errx(1, "error in config file; bad permissions:\n%s",
> 			    errline);
> -		q = parse = missing_field(sob(++parse), errline);
> +		q = parse = missing_field(sob(parse + 1), errline);
> 		parse = son(parse);
> 		if (!*parse)
> 			errx(1, "malformed line (missing fields):\n%s",
> _at__at_ -1197,7 +1197,7 _at__at_
> 			errx(1, "error in config file; bad value for count of logs to save:\n%s",
> 			    errline);
> -		q = parse = missing_field(sob(++parse), errline);
> +		q = parse = missing_field(sob(parse + 1), errline);
> 		parse = son(parse);
> 		if (!*parse)
> 			errx(1, "malformed line (missing fields):\n%s",
> _at__at_ -1215,7 +1215,7 _at__at_
>  		working->flags = 0;
> 		working->compress = COMPRESS_NONE;
> -		q = parse = missing_field(sob(++parse), errline);
> +		q = parse = missing_field(sob(parse + 1), errline);
> 		parse = son(parse);
> 		eol = !*parse;
> 		*parse = '\0';
> _at__at_ -1257,7 +1257,7 _at__at_
> 		if (eol)
> 			q = NULL;
> 		else {
> -			q = parse = sob(++parse);	/* Optional field */
> +			q = parse = sob(parse + 1);	/* Optional field */
> 			parse = son(parse);
> 			if (!*parse)
> 				eol = 1;
> _at__at_ -1327,7 +1327,7 _at__at_
> 		if (eol)
> 			q = NULL;
> 		else {
> -			q = parse = sob(++parse);	/* Optional field */
> +			q = parse = sob(parse + 1);	/* Optional field */
> 			parse = son(parse);
> 			if (!*parse)
> 				eol = 1;
> _at__at_ -1348,7 +1348,7 _at__at_
> 		if (eol)
> 			q = NULL;
> 		else {
> -			q = parse = sob(++parse);	/* Optional field */
> +			q = parse = sob(parse + 1);	/* Optional field */
> 			*(parse = son(parse)) = '\0';
> 		}
> Index: usr.sbin/pw/pw_user.c
> ===================================================================
> --- usr.sbin/pw/pw_user.c	(revision 252372)
> +++ usr.sbin/pw/pw_user.c	(working copy)
> _at__at_ -200,7 +200,7 _at__at_
> 			strlcpy(dbuf, cnf->home, sizeof(dbuf));
> 			p = dbuf;
> 			if (stat(dbuf, &st) == -1) {
> -				while ((p = strchr(++p, '/')) != NULL) {
> +				while ((p = strchr(p + 1, '/')) != NULL) {
> 					*p = '\0';
> 					if (stat(dbuf, &st) == -1) {
> 						if (mkdir(dbuf, _DEF_DIRMODE) == -1)
> _______________________________________________
> freebsd-current_at_freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-current
> To unsubscribe, send any mail to "freebsd-current-unsubscribe_at_freebsd.org"
Received on Sat Jun 29 2013 - 13:59:02 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:39 UTC