Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
rlib
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
river
rlib
Commits
344b3197
There was an error fetching the commit references. Please try again later.
Commit
344b3197
authored
6 years ago
by
Recolic Keghart
Browse files
Options
Downloads
Patches
Plain Diff
c++17: remove inline variable
parent
4ebdfc3b
No related branches found
No related tags found
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
libr.cc
+8
-8
8 additions, 8 deletions
libr.cc
log.hpp
+4
-4
4 additions, 4 deletions
log.hpp
stdio.hpp
+4
-4
4 additions, 4 deletions
stdio.hpp
stream.hpp
+6
-12
6 additions, 12 deletions
stream.hpp
string.hpp
+5
-5
5 additions, 5 deletions
string.hpp
with
27 additions
and
33 deletions
libr.cc
+
8
−
8
View file @
344b3197
...
...
@@ -3,19 +3,19 @@
#include
<sstream>
namespace
rlib
{
namespace
impl
{
#if RLIB_CXX_STD < 2017
//
#if RLIB_CXX_STD < 2017
bool
enable_endl_flush
=
true
;
int
max_predefined_log_level
=
(
int
)
log_level_t
::
DEBUG
;
NullStreamBuf
null_streambuf
;
#endif
#ifndef RLIB_MINGW_DISABLE_TLS
#if RLIB_CXX_STD < 2017
//
#endif
//
#ifndef RLIB_MINGW_DISABLE_TLS
//
#if RLIB_CXX_STD < 2017
thread_local
std
::
stringstream
_format_string_helper_ss
;
thread_local
std
::
stringstream
to_string_by_sstream_ss
;
#endif
#endif
//
#endif
//
#endif
}
#if RLIB_CXX_STD < 2017
//
#if RLIB_CXX_STD < 2017
std
::
ostream
null_stream
(
&
impl
::
null_streambuf
);
#endif
//
#endif
}
This diff is collapsed.
Click to expand it.
log.hpp
+
4
−
4
View file @
344b3197
...
...
@@ -36,11 +36,11 @@ namespace rlib {
// Allow extension.
enum
class
log_level_t
:
int
{
FATAL
=
1
,
ERROR
,
WARNING
,
INFO
,
VERBOSE
,
DEBUG
};
namespace
impl
{
#if RLIB_CXX_STD < 2017
//
#if RLIB_CXX_STD < 2017
extern
int
max_predefined_log_level
;
#else
inline
int
max_predefined_log_level
=
(
int
)
log_level_t
::
DEBUG
;
#endif
//
#else
//
inline int max_predefined_log_level = (int)log_level_t::DEBUG;
//
#endif
}
/*
How to update log_level_t:
...
...
This diff is collapsed.
Click to expand it.
stdio.hpp
+
4
−
4
View file @
344b3197
...
...
@@ -80,11 +80,11 @@ namespace rlib {
size_t
printfln
(
const
std
::
string
&
fmt
,
Args
...
args
);
namespace
impl
{
#if RLIB_CXX_STD < 2017
//
#if RLIB_CXX_STD < 2017
extern
bool
enable_endl_flush
;
#else
inline
bool
enable_endl_flush
=
true
;
#endif
//
#else
//
inline bool enable_endl_flush = true;
//
#endif
}
inline
bool
sync_with_stdio
(
bool
sync
=
true
)
noexcept
{
...
...
This diff is collapsed.
Click to expand it.
stream.hpp
+
6
−
12
View file @
344b3197
...
...
@@ -3,13 +3,6 @@
#include
<iostream>
#include
<rlib/sys/os.hpp>
// I'm testing this macro. if it works good, I'll apply it to rlib.
#if RLIB_CXX_STD >= 2017
#define RLIB_IMPL_VAR_DECL inline
#else
#define RLIB_IMPL_VAR_DECL extern
#endif
namespace
rlib
{
namespace
impl
{
class
NullStreamBuf
:
public
std
::
streambuf
...
...
@@ -17,12 +10,13 @@ namespace rlib {
public:
int
overflow
(
int
c
)
{
return
c
;
}
};
RLIB_IMPL_VAR_DECL
NullStreamBuf
null_streambuf
;
// stdc++ 17 removed
extern
NullStreamBuf
null_streambuf
;
}
#if RLIB_CXX_STD < 2017
//
#if RLIB_CXX_STD < 2017
extern
std
::
ostream
null_stream
;
#else
RLIB_IMPL_VAR_DECL
std
::
ostream
null_stream
(
&
impl
::
null_streambuf
);
#endif
//
#else
//
inline
std::ostream null_stream(&impl::null_streambuf);
//
#endif
}
This diff is collapsed.
Click to expand it.
string.hpp
+
5
−
5
View file @
344b3197
...
...
@@ -28,14 +28,14 @@ namespace rlib {
// literals::_format, format_string, string::format
namespace
impl
{
#ifndef RLIB_MINGW_DISABLE_TLS
#if RLIB_CXX_STD < 2017
//
#if RLIB_CXX_STD < 2017
// Intel C++ compiler has a pending bug for `thread_local inline` variable.
thread_local
extern
std
::
stringstream
to_string_by_sstream_ss
;
thread_local
extern
std
::
stringstream
_format_string_helper_ss
;
#else
thread_local
inline
std
::
stringstream
to_string_by_sstream_ss
;
thread_local
inline
std
::
stringstream
_format_string_helper_ss
;
#endif
//
#else
//
thread_local inline std::stringstream to_string_by_sstream_ss;
//
thread_local inline std::stringstream _format_string_helper_ss;
//
#endif
#endif
template
<
typename
VarT
>
std
::
string
to_string_by_sstream
(
VarT
&
thing
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment