Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
fmt
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
fmt
Commits
f733882b
Commit
f733882b
authored
Feb 14, 2020
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove misleading FMT_USE_WINDOWS_H
parent
dc22360c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
24 deletions
+5
-24
include/fmt/os.h
include/fmt/os.h
+2
-9
src/os.cc
src/os.cc
+3
-3
test/CMakeLists.txt
test/CMakeLists.txt
+0
-12
No files found.
include/fmt/os.h
View file @
f733882b
...
@@ -132,15 +132,8 @@ class error_code {
...
@@ -132,15 +132,8 @@ class error_code {
int
get
()
const
FMT_NOEXCEPT
{
return
value_
;
}
int
get
()
const
FMT_NOEXCEPT
{
return
value_
;
}
};
};
// Define FMT_USE_WINDOWS_H to 0 to disable use of windows.h.
// All the functionality that relies on it will be disabled too.
#ifndef _WIN32
# define FMT_USE_WINDOWS_H 0
#elif !defined(FMT_USE_WINDOWS_H)
# define FMT_USE_WINDOWS_H 1
#endif
#if
FMT_USE_WINDOWS_H
#if
def _WIN32
namespace
internal
{
namespace
internal
{
// A converter from UTF-16 to UTF-8.
// A converter from UTF-16 to UTF-8.
// It is only provided for Windows since other systems support UTF-8 natively.
// It is only provided for Windows since other systems support UTF-8 natively.
...
@@ -210,7 +203,7 @@ class windows_error : public system_error {
...
@@ -210,7 +203,7 @@ class windows_error : public system_error {
// Can be used to report errors from destructors.
// Can be used to report errors from destructors.
FMT_API
void
report_windows_error
(
int
error_code
,
FMT_API
void
report_windows_error
(
int
error_code
,
string_view
message
)
FMT_NOEXCEPT
;
string_view
message
)
FMT_NOEXCEPT
;
#endif
#endif
// _WIN32
// A buffered file.
// A buffered file.
class
buffered_file
{
class
buffered_file
{
...
...
src/os.cc
View file @
f733882b
...
@@ -44,7 +44,7 @@
...
@@ -44,7 +44,7 @@
# endif // _WIN32
# endif // _WIN32
#endif // FMT_USE_FCNTL
#endif // FMT_USE_FCNTL
#if
FMT_USE_WINDOWS_H
#if
def _WIN32
# include <windows.h>
# include <windows.h>
#endif
#endif
...
@@ -72,7 +72,7 @@ inline std::size_t convert_rwcount(std::size_t count) { return count; }
...
@@ -72,7 +72,7 @@ inline std::size_t convert_rwcount(std::size_t count) { return count; }
FMT_BEGIN_NAMESPACE
FMT_BEGIN_NAMESPACE
#if
FMT_USE_WINDOWS_H
#if
def _WIN32
internal
::
utf16_to_utf8
::
utf16_to_utf8
(
wstring_view
s
)
{
internal
::
utf16_to_utf8
::
utf16_to_utf8
(
wstring_view
s
)
{
if
(
int
error_code
=
convert
(
s
))
{
if
(
int
error_code
=
convert
(
s
))
{
FMT_THROW
(
windows_error
(
error_code
,
FMT_THROW
(
windows_error
(
error_code
,
...
@@ -145,7 +145,7 @@ void report_windows_error(int error_code,
...
@@ -145,7 +145,7 @@ void report_windows_error(int error_code,
fmt
::
string_view
message
)
FMT_NOEXCEPT
{
fmt
::
string_view
message
)
FMT_NOEXCEPT
{
report_error
(
internal
::
format_windows_error
,
error_code
,
message
);
report_error
(
internal
::
format_windows_error
,
error_code
,
message
);
}
}
#endif //
FMT_USE_WINDOWS_H
#endif //
_WIN32
buffered_file
::~
buffered_file
()
FMT_NOEXCEPT
{
buffered_file
::~
buffered_file
()
FMT_NOEXCEPT
{
if
(
file_
&&
FMT_SYSTEM
(
fclose
(
file_
))
!=
0
)
if
(
file_
&&
FMT_SYSTEM
(
fclose
(
file_
))
!=
0
)
...
...
test/CMakeLists.txt
View file @
f733882b
...
@@ -171,18 +171,6 @@ if (FMT_PEDANTIC)
...
@@ -171,18 +171,6 @@ if (FMT_PEDANTIC)
target_compile_definitions
(
target_compile_definitions
(
nolocale-test PRIVATE FMT_STATIC_THOUSANDS_SEPARATOR=1
)
nolocale-test PRIVATE FMT_STATIC_THOUSANDS_SEPARATOR=1
)
# Test that the library compiles without windows.h.
if
(
CMAKE_SYSTEM_NAME STREQUAL
"Windows"
)
add_library
(
no-windows-h-test ../src/format.cc
)
target_include_directories
(
no-windows-h-test PRIVATE
${
PROJECT_SOURCE_DIR
}
/include
)
target_compile_definitions
(
no-windows-h-test PRIVATE FMT_USE_WINDOWS_H=0
)
if
(
FMT_PEDANTIC
)
target_compile_options
(
no-windows-h-test PRIVATE
${
PEDANTIC_COMPILE_FLAGS
}
)
endif
()
target_include_directories
(
no-windows-h-test SYSTEM PUBLIC gtest gmock
)
endif
()
add_test
(
compile-error-test
${
CMAKE_CTEST_COMMAND
}
add_test
(
compile-error-test
${
CMAKE_CTEST_COMMAND
}
--build-and-test
--build-and-test
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/compile-error-test"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/compile-error-test"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment