[libc-commits] [libc] [libc][NFC] Format CMake files under libc/ (PR #228527)

Jeff Bailey via libc-commits libc-commits at lists.llvm.org
Fri Oct 9 00:22:54 PDT 2026


https://github.com/kaladron updated https://github.com/llvm/llvm-project/pull/228527

>From f90800debf1d74a72b6cfdb472d59f85145fa566 Mon Sep 17 00:00:00 2001
From: Jeff Bailey <jbailey at raspberryginger.com>
Date: Fri, 2 Oct 2026 15:04:38 +0100
Subject: [PATCH 1/2] [libc][NFC] Format CMake files under libc/

Run libc/utils/cmake_format.py across libc/ to format CMake files
modified since commit 8969ae16e065.

Assisted-by: Automated tooling, human reviewed.
---
 libc/CMakeLists.txt                           | 22 +++++++++----------
 .../caches/armv8m.main-none-eabihf.cmake      |  2 +-
 .../modules/LLVMLibCCompileOptionRules.cmake  |  2 +-
 libc/cmake/modules/LLVMLibCTestRules.cmake    |  4 ++--
 libc/fuzzing/__support/CMakeLists.txt         |  2 +-
 .../linux/syscall_wrappers/CMakeLists.txt     |  1 -
 libc/src/__support/macros/CMakeLists.txt      |  1 -
 libc/src/grp/CMakeLists.txt                   |  2 +-
 libc/src/stdlib/CMakeLists.txt                |  1 -
 libc/src/stdlib/linux/CMakeLists.txt          |  1 -
 libc/test/src/mathvec/CMakeLists.txt          |  2 +-
 libc/test/src/stdlib/CMakeLists.txt           |  1 -
 libc/test/src/sys/stat/CMakeLists.txt         |  2 +-
 13 files changed, 19 insertions(+), 24 deletions(-)

diff --git a/libc/CMakeLists.txt b/libc/CMakeLists.txt
index 292e4c90a26a85..6f72a0227fdbbd 100644
--- a/libc/CMakeLists.txt
+++ b/libc/CMakeLists.txt
@@ -102,22 +102,22 @@ set(LIBC_TEST_LINK_OPTIONS_DEFAULT "" CACHE STRING "Common link options for all
 # Enable source-based code coverage using Clang's continuous profiling mode.
 option(LIBC_ENABLE_COVERAGE "Build libc with coverage instrumentation" OFF)
 option(LIBC_ENABLE_COVERAGE_MCDC
-       "Enable Modified Condition / Decision Coverage (MC/DC)" OFF)
+  "Enable Modified Condition / Decision Coverage (MC/DC)" OFF)
 if(LIBC_ENABLE_COVERAGE)
   if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
     list(APPEND LIBC_COMPILE_OPTIONS_DEFAULT
-         "-fprofile-instr-generate=libc_cov_%p.profraw"
-         "-fcoverage-mapping"
-         "-fprofile-continuous")
+      "-fprofile-instr-generate=libc_cov_%p.profraw"
+      "-fcoverage-mapping"
+      "-fprofile-continuous")
     list(APPEND LIBC_TEST_LINK_OPTIONS_DEFAULT
-         "-fprofile-instr-generate=libc_cov_%p.profraw"
-         "-fprofile-continuous")
+      "-fprofile-instr-generate=libc_cov_%p.profraw"
+      "-fprofile-continuous")
     if(LIBC_ENABLE_COVERAGE_MCDC)
       list(APPEND LIBC_COMPILE_OPTIONS_DEFAULT "-fcoverage-mcdc")
     endif()
   else()
     message(FATAL_ERROR
-            "Coverage instrumentation is currently only supported with Clang")
+      "Coverage instrumentation is currently only supported with Clang")
   endif()
 endif()
 
@@ -200,16 +200,16 @@ if(LIBC_ENABLE_COVERAGE)
     endif()
     execute_process(
       COMMAND ${CMAKE_CXX_COMPILER} ${target_arg}
-              --print-file-name=libclang_rt.profile.a
+        --print-file-name=libclang_rt.profile.a
       OUTPUT_STRIP_TRAILING_WHITESPACE
       OUTPUT_VARIABLE libc_profile_lib
     )
     if(NOT EXISTS "${libc_profile_lib}")
       set(profile_arch_lib
-          "libclang_rt.profile-${LIBC_TARGET_ARCHITECTURE}.a")
+        "libclang_rt.profile-${LIBC_TARGET_ARCHITECTURE}.a")
       execute_process(
         COMMAND ${CMAKE_CXX_COMPILER} ${target_arg}
-                --print-file-name=${profile_arch_lib}
+          --print-file-name=${profile_arch_lib}
         OUTPUT_STRIP_TRAILING_WHITESPACE
         OUTPUT_VARIABLE libc_profile_lib
       )
