From 06aa3e3d407dad409fbaa30078d602bdc0d2ecd1 Mon Sep 17 00:00:00 2001 From: Jake Hillion Date: Thu, 16 Mar 2023 06:36:30 -0700 Subject: [PATCH] clear all warnings and enable -Werror --- src/Metrics.h | 4 ++-- test/integration/arrays.toml | 11 +++++++++-- test/integration/gen_tests.py | 3 +++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/Metrics.h b/src/Metrics.h index b09c101..f1a0452 100644 --- a/src/Metrics.h +++ b/src/Metrics.h @@ -36,8 +36,8 @@ constexpr auto outputEnvKey = "OID_METRICS_OUTPUT"; * "oid_metrics.json". */ struct TraceFlags { - bool time : 1 = false; - bool rss : 1 = false; + bool time = false; + bool rss = false; operator bool() const { return time || rss; diff --git a/test/integration/arrays.toml b/test/integration/arrays.toml index 406f446..6836594 100644 --- a/test/integration/arrays.toml +++ b/test/integration/arrays.toml @@ -2,9 +2,16 @@ definitions = ''' struct Foo10 { int arr[10]; }; + + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wzero-length-array" struct Foo0 { int arr[0]; }; + + using ZeroLengthIntArray = int[0]; + #pragma clang diagnostic pop + struct MultiDim { int arr[2][3]; }; @@ -59,7 +66,7 @@ definitions = ''' # WARNING: zero-length arrays are handled differently to non-empty arrays. # They end up not being treated as containers. This should probably change # in the future. - param_types = ["int[0]"] + param_types = ["ZeroLengthIntArray"] setup = "return {};" expect_json = '[{"staticSize":0, "dynamicSize":0}]' [cases.ref_int10] @@ -72,6 +79,6 @@ definitions = ''' # WARNING: zero-length arrays are handled differently to non-empty arrays. # They end up not being treated as containers. This should probably change # in the future. - param_types = ["const int(&)[0]"] + param_types = ["const ZeroLengthIntArray&"] setup = "return {};" expect_json = '[{"staticSize":0, "dynamicSize":0}]' diff --git a/test/integration/gen_tests.py b/test/integration/gen_tests.py index d13eaae..12e6d19 100644 --- a/test/integration/gen_tests.py +++ b/test/integration/gen_tests.py @@ -56,7 +56,10 @@ def add_test_setup(f, config): f"\n" f'{config.get("raw_definitions", "")}\n' f"namespace {ns} {{\n" + f"#pragma clang diagnostic push\n" + f"#pragma clang diagnostic ignored \"-Wunused-private-field\"\n" f'{config.get("definitions", "")}\n' + f"#pragma clang diagnostic pop\n" ) # fmt: on