Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
benchmark
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
benchmark
Commits
95a1435b
Commit
95a1435b
authored
Nov 30, 2017
by
Victor Costan
Committed by
Dominic Hamon
Nov 30, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix compilation error with GCC on OSX (issue #490). (#491)
parent
c45f0186
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
15 deletions
+3
-15
sysinfo.cc
src/sysinfo.cc
+3
-15
No files found.
src/sysinfo.cc
View file @
95a1435b
...
...
@@ -73,22 +73,14 @@ BENCHMARK_NORETURN void PrintErrorAndDie(Args&&... args) {
#ifdef BENCHMARK_HAS_SYSCTL
#ifdef __GNUC__
// Suppress the warning generated by the C11 flexible array member below.
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
#endif
/// ValueUnion - A type used to correctly alias the byte-for-byte output of
/// `sysctl` with the result type it's to be interpreted as.
struct
ValueUnion
{
union
DataT
{
uint32_t
uint32_value
;
uint64_t
uint64_value
;
// FIXME (Maybe?): This is a C11 flexible array member, and not technically
// C++. However, all compilers support it and it allows for correct aliasing
// of union members from bytes.
char
bytes
[];
// For correct aliasing of union members from bytes.
char
bytes
[
8
];
};
using
DataPtr
=
std
::
unique_ptr
<
DataT
,
decltype
(
&
std
::
free
)
>
;
...
...
@@ -137,10 +129,6 @@ struct ValueUnion {
}
};
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
ValueUnion
GetSysctlImp
(
std
::
string
const
&
Name
)
{
size_t
CurBuffSize
=
0
;
if
(
sysctlbyname
(
Name
.
c_str
(),
nullptr
,
&
CurBuffSize
,
nullptr
,
0
)
==
-
1
)
...
...
@@ -177,7 +165,7 @@ bool GetSysctl(std::string const& Name, std::array<Tp, N>* Out) {
if
(
!
Buff
)
return
false
;
*
Out
=
Buff
.
GetAsArray
<
Tp
,
N
>
();
return
true
;
}
;
}
#endif
template
<
class
ArgT
>
...
...
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