From 518044605173fee73f9e4b08a62624ae4b4f5bd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Wed, 1 Nov 2017 22:54:39 +0100 Subject: [PATCH] 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__. --- src/journal/journal-file.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c index 3027801ab1..5d70421b76 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(). */