squid
squid copied to clipboard
Bug 4875 pt3: GCC-8 compile errors with -O3 optimization
Building with GCC-8 and the -O3 optimization level exposes several more cases of -Werror -Wall turning warnings into hard errors, and two actual cases of string truncation - one harmless, the other possibly causing subtle errors.
Alter the fde::desc type from char* to SBuf. Allowing variable length descriptions capable of holding modern URLs better and SBuf optimized copy instead of full-length string copy between buffers when the description is a constant.
Thank you for extracting the useful pieces from this PR into #287 and #288. Should this PR be closed now? If this PR is still useful, please adjust its description to match the adjusted content/intent.
I am leaving the FD related changes under this PR, so it is still relevant. I will get back to this when they are merged and the PR branch can be made cleaner.
Okay, updated now to use SBuf with most being constants instead of dynamic allocation.
Please update PR title and description to reflect the current state of this PR. That state has changed a lot since those texts were written.
I adjusted the text right after this last commit. The driver behind this PR is still the GCC-8 build errors with the cause being char* string truncation warning promoted by -Wall to error. The fix is fde::desc member change to SBuf. (Reports in the bug about it being 'fixed' already were for Squid patched with earlier versions of this PR diff.).
The driver behind this PR is still the GCC-8 build errors
Recording your motivation is often a good idea, but the PR description should focus on the changes. A reader should not be forced to ignore the PR/commit title and the first paragraph of the PR/commit description to finally find out what the PR is all about!
Closing as I no longer have GCC-8 to test this bug fix.