util: silence warnings when memfd_create is missing

src/util-memfile.c:55:1: warning: unused function 'memfile_create' [-Wunused-function]
OBJECT_IMPLEMENT_CREATE(memfile);
^
src/util-object.h:164:16: note: expanded from macro 'OBJECT_IMPLEMENT_CREATE'
struct type_ * type_##_create(struct object *parent) { \
               ^
<scratch space>:133:1: note: expanded from here
memfile_create
^

test/test-ei-device.c:37:1: warning: unused function 'memfile_unrefp' [-Wunused-function]
DEFINE_TRIVIAL_CLEANUP_FUNC(struct memfile *, memfile_unref);
^
src/util-mem.h:56:21: note: expanded from macro 'DEFINE_TRIVIAL_CLEANUP_FUNC'
        static inline void _func##p(_type *_p) {                \
                           ^
<scratch space>:159:1: note: expanded from here
memfile_unrefp
^
This commit is contained in:
Jan Beich 2023-05-19 14:04:09 +00:00 committed by Peter Hutterer
parent e27f039b32
commit 708d0f57e8
2 changed files with 3 additions and 3 deletions

View file

@ -24,13 +24,12 @@
#include "config.h"
#if HAVE_MEMFD_CREATE
#include <stddef.h>
#include <unistd.h>
#include <fcntl.h>
#if HAVE_MEMFD_CREATE
#include <sys/mman.h>
#endif
#include "util-memfile.h"
#include "util-mem.h"
@ -58,7 +57,6 @@ OBJECT_IMPLEMENT_REF(memfile);
OBJECT_IMPLEMENT_GETTER(memfile, fd, int);
OBJECT_IMPLEMENT_GETTER(memfile, size, size_t);
#if HAVE_MEMFD_CREATE
struct memfile *
memfile_new(const char *data, size_t sz) {
_unref_(memfile) *memfile = memfile_create(NULL);

View file

@ -34,8 +34,10 @@
#include "eierpecken.h"
#if HAVE_MEMFD_CREATE
DEFINE_TRIVIAL_CLEANUP_FUNC(struct memfile *, memfile_unref);
#define _cleanup_memfile_ _cleanup_(memfile_unrefp)
#endif
MUNIT_TEST(test_ei_device_basics)
{