Issue 83210
Summary [libc] convert preprocessor includes to "" for other libc sources
Labels code-cleanup, libc
Assignees
Reporter nickdesaulniers
    Forking the discussion from https://github.com/llvm/llvm-project/pull/83199#discussion_r1505142721.

> all the #includes in /include/ for things in llvm-libc-types or llvm-libc-macros currently use <>. It may be worthwhile to change this, but that should probably be one cleanup patch.

So we're pretty inconsistent in our use of `#include` preprocessor statement wrt `<>` vs `""`.  I _think_ we should move to the convention (and document it in our coding style):
- If the .h file is part of our sources, use `""`
- If the .h file is NOT part of our sources, use `<>`

https://gcc.gnu.org/onlinedocs/cpp/Search-Path.html is helpful, particularly:

> By default, the preprocessor looks for header files included by the quote form of the directive #include "file" first relative to the directory of the current file, and then in a preconfigured list of standard system directories. For example, if /usr/include/sys/stat.h contains #include "types.h", GCC looks for types.h first in /usr/include/sys, then in its usual search path.

> For the angle-bracket form #include <file>, the preprocessor’s default behavior is to look only in the standard system directories.

> The most commonly-used option is -Idir, which causes dir to be searched after the current directory (for the quote form of the directive) and ahead of the standard system directories.

Then I think that will help us refine our clang-tidy lint for this: #82695
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to