Merge branch 'main' into clang-tidy
diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml
index d05300d..ae92cca 100644
--- a/.github/workflows/build-and-test.yml
+++ b/.github/workflows/build-and-test.yml
@@ -141,8 +141,9 @@
git
base-devel
pacboy: >-
- cc:p
cmake:p
+ gcc:p
+ llvm:p
ninja:p
- name: configure cmake
diff --git a/include/benchmark/benchmark.h b/include/benchmark/benchmark.h
index 86f9dbb..f4c062f 100644
--- a/include/benchmark/benchmark.h
+++ b/include/benchmark/benchmark.h
@@ -171,6 +171,8 @@
// This _MSC_VER check should detect VS 2017 v15.3 and newer.
#if __cplusplus >= 201703L || \
(defined(_MSC_VER) && _MSC_VER >= 1911 && _MSVC_LANG >= 201703L)
+// CXX17 implies CXX11
+#define BENCHMARK_HAS_CXX11
#define BENCHMARK_HAS_CXX17
#endif
@@ -403,7 +405,16 @@
// TimeUnit is passed to a benchmark in order to specify the order of magnitude
// for the measured time.
-enum TimeUnit { kNanosecond, kMicrosecond, kMillisecond, kSecond };
+enum TimeUnit
+#if defined(BENCHMARK_HAS_CXX11)
+ : uint8_t
+#endif
+{
+ kNanosecond,
+ kMicrosecond,
+ kMillisecond,
+ kSecond
+};
BENCHMARK_EXPORT TimeUnit GetDefaultTimeUnit();
@@ -698,7 +709,11 @@
kInvert = 1 << 31
};
- enum OneK {
+ enum OneK
+#if defined(BENCHMARK_HAS_CXX11)
+ : uint16_t
+#endif
+ {
// 1'000 items per 1k
kIs1000 = 1000,
// 1'024 items per 1k
@@ -732,13 +747,34 @@
// computational
// complexity for the benchmark. In case oAuto is selected, complexity will be
// calculated automatically to the best fit.
-enum BigO { oNone, o1, oN, oNSquared, oNCubed, oLogN, oNLogN, oAuto, oLambda };
+enum BigO
+#if defined(BENCHMARK_HAS_CXX11)
+ : uint8_t
+#endif
+{
+ oNone,
+ o1,
+ oN,
+ oNSquared,
+ oNCubed,
+ oLogN,
+ oNLogN,
+ oAuto,
+ oLambda
+};
typedef int64_t ComplexityN;
typedef int64_t IterationCount;
-enum StatisticUnit { kTime, kPercentage };
+enum StatisticUnit
+#if defined(BENCHMARK_HAS_CXX11)
+ : uint8_t
+#endif
+{
+ kTime,
+ kPercentage
+};
// BigOFunc is passed to a benchmark in order to specify the asymptotic
// computational complexity for the benchmark.
@@ -766,8 +802,7 @@
enum AggregationReportMode
#if defined(BENCHMARK_HAS_CXX11)
- : unsigned
-#else
+ : uint8_t
#endif
{
// The mode has not been manually specified
@@ -786,7 +821,7 @@
enum Skipped
#if defined(BENCHMARK_HAS_CXX11)
- : unsigned
+ : uint8_t
#endif
{
NotSkipped = 0,
@@ -1789,7 +1824,15 @@
int num_sharing;
};
- enum Scaling { UNKNOWN, ENABLED, DISABLED };
+ enum Scaling
+#if defined(BENCHMARK_HAS_CXX11)
+ : uint8_t
+#endif
+ {
+ UNKNOWN,
+ ENABLED,
+ DISABLED
+ };
int num_cpus;
Scaling scaling;
@@ -1850,7 +1893,14 @@
struct BENCHMARK_EXPORT Run {
static const int64_t no_repetition_index = -1;
- enum RunType { RT_Iteration, RT_Aggregate };
+ enum RunType
+#if defined(BENCHMARK_HAS_CXX11)
+ : uint8_t
+#endif
+ {
+ RT_Iteration,
+ RT_Aggregate
+ };
Run()
: run_type(RT_Iteration),
@@ -2006,7 +2056,11 @@
// default reporter used by RunSpecifiedBenchmarks().
class BENCHMARK_EXPORT ConsoleReporter : public BenchmarkReporter {
public:
- enum OutputOptions {
+ enum OutputOptions
+#if defined(BENCHMARK_HAS_CXX11)
+ : uint8_t
+#endif
+ {
OO_None = 0,
OO_Color = 1,
OO_Tabular = 2,
diff --git a/src/log.h b/src/log.h
index 9a21400..54e22a6 100644
--- a/src/log.h
+++ b/src/log.h
@@ -11,6 +11,14 @@
#define BENCHMARK_HAS_CXX11
#endif
+// This _MSC_VER check should detect VS 2017 v15.3 and newer.
+#if __cplusplus >= 201703L || \
+ (defined(_MSC_VER) && _MSC_VER >= 1911 && _MSVC_LANG >= 201703L)
+// CXX17 implies CXX11
+#define BENCHMARK_HAS_CXX11
+#define BENCHMARK_HAS_CXX17
+#endif
+
namespace benchmark {
namespace internal {