Hi

On Fri, Aug 15, 2014 at 1:22 PM, Lennart Poettering
<lenn...@poettering.net> wrote:
> On Fri, 15.08.14 13:00, David Herrmann (dh.herrm...@gmail.com) wrote:
>
>> > src/resolve/resolved-dns-stream.c:67:43: error: non-const static data
>> > member must be initialized out of line
>> >                 uint8_t buffer[CMSG_SPACE(MAX(sizeof(struct
>> > in_pktinfo), sizeof(struct in6_pktinfo)))
>> >                                           ^
>>
>> Ok, this can be fixed by adding "const" to the variables inside the ({
>> }) else-clause. But we then end up with:
>>   error: statement expression not allowed at file scope
>
> I wonder if there's *any* way how to implement a double-evalutation-free
> all-type MAX() on LLVM... That'd be quite a limitation in LLVM...

I looked around and it seems like there's nothing we can do. Weird
thing is, LLVM allows const-initialization but not member-definition
with that macro. I really don't understand why..

I somehow think adding MAX_CONST which uses __builtin_constant_p and
assert_cc() is the easiest way here. That is, we use MAX_CONST() for
all cases where MAX fails. I think this is the easiest way to
guarantee no-one else changes the code to use MAX() again.
Furthermore, it guarantees that MAX_CONST is *really* called with
constant arguments.

Thanks
David
_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to