brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · beda0e1 Raw
36 lines · plain
1.. title:: clang-tidy - llvmlibc-restrict-system-libc-headers2 3llvmlibc-restrict-system-libc-headers4=====================================5 6Finds includes of system libc headers not provided by the compiler within7llvm-libc implementations.8 9.. code-block:: c++10 11   #include <stdio.h>            // Not allowed because it is part of system libc.12   #include <stddef.h>           // Allowed because it is provided by the compiler.13   #include "internal/stdio.h"   // Allowed because it is NOT part of system libc.14 15 16This check is necessary because accidentally including system libc headers can17lead to subtle and hard to detect bugs. For example consider a system libc18whose ``dirent`` struct has slightly different field ordering than llvm-libc.19While this will compile successfully, this can cause issues during runtime20because they are ABI incompatible.21 22Options23-------24 25.. option:: Includes26 27   A string containing a comma separated glob list of allowed include28   filenames. Similar to the -checks glob list for running clang-tidy itself,29   the two wildcard characters are `*` and `-`, to include and exclude globs,30   respectively. The default is `-*`, which disallows all includes.31 32   This can be used to allow known safe includes such as Linux development33   headers. See :doc:`portability-restrict-system-includes34   <../portability/restrict-system-includes>` for more35   details.36