commit e7fc425d62c3b1be654c6b7cb7e7dd1da41a324a Author: David Edmundson Date: Tue Oct 1 15:57:11 2019 +0100 Avoid using C++20 Whilst C has struct intializers with designators, C++ does not. In C++ one can only do it in order {arg1, arg2} designators don't come till C++20. C++ does have constructors though, we can use them. diff --git a/kiofusevfs.cpp b/kiofusevfs.cpp index 247d035..b70d2b1 100644 --- a/kiofusevfs.cpp +++ b/kiofusevfs.cpp @@ -39,31 +39,33 @@ #pragma GCC diagnostic ignored "-Wpedantic" #pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wmissing-field-initializers" - -const struct fuse_lowlevel_ops KIOFuseVFS::fuse_ll_ops = { - .init = &KIOFuseVFS::init, - .lookup = &KIOFuseVFS::lookup, - .forget = &KIOFuseVFS::forget, - .getattr = &KIOFuseVFS::getattr, - .setattr = &KIOFuseVFS::setattr, - .readlink = &KIOFuseVFS::readlink, - .mknod = &KIOFuseVFS::mknod, - .mkdir = &KIOFuseVFS::mkdir, - .unlink = &KIOFuseVFS::unlink, - .rmdir = &KIOFuseVFS::rmdir, - .symlink = &KIOFuseVFS::symlink, - .rename = &KIOFuseVFS::rename, - .open = &KIOFuseVFS::open, - .read = &KIOFuseVFS::read, - .write = &KIOFuseVFS::write, - .flush = &KIOFuseVFS::flush, - .release = &KIOFuseVFS::release, - .fsync = &KIOFuseVFS::fsync, - .readdir = &KIOFuseVFS::readdir, +struct KIOFuseVFS::FuseLLOps : public fuse_lowlevel_ops +{ + FuseLLOps() + { + init = &KIOFuseVFS::init; + lookup = &KIOFuseVFS::lookup; + forget = &KIOFuseVFS::forget; + getattr = &KIOFuseVFS::getattr; + setattr = &KIOFuseVFS::setattr; + readlink = &KIOFuseVFS::readlink; + mknod = &KIOFuseVFS::mknod; + mkdir = &KIOFuseVFS::mkdir; + unlink = &KIOFuseVFS::unlink; + rmdir = &KIOFuseVFS::rmdir; + symlink = &KIOFuseVFS::symlink; + rename = &KIOFuseVFS::rename; + open = &KIOFuseVFS::open; + read = &KIOFuseVFS::read; + write = &KIOFuseVFS::write; + flush = &KIOFuseVFS::flush; + release = &KIOFuseVFS::release; + fsync = &KIOFuseVFS::fsync; + readdir = &KIOFuseVFS::readdir; + } }; -#pragma GCC diagnostic pop + +const struct KIOFuseVFS::FuseLLOps KIOFuseVFS::fuse_ll_ops; /* Handles partial writes and EINTR. * Returns true only if count bytes were written successfully. */ diff --git a/kiofusevfs.h b/kiofusevfs.h index d61b2f3..d62c869 100644 --- a/kiofusevfs.h +++ b/kiofusevfs.h @@ -159,7 +159,8 @@ private: std::unique_ptr m_eventLoopLocker; /** Struct of implemented fuse operations. */ - static const struct fuse_lowlevel_ops fuse_ll_ops; + struct FuseLLOps; + static const FuseLLOps fuse_ll_ops; /** Fuse bookkeeping. */ struct fuse_session *m_fuseSession = nullptr;