How to let know developers automatically that this "bits/shared_ptr.h" is internal to standard library (gcc and clang).
#include <bits/shared_ptr.h>
// some code using std::shared_ptr
The best would be to also inform <memory>
should be used instead.
This <bits/shared_ptr.h>
is just an example - I mean - how to warn about any implementation header being included.
By "automatically" I mean - compiler warning or static analysis like clang-tidy.
I have tried "-Wall -Wextra -pedantic" and all clang-tidy checks, without llvm* checks - these llvm* warns for almost every header and it is just for llvm developers, not for us, regular developers.
Any advice?
I prefer existing solution, I know I can write script for that.
Ok, I found one check in clang-tidy that I can use.
It is portability-restrict-system-includes
Just need to specify in config that "bits" things are not allowed:
-config="CheckOptions: {portability-restrict-system-includes.Includes: '*,-bits/*,bitset'}"
See demo.
But, well, it is not perfect solution - one would need to maintain list of "not allowed" headers.