[libc-commits] [libc] 5753103 - [libc][doc] Update macros documentation

Guillaume Chatelet via libc-commits libc-commits at lists.llvm.org
Tue Aug 8 01:02:39 PDT 2023


Author: Guillaume Chatelet
Date: 2023-08-08T08:02:30Z
New Revision: 575310330bd503287fd8959a87b2b6efab2f3067

URL: https://github.com/llvm/llvm-project/commit/575310330bd503287fd8959a87b2b6efab2f3067
DIFF: https://github.com/llvm/llvm-project/commit/575310330bd503287fd8959a87b2b6efab2f3067.diff

LOG: [libc][doc] Update macros documentation

Update documentaiton now that macros are laid out in a more structured way.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D143911

Added: 
    

Modified: 
    libc/docs/dev/code_style.rst

Removed: 
    


################################################################################
diff  --git a/libc/docs/dev/code_style.rst b/libc/docs/dev/code_style.rst
index 72ce9dc068957a..0c3171b7c95027 100644
--- a/libc/docs/dev/code_style.rst
+++ b/libc/docs/dev/code_style.rst
@@ -27,7 +27,7 @@ 
diff erences are as follows:
 Macro style
 ===========
 
-We define two kinds of macros: **code defined** and **build defined** macros.
+We define two kinds of macros:
 
 #. **Build defined** macros are generated by `CMake` or `Bazel` and are passed
    down to the compiler with the ``-D`` command line flag. They start with the
@@ -35,15 +35,27 @@ We define two kinds of macros: **code defined** and **build defined** macros.
    They either denote an action or define a constant.
 
 #. **Code defined** macros are defined within the ``src/__support/macros``
-   folder. They all start with the ``LIBC_`` prefix. They are of two kinds
-
-   * **Properties** - Build related properties like used compiler, target
-     architecture or enabled CPU features defined by introspecting compiler
-     defined preprocessor definitions. e.g., ``LIBC_TARGET_ARCH_IS_ARM``,
-     ``LIBC_TARGET_CPU_HAS_AVX2``, ``LIBC_COMPILER_IS_CLANG``, ...
-   * **Attributes** - Compiler agnostic attributes or functions to handle
-     specific operations. e.g., ``LIBC_INLINE``, ``LIBC_NO_LOOP_UNROLL``,
-     ``LIBC_LIKELY``, ``LIBC_INLINE_ASM``.
+   folder. They all start with the ``LIBC_`` prefix.
+
+   * ``src/__support/macros/properties/`` - Build related properties like
+     target architecture or enabled CPU features defined by introspecting
+     compiler defined preprocessor defininitions.
+
+     * ``architectures.h`` - Target architecture properties.
+       e.g., ``LIBC_TARGET_ARCH_IS_ARM``.
+     * ``compiler.h`` - Host compiler properties.
+       e.g., ``LIBC_COMPILER_IS_CLANG``.
+     * ``cpu_features.h`` - Target cpu apu feature availability.
+       e.g., ``LIBC_TARGET_CPU_HAS_AVX2``.
+
+   * ``src/__support/macros/config.h`` - Important compiler and platform
+     features. Such macros can be used to produce portable code by
+     parameterizing compilation based on the presence or lack of a given
+     feature. e.g., ``LIBC_HAS_BUILTIN``
+   * ``src/__support/macros/attributes.h`` - Attributes for functions, types,
+     and variables. e.g., ``LIBC_UNUSED``
+   * ``src/__support/macros/optimization.h`` - Portable macros for performance
+     optimization. e.g., ``LIBC_LIKELY``, ``LIBC_LOOP_NOUNROLL``
 
 Inline functions and variables defined in header files
 ======================================================


        


More information about the libc-commits mailing list