Re: What's cooking in git.git (Dec 2013, #02; Fri, 6)
- From
Karsten Blees <karsten.blees@gmail.com>
- Date
- Dec 18, 2013, 14:12 UTC
- Message-ID
- <52B1AD66.4000507@gmail.com>
- In-Reply-To
- <52A5CDB0.2020206@gmail.com>
Am 09.12.2013 15:03, schrieb Karsten Blees:
Show 12 quoted lines
> 3.) Inject individual fields via macro
>
> Instead of injecting a struct hashmap_entry, which implies alignment to sizeof(struct hashmap_entry), we could inject the individual fields, e.g.
>
> #define HASHMAP_ENTRY_HEADER struct hashmap_entry __next; unsinged int __hash;
>
> struct name_entry {
> HASHMAP_ENTRY_HEADER
> int namelen;
> char *name;
> };
> I've tried this as well. However, the change is much more intrusive, and produces lots of strict-aliasing warnings in GCC 4.4, probably due to this bug [1]. So I don't think its a good solution. For anyone interested, the patch can be found at [2].
[1] http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42032 [2] https://github.com/kblees/git/commits/kb/hashmap-v5-fixes-macro