[PATCH] util/attr.h: use HAVE___ATTRIBUTE__, not __GNUC__ comparisons

Douglas Bagnall douglas.bagnall at catalyst.net.nz
Tue Mar 22 22:50:06 UTC 2016


hi,

I have a pre-release version of gcc-6 which I just tried with -O3, and:

../source4/dsdb/samdb/ldb_modules/repl_meta_data.c: In function ‘replmd_op_name_modify_callback’:
../source4/dsdb/samdb/ldb_modules/repl_meta_data.c:3727:6: error: ‘conflict_dn’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  ret = replmd_name_modify(ar, req, conflict_dn);
  ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The offending code is like this:

	struct ldb_dn *conflict_dn;

	switch (req->operation) {
	case LDB_ADD:
		conflict_dn = req->op.add.message->dn;
		break;
	case LDB_MODIFY:
		conflict_dn = req->op.mod.message->dn;
		break;
	default:
		smb_panic("replmd_op_name_modify_callback called in unknown circumstances");
	}

	/* perform a modify of the rDN and name of the record */
	ret = replmd_name_modify(ar, req, conflict_dn);


where gcc-6 seems not to know that smb_panic is marked _NORETURN_.

That turns out to be defined thus:

 #if (__GNUC__ >= 3) && (__GNUC_MINOR__ >= 1 )
 #define _NORETURN_ __attribute__ ((noreturn))
 #else
 #define _NORETURN_
 #endif

which would have done the wrong thing for 4.0. With version 5, GCC
switched to 1-based minor versions, but as gcc-6 has not been
released, I still have a minor version of zero.

In any case, we now have a direct check for __attribute__ in
configure.

cheers,
Douglas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-util-attr.h-use-HAVE___ATTRIBUTE__-not-__GNUC__-comp.patch
Type: text/x-diff
Size: 3047 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20160323/1d5a729a/0001-util-attr.h-use-HAVE___ATTRIBUTE__-not-__GNUC__-comp.diff>


More information about the samba-technical mailing list