[libcxx-commits] [libcxx] [llvm] [libc++] Refactor the configuration macros to being always defined (PR #112094)

via libcxx-commits libcxx-commits at lists.llvm.org
Sat Oct 12 05:21:01 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 9f24c145494ee238e65e25205a4dcb4451f009ae c44ba766fdae9d1269cd6f4661189d0573d9687f --extensions ,cpp,inc,h -- libcxx/include/__algorithm/find.h libcxx/include/__algorithm/lexicographical_compare.h libcxx/include/__algorithm/sort.h libcxx/include/__atomic/aliases.h libcxx/include/__atomic/atomic_sync.h libcxx/include/__chrono/convert_to_tm.h libcxx/include/__chrono/formatter.h libcxx/include/__chrono/high_resolution_clock.h libcxx/include/__chrono/ostream.h libcxx/include/__chrono/parser_std_format_spec.h libcxx/include/__chrono/statically_widen.h libcxx/include/__chrono/steady_clock.h libcxx/include/__chrono/time_zone.h libcxx/include/__chrono/time_zone_link.h libcxx/include/__chrono/tzdb.h libcxx/include/__chrono/tzdb_list.h libcxx/include/__chrono/zoned_time.h libcxx/include/__condition_variable/condition_variable.h libcxx/include/__config libcxx/include/__configuration/availability.h libcxx/include/__filesystem/directory_entry.h libcxx/include/__filesystem/directory_iterator.h libcxx/include/__filesystem/operations.h libcxx/include/__filesystem/path.h libcxx/include/__filesystem/recursive_directory_iterator.h libcxx/include/__format/concepts.h libcxx/include/__format/format_arg_store.h libcxx/include/__format/format_context.h libcxx/include/__format/format_functions.h libcxx/include/__format/format_parse_context.h libcxx/include/__format/formatter_bool.h libcxx/include/__format/formatter_char.h libcxx/include/__format/formatter_floating_point.h libcxx/include/__format/formatter_integral.h libcxx/include/__format/formatter_output.h libcxx/include/__format/formatter_string.h libcxx/include/__format/parser_std_format_spec.h libcxx/include/__format/unicode.h libcxx/include/__format/write_escaped.h libcxx/include/__functional/hash.h libcxx/include/__fwd/fstream.h libcxx/include/__fwd/ios.h libcxx/include/__fwd/istream.h libcxx/include/__fwd/ostream.h libcxx/include/__fwd/sstream.h libcxx/include/__fwd/streambuf.h libcxx/include/__fwd/string.h libcxx/include/__fwd/string_view.h libcxx/include/__locale libcxx/include/__locale_dir/locale_base_api.h libcxx/include/__locale_dir/locale_base_api/bsd_locale_fallbacks.h libcxx/include/__mbstate_t.h libcxx/include/__memory/shared_ptr.h libcxx/include/__memory_resource/synchronized_pool_resource.h libcxx/include/__mutex/mutex.h libcxx/include/__ostream/basic_ostream.h libcxx/include/__ostream/print.h libcxx/include/__random/random_device.h libcxx/include/__ranges/istream_view.h libcxx/include/__stop_token/atomic_unique_lock.h libcxx/include/__stop_token/stop_callback.h libcxx/include/__stop_token/stop_source.h libcxx/include/__stop_token/stop_state.h libcxx/include/__stop_token/stop_token.h libcxx/include/__string/char_traits.h libcxx/include/__support/xlocale/__posix_l_fallback.h libcxx/include/__support/xlocale/__strtonum_fallback.h libcxx/include/__thread/formatter.h libcxx/include/__thread/id.h libcxx/include/__thread/jthread.h libcxx/include/__thread/support.h libcxx/include/__thread/this_thread.h libcxx/include/__thread/thread.h libcxx/include/__thread/timed_backoff_policy.h libcxx/include/__type_traits/is_integral.h libcxx/include/barrier libcxx/include/chrono libcxx/include/codecvt libcxx/include/complex libcxx/include/condition_variable libcxx/include/cstdlib libcxx/include/deque libcxx/include/format libcxx/include/fstream libcxx/include/future libcxx/include/iomanip libcxx/include/ios libcxx/include/iosfwd libcxx/include/iostream libcxx/include/istream libcxx/include/latch libcxx/include/list libcxx/include/locale libcxx/include/mutex libcxx/include/ostream libcxx/include/print libcxx/include/ranges libcxx/include/regex libcxx/include/semaphore libcxx/include/shared_mutex libcxx/include/sstream libcxx/include/stdatomic.h libcxx/include/stop_token libcxx/include/streambuf libcxx/include/string libcxx/include/string_view libcxx/include/syncstream libcxx/include/thread libcxx/include/vector libcxx/include/version libcxx/include/wchar.h libcxx/modules/std.compat/clocale.inc libcxx/modules/std.compat/cstdlib.inc libcxx/modules/std.compat/cwchar.inc libcxx/modules/std.compat/cwctype.inc libcxx/modules/std/atomic.inc libcxx/modules/std/barrier.inc libcxx/modules/std/chrono.inc libcxx/modules/std/clocale.inc libcxx/modules/std/codecvt.inc libcxx/modules/std/complex.inc libcxx/modules/std/condition_variable.inc libcxx/modules/std/cstdlib.inc libcxx/modules/std/cwchar.inc libcxx/modules/std/cwctype.inc libcxx/modules/std/filesystem.inc libcxx/modules/std/format.inc libcxx/modules/std/fstream.inc libcxx/modules/std/future.inc libcxx/modules/std/iomanip.inc libcxx/modules/std/ios.inc libcxx/modules/std/iosfwd.inc libcxx/modules/std/iostream.inc libcxx/modules/std/istream.inc libcxx/modules/std/latch.inc libcxx/modules/std/locale.inc libcxx/modules/std/memory.inc libcxx/modules/std/mutex.inc libcxx/modules/std/ostream.inc libcxx/modules/std/print.inc libcxx/modules/std/random.inc libcxx/modules/std/ranges.inc libcxx/modules/std/regex.inc libcxx/modules/std/semaphore.inc libcxx/modules/std/shared_mutex.inc libcxx/modules/std/spanstream.inc libcxx/modules/std/sstream.inc libcxx/modules/std/stop_token.inc libcxx/modules/std/streambuf.inc libcxx/modules/std/string.inc libcxx/modules/std/string_view.inc libcxx/modules/std/strstream.inc libcxx/modules/std/syncstream.inc libcxx/modules/std/thread.inc libcxx/src/algorithm.cpp libcxx/src/call_once.cpp libcxx/src/chrono.cpp libcxx/src/experimental/include/tzdb/tzdb_list_private.h libcxx/src/filesystem/time_utils.h libcxx/src/include/atomic_support.h libcxx/src/include/config_elast.h libcxx/src/ios.cpp libcxx/src/ios.instantiations.cpp libcxx/src/iostream.cpp libcxx/src/locale.cpp libcxx/src/memory.cpp libcxx/src/memory_resource.cpp libcxx/src/ostream.cpp libcxx/src/print.cpp libcxx/src/random_shuffle.cpp libcxx/src/std_stream.h libcxx/src/string.cpp libcxx/src/system_error.cpp libcxx/test/benchmarks/std_format_spec_string_unicode.bench.cpp libcxx/test/benchmarks/std_format_spec_string_unicode_escape.bench.cpp libcxx/test/libcxx/depr/depr.c.headers/extern_c.pass.cpp libcxx/test/libcxx/include_as_c.sh.cpp libcxx/test/libcxx/vendor/apple/availability-with-pedantic-errors.compile.pass.cpp libcxx/test/std/containers/container.adaptors/container.adaptors.format/format.functions.tests.h libcxx/test/std/language.support/support.limits/support.limits.general/barrier.version.compile.pass.cpp libcxx/test/std/language.support/support.limits/support.limits.general/filesystem.version.compile.pass.cpp libcxx/test/std/language.support/support.limits/support.limits.general/fstream.version.compile.pass.cpp libcxx/test/std/language.support/support.limits/support.limits.general/iomanip.version.compile.pass.cpp libcxx/test/std/language.support/support.limits/support.limits.general/latch.version.compile.pass.cpp libcxx/test/std/language.support/support.limits/support.limits.general/mutex.version.compile.pass.cpp libcxx/test/std/language.support/support.limits/support.limits.general/semaphore.version.compile.pass.cpp libcxx/test/std/language.support/support.limits/support.limits.general/shared_mutex.version.compile.pass.cpp libcxx/test/std/language.support/support.limits/support.limits.general/stop_token.version.compile.pass.cpp libcxx/test/std/language.support/support.limits/support.limits.general/thread.version.compile.pass.cpp libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp libcxx/test/std/utilities/format/format.range/format.range.fmtmap/format.functions.tests.h libcxx/test/std/utilities/format/format.range/format.range.fmtset/format.functions.tests.h libcxx/test/std/utilities/format/format.range/format.range.formatter/format.functions.tests.h libcxx/test/support/filesystem_test_helper.h libcxx/test/support/test_macros.h libcxx/test/tools/clang_tidy_checks/internal_ftm_use.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/libcxx/include/__configuration/availability.h b/libcxx/include/__configuration/availability.h
index 65d252d4e3..18717d30c4 100644
--- a/libcxx/include/__configuration/availability.h
+++ b/libcxx/include/__configuration/availability.h
@@ -70,15 +70,15 @@
 // For backwards compatibility, allow users to define _LIBCPP_DISABLE_AVAILABILITY
 // for a while.
 #if defined(_LIBCPP_DISABLE_AVAILABILITY)
-#undef _LIBCPP_HAS_VENDOR_AVAILABILITY_ANNOTATIONS
-#define _LIBCPP_HAS_VENDOR_AVAILABILITY_ANNOTATIONS 0
+#  undef _LIBCPP_HAS_VENDOR_AVAILABILITY_ANNOTATIONS
+#  define _LIBCPP_HAS_VENDOR_AVAILABILITY_ANNOTATIONS 0
 #endif
 
 // Availability markup is disabled when building the library, or when a non-Clang
 // compiler is used because only Clang supports the necessary attributes.
 #if defined(_LIBCPP_BUILDING_LIBRARY) || defined(_LIBCXXABI_BUILDING_LIBRARY) || !defined(_LIBCPP_COMPILER_CLANG_BASED)
-#undef _LIBCPP_HAS_VENDOR_AVAILABILITY_ANNOTATIONS
-#define _LIBCPP_HAS_VENDOR_AVAILABILITY_ANNOTATIONS 0
+#  undef _LIBCPP_HAS_VENDOR_AVAILABILITY_ANNOTATIONS
+#  define _LIBCPP_HAS_VENDOR_AVAILABILITY_ANNOTATIONS 0
 #endif
 
 // When availability annotations are disabled, we take for granted that features introduced
diff --git a/libcxx/modules/std/codecvt.inc b/libcxx/modules/std/codecvt.inc
index 7ad2d3bdc2..07accd5134 100644
--- a/libcxx/modules/std/codecvt.inc
+++ b/libcxx/modules/std/codecvt.inc
@@ -16,5 +16,5 @@ export namespace std {
   using std::codecvt_utf8;
   using std::codecvt_utf8_utf16;
 #  endif // _LIBCPP_STD_VER < 26 || defined(_LIBCPP_ENABLE_CXX26_REMOVED_CODECVT)
-#endif // _LIBCPP_HAS_LOCALIZATION
+#endif   // _LIBCPP_HAS_LOCALIZATION
 } // namespace std
diff --git a/libcxx/modules/std/strstream.inc b/libcxx/modules/std/strstream.inc
index 7807318895..5b9d45ad9e 100644
--- a/libcxx/modules/std/strstream.inc
+++ b/libcxx/modules/std/strstream.inc
@@ -15,5 +15,5 @@ export namespace std {
   using std::strstream;
   using std::strstreambuf;
 #  endif // _LIBCPP_STD_VER < 26 || defined(_LIBCPP_ENABLE_CXX26_REMOVED_STRSTREAM)
-#endif // _LIBCPP_HAS_LOCALIZATION
+#endif   // _LIBCPP_HAS_LOCALIZATION
 } // namespace std
diff --git a/libcxx/test/libcxx/depr/depr.c.headers/extern_c.pass.cpp b/libcxx/test/libcxx/depr/depr.c.headers/extern_c.pass.cpp
index e51b183a59..f77b7a9580 100644
--- a/libcxx/test/libcxx/depr/depr.c.headers/extern_c.pass.cpp
+++ b/libcxx/test/libcxx/depr/depr.c.headers/extern_c.pass.cpp
@@ -27,7 +27,7 @@ extern "C" {
 #include <iso646.h>
 #include <limits.h>
 #if _LIBCPP_HAS_LOCALIZATION
-#   include <locale.h>
+#  include <locale.h>
 #endif
 #include <math.h>
 #include <setjmp.h>
@@ -44,8 +44,8 @@ extern "C" {
 #include <time.h>
 // FIXME: #include <uchar.h>
 #if _LIBCPP_HAS_WIDE_CHARACTERS
-#   include <wchar.h>
-#   include <wctype.h>
+#  include <wchar.h>
+#  include <wctype.h>
 #endif
 }
 
diff --git a/libcxx/test/libcxx/include_as_c.sh.cpp b/libcxx/test/libcxx/include_as_c.sh.cpp
index 9b16d8953c..fde1123743 100644
--- a/libcxx/test/libcxx/include_as_c.sh.cpp
+++ b/libcxx/test/libcxx/include_as_c.sh.cpp
@@ -30,7 +30,7 @@
 #include <inttypes.h>
 #include <limits.h>
 #if _LIBCPP_HAS_LOCALIZATION
-#   include <locale.h>
+#  include <locale.h>
 #endif
 #include <math.h>
 #include <setjmp.h>
@@ -47,8 +47,8 @@
 #    include <tgmath.h>
 #endif
 #if _LIBCPP_HAS_WIDE_CHARACTERS
-#   include <wchar.h>
-#   include <wctype.h>
+#  include <wchar.h>
+#  include <wctype.h>
 #endif
 
 int main(int argc, char **argv) {
diff --git a/libcxx/test/support/test_macros.h b/libcxx/test/support/test_macros.h
index 03a55b1c39..11113021b7 100644
--- a/libcxx/test/support/test_macros.h
+++ b/libcxx/test/support/test_macros.h
@@ -388,11 +388,11 @@ inline Tp const& DoNotOptimize(Tp const& value) {
 
 // Support for carving out parts of the test suite, like removing wide characters, etc.
 #if defined(_LIBCPP_VERSION) && !_LIBCPP_HAS_WIDE_CHARACTERS
-#   define TEST_HAS_NO_WIDE_CHARACTERS
+#  define TEST_HAS_NO_WIDE_CHARACTERS
 #endif
 
 #if defined(_LIBCPP_VERSION) && !_LIBCPP_HAS_UNICODE
-#   define TEST_HAS_NO_UNICODE
+#  define TEST_HAS_NO_UNICODE
 #elif defined(_MSVC_EXECUTION_CHARACTER_SET) && _MSVC_EXECUTION_CHARACTER_SET != 65001
 #   define TEST_HAS_NO_UNICODE
 #endif

``````````

</details>


https://github.com/llvm/llvm-project/pull/112094


More information about the libcxx-commits mailing list