summaryrefslogtreecommitdiffstats
path: root/src/boost/libs/log/test/compile
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 18:24:20 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 18:24:20 +0000
commit483eb2f56657e8e7f419ab1a4fab8dce9ade8609 (patch)
treee5d88d25d870d5dedacb6bbdbe2a966086a0a5cf /src/boost/libs/log/test/compile
parentInitial commit. (diff)
downloadceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.tar.xz
ceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.zip
Adding upstream version 14.2.21.upstream/14.2.21upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/boost/libs/log/test/compile')
-rw-r--r--src/boost/libs/log/test/compile/current_function_support.cpp37
-rw-r--r--src/boost/libs/log/test/compile/self_contained_header.cpp22
-rw-r--r--src/boost/libs/log/test/compile/src_logger_assignable.cpp39
-rw-r--r--src/boost/libs/log/test/compile/src_logger_get_attributes.cpp44
-rw-r--r--src/boost/libs/log/test/compile/util_unique_identifier.cpp34
5 files changed, 176 insertions, 0 deletions
diff --git a/src/boost/libs/log/test/compile/current_function_support.cpp b/src/boost/libs/log/test/compile/current_function_support.cpp
new file mode 100644
index 00000000..cdcd1051
--- /dev/null
+++ b/src/boost/libs/log/test/compile/current_function_support.cpp
@@ -0,0 +1,37 @@
+/*
+ * Copyright Andrey Semashev 2007 - 2015.
+ * Distributed under the Boost Software License, Version 1.0.
+ * (See accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ */
+/*!
+ * \file current_function_support.cpp
+ * \author Andrey Semashev
+ * \date 26.09.2010
+ *
+ * \brief This test checks that the BOOST_CURRENT_FUNCTION macro has semantics
+ * compatible with Boost.Log on the current platform.
+ *
+ * The point of this test is to determine whether the macro unfolds into a string literal
+ * rather than a pointer to a string. This is critical because BOOST_LOG_WFUNCTION
+ * relies on this fact - it determines the length of the literal by applying sizeof to it.
+ */
+
+#define BOOST_TEST_MODULE current_function_support
+
+#include <boost/current_function.hpp>
+#include <boost/static_assert.hpp>
+#include <boost/type_traits/is_array.hpp>
+
+template< typename T >
+void check(T& param)
+{
+ BOOST_STATIC_ASSERT(boost::is_array< T >::value);
+}
+
+int main(int, char*[])
+{
+ check(BOOST_CURRENT_FUNCTION);
+
+ return 0;
+}
diff --git a/src/boost/libs/log/test/compile/self_contained_header.cpp b/src/boost/libs/log/test/compile/self_contained_header.cpp
new file mode 100644
index 00000000..8e3a2c5a
--- /dev/null
+++ b/src/boost/libs/log/test/compile/self_contained_header.cpp
@@ -0,0 +1,22 @@
+/*
+ * Copyright Andrey Semashev 2007 - 2015.
+ * Distributed under the Boost Software License, Version 1.0.
+ * (See accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ */
+/*!
+ * \file self_contained_header.cpp
+ * \author Andrey Semashev
+ * \date 15.03.2014
+ *
+ * \brief This file contains a test boilerplate for checking that every public header is self-contained and does not have any missing #includes.
+ */
+
+#define BOOST_LOG_TEST_INCLUDE_HEADER() <boost/log/BOOST_LOG_TEST_HEADER>
+
+#include BOOST_LOG_TEST_INCLUDE_HEADER()
+
+int main(int, char*[])
+{
+ return 0;
+}
diff --git a/src/boost/libs/log/test/compile/src_logger_assignable.cpp b/src/boost/libs/log/test/compile/src_logger_assignable.cpp
new file mode 100644
index 00000000..d1d51f57
--- /dev/null
+++ b/src/boost/libs/log/test/compile/src_logger_assignable.cpp
@@ -0,0 +1,39 @@
+/*
+ * Copyright Andrey Semashev 2007 - 2015.
+ * Distributed under the Boost Software License, Version 1.0.
+ * (See accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ */
+/*!
+ * \file src_logger_assignable.cpp
+ * \author Andrey Semashev
+ * \date 16.05.2011
+ *
+ * \brief This header contains a test for logger assignability.
+ */
+
+#include <boost/log/sources/logger.hpp>
+#include <boost/log/sources/severity_logger.hpp>
+#include <boost/log/sources/channel_logger.hpp>
+#include <boost/log/sources/severity_channel_logger.hpp>
+
+template< typename LoggerT >
+void test()
+{
+ LoggerT lg1, lg2;
+
+ // Loggers must be assignable. The assignment operator must be taken
+ // from the composite_logger class and not auto-generated (in which
+ // case it will fail to compile because assignment in basic_logger is private).
+ lg1 = lg2;
+}
+
+int main(int, char*[])
+{
+ test< boost::log::sources::logger >();
+ test< boost::log::sources::severity_logger< > >();
+ test< boost::log::sources::channel_logger< > >();
+ test< boost::log::sources::severity_channel_logger< > >();
+
+ return 0;
+}
diff --git a/src/boost/libs/log/test/compile/src_logger_get_attributes.cpp b/src/boost/libs/log/test/compile/src_logger_get_attributes.cpp
new file mode 100644
index 00000000..b837917a
--- /dev/null
+++ b/src/boost/libs/log/test/compile/src_logger_get_attributes.cpp
@@ -0,0 +1,44 @@
+/*
+ * Copyright Andrey Semashev 2007 - 2015.
+ * Distributed under the Boost Software License, Version 1.0.
+ * (See accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ */
+/*!
+ * \file src_logger_get_attributes.cpp
+ * \author Andrey Semashev
+ * \date 01.03.2014
+ *
+ * \brief This header contains a test for logger \c get_attributes method.
+ */
+
+#include <boost/log/sources/logger.hpp>
+#include <boost/log/sources/severity_logger.hpp>
+#include <boost/log/sources/channel_logger.hpp>
+#include <boost/log/sources/severity_channel_logger.hpp>
+
+template< typename LoggerT >
+void test()
+{
+ LoggerT lg;
+
+ // Test that get_attributes(), which is a const method, can acquire the internal mutex in the threading model.
+ lg.get_attributes();
+}
+
+int main(int, char*[])
+{
+ test< boost::log::sources::logger >();
+ test< boost::log::sources::severity_logger< > >();
+ test< boost::log::sources::channel_logger< > >();
+ test< boost::log::sources::severity_channel_logger< > >();
+
+#if !defined(BOOST_LOG_NO_THREADS)
+ test< boost::log::sources::logger_mt >();
+ test< boost::log::sources::severity_logger_mt< > >();
+ test< boost::log::sources::channel_logger_mt< > >();
+ test< boost::log::sources::severity_channel_logger_mt< > >();
+#endif
+
+ return 0;
+}
diff --git a/src/boost/libs/log/test/compile/util_unique_identifier.cpp b/src/boost/libs/log/test/compile/util_unique_identifier.cpp
new file mode 100644
index 00000000..50e7ee03
--- /dev/null
+++ b/src/boost/libs/log/test/compile/util_unique_identifier.cpp
@@ -0,0 +1,34 @@
+/*
+ * Copyright Andrey Semashev 2007 - 2015.
+ * Distributed under the Boost Software License, Version 1.0.
+ * (See accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ */
+/*!
+ * \file util_unique_identifier.cpp
+ * \author Andrey Semashev
+ * \date 24.01.2009
+ *
+ * \brief This header contains tests for the unique identifier name generator.
+ */
+
+#include <boost/log/utility/unique_identifier_name.hpp>
+
+// Some hints to avoid warnings about unused variables in this test
+#if defined(__GNUC__)
+#define BOOST_LOG_AUX_UNUSED_ATTR __attribute__((unused))
+#else
+#define BOOST_LOG_AUX_UNUSED_ATTR
+#endif
+
+int main(int, char*[])
+{
+ // Names with the same prefixes may coexist in different lines
+ BOOST_LOG_AUX_UNUSED_ATTR int BOOST_LOG_UNIQUE_IDENTIFIER_NAME(var) = 0;
+ BOOST_LOG_AUX_UNUSED_ATTR int BOOST_LOG_UNIQUE_IDENTIFIER_NAME(var) = 0;
+
+ // Names with different prefixes may coexist on the same line
+ BOOST_LOG_AUX_UNUSED_ATTR int BOOST_LOG_UNIQUE_IDENTIFIER_NAME(var1) = 0; BOOST_LOG_AUX_UNUSED_ATTR int BOOST_LOG_UNIQUE_IDENTIFIER_NAME(var2) = 0;
+
+ return 0;
+}