@@ -218,7 +218,7 @@ if(LIBC_ENABLE_COVERAGE)
       message(FATAL_ERROR "Coverage enabled but profile runtime not found.")
     endif()
     set(LIBC_CLANG_PROFILE_LIB "${libc_profile_lib}"
-        CACHE INTERNAL "Clang profile runtime")
+      CACHE INTERNAL "Clang profile runtime")
   endif()
 endif()
 option(LLVM_LIBC_IMPLEMENTATION_DEFINED_TEST_BEHAVIOR "Build LLVM libc tests assuming our implementation-defined behavior" ON)
diff --git a/libc/cmake/caches/armv8m.main-none-eabihf.cmake b/libc/cmake/caches/armv8m.main-none-eabihf.cmake
index 46c71dedb0c3a2..e95b0fd8b97ef3 100644
--- a/libc/cmake/caches/armv8m.main-none-eabihf.cmake
+++ b/libc/cmake/caches/armv8m.main-none-eabihf.cmake
@@ -2,7 +2,7 @@ set(CMAKE_SYSTEM_PROCESSOR arm CACHE STRING "")
 set(RUNTIMES_TARGET_TRIPLE "armv8m.main-none-eabihf" CACHE STRING "")
 
 foreach(lang C;CXX;ASM)
-    set(CMAKE_${lang}_FLAGS "-mfloat-abi=hard -march=armv8m.main+fp+dsp -mcpu=cortex-m33" CACHE STRING "")
+  set(CMAKE_${lang}_FLAGS "-mfloat-abi=hard -march=armv8m.main+fp+dsp -mcpu=cortex-m33" CACHE STRING "")
 endforeach()
 
 include(${CMAKE_CURRENT_LIST_DIR}/baremetal_common.cmake)
diff --git a/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake b/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake
index 79f2d80bcba7a1..95f398e10855fb 100644
--- a/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake
+++ b/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake
@@ -200,7 +200,7 @@ function(_get_compile_options_from_config output_var)
   if(LIBC_COPT_HARDENING_MODE)
     libc_add_definition(config_options "LIBC_COPT_HARDENING_MODE=${LIBC_COPT_HARDENING_MODE}")
   endif()
-  
+
   if(LIBC_CONF_SCANF_PROVIDE_ISOC99_ALIASES)
     list(APPEND config_options "-DLIBC_COPT_SCANF_PROVIDE_ISOC99_ALIASES")
   endif()
diff --git a/libc/cmake/modules/LLVMLibCTestRules.cmake b/libc/cmake/modules/LLVMLibCTestRules.cmake
index 917e0ce2a9b052..23a86ba8ef96de 100644
--- a/libc/cmake/modules/LLVMLibCTestRules.cmake
+++ b/libc/cmake/modules/LLVMLibCTestRules.cmake
@@ -830,7 +830,7 @@ function(add_libc_hermetic test_name)
   endif()
 
   if(LIBC_ENABLE_COVERAGE)
