another -Wunsequenced topic

Tim Kientzle tim at kientzle.com
Sat Jun 29 15:59:02 UTC 2013


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)
> @@ -89,7 +89,7 @@
> 		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)
> @@ -1249,7 +1249,7 @@
> 				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)
> @@ -376,7 +376,7 @@
>  		/* 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)
> @@ -96,7 +96,7 @@
> 	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)
> @@ -1083,7 +1083,7 @@
> 		 * 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",
> @@ -1096,7 +1096,7 @@
> 		} 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",
> @@ -1138,7 +1138,7 @@
> 			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",
> @@ -1172,7 +1172,7 @@
> 			} 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",
> @@ -1187,7 +1187,7 @@
> 			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",
> @@ -1197,7 +1197,7 @@
> 			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",
> @@ -1215,7 +1215,7 @@
>  		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';
> @@ -1257,7 +1257,7 @@
> 		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;
> @@ -1327,7 +1327,7 @@
> 		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;
> @@ -1348,7 +1348,7 @@
> 		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)
> @@ -200,7 +200,7 @@
> 			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"



More information about the freebsd-current mailing list