Hi Samy,
On Tue, Mar 25, 2014 at 09:00:16AM -0700, sbahra wrote:
> I'm definitely open to merging this in. However, could I see what the
> remaining issues are? const semantics get kind of icky for operations
> (double width load, for example) that generate write cycles.
If you apply the patch I attached previously, it changes the configure script
to compile with -Wcast-qual. So if you run "make" and "make check" after
applying the patch and rerunning configure, you will see all the remaining
complaints.
Here are the remaining Wcast-qual warnings produced by running "make":
ck_rhs.c:799:11: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
src/ck_epoch.c:137:187: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
src/ck_epoch.c:138:184: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
src/ck_hp.c:64:178: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
src/ck_hp.c:65:178: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
src/ck_hs.c:504:11: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
src/ck_ht_hash.h:125:47: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
src/ck_ht_hash.h:182:17: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
src/ck_ht_hash.h:251:18: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
src/ck_ht_hash.h:252:18: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
src/ck_ht_hash.h:253:18: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
And from "make check":
../../../include/ck_cc.h:43:25: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
../../../src/ck_hs.c:504:11: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
../../../src/ck_ht_hash.h:125:47: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
../../../src/ck_ht_hash.h:182:17: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
../../../src/ck_ht_hash.h:251:18: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
../../../src/ck_ht_hash.h:252:18: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
../../../src/ck_ht_hash.h:253:18: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
../../../src/ck_rhs.c:799:11: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
ck_epoch_poll.c:126:21: warning: cast discards ‘__attribute__((noreturn))’ qualifier from pointer target type [-Wcast-qual]
ck_epoch_synchronize.c:126:21: warning: cast discards ‘__attribute__((noreturn))’ qualifier from pointer target type [-Wcast-qual]
For example, in ck_cc.h, in the CK_CC_CONTAINER macro, it says:
const F *n = p;
return (T *)(void *)(((char *)n) - ((size_t)&((T *)0)->M));
The 'const' attribute is discarded from 'n'. Can that be fixed?
Would you like me to attempt to provide a patch for these remaining problems?
Regards,
Andy