-     set(coverage_deps
+    set(coverage_deps
       libc.src.stdio.fclose
       libc.src.stdio.fdopen
       libc.src.stdio.feof
@@ -996,7 +996,7 @@ function(add_libc_hermetic test_name)
   if(LIBC_ENABLE_COVERAGE)
     set(coverage_link_libs
       "${LIBC_CLANG_PROFILE_LIB}"
-       ${fq_target_name}.__libc__
+      ${fq_target_name}.__libc__
     )
   endif()
 
diff --git a/libc/fuzzing/__support/CMakeLists.txt b/libc/fuzzing/__support/CMakeLists.txt
index 2fbaa2f7cd6cff..eec09a1dc1daeb 100644
--- a/libc/fuzzing/__support/CMakeLists.txt
+++ b/libc/fuzzing/__support/CMakeLists.txt
@@ -59,7 +59,7 @@ if(LLVM_LIBC_FULL_BUILD AND NOT LIBC_TARGET_OS_IS_GPU)
   # the use of -DCMAKE_MSVC_DEBUG_INFORMATION_FORMAT=Embedded.
   get_fq_target_name(freelist_heap_fuzz freelist_heap_fuzz_target_name)
   get_fq_target_name(freelist_heap_rotation_fuzz
-                     freelist_heap_rotation_fuzz_target_name)
+    freelist_heap_rotation_fuzz_target_name)
   set_target_properties(
     ${freelist_heap_fuzz_target_name}
     ${freelist_heap_rotation_fuzz_target_name}
diff --git a/libc/src/__support/OSUtil/linux/syscall_wrappers/CMakeLists.txt b/libc/src/__support/OSUtil/linux/syscall_wrappers/CMakeLists.txt
index 2a24b6b28cab0f..f02e18eda600fe 100644
--- a/libc/src/__support/OSUtil/linux/syscall_wrappers/CMakeLists.txt
+++ b/libc/src/__support/OSUtil/linux/syscall_wrappers/CMakeLists.txt
@@ -1543,4 +1543,3 @@ add_header_library(
     libc.src.__support.error_or
     libc.src.__support.macros.config
 )
-
diff --git a/libc/src/__support/macros/CMakeLists.txt b/libc/src/__support/macros/CMakeLists.txt
index c9afc2829dbcbb..c600b453af510f 100644
--- a/libc/src/__support/macros/CMakeLists.txt
+++ b/libc/src/__support/macros/CMakeLists.txt
@@ -60,4 +60,3 @@ add_header_library(
   HDRS
     hardening.h
 )
-
diff --git a/libc/src/grp/CMakeLists.txt b/libc/src/grp/CMakeLists.txt
index f7a2c81eea181c..d0c5b47d71eee1 100644
--- a/libc/src/grp/CMakeLists.txt
+++ b/libc/src/grp/CMakeLists.txt
@@ -1,5 +1,5 @@
 if(NOT TARGET libc.src.__support.File.file OR
-   NOT TARGET libc.src.__support.File.platform_file)
+  NOT TARGET libc.src.__support.File.platform_file)
   return()
 endif()
 
diff --git a/libc/src/stdlib/CMakeLists.txt b/libc/src/stdlib/CMakeLists.txt
index faa31c62d1d8e8..7a584379decb2f 100644
--- a/libc/src/stdlib/CMakeLists.txt
+++ b/libc/src/stdlib/CMakeLists.txt
@@ -872,4 +872,3 @@ add_entrypoint_object(
   DEPENDS
     .${LIBC_TARGET_OS}.system
 )
-
diff --git a/libc/src/stdlib/linux/CMakeLists.txt b/libc/src/stdlib/linux/CMakeLists.txt
index e8711b73985862..00d108767ac20c 100644
--- a/libc/src/stdlib/linux/CMakeLists.txt
+++ b/libc/src/stdlib/linux/CMakeLists.txt
@@ -200,4 +200,3 @@ add_entrypoint_object(
     libc.src.__support.macros.config
     libc.src.__support.macros.null_check
 )
-
diff --git a/libc/test/src/mathvec/CMakeLists.txt b/libc/test/src/mathvec/CMakeLists.txt
index 85a3e09bd22526..597845abcc9596 100644
--- a/libc/test/src/mathvec/CMakeLists.txt
+++ b/libc/test/src/mathvec/CMakeLists.txt
@@ -421,7 +421,7 @@ add_fp_unittest(
 )
 
 if(NOT LIBC_CONF_MATH_OPTIMIZATIONS MATCHES
-   "LIBC_MATH_INTERMEDIATE_COMP_IN_FLOAT")
+  "LIBC_MATH_INTERMEDIATE_COMP_IN_FLOAT")
   add_fp_unittest(
     sinf_test
     SUITE
diff --git a/libc/test/src/stdlib/CMakeLists.txt b/libc/test/src/stdlib/CMakeLists.txt
index 40167c1638cc78..cc00bb5b381011 100644
--- a/libc/test/src/stdlib/CMakeLists.txt
+++ b/libc/test/src/stdlib/CMakeLists.txt
@@ -669,4 +669,3 @@ add_libc_test(
     libc.test.UnitTest.ErrnoCheckingTest
     libc.test.UnitTest.ErrnoSetterMatcher
 )
-
diff --git a/libc/test/src/sys/stat/CMakeLists.txt b/libc/test/src/sys/stat/CMakeLists.txt
index 9851488f67c034..72f44c68d03576 100644
--- a/libc/test/src/sys/stat/CMakeLists.txt
+++ b/libc/test/src/sys/stat/CMakeLists.txt
@@ -292,7 +292,7 @@ add_libc_test(
     libc.src.fcntl.open
     libc.src.sys.stat.stat
     libc.src.unistd.close
-    libc.src.stdio.remove    
+    libc.src.stdio.remove
     libc.src.__support.CPP.scope
     libc.test.UnitTest.ErrnoCheckingTest
     libc.test.UnitTest.ErrnoSetterMatcher

>From 25005cce37aa5ffbd0b839338cf7b297dcf75faf Mon Sep 17 00:00:00 2001
From: Jeff Bailey <jbailey at raspberryginger.com>
Date: Fri, 9 Oct 2026 08:22:42 +0100
Subject: [PATCH 2/2] [libc][NFC] Format CMake files modified on main

Formatted the remaining 8 CMake files under libc/ modified on main
prior to #228526 merging.

Assisted-by: Automated tooling, human reviewed.
---
 libc/CMakeLists.txt                           |  4 ++--
 libc/cmake/modules/LLVMLibCTestRules.cmake    |  4 ++--
 libc/fuzzing/arpa/inet/CMakeLists.txt         |  1 -
 libc/lib/CMakeLists.txt                       |  2 +-
 .../linux/syscall_wrappers/CMakeLists.txt     |  1 -
 libc/startup/baremetal/CMakeLists.txt         |  6 ++---
 libc/test/src/__support/CMakeLists.txt        |  2 +-
 libc/test/src/math/smoke/CMakeLists.txt       | 24 +++++++++----------
 8 files changed, 21 insertions(+), 23 deletions(-)

diff --git a/libc/CMakeLists.txt b/libc/CMakeLists.txt
index df062085d141ed..6a1e9ac9e83069 100644
--- a/libc/CMakeLists.txt
+++ b/libc/CMakeLists.txt
@@ -263,8 +263,8 @@ if(LIBC_ENABLE_COVERAGE)
   endif()
 endif()
 option(LLVM_LIBC_HERMETIC_TEST_USE_INTERNAL_STARTUP
-       "Link hermetic tests against LLVM libc's own startup object"
-       ON)
+  "Link hermetic tests against LLVM libc's own startup object"
+  ON)
 option(LLVM_LIBC_IMPLEMENTATION_DEFINED_TEST_BEHAVIOR "Build LLVM libc tests assuming our implementation-defined behavior" ON)
 option(LLVM_LIBC_ENABLE_LINTING "Enables linting of libc source files" OFF)
 option(LLVM_LIBC_ALL_HEADERS "Outputs all functions in header files, regardless of whether they are enabled on this target" OFF)
diff --git a/libc/cmake/modules/LLVMLibCTestRules.cmake b/libc/cmake/modules/LLVMLibCTestRules.cmake
index 18c50aba024ca8..cde5519d0a3151 100644
--- a/libc/cmake/modules/LLVMLibCTestRules.cmake
+++ b/libc/cmake/modules/LLVMLibCTestRules.cmake
@@ -214,8 +214,8 @@ function(get_object_files_for_test result skipped_entrypoints_list)
           # object. External baremetal startup code can reference the public C exit
           # symbol, so use the public-packaging object for exit in this configuration.
           if(dep STREQUAL "libc.src.stdlib.exit" AND
-             NOT LLVM_LIBC_HERMETIC_TEST_USE_INTERNAL_STARTUP AND
-             LIBC_TARGET_OS_IS_BAREMETAL)
+            NOT LLVM_LIBC_HERMETIC_TEST_USE_INTERNAL_STARTUP AND
+            LIBC_TARGET_OS_IS_BAREMETAL)
             string(REPLACE ".__internal__" "" object_file_raw ${object_file_raw})
           endif()
           list(APPEND dep_obj ${object_file_raw})
