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
df991a0f
Commit
df991a0f
authored
May 18, 2014
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Windows build.
parent
f21fa231
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
6 deletions
+32
-6
test/gtest-extra.h
test/gtest-extra.h
+8
-5
test/posix-test.cc
test/posix-test.cc
+17
-0
test/posix-test.h
test/posix-test.h
+7
-1
No files found.
test/gtest-extra.h
View file @
df991a0f
...
...
@@ -101,18 +101,21 @@ std::string FormatSystemErrorMessage(int error_code, fmt::StringRef message);
#ifndef FMT_POSIX
# ifdef _WIN32
// Fix warnings about deprecated symbols.
# define FMT_POSIX(
name) _##name
# define FMT_POSIX(
call) _##call
# else
# define FMT_POSIX(
name) name
# define FMT_POSIX(
call) call
# endif
#endif
#ifndef FMT_POSIX_CALL
#ifdef FMT_SYSTEM
# define FMT_POSIX_CALL(call) FMT_SYSTEM(call)
#else
# define FMT_SYSTEM(call) call
# ifdef _WIN32
// Fix warnings about deprecated symbols.
# define FMT_POSIX_CALL(
name) ::_##name
# define FMT_POSIX_CALL(
call) ::_##call
# else
# define FMT_POSIX_CALL(
name) ::name
# define FMT_POSIX_CALL(
call) ::call
# endif
#endif
...
...
test/posix-test.cc
View file @
df991a0f
...
...
@@ -30,6 +30,10 @@
#include <errno.h>
#include <fcntl.h>
#ifdef _WIN32
# include <io.h>
#endif
#include "gtest-extra.h"
namespace
{
...
...
@@ -42,6 +46,7 @@ int fileno_count;
int
read_count
;
int
write_count
;
int
pipe_count
;
int
fclose_count
;
}
#define EMULATE_EINTR(func, error_result) \
...
...
@@ -102,10 +107,22 @@ test::ssize_t test::write(int fildes, const void *buf, test::size_t nbyte) {
return
::
write
(
fildes
,
buf
,
nbyte
);
}
#ifndef _WIN32
int
test
::
pipe
(
int
fildes
[
2
])
{
EMULATE_EINTR
(
pipe
,
-
1
);
return
::
pipe
(
fildes
);
}
#else
int
test
::
pipe
(
int
*
pfds
,
unsigned
psize
,
int
textmode
)
{
EMULATE_EINTR
(
pipe
,
-
1
);
return
_pipe
(
fildes
,
256
,
O_BINARY
);
}
#endif
int
test
::
fclose
(
FILE
*
stream
)
{
EMULATE_EINTR
(
fclose
,
EOF
);
return
::
fclose
(
stream
);
}
#ifndef _WIN32
# define EXPECT_RETRY(statement, func, message) \
...
...
test/posix-test.h
View file @
df991a0f
...
...
@@ -56,10 +56,16 @@ int fileno(FILE *stream);
ssize_t
read
(
int
fildes
,
void
*
buf
,
size_t
nbyte
);
ssize_t
write
(
int
fildes
,
const
void
*
buf
,
size_t
nbyte
);
#ifndef _WIN32
int
pipe
(
int
fildes
[
2
]);
#else
int
pipe
(
int
*
pfds
,
unsigned
psize
,
int
textmode
);
#endif
int
fclose
(
FILE
*
stream
);
}
// namespace test
#define FMT_
POSIX_CALL
(call) test::call
#define FMT_
SYSTEM
(call) test::call
#endif // FMT_POSIX_TEST_H
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