Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 29 Jun 2013 08:59:01 -0700
From:      Tim Kientzle <tim@kientzle.com>
To:        dt71@gmx.com
Cc:        freebsd-current@freebsd.org
Subject:   Re: another -Wunsequenced topic
Message-ID:  <D0415B1D-6006-4CDB-8703-2EF5CBE427A6@kientzle.com>
In-Reply-To: <51CEEC34.2010308@gmx.com>
References:  <51CEEC34.2010308@gmx.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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@gmx.com wrote:

> Here's a patch to fix several compilation errors coming from =
-Wunsequenced warnings:
>=20
> Index: bin/ed/re.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- bin/ed/re.c	(revision 252372)
> +++ bin/ed/re.c	(working copy)
> @@ -89,7 +89,7 @@
> 		default:
> 			break;
> 		case '[':
> -			if ((nd =3D parse_char_class(++nd)) =3D=3D NULL) =
{
> +			if ((nd =3D parse_char_class(nd + 1)) =3D=3D =
NULL) {
> 				errmsg =3D "unbalanced brackets ([])";
> 				return NULL;
> 			}
> Index: contrib/bmake/meta.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- 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 =3D strchr(++cp, '\n');
> +			    cp =3D strchr(cp + 1, '\n');
> 			} while (cp);
> 			if (buf[x - 1] =3D=3D '\n')
> 			    buf[x - 1] =3D '\0';
> Index: lib/libfetch/fetch.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- lib/libfetch/fetch.c	(revision 252372)
> +++ lib/libfetch/fetch.c	(working copy)
> @@ -376,7 +376,7 @@
>  		/* password */
> 		if (*q =3D=3D ':')
> -			q =3D fetch_pctdecode(u->pwd, ++q, URL_PWDLEN);
> +			q =3D fetch_pctdecode(u->pwd, q + 1, =
URL_PWDLEN);
>  		p++;
> 	} else {
> Index: lib/libutil/login_times.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- lib/libutil/login_times.c	(revision 252372)
> +++ lib/libutil/login_times.c	(working copy)
> @@ -96,7 +96,7 @@
> 	else
> 	    m.lt_start =3D 0;
> 	if (*p =3D=3D '-')
> -	    p =3D parse_time(++p, &m.lt_end);
> +	    p =3D parse_time(p + 1, &m.lt_end);
> 	else
> 	    m.lt_end =3D 1440;
> Index: usr.sbin/newsyslog/newsyslog.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- 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) =3D=3D 0) {
> -			q =3D parse =3D missing_field(sob(++parse), =
errline);
> +			q =3D parse =3D missing_field(sob(parse + 1), =
errline);
> 			parse =3D son(parse);
> 			if (!*parse)
> 				warnx("debug line specifies no =
option:\n%s",
> @@ -1096,7 +1096,7 @@
> 		} else if (strcasecmp(INCLUDE_MARKER, q) =3D=3D 0) {
> 			if (verbose)
> 				printf("Found: %s", errline);
> -			q =3D parse =3D missing_field(sob(++parse), =
errline);
> +			q =3D parse =3D missing_field(sob(parse + 1), =
errline);
> 			parse =3D son(parse);
> 			if (!*parse) {
> 				warnx("include line missing =
argument:\n%s",
> @@ -1138,7 +1138,7 @@
> 			defconf_p =3D working;
> 		}
> -		q =3D parse =3D missing_field(sob(++parse), errline);
> +		q =3D parse =3D missing_field(sob(parse + 1), errline);
> 		parse =3D son(parse);
> 		if (!*parse)
> 			errx(1, "malformed line (missing fields):\n%s",
> @@ -1172,7 +1172,7 @@
> 			} else
> 				working->gid =3D (gid_t)-1;
> -			q =3D parse =3D missing_field(sob(++parse), =
errline);
> +			q =3D parse =3D missing_field(sob(parse + 1), =
errline);
> 			parse =3D 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 =3D parse =3D missing_field(sob(++parse), errline);
> +		q =3D parse =3D missing_field(sob(parse + 1), errline);
> 		parse =3D 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 =3D parse =3D missing_field(sob(++parse), errline);
> +		q =3D parse =3D missing_field(sob(parse + 1), errline);
> 		parse =3D son(parse);
> 		if (!*parse)
> 			errx(1, "malformed line (missing fields):\n%s",
> @@ -1215,7 +1215,7 @@
>  		working->flags =3D 0;
> 		working->compress =3D COMPRESS_NONE;
> -		q =3D parse =3D missing_field(sob(++parse), errline);
> +		q =3D parse =3D missing_field(sob(parse + 1), errline);
> 		parse =3D son(parse);
> 		eol =3D !*parse;
> 		*parse =3D '\0';
> @@ -1257,7 +1257,7 @@
> 		if (eol)
> 			q =3D NULL;
> 		else {
> -			q =3D parse =3D sob(++parse);	/* Optional =
field */
> +			q =3D parse =3D sob(parse + 1);	/* Optional =
field */
> 			parse =3D son(parse);
> 			if (!*parse)
> 				eol =3D 1;
> @@ -1327,7 +1327,7 @@
> 		if (eol)
> 			q =3D NULL;
> 		else {
> -			q =3D parse =3D sob(++parse);	/* Optional =
field */
> +			q =3D parse =3D sob(parse + 1);	/* Optional =
field */
> 			parse =3D son(parse);
> 			if (!*parse)
> 				eol =3D 1;
> @@ -1348,7 +1348,7 @@
> 		if (eol)
> 			q =3D NULL;
> 		else {
> -			q =3D parse =3D sob(++parse);	/* Optional =
field */
> +			q =3D parse =3D sob(parse + 1);	/* Optional =
field */
> 			*(parse =3D son(parse)) =3D '\0';
> 		}
> Index: usr.sbin/pw/pw_user.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- 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 =3D dbuf;
> 			if (stat(dbuf, &st) =3D=3D -1) {
> -				while ((p =3D strchr(++p, '/')) !=3D =
NULL) {
> +				while ((p =3D strchr(p + 1, '/')) !=3D =
NULL) {
> 					*p =3D '\0';
> 					if (stat(dbuf, &st) =3D=3D -1) {
> 						if (mkdir(dbuf, =
_DEF_DIRMODE) =3D=3D -1)
> _______________________________________________
> freebsd-current@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-current
> To unsubscribe, send any mail to =
"freebsd-current-unsubscribe@freebsd.org"




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?D0415B1D-6006-4CDB-8703-2EF5CBE427A6>