diff --git a/libc/fuzzing/arpa/inet/CMakeLists.txt b/libc/fuzzing/arpa/inet/CMakeLists.txt
index 244438620c7562..1422ebea660444 100644
--- a/libc/fuzzing/arpa/inet/CMakeLists.txt
+++ b/libc/fuzzing/arpa/inet/CMakeLists.txt
@@ -26,4 +26,3 @@ add_libc_fuzzer(
     libc.src.arpa.inet.inet_pton
     libc.src.errno.errno
 )
-
diff --git a/libc/lib/CMakeLists.txt b/libc/lib/CMakeLists.txt
index b244a8f7667561..48d129132a5179 100644
--- a/libc/lib/CMakeLists.txt
+++ b/libc/lib/CMakeLists.txt
@@ -27,7 +27,7 @@ elseif(LLVM_LIBC_FULL_BUILD)
   list(APPEND libc_archive_names c m mvec)
   list(APPEND libc_archive_targets libc libm libmvec)
   list(APPEND libc_archive_entrypoint_lists
-       TARGET_LIBC_ENTRYPOINTS TARGET_LIBM_ENTRYPOINTS TARGET_LIBMVEC_ENTRYPOINTS)
+    TARGET_LIBC_ENTRYPOINTS TARGET_LIBM_ENTRYPOINTS TARGET_LIBMVEC_ENTRYPOINTS)
 else()
   list(APPEND libc_archive_names llvmlibc)
   list(APPEND libc_archive_targets libc)
