Tautological comparison in gcc 6.1.1
Amitay Isaacs
amitay at gmail.com
Wed Jul 13 04:29:02 UTC 2016
On Wed, Jul 13, 2016 at 10:37 AM, Michael Adam <obnox at samba.org> wrote:
> On 2016-07-13 at 02:01 +0200, Michael Adam wrote:
> > On 2016-07-13 at 00:15 +0200, Michael Adam wrote:
> > >
> > > Attached are patches that cover all definitions of DLIST_ADD_END
> > > as above. We could add those with your authorship, amitay.
> > >
> > > These are not the only problems encountered with gcc6.
> > >
> > > Continuing now ...
> >
> > One problem is that we have quite a number of
> > uses of DLIST_REMOVE in the form of
> >
> > DLIST_REMOVE(p, p)
> >
> > which will lead to a comparison if ((p) == (p))...
> >
> > This is a completely valid pattern.
> > Not sure yet how to fix this in a conceptually good way.
>
> Attached patches (with the previous patches for DLIST_ADD_END)
> fix the gcc6 build (on f24) for me.
>
> Not super elegant but does the job...
>
> review / push / comments welcome!
>
> Cheers - Michael
>
One minor comment. In the following patch (first patch in the series),
conn->sessions->conn = NULL;
can be replaced with
session->conn = NULL;
@@ -301,8 +301,10 @@ static int smbXcli_conn_destructor(struct
smbXcli_conn *conn)
smbXcli_conn_disconnect(conn, NT_STATUS_OK);
while (conn->sessions) {
+ struct smbXcli_session *session = conn->sessions;
+
conn->sessions->conn = NULL;
- DLIST_REMOVE(conn->sessions, conn->sessions);
+ DLIST_REMOVE(conn->sessions, session);
}
if (conn->smb1.trans_enc) {
With this change, reviewed by me.
Amitay.
More information about the samba-technical
mailing list