From: Zbigniew Jędrzejewski-Szmek Date: Wed, 1 Nov 2017 21:54:39 +0000 (+0100) Subject: journal: disable -Waddress-of-packed-member under clang X-Git-Tag: v236~270^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=518044605173fee73f9e4b08a62624ae4b4f5bd2;p=thirdparty%2Fsystemd.git journal: disable -Waddress-of-packed-member under clang clang warns about a few sites like this: ../src/journal/journal-file.c:1780:48: warning: taking address of packed member 'entry_offset' of class or structure 'DataObject' may result in an unaligned pointer value [-Waddress-of-packed-member] &o->data.entry_offset, ^~~~~~~~~~~~~~~~~~~~ but DataObject.entry_offset will always be 8-byte aligned as long as the DataObject structure is aligned. Similarly in other cases, the field is always aligned. Let's just silence the warning to avoid noise. gcc does not know -Waddress-of-packed-member, and would warn about an unknown warning, so we need to conditionalize on __clang__. --- diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c index 3027801ab13..5d70421b762 100644 --- a/src/journal/journal-file.c +++ b/src/journal/journal-file.c @@ -90,6 +90,10 @@ /* The mmap context to use for the header we pick as one above the last defined typed */ #define CONTEXT_HEADER _OBJECT_TYPE_MAX +#ifdef __clang__ +# pragma GCC diagnostic ignored "-Waddress-of-packed-member" +#endif + /* This may be called from a separate thread to prevent blocking the caller for the duration of fsync(). * As a result we use atomic operations on f->offline_state for inter-thread communications with * journal_file_set_offline() and journal_file_set_online(). */