diff --git a/libc/src/__support/OSUtil/linux/syscall_wrappers/CMakeLists.txt b/libc/src/__support/OSUtil/linux/syscall_wrappers/CMakeLists.txt
index 47ddb551680199..602531273ac815 100644
--- a/libc/src/__support/OSUtil/linux/syscall_wrappers/CMakeLists.txt
+++ b/libc/src/__support/OSUtil/linux/syscall_wrappers/CMakeLists.txt
@@ -1606,4 +1606,3 @@ add_header_library(
     libc.src.__support.error_or
     libc.src.__support.macros.config
 )
-
diff --git a/libc/startup/baremetal/CMakeLists.txt b/libc/startup/baremetal/CMakeLists.txt
index d186b65688c809..668af64ff84b00 100644
--- a/libc/startup/baremetal/CMakeLists.txt
+++ b/libc/startup/baremetal/CMakeLists.txt
@@ -71,7 +71,7 @@ set(fq_target_name libc.startup.baremetal.${LIBC_TARGET_ARCHITECTURE}.crt1)
 add_dependencies(libc-startup ${fq_target_name})
 if(NOT LLVM_LIBC_ENABLE_MINOR_VARIANT)
   install(FILES $<TARGET_OBJECTS:${fq_target_name}>
-          DESTINATION ${LIBC_INSTALL_LIBRARY_DIR}
-          RENAME $<TARGET_PROPERTY:${fq_target_name},OUTPUT_NAME>
-          COMPONENT libc)
+    DESTINATION ${LIBC_INSTALL_LIBRARY_DIR}
+    RENAME $<TARGET_PROPERTY:${fq_target_name},OUTPUT_NAME>
+    COMPONENT libc)
 endif()
diff --git a/libc/test/src/__support/CMakeLists.txt b/libc/test/src/__support/CMakeLists.txt
index c71385d98898b5..765eec6b421780 100644
--- a/libc/test/src/__support/CMakeLists.txt
+++ b/libc/test/src/__support/CMakeLists.txt
@@ -301,7 +301,7 @@ add_libc_test(
 )
 
 if(LIBC_TARGET_OS_IS_BAREMETAL AND
-   NOT LLVM_LIBC_HERMETIC_TEST_USE_INTERNAL_STARTUP)
+  NOT LLVM_LIBC_HERMETIC_TEST_USE_INTERNAL_STARTUP)
   add_object_library(
     minimal_external_crt1_for_test
     SRCS
diff --git a/libc/test/src/math/smoke/CMakeLists.txt b/libc/test/src/math/smoke/CMakeLists.txt
index d647c24cfcf365..fe9fafdfab9a3f 100644
--- a/libc/test/src/math/smoke/CMakeLists.txt
+++ b/libc/test/src/math/smoke/CMakeLists.txt
@@ -5357,18 +5357,18 @@ add_fp_unittest(
 
 # TODO: Re-enable the test for GPU.
 if(NOT LIBC_TARGET_OS_IS_GPU)
-add_fp_unittest(
-  powf_test
-  SUITE
-    libc-math-smoke-tests
-  SRCS
-    powf_test.cpp
-  DEPENDS
-    libc.src.math.powf
-    libc.src.__support.math.powf_double_eval
-    libc.src.__support.math.powf_float_eval
-    libc.src.__support.FPUtil.fp_bits
-)
+  add_fp_unittest(
+    powf_test
+    SUITE
+      libc-math-smoke-tests
+    SRCS
+      powf_test.cpp
+    DEPENDS
+      libc.src.math.powf
+      libc.src.__support.math.powf_double_eval
+      libc.src.__support.math.powf_float_eval
+      libc.src.__support.FPUtil.fp_bits
+  )
 endif()
 
 add_fp_unittest(



More information about the libc-commits mailing list