varnish-cache icon indicating copy to clipboard operation
varnish-cache copied to clipboard

build: add --enable-optimization-warnings

Open asadsa92 opened this issue 1 year ago • 3 comments

Start off by adding -Wpadded and -Wno-error=padded . This is useful when investigating holes in the struct layout. Alternatively, the pahole utility can be used for this.

Dridi suggested that I add this to a new class of warnings.

asadsa92 avatar Aug 20 '24 09:08 asadsa92

I am not entirely on board with this, because there are valid reasons not want structs tightly packed, for instance cacheline considerations.

It also bothers me that the patch calls them "OPTIMIZATION_FLAGS", they're not. At best they're "DEVELOPER_INFORMATION_FLAGS" or something of that sort.

bsdphk avatar Aug 26 '24 10:08 bsdphk

I am not entirely on board with this, because there are valid reasons not want structs tightly packed, for instance cacheline considerations.

Yes, we can always ignore false-positives. The intend was not to enable this by default. We could also place a reserved variable there to fill the hole and make it more explicit. Then, in the future, we can use this space for something else rather than expanding the struct size.

It also bothers me that the patch calls them "OPTIMIZATION_FLAGS", they're not. At best they're "DEVELOPER_INFORMATION_FLAGS" or something of that sort.

Sure, we can rename it. I do not think it make sense to enable this through the default ./autogen.des invocation, at least not before we have reviewed what we got first.

asadsa92 avatar Aug 26 '24 10:08 asadsa92

would @asadsa92's proposed changes help it past the finish line?

gquintard avatar Aug 11 '25 17:08 gquintard