[libc-commits] [libc] [libc] Generate configure.rst from the JSON config information. (PR #65791)

Siva Chandra via libc-commits libc-commits at lists.llvm.org
Fri Sep 8 12:36:10 PDT 2023


================
@@ -135,3 +135,85 @@ function(load_libc_config config_file)
     set(${opt_name} ${opt_value} PARENT_SCOPE)
   endforeach()
 endfunction()
+
+function(generate_config_doc config_file doc_file)
+  if(NOT EXISTS ${config_file})
+    message(FATAL_ERROR "${config_file} does not exist")
+  endif()
+  file(READ ${config_file} json_config)
+  string(JSON group_count ERROR_VARIABLE json_error LENGTH ${json_config})
+  if(json_error)
+    message(FATAL_ERROR "${config_file}: ${json_error}")
+  endif()
+  if(${group_count} EQUAL 0)
+    message(FATAL_ERROR "${config_file}: Does not contain any config option groups")
+    return()
----------------
sivachandra wrote:

Yes. The idea is that if there are no config option groups, there should be no `config.json` added at all.

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


More information about the libc-commits mailing list