summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2022-02-07 20:43:17 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2022-02-07 20:43:17 +0000
commit111b7e8e1051c643d3ca05ab6b86dcd99604fa7f (patch)
treea3c12711383966757752d84ddd58e9309e680b6f
parentRemove all pre-C++20 compile time formatter support (diff)
downloadlibadhocutil-111b7e8e1051c643d3ca05ab6b86dcd99604fa7f.tar.bz2
libadhocutil-111b7e8e1051c643d3ca05ab6b86dcd99604fa7f.tar.xz
libadhocutil-111b7e8e1051c643d3ca05ab6b86dcd99604fa7f.zip
Tidy up lots of defines mostly with pragma once
-rw-r--r--libadhocutil/boost-test-extra.h5
-rw-r--r--libadhocutil/buffer.h5
-rw-r--r--libadhocutil/c++11Helpers.h5
-rw-r--r--libadhocutil/cache.h5
-rw-r--r--libadhocutil/cache.impl.h5
-rw-r--r--libadhocutil/case_less.h5
-rw-r--r--libadhocutil/compileTimeFormatter.h5
-rw-r--r--libadhocutil/ctf-impl/printf-compat.h5
-rw-r--r--libadhocutil/curlHandle.h5
-rw-r--r--libadhocutil/curlMultiHandle.h5
-rw-r--r--libadhocutil/curlStream.h5
-rw-r--r--libadhocutil/definedDirs.h21
-rw-r--r--libadhocutil/exception.h5
-rw-r--r--libadhocutil/factory.h5
-rw-r--r--libadhocutil/factory.impl.h5
-rw-r--r--libadhocutil/fileUtils.h5
-rw-r--r--libadhocutil/fprintbf.h5
-rw-r--r--libadhocutil/globalStatic.h5
-rw-r--r--libadhocutil/globalStatic.impl.h5
-rw-r--r--libadhocutil/handle.h5
-rw-r--r--libadhocutil/lazyPointer.h5
-rw-r--r--libadhocutil/lexer-regex.h5
-rw-r--r--libadhocutil/lexer.h5
-rw-r--r--libadhocutil/lockHelpers.h5
-rw-r--r--libadhocutil/memstream.h5
-rw-r--r--libadhocutil/nagios.h5
-rw-r--r--libadhocutil/nvpParse.h5
-rw-r--r--libadhocutil/optionalUtils.h5
-rw-r--r--libadhocutil/plugins.h5
-rw-r--r--libadhocutil/plugins.impl.h5
-rw-r--r--libadhocutil/processPipes.h5
-rw-r--r--libadhocutil/resourcePool.h7
-rw-r--r--libadhocutil/resourcePool.impl.h6
-rw-r--r--libadhocutil/runtimeContext.h5
-rw-r--r--libadhocutil/safeMapFind.h5
-rw-r--r--libadhocutil/scopeExit.h5
-rw-r--r--libadhocutil/unique.h5
-rw-r--r--libadhocutil/unittests/utilTestClasses.h5
-rw-r--r--libadhocutil/uriParse.h5
-rw-r--r--libadhocutil/visibility.h7
40 files changed, 50 insertions, 171 deletions
diff --git a/libadhocutil/boost-test-extra.h b/libadhocutil/boost-test-extra.h
index b05349c..d327ed7 100644
--- a/libadhocutil/boost-test-extra.h
+++ b/libadhocutil/boost-test-extra.h
@@ -1,5 +1,4 @@
-#ifndef ADHOCUTIL_BOOST_TEST_EXTRA_H
-#define ADHOCUTIL_BOOST_TEST_EXTRA_H
+#pragma once
#define BOOST_CHECK_IF(VAR, EXPR) \
if (auto VAR = (EXPR); !VAR) { \
@@ -12,5 +11,3 @@
BOOST_CHECK_EQUAL(VAR, EQ); \
} \
else
-
-#endif
diff --git a/libadhocutil/buffer.h b/libadhocutil/buffer.h
index bd9fc30..7fa4911 100644
--- a/libadhocutil/buffer.h
+++ b/libadhocutil/buffer.h
@@ -1,5 +1,4 @@
-#ifndef ADHOCUTIL_BUFFER_H
-#define ADHOCUTIL_BUFFER_H
+#pragma once
#include "c++11Helpers.h"
#include "visibility.h"
@@ -180,5 +179,3 @@ namespace AdHoc {
#define vstringf(...) AdHoc::Buffer().vappendf(__VA_ARGS__).str()
#define stringf(...) AdHoc::Buffer().appendf(__VA_ARGS__).str()
#define stringbf(...) AdHoc::Buffer().appendbf(__VA_ARGS__).str()
-
-#endif
diff --git a/libadhocutil/c++11Helpers.h b/libadhocutil/c++11Helpers.h
index 74f0987..ae00e52 100644
--- a/libadhocutil/c++11Helpers.h
+++ b/libadhocutil/c++11Helpers.h
@@ -1,5 +1,4 @@
-#ifndef ADHOCUTIL_CPP11_HELPERS
-#define ADHOCUTIL_CPP11_HELPERS
+#pragma once
#define SPECIAL_MEMBERS_CONS(T, type) \
T(const T &) = type; \
@@ -29,5 +28,3 @@
#define SPECIAL_MEMBERS_DEFAULT_MOVE_NO_COPY(T) \
SPECIAL_MEMBERS_COPY(T, delete); \
SPECIAL_MEMBERS_MOVE(T, default)
-
-#endif
diff --git a/libadhocutil/cache.h b/libadhocutil/cache.h
index 56fb5ac..75b14c7 100644
--- a/libadhocutil/cache.h
+++ b/libadhocutil/cache.h
@@ -1,5 +1,4 @@
-#ifndef ADHOCUTIL_CACHE_H
-#define ADHOCUTIL_CACHE_H
+#pragma once
#include "c++11Helpers.h"
#include "visibility.h"
@@ -147,5 +146,3 @@ namespace AdHoc {
};
}
-
-#endif
diff --git a/libadhocutil/cache.impl.h b/libadhocutil/cache.impl.h
index 2f509f8..812ef98 100644
--- a/libadhocutil/cache.impl.h
+++ b/libadhocutil/cache.impl.h
@@ -1,5 +1,4 @@
-#ifndef ADHOCUTIL_CACHE_IMPL_H
-#define ADHOCUTIL_CACHE_IMPL_H
+#pragma once
#include "cache.h" // IWYU pragma: export
#include "lockHelpers.h"
@@ -175,5 +174,3 @@ namespace AdHoc {
/// @endcond
}
-
-#endif
diff --git a/libadhocutil/case_less.h b/libadhocutil/case_less.h
index 05a0d08..d1d2bd0 100644
--- a/libadhocutil/case_less.h
+++ b/libadhocutil/case_less.h
@@ -1,5 +1,4 @@
-#ifndef ADHOCUTIL_CASELESS_H
-#define ADHOCUTIL_CASELESS_H
+#pragma once
#include <algorithm> // IWYU pragma: keep
#include <cstring>
@@ -17,5 +16,3 @@ namespace AdHoc {
}
};
}
-
-#endif
diff --git a/libadhocutil/compileTimeFormatter.h b/libadhocutil/compileTimeFormatter.h
index be57fee..218d099 100644
--- a/libadhocutil/compileTimeFormatter.h
+++ b/libadhocutil/compileTimeFormatter.h
@@ -1,5 +1,4 @@
-#ifndef ADHOCUTIL_COMPILE_TIME_FORMATTER_H
-#define ADHOCUTIL_COMPILE_TIME_FORMATTER_H
+#pragma once
#include <array>
#include <boost/preprocessor/control/iif.hpp> // IWYU pragma: keep
@@ -301,5 +300,3 @@ namespace AdHoc {
}
}
}
-
-#endif
diff --git a/libadhocutil/ctf-impl/printf-compat.h b/libadhocutil/ctf-impl/printf-compat.h
index 40508f7..b2004fb 100644
--- a/libadhocutil/ctf-impl/printf-compat.h
+++ b/libadhocutil/ctf-impl/printf-compat.h
@@ -1,5 +1,4 @@
-#ifndef ADHOCUTIL_COMPILE_TIME_FORMATTER_PRINTF_H
-#define ADHOCUTIL_COMPILE_TIME_FORMATTER_PRINTF_H
+#pragma once
#include "../compileTimeFormatter.h"
#include <boost/assert.hpp>
@@ -211,5 +210,3 @@ namespace AdHoc {
FLAGCONV(s << std::setfill(' '), ' ');
#undef FLAGCONV
}
-
-#endif
diff --git a/libadhocutil/curlHandle.h b/libadhocutil/curlHandle.h
index ba1df78..d1c6471 100644
--- a/libadhocutil/curlHandle.h
+++ b/libadhocutil/curlHandle.h
@@ -1,5 +1,4 @@
-#ifndef ADHOCUTIL_CURLHANDLE_H
-#define ADHOCUTIL_CURLHANDLE_H
+#pragma once
#include "c++11Helpers.h"
#include "visibility.h"
@@ -59,5 +58,3 @@ namespace AdHoc::Net {
};
using CurlHandlePtr = std::shared_ptr<CurlHandle>;
}
-
-#endif
diff --git a/libadhocutil/curlMultiHandle.h b/libadhocutil/curlMultiHandle.h
index 81dc9c2..140c469 100644
--- a/libadhocutil/curlMultiHandle.h
+++ b/libadhocutil/curlMultiHandle.h
@@ -1,5 +1,4 @@
-#ifndef ADHOCUTIL_CURLMULTIHANDLE_H
-#define ADHOCUTIL_CURLMULTIHANDLE_H
+#pragma once
#include "c++11Helpers.h"
#include "curlHandle.h"
@@ -42,5 +41,3 @@ namespace AdHoc::Net {
};
using CurlMultiHandlePtr = std::shared_ptr<CurlMultiHandle>;
}
-
-#endif
diff --git a/libadhocutil/curlStream.h b/libadhocutil/curlStream.h
index 51d7d31..ce99a12 100644
--- a/libadhocutil/curlStream.h
+++ b/libadhocutil/curlStream.h
@@ -1,5 +1,4 @@
-#ifndef ADHOCUTIL_CURLSTREAM_H
-#define ADHOCUTIL_CURLSTREAM_H
+#pragma once
#include "c++11Helpers.h"
#include "curlHandle.h"
@@ -45,5 +44,3 @@ namespace AdHoc::Net {
using CurlStream = boost::iostreams::stream<boost::reference_wrapper<CurlStreamSource>>;
}
-
-#endif
diff --git a/libadhocutil/definedDirs.h b/libadhocutil/definedDirs.h
index d746891..1768bba 100644
--- a/libadhocutil/definedDirs.h
+++ b/libadhocutil/definedDirs.h
@@ -1,16 +1,13 @@
-#ifndef ADHOCUTIL_DEFINEDDIRS_H
-#define ADHOCUTIL_DEFINEDDIRS_H
+#pragma once
#include <filesystem>
-#ifndef ROOT
-# error "ROOT needs to be defined at compilation time"
-#endif
-
-#define XSTR(s) STR(s)
-#define STR(s) #s
-const std::filesystem::path selfExe = std::filesystem::canonical("/proc/self/exe");
-const std::filesystem::path binDir = selfExe.parent_path();
-const std::filesystem::path rootDir(XSTR(ROOT));
-
+inline const std::filesystem::path selfExe = std::filesystem::canonical("/proc/self/exe");
+inline const std::filesystem::path binDir = selfExe.parent_path();
+#ifdef ROOT
+# define XSTR(s) STR(s)
+# define STR(s) # s
+inline const std::filesystem::path rootDir(XSTR(ROOT));
+# undef XSTR
+# undef STR
#endif
diff --git a/libadhocutil/exception.h b/libadhocutil/exception.h
index ed151b6..ebc820d 100644
--- a/libadhocutil/exception.h
+++ b/libadhocutil/exception.h
@@ -1,5 +1,4 @@
-#ifndef ADHOCUTIL_EXCEPTION_H
-#define ADHOCUTIL_EXCEPTION_H
+#pragma once
#include <exception> // IWYU pragma: export
#include <optional>
@@ -30,5 +29,3 @@ namespace AdHoc {
};
using StdException = Exception<std::exception>;
}
-
-#endif
diff --git a/libadhocutil/factory.h b/libadhocutil/factory.h
index 1d614fd..748fc4a 100644
--- a/libadhocutil/factory.h
+++ b/libadhocutil/factory.h
@@ -1,5 +1,4 @@
-#ifndef ADHOCUTIL_FACTORY_H
-#define ADHOCUTIL_FACTORY_H
+#pragma once
#include "plugins.h"
#include "visibility.h"
@@ -51,5 +50,3 @@ namespace AdHoc {
#define NAMEDFACTORY(Name, Implementation, BaseFactory) NAMEDPLUGIN(Name, BaseFactory::For<Implementation>, BaseFactory)
#define FACTORY(Implementation, BaseFactory) NAMEDFACTORY(#Implementation, Implementation, BaseFactory)
-
-#endif
diff --git a/libadhocutil/factory.impl.h b/libadhocutil/factory.impl.h
index 905b7c4..074deea 100644
--- a/libadhocutil/factory.impl.h
+++ b/libadhocutil/factory.impl.h
@@ -1,5 +1,4 @@
-#ifndef ADHOCUTIL_FACTORY_IMPL_H
-#define ADHOCUTIL_FACTORY_IMPL_H
+#pragma once
#include "factory.h" // IWYU pragma: export
#include "plugins.impl.h" // IWYU pragma: export
@@ -29,5 +28,3 @@ namespace AdHoc {
#define INSTANTIATEFACTORY(Base, ...) \
template class AdHoc::Factory<Base, __VA_ARGS__>; \
INSTANTIATEPLUGINOF(AdHoc::Factory<Base, __VA_ARGS__>)
-
-#endif
diff --git a/libadhocutil/fileUtils.h b/libadhocutil/fileUtils.h
index eee8ab3..70b302c 100644
--- a/libadhocutil/fileUtils.h
+++ b/libadhocutil/fileUtils.h
@@ -1,5 +1,4 @@
-#ifndef ADHOCUTIL_FILEUTILS_H
-#define ADHOCUTIL_FILEUTILS_H
+#pragma once
#include "c++11Helpers.h"
#include "visibility.h"
@@ -179,5 +178,3 @@ namespace AdHoc::FileUtils {
[[nodiscard]] DLL_PRIVATE void * setupMap(const std::filesystem::path & path, int flags) const;
};
}
-
-#endif
diff --git a/libadhocutil/fprintbf.h b/libadhocutil/fprintbf.h
index 8b15d56..1ff34f5 100644
--- a/libadhocutil/fprintbf.h
+++ b/libadhocutil/fprintbf.h
@@ -1,5 +1,4 @@
-#ifndef ADHOCUTIL_FPRINTBF_H
-#define ADHOCUTIL_FPRINTBF_H
+#pragma once
#include "buffer.h"
#include "visibility.h"
@@ -27,5 +26,3 @@ size_t inline fprintbf(FILE * f, boost::format & fmt, const Param & p, const Par
fmt % p;
return fprintbf(f, fmt, ps...);
}
-
-#endif
diff --git a/libadhocutil/globalStatic.h b/libadhocutil/globalStatic.h
index 4bc16ef..a39630a 100644
--- a/libadhocutil/globalStatic.h
+++ b/libadhocutil/globalStatic.h
@@ -1,5 +1,4 @@
-#ifndef ADHOCUTIL_GLOBALSTATIC_H
-#define ADHOCUTIL_GLOBALSTATIC_H
+#pragma once
namespace AdHoc {
/**
@@ -24,5 +23,3 @@ namespace AdHoc {
inline static Ptr & instance();
};
}
-
-#endif
diff --git a/libadhocutil/globalStatic.impl.h b/libadhocutil/globalStatic.impl.h
index ba12da8..61314ea 100644
--- a/libadhocutil/globalStatic.impl.h
+++ b/libadhocutil/globalStatic.impl.h
@@ -1,5 +1,4 @@
-#ifndef ADHOCUTIL_GLOBALSTATIC_IMPL_H
-#define ADHOCUTIL_GLOBALSTATIC_IMPL_H
+#pragma once
#include "globalStatic.h" // IWYU pragma: export
@@ -34,5 +33,3 @@ namespace AdHoc {
return _instance;
}
}
-
-#endif
diff --git a/libadhocutil/handle.h b/libadhocutil/handle.h
index 7547b99..97770d9 100644
--- a/libadhocutil/handle.h
+++ b/libadhocutil/handle.h
@@ -1,5 +1,4 @@
-#ifndef ADHOCUTIL_HANDLE_H
-#define ADHOCUTIL_HANDLE_H
+#pragma once
#include "c++11Helpers.h"
#include <utility>
@@ -107,5 +106,3 @@ namespace AdHoc {
return {T(std::forward<Args>(args)...), std::forward<D>(d)};
}
}
-
-#endif
diff --git a/libadhocutil/lazyPointer.h b/libadhocutil/lazyPointer.h
index c412f03..b6651b9 100644
--- a/libadhocutil/lazyPointer.h
+++ b/libadhocutil/lazyPointer.h
@@ -1,5 +1,4 @@
-#ifndef ADHOCUTIL_LAZYPOINTER_H
-#define ADHOCUTIL_LAZYPOINTER_H
+#pragma once
#include <functional>
#include <memory>
@@ -139,5 +138,3 @@ namespace boost {
return dynamic_cast<R *>(p.get());
}
}
-
-#endif
diff --git a/libadhocutil/lexer-regex.h b/libadhocutil/lexer-regex.h
index 3b8ca04..0673e1a 100644
--- a/libadhocutil/lexer-regex.h
+++ b/libadhocutil/lexer-regex.h
@@ -1,5 +1,4 @@
-#ifndef ADHOCUTIL_LEXER_REGEX_H
-#define ADHOCUTIL_LEXER_REGEX_H
+#pragma once
#include "lexer.h" // IWYU pragma: export
#include "visibility.h"
@@ -24,5 +23,3 @@ namespace AdHoc::LexerMatchers {
DLL_PUBLIC Lexer::PatternPtr regex(
const Glib::ustring & regex, GRegexCompileFlags compile = {}, GRegexMatchFlags match = {});
}
-
-#endif
diff --git a/libadhocutil/lexer.h b/libadhocutil/lexer.h
index d6ec249..1a9d9b4 100644
--- a/libadhocutil/lexer.h
+++ b/libadhocutil/lexer.h
@@ -1,5 +1,4 @@
-#ifndef ADHOCUTIL_LEXER_H
-#define ADHOCUTIL_LEXER_H
+#pragma once
#include "c++11Helpers.h"
#include "visibility.h"
@@ -102,5 +101,3 @@ namespace AdHoc {
void extract(const gchar * string, size_t length) const;
};
}
-
-#endif
diff --git a/libadhocutil/lockHelpers.h b/libadhocutil/lockHelpers.h
index d306f9c..f9f8b84 100644
--- a/libadhocutil/lockHelpers.h
+++ b/libadhocutil/lockHelpers.h
@@ -1,5 +1,4 @@
-#ifndef ADHOCUTIL_LOCKHELPERS_H
-#define ADHOCUTIL_LOCKHELPERS_H
+#pragma once
#define LIBADHOC_LOCK_CONCAT2(a, b) a##b
#define LIBADHOC_LOCK_CONCAT(a, b) LIBADHOC_LOCK_CONCAT2(a, b)
@@ -13,5 +12,3 @@
#define ScopeLock(l) BaseScopeLock(l, std::unique_lock)
#define SharedScopeLock(l) BaseScopeLock(l, std::shared_lock)
-
-#endif
diff --git a/libadhocutil/memstream.h b/libadhocutil/memstream.h
index 43a06fb..344e4cf 100644
--- a/libadhocutil/memstream.h
+++ b/libadhocutil/memstream.h
@@ -1,5 +1,4 @@
-#ifndef LIBADHOC_MEMSTREAM_H
-#define LIBADHOC_MEMSTREAM_H
+#pragma once
#include "c++11Helpers.h"
#include <cstdio>
@@ -47,5 +46,3 @@ namespace AdHoc {
FILE * strm;
};
}
-
-#endif
diff --git a/libadhocutil/nagios.h b/libadhocutil/nagios.h
index 3d51133..cbe02d9 100644
--- a/libadhocutil/nagios.h
+++ b/libadhocutil/nagios.h
@@ -1,5 +1,4 @@
-#ifndef NAGIOS_H
-#define NAGIOS_H
+#pragma once
#include "visibility.h"
#include <cstdint>
@@ -19,5 +18,3 @@ namespace AdHoc {
DLL_PUBLIC bool submitNagiosPassiveServiceCheck(
std::ostream &, const std::string_view &, NagiosStatusCode, const std::string_view &);
}
-
-#endif
diff --git a/libadhocutil/nvpParse.h b/libadhocutil/nvpParse.h
index fe943dc..0e825b5 100644
--- a/libadhocutil/nvpParse.h
+++ b/libadhocutil/nvpParse.h
@@ -1,5 +1,4 @@
-#ifndef ADHOCUTIL_REFLECTION_H
-#define ADHOCUTIL_REFLECTION_H
+#pragma once
#include <boost/lexical_cast.hpp>
#include <functional>
@@ -97,5 +96,3 @@ namespace AdHoc {
};
}
-
-#endif
diff --git a/libadhocutil/optionalUtils.h b/libadhocutil/optionalUtils.h
index 0ba3cb7..bfae9d0 100644
--- a/libadhocutil/optionalUtils.h
+++ b/libadhocutil/optionalUtils.h
@@ -1,5 +1,4 @@
-#ifndef ADHOCUTIL_OPTIONALS_H
-#define ADHOCUTIL_OPTIONALS_H
+#pragma once
#include <type_traits>
@@ -22,5 +21,3 @@ namespace AdHoc {
return (a ? &*a : b);
}
}
-
-#endif
diff --git a/libadhocutil/plugins.h b/libadhocutil/plugins.h
index c0f9cf2..4f2ff84 100644
--- a/libadhocutil/plugins.h
+++ b/libadhocutil/plugins.h
@@ -1,5 +1,4 @@
-#ifndef ADHOCUTIL_PLUGINS_H
-#define ADHOCUTIL_PLUGINS_H
+#pragma once
#include "c++11Helpers.h"
#include "unique.h"
@@ -240,5 +239,3 @@ namespace AdHoc {
} \
}
#define PLUGIN(Implementation, Base) NAMEDPLUGIN(#Implementation, Implementation, Base)
-
-#endif
diff --git a/libadhocutil/plugins.impl.h b/libadhocutil/plugins.impl.h
index d10976b..becd149 100644
--- a/libadhocutil/plugins.impl.h
+++ b/libadhocutil/plugins.impl.h
@@ -1,5 +1,4 @@
-#ifndef ADHOCUTIL_PLUGINS_IMPL_H
-#define ADHOCUTIL_PLUGINS_IMPL_H
+#pragma once
#include "plugins.h" // IWYU pragma: export
#include "unique.h"
@@ -124,5 +123,3 @@ namespace AdHoc {
::AdHoc::PluginManager::getDefault()->removeResolver<T>(); \
} \
}
-
-#endif
diff --git a/libadhocutil/processPipes.h b/libadhocutil/processPipes.h
index 8eee53f..253f713 100644
--- a/libadhocutil/processPipes.h
+++ b/libadhocutil/processPipes.h
@@ -1,5 +1,4 @@
-#ifndef ADHOCUTIL_PROCESSPIPES_H
-#define ADHOCUTIL_PROCESSPIPES_H
+#pragma once
#include "handle.h"
#include "visibility.h"
@@ -53,5 +52,3 @@ namespace AdHoc::System {
const OFHandle out, error;
};
}
-
-#endif
diff --git a/libadhocutil/resourcePool.h b/libadhocutil/resourcePool.h
index 495eb61..6761a16 100644
--- a/libadhocutil/resourcePool.h
+++ b/libadhocutil/resourcePool.h
@@ -1,15 +1,14 @@
-#ifndef ADHOCUTIL_RESOURCEPOOL_H
-#define ADHOCUTIL_RESOURCEPOOL_H
+#pragma once
#include "c++11Helpers.h"
#include "exception.h"
-#include <semaphore>
#include "visibility.h"
#include <chrono>
#include <cstddef>
#include <list>
#include <map>
#include <memory>
+#include <semaphore>
#include <shared_mutex>
#include <string>
#include <thread>
@@ -172,5 +171,3 @@ namespace AdHoc {
};
}
-
-#endif
diff --git a/libadhocutil/resourcePool.impl.h b/libadhocutil/resourcePool.impl.h
index f2a62b4..e6e3e0d 100644
--- a/libadhocutil/resourcePool.impl.h
+++ b/libadhocutil/resourcePool.impl.h
@@ -1,5 +1,4 @@
-#ifndef ADHOCUTIL_RESOURCEPOOL_IMPL_H
-#define ADHOCUTIL_RESOURCEPOOL_IMPL_H
+#pragma once
#include "lockHelpers.h"
#include "resourcePool.h" // IWYU pragma: export
@@ -17,7 +16,6 @@ namespace AdHoc {
//
// ResourceHandle
//
-
template<typename R> ResourceHandle<R>::ResourceHandle(std::shared_ptr<Object> o) noexcept : resource(std::move(o))
{
}
@@ -273,5 +271,3 @@ namespace AdHoc {
{
}
}
-
-#endif
diff --git a/libadhocutil/runtimeContext.h b/libadhocutil/runtimeContext.h
index 08c6614..1933374 100644
--- a/libadhocutil/runtimeContext.h
+++ b/libadhocutil/runtimeContext.h
@@ -1,5 +1,4 @@
-#ifndef ADHOCUTIL_RUNTIMECONTEXT_H
-#define ADHOCUTIL_RUNTIMECONTEXT_H
+#pragma once
#include "c++11Helpers.h"
#include "visibility.h"
@@ -45,5 +44,3 @@ namespace AdHoc::System {
};
}
-
-#endif
diff --git a/libadhocutil/safeMapFind.h b/libadhocutil/safeMapFind.h
index 0f5c24d..506f86f 100644
--- a/libadhocutil/safeMapFind.h
+++ b/libadhocutil/safeMapFind.h
@@ -1,5 +1,4 @@
-#ifndef ADHOCUTIL_SAFEMAPFIND_H
-#define ADHOCUTIL_SAFEMAPFIND_H
+#pragma once
#include <algorithm>
@@ -59,5 +58,3 @@ namespace AdHoc {
}
}
-
-#endif
diff --git a/libadhocutil/scopeExit.h b/libadhocutil/scopeExit.h
index 1b50fa8..9d4341e 100644
--- a/libadhocutil/scopeExit.h
+++ b/libadhocutil/scopeExit.h
@@ -1,5 +1,4 @@
-#ifndef ADHOCUTIL_SCOPEEXIT_H
-#define ADHOCUTIL_SCOPEEXIT_H
+#pragma once
#include "c++11Helpers.h"
#include "visibility.h"
@@ -40,5 +39,3 @@ namespace AdHoc {
};
}
-
-#endif
diff --git a/libadhocutil/unique.h b/libadhocutil/unique.h
index d64ac47..cce6805 100644
--- a/libadhocutil/unique.h
+++ b/libadhocutil/unique.h
@@ -1,8 +1,5 @@
-#ifndef ADHOCUTIL_UNIQUE_H
-#define ADHOCUTIL_UNIQUE_H
+#pragma once
#define CONCATENATE_DETAIL(x, y) x##y
#define CONCATENATE(x, y) CONCATENATE_DETAIL(x, y)
#define MAKE_UNIQUE(x) CONCATENATE(x, __COUNTER__)
-
-#endif
diff --git a/libadhocutil/unittests/utilTestClasses.h b/libadhocutil/unittests/utilTestClasses.h
index 1fbe766..0fb6c6a 100644
--- a/libadhocutil/unittests/utilTestClasses.h
+++ b/libadhocutil/unittests/utilTestClasses.h
@@ -1,5 +1,4 @@
-#ifndef LIBADHOCUTIL_UNITTESTS_UTILTESTCLASSES_H
-#define LIBADHOCUTIL_UNITTESTS_UTILTESTCLASSES_H
+#pragma once
#include <plugins.h>
@@ -17,5 +16,3 @@ class OtherBase : public AdHoc::AbstractPluginImplementation {
class OtherImpl : public OtherBase {
};
-
-#endif
diff --git a/libadhocutil/uriParse.h b/libadhocutil/uriParse.h
index 2ada3df..c059b3c 100644
--- a/libadhocutil/uriParse.h
+++ b/libadhocutil/uriParse.h
@@ -1,5 +1,4 @@
-#ifndef ADHOCUTIL_URIPARSE_H
-#define ADHOCUTIL_URIPARSE_H
+#pragma once
#include "exception.h"
#include "visibility.h"
@@ -55,5 +54,3 @@ namespace AdHoc {
const std::string uri;
};
}
-
-#endif
diff --git a/libadhocutil/visibility.h b/libadhocutil/visibility.h
index c049b82..2eb62ad 100644
--- a/libadhocutil/visibility.h
+++ b/libadhocutil/visibility.h
@@ -1,7 +1,4 @@
-#ifndef DLL_PUBLIC
-#define DLL_PUBLIC __attribute__((visibility("default")))
-#endif
+#pragma once
-#ifndef DLL_PRIVATE
+#define DLL_PUBLIC __attribute__((visibility("default")))
#define DLL_PRIVATE __attribute__((visibility("hidden")))
-#endif