Clang warnings in itemrepository.h: cast from 'char *' to ... increases required alignment

Milian Wolff mail at milianw.de
Sun Aug 4 01:49:21 UTC 2013


On Sunday 04 August 2013 01:49:51 Steffen Ohrendorf wrote:
> Am Sonntag, 4. August 2013, 01:40:19 schrieb Milian Wolff:
> > Still, isn't the issue that clang warns us about here relevant? Sure, we
> > don't run on ARM hardware anyways, but besides that? Should one fix
> > anything here?
> 
> Aligned memory improves memory access speed as the memory controller doesn't
> need to hazzle with 4-byte (on x86) or even 8-byte (x64) chunks that often.
> Additionally, I think most CPUs/on-chip-caches have optimizations for
> aligned memory, and even the run-time has such optimizations which might
> not trigger on non-aligned memory, and chances are there that some
> implementations do not check for non-aligned pointers.

Yes, I'm aware of the potential implications here. I just wonder how one 
should ever use i.e. uchar* returned from mmap directly without these 
warnings.

> A solution would be to do a memcpy at load time and let the memory manager
> do a proper alignment. From your statement of a 1-to-1-memdump, this would
> only affect the loading code, not the code involved in saving the data.

>From a performance POV that's bad. But yeah, wherever we already do a copy 
this becomes a non-issue. But in the layer below we have code that does not do 
any copies...

Anyhow, I've now pushed commits that silence most clang compiler warnings in 
both, KDevelop and KDevplatform. Happy recompiling - please tell me if I broke 
anything.

Cheers
-- 
Milian Wolff
mail at milianw.de
http://milianw.de


More information about the KDevelop-devel mailing list