[libcxx-commits] [libcxx] [libc++][NFC] Disable std_format_spec benchmarks through lit instead of the preprocessor (PR #179228)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Feb 2 05:29:09 PST 2026
https://github.com/philnik777 created https://github.com/llvm/llvm-project/pull/179228
This is probably a relic from when we didn't use lit to run benchmarks. Nowadays we should just use the lit features to disable benchmarks like we do in any other test instead of using the preprocessor.
>From 8af809b1ce6b4a9d310836862e28695fae4a9163 Mon Sep 17 00:00:00 2001
From: Nikolas Klauser <nikolasklauser at berlin.de>
Date: Mon, 2 Feb 2026 14:27:50 +0100
Subject: [PATCH] [libc++][NFC] Disable std_format_spec benchmarks through lit
instead of the preprocessor
---
.../std_format_spec_string_unicode.bench.cpp | 24 ++++++++----------
...ormat_spec_string_unicode_escape.bench.cpp | 25 ++++++++-----------
2 files changed, 20 insertions(+), 29 deletions(-)
diff --git a/libcxx/test/benchmarks/format/std_format_spec_string_unicode.bench.cpp b/libcxx/test/benchmarks/format/std_format_spec_string_unicode.bench.cpp
index 1c859e1b2b833..eb3ffc37c882e 100644
--- a/libcxx/test/benchmarks/format/std_format_spec_string_unicode.bench.cpp
+++ b/libcxx/test/benchmarks/format/std_format_spec_string_unicode.bench.cpp
@@ -6,17 +6,17 @@
// UNSUPPORTED: c++03, c++11, c++14, c++17
-# include <concepts>
-# include <format>
-# include <string_view>
+// UNSUPPORTED: libcpp-has-no-unicode
-# include "benchmark/benchmark.h"
-# include "make_string.h"
-# include "test_macros.h"
+#include <concepts>
+#include <format>
+#include <string_view>
-# define SV(S) MAKE_STRING_VIEW(CharT, S)
+#include "benchmark/benchmark.h"
+#include "make_string.h"
+#include "test_macros.h"
-#if _LIBCPP_HAS_UNICODE
+#define SV(S) MAKE_STRING_VIEW(CharT, S)
// generated with https://generator.lorem-ipsum.info/_latin
@@ -285,16 +285,12 @@ BENCHMARK(BM_cyrillic_text<char>);
BENCHMARK(BM_japanese_text<char>);
BENCHMARK(BM_emoji_text<char>);
-# ifndef TEST_HAS_NO_WIDE_CHARACTERS
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
BENCHMARK(BM_ascii_text<wchar_t>);
BENCHMARK(BM_unicode_text<wchar_t>);
BENCHMARK(BM_cyrillic_text<wchar_t>);
BENCHMARK(BM_japanese_text<wchar_t>);
BENCHMARK(BM_emoji_text<wchar_t>);
-# endif
+#endif
BENCHMARK_MAIN();
-
-#else
-int main(int, char**) { return 0; }
-#endif
diff --git a/libcxx/test/benchmarks/format/std_format_spec_string_unicode_escape.bench.cpp b/libcxx/test/benchmarks/format/std_format_spec_string_unicode_escape.bench.cpp
index 4a1eb47a71ff0..aa91229798903 100644
--- a/libcxx/test/benchmarks/format/std_format_spec_string_unicode_escape.bench.cpp
+++ b/libcxx/test/benchmarks/format/std_format_spec_string_unicode_escape.bench.cpp
@@ -8,21 +8,20 @@
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+// UNSUPPORTED: libcpp-has-no-unicode
+
// This test formats a larger piece of text in "escaped" mode. It uses several
// datasets to give an impression how the amount of multibyte UTF-8 sequences
// and larger grapheme clusters affect the performance.
-# include <concepts>
-# include <format>
-# include <string_view>
-
-# include "benchmark/benchmark.h"
-# include "make_string.h"
-# include "test_macros.h"
+#include <concepts>
+#include <format>
+#include <string_view>
-#if _LIBCPP_HAS_UNICODE
+#include "benchmark/benchmark.h"
+#include "make_string.h"
-# define SV(S) MAKE_STRING_VIEW(CharT, S)
+#define SV(S) MAKE_STRING_VIEW(CharT, S)
// generated with https://generator.lorem-ipsum.info/_latin
@@ -288,16 +287,12 @@ BENCHMARK(BM_cyrillic_escaped<char>);
BENCHMARK(BM_japanese_escaped<char>);
BENCHMARK(BM_emoji_escaped<char>);
-# ifndef TEST_HAS_NO_WIDE_CHARACTERS
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
BENCHMARK(BM_ascii_escaped<wchar_t>);
BENCHMARK(BM_unicode_escaped<wchar_t>);
BENCHMARK(BM_cyrillic_escaped<wchar_t>);
BENCHMARK(BM_japanese_escaped<wchar_t>);
BENCHMARK(BM_emoji_escaped<wchar_t>);
-# endif
+#endif
BENCHMARK_MAIN();
-
-#else
-int main(int, char**) { return 0; }
-#endif
More information about the libcxx-commits
mailing list