1
0
mirror of https://github.com/google/benchmark.git synced 2025-04-12 20:41:14 +08:00
This commit is contained in:
Eric Fiselier 2015-02-19 17:37:40 -05:00
commit c6025a324d
6 changed files with 42 additions and 31 deletions

View File

@ -14,10 +14,6 @@
#ifndef BENCHMARK_MACROS_H_
#define BENCHMARK_MACROS_H_
#ifndef __has_feature
# define __has_feature(x) 0
#endif
#if __cplusplus < 201103L
# define BENCHMARK_DISALLOW_COPY_AND_ASSIGN(TypeName) \
TypeName(const TypeName&); \
@ -45,18 +41,4 @@
# define BENCHMARK_BUILTIN_EXPECT(x, y) x
#endif
#if defined(__CYGWIN__)
# define OS_CYGWIN 1
#elif defined(_WIN32)
# define OS_WINDOWS 1
#elif defined(__APPLE__)
// TODO(ericwf) This doesn't actually check that it is a Mac OSX system. Just
// that it is an apple system.
# define OS_MACOSX 1
#elif defined(__FreeBSD__)
# define OS_FREEBSD 1
#elif defined(__linux__)
# define OS_LINUX 1
#endif
#endif // BENCHMARK_MACROS_H_

View File

@ -4,17 +4,9 @@
#include <cstdlib>
#include <ostream>
#include "benchmark/macros.h"
#include "internal_macros.h"
#include "log.h"
#if __has_feature(cxx_attributes)
# define BENCHMARK_NORETURN [[noreturn]]
#elif defined(__GNUC__)
# define BENCHMARK_NORETURN __attribute__((noreturn))
#else
# define BENCHMARK_NORETURN
#endif
namespace benchmark {
namespace internal {

View File

@ -39,7 +39,7 @@ extern "C" uint64_t __rdtsc();
#endif
#include <sys/time.h>
#include "benchmark/macros.h"
#include "internal_macros.h"
namespace benchmark {
// NOTE: only i386 and x86_64 have been well tested.

40
src/internal_macros.h Normal file
View File

@ -0,0 +1,40 @@
#ifndef BENCHMARK_INTERNAL_MACROS_H_
#define BENCHMARK_INTERNAL_MACROS_H_
#include "benchmark/macros.h"
#ifndef __has_feature
# define __has_feature(x) 0
#endif
#if __has_feature(cxx_attributes)
# define BENCHMARK_NORETURN [[noreturn]]
#elif defined(__GNUC__)
# define BENCHMARK_NORETURN __attribute__((noreturn))
#else
# define BENCHMARK_NORETURN
#endif
#if defined(__CYGWIN__)
# define OS_CYGWIN 1
#elif defined(_WIN32)
# define OS_WINDOWS 1
#elif defined(__APPLE__)
// TODO(ericwf) This doesn't actually check that it is a Mac OSX system. Just
// that it is an apple system.
# define OS_MACOSX 1
#elif defined(__FreeBSD__)
# define OS_FREEBSD 1
#elif defined(__linux__)
# define OS_LINUX 1
#endif
#if defined(__clang__)
# define COMPILER_CLANG
#elif defined(_MSC_VER)
# define COMPILER_MSVC
#elif defined(__GNUC__)
# define COMPILER_GCC
#endif
#endif // BENCHMARK_INTERNAL_MACROS_H_

View File

@ -12,7 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include <benchmark/macros.h>
#include "re.h"
namespace benchmark {

View File

@ -3,8 +3,6 @@
#include <string>
#include "benchmark/macros.h"
namespace benchmark {
namespace walltime {