Skip to content

Conversation

@saturn691
Copy link
Contributor

Following discussion from https://discourse.llvm.org/t/missing-declarations-in-header-files/86678, we decided to add a flag to output all headers. Requires #144049.

  • Allows outputting all headers
  • Minor whitespace change for alignment

@llvmbot llvmbot added the libc label Jun 13, 2025
@llvmbot
Copy link
Member

llvmbot commented Jun 13, 2025

@llvm/pr-subscribers-libc

Author: William Huynh (saturn691)

Changes

Following discussion from https://discourse.llvm.org/t/missing-declarations-in-header-files/86678, we decided to add a flag to output all headers. Requires #144049.

  • Allows outputting all headers
  • Minor whitespace change for alignment

Full diff: https://github.com/llvm/llvm-project/pull/144114.diff

2 Files Affected:

  • (modified) libc/cmake/modules/LLVMLibCHeaderRules.cmake (+6-1)
  • (modified) libc/test/UnitTest/CMakeLists.txt (+1-1)
diff --git a/libc/cmake/modules/LLVMLibCHeaderRules.cmake b/libc/cmake/modules/LLVMLibCHeaderRules.cmake
index 99f90244e0134..add58756dfc17 100644
--- a/libc/cmake/modules/LLVMLibCHeaderRules.cmake
+++ b/libc/cmake/modules/LLVMLibCHeaderRules.cmake
@@ -97,8 +97,13 @@ function(add_gen_header target_name)
   set(out_file ${LIBC_INCLUDE_DIR}/${relative_path})
   set(dep_file "${out_file}.d")
   set(yaml_file ${CMAKE_SOURCE_DIR}/${ADD_GEN_HDR_YAML_FILE})
+  
+  if(LIBC_CONF_OUTPUT_ALL_HEADERS)
+    set(entry_points "")
+  else()
+    set(entry_points "${TARGET_ENTRYPOINT_NAME_LIST}")
+  endif()
 
-  set(entry_points "${TARGET_ENTRYPOINT_NAME_LIST}")
   list(TRANSFORM entry_points PREPEND "--entry-point=")
 
   add_custom_command(
diff --git a/libc/test/UnitTest/CMakeLists.txt b/libc/test/UnitTest/CMakeLists.txt
index b0a3a7431c222..c32809da577d4 100644
--- a/libc/test/UnitTest/CMakeLists.txt
+++ b/libc/test/UnitTest/CMakeLists.txt
@@ -35,7 +35,7 @@ function(add_unittest_framework_library name)
   else()
     _get_common_test_compile_options(compile_options "" "")
     target_compile_options(${name}.unit PRIVATE ${compile_options})
-endif()
+  endif()
 
   _get_hermetic_test_compile_options(compile_options "")
   target_include_directories(${name}.hermetic PRIVATE ${LIBC_INCLUDE_DIR})

set(dep_file "${out_file}.d")
set(yaml_file ${CMAKE_SOURCE_DIR}/${ADD_GEN_HDR_YAML_FILE})

if(LIBC_CONF_OUTPUT_ALL_HEADERS)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This flag looks good, but you should add an option in the cmake to the top level CMakeLists: https://github.com/llvm/llvm-project/blob/main/libc/CMakeLists.txt#L138

Also the CONF options are intended to come from config.json, this user-exposed cmake flag can just be LIBC_OUTPUT_ALL_HEADERS

Copy link
Contributor

@michaelrj-google michaelrj-google left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor phrasing suggestion, but otherwise LGTM

Co-authored-by: Michael Jones <[email protected]>
Copy link
Contributor

@michaelrj-google michaelrj-google left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I'll merge this once the presubmits finish

michaelrj-google pushed a commit that referenced this pull request Jun 13, 2025
Fixes a couple of bugs found when building. The PR to enable the headers
can be found here: #144114.

- math.yaml: float128 guard
- wchar.yaml: __restrict keyword order
@michaelrj-google michaelrj-google merged commit 473dea9 into llvm:main Jun 13, 2025
15 of 16 checks passed
tomtor pushed a commit to tomtor/llvm-project that referenced this pull request Jun 14, 2025
Fixes a couple of bugs found when building. The PR to enable the headers
can be found here: llvm#144114.

- math.yaml: float128 guard
- wchar.yaml: __restrict keyword order
tomtor pushed a commit to tomtor/llvm-project that referenced this pull request Jun 14, 2025
)

Following discussion from
https://discourse.llvm.org/t/missing-declarations-in-header-files/86678,
we decided to add a flag to output all headers. Requires llvm#144049.

- Allows outputting all headers
- Minor whitespace change for alignment

---------

Co-authored-by: Michael Jones <[email protected]>
saturn691 added a commit to saturn691/arm-toolchain that referenced this pull request Jun 16, 2025
Follows from llvm/llvm-project#144114
LLVM-libc doesn't provide all functions, but it is reasonable
to expect the signature in the header file, consistent with
picolibc. This allows the user to implement it later.
saturn691 added a commit to saturn691/arm-toolchain that referenced this pull request Jun 16, 2025
Follows from llvm/llvm-project#144114
LLVM-libc doesn't provide all functions, but it is reasonable
to expect the signature in the header file, consistent with
picolibc. This allows the user to implement it later.
saturn691 added a commit to arm/arm-toolchain that referenced this pull request Jun 16, 2025
Follows from llvm/llvm-project#144114 LLVM-libc
doesn't provide all functions, but it is reasonable to expect the
signature in the header file, consistent with picolibc. This allows the
user to implement it later.
akuhlens pushed a commit to akuhlens/llvm-project that referenced this pull request Jun 24, 2025
Fixes a couple of bugs found when building. The PR to enable the headers
can be found here: llvm#144114.

- math.yaml: float128 guard
- wchar.yaml: __restrict keyword order
akuhlens pushed a commit to akuhlens/llvm-project that referenced this pull request Jun 24, 2025
)

Following discussion from
https://discourse.llvm.org/t/missing-declarations-in-header-files/86678,
we decided to add a flag to output all headers. Requires llvm#144049.

- Allows outputting all headers
- Minor whitespace change for alignment

---------

Co-authored-by: Michael Jones <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants