[systemd-devel] PATCH: fix sparse warnings

Lennart Poettering lennart at poettering.net
Wed Mar 14 10:58:32 PDT 2012


On Wed, 07.03.12 06:34, Josh Triplett (josh at joshtriplett.org) wrote:

> I've attached a header file which should provide all the endianness
> checking you need.  Just include it in place of endian.h everywhere you
> currently include endian.h.  I stuck an all-permissive MIT license on
> it, for maximum possible reuse.

This looks really cool! Thanks a lot for this. One comment, before we
stick this into systemd:

> #ifndef SPARSE_ENDIAN_H
> #define SPARSE_ENDIAN_H
> 
> #include <endian.h>
> #include <stdint.h>
> 
> #ifdef __CHECKER__
> #define __bitwise __attribute__((bitwise))
> #define __force __attribute__((force))
> #else
> #define __bitwise
> #define __force
> #endif
> 
> typedef uint16_t __bitwise le16;
> typedef uint16_t __bitwise be16;
> typedef uint32_t __bitwise le32;
> typedef uint32_t __bitwise be32;
> typedef uint64_t __bitwise le64;
> typedef uint64_t __bitwise be64;

Can we add a suffix _t here? I much prefer le16_t over le16, since this
is a type. (and also, emacs' recognizes this and highlights it
differently ;-))

Thanks!

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list