Skip to content
Snippets Groups Projects
Commit 83a09137 authored by Bensong Liu's avatar Bensong Liu
Browse files

adjust cxx version control, fix a stream.hpp bug

parent b18f8caa
No related branches found
No related tags found
No related merge requests found
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <rlib/stdio.hpp> #include <rlib/stdio.hpp>
#include <rlib/sys/time.hpp> #include <rlib/sys/time.hpp>
#include <rlib/class_decorator.hpp> #include <rlib/class_decorator.hpp>
#include <rlib/require/cxx14>
// currently disable this error-prone shit. // currently disable this error-prone shit.
#define RLIB_IMPL_ENABLE_LOGGER_FROM_FD 0 #define RLIB_IMPL_ENABLE_LOGGER_FROM_FD 0
......
...@@ -18,7 +18,7 @@ namespace rlib { ...@@ -18,7 +18,7 @@ namespace rlib {
} }
inline std::ostream &null_stream() { inline std::ostream &null_stream() {
static std::ostream instance(impl::null_streambuf()); static std::ostream instance(&impl::null_streambuf());
return instance; return instance;
} }
} }
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#ifndef R_STRING_HPP #ifndef R_STRING_HPP
#define R_STRING_HPP #define R_STRING_HPP
#include <rlib/require/cxx14> #include <rlib/require/cxx11>
#include <rlib/class_decorator.hpp> #include <rlib/class_decorator.hpp>
#include <rlib/sys/os.hpp> #include <rlib/sys/os.hpp>
......
#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
# Compile and run tests for rlib # Compile and run tests for rlib
# CopyRight (C) 2017-2018 Recolic Keghart <root@recolic.net> # 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, # Use `make <module>` to build and run a module,
# and `make` to build and run all modules. # and `make` to build and run all modules.
# #
...@@ -40,7 +40,7 @@ endif ...@@ -40,7 +40,7 @@ endif
POSTFIX=$(STD)_$(CXX) POSTFIX=$(STD)_$(CXX)
all: string common all: string common header-include-all
common: common:
$(CXX) $(CXXFLAGS) src/common.cc $(CXXFLAGS) -o src/common_$(POSTFIX).out $(CXX) $(CXXFLAGS) src/common.cc $(CXXFLAGS) -o src/common_$(POSTFIX).out
...@@ -50,6 +50,10 @@ string: ...@@ -50,6 +50,10 @@ string:
$(CXX) $(CXXFLAGS) src/string.cc $(CXXFLAGS) -o src/string_$(POSTFIX).out $(CXX) $(CXXFLAGS) src/string.cc $(CXXFLAGS) -o src/string_$(POSTFIX).out
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: clean:
rm -f src/*.out rm -f src/*.out
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
void test_f(int); void test_f(int);
class test_c { class test_c {
public: public:
auto operator()(int a) { int operator()(int a) {
return a; return a;
} }
}; };
......
#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; }
#ifndef RLIB_TRAITS_HPP #ifndef RLIB_TRAITS_HPP
#define RLIB_TRAITS_HPP #define RLIB_TRAITS_HPP
#include <rlib/require/cxx11>
#include <type_traits> #include <type_traits>
namespace rlib{ namespace rlib{
...@@ -31,7 +32,7 @@ namespace rlib{ ...@@ -31,7 +32,7 @@ namespace rlib{
namespace rlib { namespace rlib {
template<typename T> 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> {
}; };
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment