diff --git a/log.hpp b/log.hpp index 4e77cfc9402b1f70f5ca813c9691432da04d5627..7d1e14246a82f546feab71e69b1e15f1ce783e0e 100644 --- a/log.hpp +++ b/log.hpp @@ -9,6 +9,7 @@ #include <rlib/stdio.hpp> #include <rlib/sys/time.hpp> #include <rlib/class_decorator.hpp> +#include <rlib/require/cxx14> // currently disable this error-prone shit. #define RLIB_IMPL_ENABLE_LOGGER_FROM_FD 0 diff --git a/stream.hpp b/stream.hpp index 93f77c25b061ac57b64be56718c3273c534b5963..84d5e4d2ff78ac0898cff9cb9075902345be1c24 100644 --- a/stream.hpp +++ b/stream.hpp @@ -18,7 +18,7 @@ namespace rlib { } inline std::ostream &null_stream() { - static std::ostream instance(impl::null_streambuf()); + static std::ostream instance(&impl::null_streambuf()); return instance; } } diff --git a/string.hpp b/string.hpp index b804952d434383509d447d8befc7a5a00444f1c7..4a43206e3ed3656c8792b1241de33f0fd55069e6 100644 --- a/string.hpp +++ b/string.hpp @@ -9,7 +9,7 @@ #ifndef R_STRING_HPP #define R_STRING_HPP -#include <rlib/require/cxx14> +#include <rlib/require/cxx11> #include <rlib/class_decorator.hpp> #include <rlib/sys/os.hpp> diff --git a/sys/rwlock.hpp b/sys/rwlock.hpp deleted file mode 100644 index 9a5be7b1b996d1764dcf0137fce28289aae018ed..0000000000000000000000000000000000000000 --- a/sys/rwlock.hpp +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef R_SWLOCK_HPP -#define R_SWLOCK_HPP - -#include <pthread.h> -namespace rlib { - [[deprecated]] class RWLock - { - public: - RWLock() : isFree(true) {pthread_rwlock_init(&m_lock, NULL);} - ~RWLock() {pthread_rwlock_destroy(&m_lock);} - void acquireShared() {pthread_rwlock_rdlock(&m_lock);isFree = false;} - void acquireExclusive() {pthread_rwlock_wrlock(&m_lock);isFree = false;} - void release() {pthread_rwlock_unlock(&m_lock);isFree = true;} - // bool tryAcquireShared() {return pthread_rwlock_tryrdlock(&m_lock) == 0;} - // bool tryAcquireExclusive() {return pthread_rwlock_trywrlock(&m_lock) == 0;} - private: - pthread_rwlock_t m_lock; - bool isFree; - }; -} - -#endif diff --git a/test/Makefile b/test/Makefile index edd67cbaeea2c5b9dfc1190853e50a7248be17fa..636adc017d57ab731043e1d9f208cd4ae957fd22 100644 --- a/test/Makefile +++ b/test/Makefile @@ -1,7 +1,7 @@ # Compile and run tests for rlib # CopyRight (C) 2017-2018 Recolic Keghart <root@recolic.net> # -# Tests may fail on both compile-time(traits and meta-lib) and run-time(return non-zero). +# Tests may fail on both compile-time(traits and meta-lib) and run-time(return non-zero) error. # Use `make <module>` to build and run a module, # and `make` to build and run all modules. # @@ -40,7 +40,7 @@ endif POSTFIX=$(STD)_$(CXX) -all: string common +all: string common header-include-all common: $(CXX) $(CXXFLAGS) src/common.cc $(CXXFLAGS) -o src/common_$(POSTFIX).out @@ -50,6 +50,10 @@ string: $(CXX) $(CXXFLAGS) src/string.cc $(CXXFLAGS) -o src/string_$(POSTFIX).out src/string_$(POSTFIX).out +header-include-all: + $(CXX) $(CXXFLAGS) src/header-include-all.cc $(CXXFLAGS) -o src/header-include-all_$(POSTFIX).out + src/header-include-all_$(POSTFIX).out + clean: rm -f src/*.out diff --git a/test/src/common.cc b/test/src/common.cc index c17ab4f18e2c42df4791170da9f05fc26a8df893..183c976bb4850cf7b66b1c6c5fe1173e58b9f2c3 100644 --- a/test/src/common.cc +++ b/test/src/common.cc @@ -10,7 +10,7 @@ void test_f(int); class test_c { public: - auto operator()(int a) { + int operator()(int a) { return a; } }; diff --git a/test/src/header-include-all.cc b/test/src/header-include-all.cc new file mode 100644 index 0000000000000000000000000000000000000000..5c11f18b2feb0e204b40a15a62c9962a182de3bf --- /dev/null +++ b/test/src/header-include-all.cc @@ -0,0 +1,31 @@ +#include <rlib/sys/os.hpp> + +#include <rlib/sys/fd.hpp> +#include <rlib/sys/time.hpp> +#include <rlib/sys/sio.hpp> + +#if RLIB_OS_ID == OS_LINUX +#include <rlib/sys/unix_handy.hpp> +#endif + +#if RLIB_CXX_STD >= 2017 +#include <rlib/functional.hpp> +#endif + +#if RLIB_CXX_STD >= 2014 +#include <rlib/meta.hpp> +#include <rlib/opt.hpp> +#include <rlib/log.hpp> +#include <rlib/pool.hpp> +#include <rlib/string.hpp> +#endif + +#include <rlib/class_decorator.hpp> +#include <rlib/macro.hpp> +#include <rlib/scope_guard.hpp> +#include <rlib/stdio.hpp> +#include <rlib/stream.hpp> +#include <rlib/terminal.hpp> +#include <rlib/traits.hpp> + +int main() { return 0; } diff --git a/traits.hpp b/traits.hpp index f15fba33d619885e8b81300741a1fc76f6689898..8b146706be7f42863bd398194eda6e395a48e7e2 100644 --- a/traits.hpp +++ b/traits.hpp @@ -1,6 +1,7 @@ #ifndef RLIB_TRAITS_HPP #define RLIB_TRAITS_HPP +#include <rlib/require/cxx11> #include <type_traits> namespace rlib{ @@ -31,7 +32,7 @@ namespace rlib{ namespace rlib { template<typename T> - struct is_callable : public std::bool_constant<impl::is_callable_helper<T>::real_value> { + struct is_callable : public std::integral_constant<bool, impl::is_callable_helper<T>::real_value> { }; }