[libc-commits] [libc] [libc] Add a developer doc about adding new config options. (PR #66432)

Guillaume Chatelet via libc-commits libc-commits at lists.llvm.org
Fri Sep 15 00:45:43 PDT 2023


================
@@ -0,0 +1,138 @@
+.. _configure_options:
+
+=================================
+Adding new libc configure options
+=================================
+
+`There are a number of configure options <../configure.html>`_ which can be used
+to configure the libc build. The config system is driven by a set of
+hierarchical JSON files. At the top of the hierarchy is a JSON file by name
+``config.json`` in the ``config`` directory. This JSON file lists the libc
+options which affect all platforms. The default value for the option and a short
+description about it listed against each option. For example:
+
+.. code-block::
+
+   {
+     "printf": {
+       "LIBC_CONF_PRINTF_DISABLE_FLOAT": {
+         "value": false,
+         "doc": "Disable printing floating point values in printf and friends."
+       },
+       ...
+     }
+   }
+
+The above config indicates that the option ``LIBC_CONF_PRINTF_DISABLE_FLOAT``
+has a value of false. A platform, say the baremetal platform, can choose to
+override this value in its ``config.json`` file in the ``config/baremetal``
+directory with the following contents:
+
+.. code-block::
+
+   {
+     "printf": {
+       "LIBC_CONF_PRINTF_DISABLE_FLOAT": {
+         "value": true
+       }
+     }
+   }
+
+As you can see, the config for the baremetal platform overrides the common
----------------
gchatelet wrote:

To avoid repetition with the next section : "As you can see, " -> "Here, "

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


More information about the libc-commits mailing list