-
Notifications
You must be signed in to change notification settings - Fork 14.1k
[include-cleaner] Add POSIX symbol mappings #144748
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Add POSIX symbol-to-header mappings (e.g., `timeval`, `strsignal`, `signal`, `errno`) in new dedicated mapping files to avoid mixing with standard library mappings. Closes several related issues: llvm#64336, llvm#76567, llvm#89844, llvm#120830, llvm#134818. Co-authored-by: itislu <[email protected]>
Thank you for submitting a Pull Request (PR) to the LLVM Project! This PR will be automatically labeled and the relevant teams will be notified. If you wish to, you can add reviewers by using the "Reviewers" section on this page. If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers. If you have further questions, they may be answered by the LLVM GitHub User Guide. You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums. |
@llvm/pr-subscribers-clang Author: Ildikó Cseri (cseriildi) ChangesSummaryThis PR adds more symbol-header mappings that
Example diagnostic message from QuestionsWe would appreciate input on the following points:
Thanks in advance for your time and feedback! Patch is 30.03 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/144748.diff 3 Files Affected:
diff --git a/clang/lib/Tooling/Inclusions/Stdlib/CPosixSymbolMap.inc b/clang/lib/Tooling/Inclusions/Stdlib/CPosixSymbolMap.inc
new file mode 100644
index 0000000000000..ab967dd193c4c
--- /dev/null
+++ b/clang/lib/Tooling/Inclusions/Stdlib/CPosixSymbolMap.inc
@@ -0,0 +1,347 @@
+//===-- CPosixSymbolMap.inc ---------------------------------------*- C -*-===//
+//
+// This is a hand-curated list for C POSIX symbols that cannot be
+// parsed/extracted via the include-mapping tool (gen_std.py).
+//
+//===----------------------------------------------------------------------===//
+
+// clang-format off
+// prevent breaking <sys/types.h> -> <sys / types.h>
+
+// errno.h
+SYMBOL(E2BIG, None, <errno.h>)
+SYMBOL(EACCES, None, <errno.h>)
+SYMBOL(EADDRINUSE, None, <errno.h>)
+SYMBOL(EADDRNOTAVAIL, None, <errno.h>)
+SYMBOL(EAFNOSUPPORT, None, <errno.h>)
+SYMBOL(EAGAIN, None, <errno.h>)
+SYMBOL(EALREADY, None, <errno.h>)
+SYMBOL(EBADE, None, <errno.h>)
+SYMBOL(EBADF, None, <errno.h>)
+SYMBOL(EBADFD, None, <errno.h>)
+SYMBOL(EBADMSG, None, <errno.h>)
+SYMBOL(EBADR, None, <errno.h>)
+SYMBOL(EBADRQC, None, <errno.h>)
+SYMBOL(EBADSLT, None, <errno.h>)
+SYMBOL(EBUSY, None, <errno.h>)
+SYMBOL(ECANCELED, None, <errno.h>)
+SYMBOL(ECHILD, None, <errno.h>)
+SYMBOL(ECHRNG, None, <errno.h>)
+SYMBOL(ECOMM, None, <errno.h>)
+SYMBOL(ECONNABORTED, None, <errno.h>)
+SYMBOL(ECONNREFUSED, None, <errno.h>)
+SYMBOL(ECONNRESET, None, <errno.h>)
+SYMBOL(EDEADLK, None, <errno.h>)
+SYMBOL(EDEADLOCK, None, <errno.h>)
+SYMBOL(EDESTADDRREQ, None, <errno.h>)
+SYMBOL(EDQUOT, None, <errno.h>)
+SYMBOL(EEXIST, None, <errno.h>)
+SYMBOL(EFAULT, None, <errno.h>)
+SYMBOL(EFBIG, None, <errno.h>)
+SYMBOL(EHOSTDOWN, None, <errno.h>)
+SYMBOL(EHOSTUNREACH, None, <errno.h>)
+SYMBOL(EHWPOISON, None, <errno.h>)
+SYMBOL(EIDRM, None, <errno.h>)
+SYMBOL(EINPROGRESS, None, <errno.h>)
+SYMBOL(EINTR, None, <errno.h>)
+SYMBOL(EINVAL, None, <errno.h>)
+SYMBOL(EIO, None, <errno.h>)
+SYMBOL(EISCONN, None, <errno.h>)
+SYMBOL(EISDIR, None, <errno.h>)
+SYMBOL(EISNAM, None, <errno.h>)
+SYMBOL(EKEYEXPIRED, None, <errno.h>)
+SYMBOL(EKEYREJECTED, None, <errno.h>)
+SYMBOL(EKEYREVOKED, None, <errno.h>)
+SYMBOL(EL2HLT, None, <errno.h>)
+SYMBOL(EL2NSYNC, None, <errno.h>)
+SYMBOL(EL3HLT, None, <errno.h>)
+SYMBOL(EL3RST, None, <errno.h>)
+SYMBOL(ELIBACC, None, <errno.h>)
+SYMBOL(ELIBBAD, None, <errno.h>)
+SYMBOL(ELIBMAX, None, <errno.h>)
+SYMBOL(ELIBSCN, None, <errno.h>)
+SYMBOL(ELIBEXEC, None, <errno.h>)
+SYMBOL(ELNRNG, None, <errno.h>)
+SYMBOL(ELOOP, None, <errno.h>)
+SYMBOL(EMEDIUMTYPE, None, <errno.h>)
+SYMBOL(EMFILE, None, <errno.h>)
+SYMBOL(EMLINK, None, <errno.h>)
+SYMBOL(EMSGSIZE, None, <errno.h>)
+SYMBOL(EMULTIHOP, None, <errno.h>)
+SYMBOL(ENAMETOOLONG, None, <errno.h>)
+SYMBOL(ENETDOWN, None, <errno.h>)
+SYMBOL(ENETRESET, None, <errno.h>)
+SYMBOL(ENETUNREACH, None, <errno.h>)
+SYMBOL(ENFILE, None, <errno.h>)
+SYMBOL(ENOANO, None, <errno.h>)
+SYMBOL(ENOBUFS, None, <errno.h>)
+SYMBOL(ENODATA, None, <errno.h>)
+SYMBOL(ENODEV, None, <errno.h>)
+SYMBOL(ENOENT, None, <errno.h>)
+SYMBOL(ENOEXEC, None, <errno.h>)
+SYMBOL(ENOKEY, None, <errno.h>)
+SYMBOL(ENOLCK, None, <errno.h>)
+SYMBOL(ENOLINK, None, <errno.h>)
+SYMBOL(ENOMEDIUM, None, <errno.h>)
+SYMBOL(ENOMEM, None, <errno.h>)
+SYMBOL(ENOMSG, None, <errno.h>)
+SYMBOL(ENONET, None, <errno.h>)
+SYMBOL(ENOPKG, None, <errno.h>)
+SYMBOL(ENOPROTOOPT, None, <errno.h>)
+SYMBOL(ENOSPC, None, <errno.h>)
+SYMBOL(ENOSR, None, <errno.h>)
+SYMBOL(ENOSTR, None, <errno.h>)
+SYMBOL(ENOSYS, None, <errno.h>)
+SYMBOL(ENOTBLK, None, <errno.h>)
+SYMBOL(ENOTCONN, None, <errno.h>)
+SYMBOL(ENOTDIR, None, <errno.h>)
+SYMBOL(ENOTEMPTY, None, <errno.h>)
+SYMBOL(ENOTRECOVERABLE, None, <errno.h>)
+SYMBOL(ENOTSOCK, None, <errno.h>)
+SYMBOL(ENOTSUP, None, <errno.h>)
+SYMBOL(ENOTTY, None, <errno.h>)
+SYMBOL(ENOTUNIQ, None, <errno.h>)
+SYMBOL(ENXIO, None, <errno.h>)
+SYMBOL(EOPNOTSUPP, None, <errno.h>)
+SYMBOL(EOVERFLOW, None, <errno.h>)
+SYMBOL(EOWNERDEAD, None, <errno.h>)
+SYMBOL(EPERM, None, <errno.h>)
+SYMBOL(EPFNOSUPPORT, None, <errno.h>)
+SYMBOL(EPIPE, None, <errno.h>)
+SYMBOL(EPROTO, None, <errno.h>)
+SYMBOL(EPROTONOSUPPORT, None, <errno.h>)
+SYMBOL(EPROTOTYPE, None, <errno.h>)
+SYMBOL(EREMCHG, None, <errno.h>)
+SYMBOL(EREMOTE, None, <errno.h>)
+SYMBOL(EREMOTEIO, None, <errno.h>)
+SYMBOL(ERESTART, None, <errno.h>)
+SYMBOL(ERFKILL, None, <errno.h>)
+SYMBOL(EROFS, None, <errno.h>)
+SYMBOL(ESHUTDOWN, None, <errno.h>)
+SYMBOL(ESPIPE, None, <errno.h>)
+SYMBOL(ESOCKTNOSUPPORT, None, <errno.h>)
+SYMBOL(ESRCH, None, <errno.h>)
+SYMBOL(ESTALE, None, <errno.h>)
+SYMBOL(ESTRPIPE, None, <errno.h>)
+SYMBOL(ETIME, None, <errno.h>)
+SYMBOL(ETIMEDOUT, None, <errno.h>)
+SYMBOL(ETOOMANYREFS, None, <errno.h>)
+SYMBOL(ETXTBSY, None, <errno.h>)
+SYMBOL(EUCLEAN, None, <errno.h>)
+SYMBOL(EUNATCH, None, <errno.h>)
+SYMBOL(EUSERS, None, <errno.h>)
+SYMBOL(EWOULDBLOCK, None, <errno.h>)
+SYMBOL(EXDEV, None, <errno.h>)
+SYMBOL(EXFULL, None, <errno.h>)
+
+// limits.h
+SYMBOL(SSIZE_MAX, None, <limits.h>)
+
+// pthread.h
+SYMBOL(pthread_attr_t, None, <pthread.h>)
+SYMBOL(pthread_attr_t, None, <sys/types.h>)
+SYMBOL(pthread_attr_t, None, <signal.h>)
+SYMBOL(pthread_barrier_t, None, <pthread.h>)
+SYMBOL(pthread_barrier_t, None, <sys/types.h>)
+SYMBOL(pthread_barrierattr_t, None, <pthread.h>)
+SYMBOL(pthread_barrierattr_t, None, <sys/types.h>)
+SYMBOL(pthread_cond_t, None, <pthread.h>)
+SYMBOL(pthread_cond_t, None, <sys/types.h>)
+SYMBOL(pthread_condattr_t, None, <pthread.h>)
+SYMBOL(pthread_condattr_t, None, <sys/types.h>)
+SYMBOL(pthread_key_t, None, <pthread.h>)
+SYMBOL(pthread_key_t, None, <sys/types.h>)
+SYMBOL(pthread_mutex_t, None, <pthread.h>)
+SYMBOL(pthread_mutex_t, None, <sys/types.h>)
+SYMBOL(pthread_mutexattr_t, None, <pthread.h>)
+SYMBOL(pthread_mutexattr_t, None, <sys/types.h>)
+SYMBOL(pthread_once_t, None, <pthread.h>)
+SYMBOL(pthread_once_t, None, <sys/types.h>)
+SYMBOL(pthread_rwlock_t, None, <pthread.h>)
+SYMBOL(pthread_rwlock_t, None, <sys/types.h>)
+SYMBOL(pthread_rwlockattr_t, None, <pthread.h>)
+SYMBOL(pthread_rwlockattr_t, None, <sys/types.h>)
+SYMBOL(pthread_spinlock_t, None, <pthread.h>)
+SYMBOL(pthread_spinlock_t, None, <sys/types.h>)
+SYMBOL(pthread_t, None, <pthread.h>)
+SYMBOL(pthread_t, None, <signal.h>)
+SYMBOL(pthread_t, None, <sys/types.h>)
+
+// signal.h - as of POSIX.1-2024
+// https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/signal.h.html
+SYMBOL(sigset_t, None, <signal.h>)
+SYMBOL(sigevent, None, <signal.h>)
+SYMBOL(SIGEV_NONE, None, <signal.h>)
+SYMBOL(SIGEV_SIGNAL, None, <signal.h>)
+SYMBOL(SIGEV_THREAD, None, <signal.h>)
+SYMBOL(sigval, None, <signal.h>)
+SYMBOL(SIGRTMIN, None, <signal.h>)
+SYMBOL(SIGRTMAX, None, <signal.h>)
+SYMBOL(SIG2STR_MAX, None, <signal.h>)
+// The ISO C standard only requires the signal names SIGABRT, SIGFPE, SIGILL,
+// SIGINT, SIGSEGV, and SIGTERM to be defined. Those are picked up by the
+// script.
+SYMBOL(SIGALRM, None, <signal.h>)
+SYMBOL(SIGBUS, None, <signal.h>)
+SYMBOL(SIGCHLD, None, <signal.h>)
+SYMBOL(SIGCONT, None, <signal.h>)
+SYMBOL(SIGHUP, None, <signal.h>)
+SYMBOL(SIGKILL, None, <signal.h>)
+SYMBOL(SIGPIPE, None, <signal.h>)
+SYMBOL(SIGQUIT, None, <signal.h>)
+SYMBOL(SIGSTOP, None, <signal.h>)
+SYMBOL(SIGTSTP, None, <signal.h>)
+SYMBOL(SIGTTIN, None, <signal.h>)
+SYMBOL(SIGTTOU, None, <signal.h>)
+SYMBOL(SIGUSR1, None, <signal.h>)
+SYMBOL(SIGUSR2, None, <signal.h>)
+SYMBOL(SIGWINCH, None, <signal.h>)
+SYMBOL(SIGSYS, None, <signal.h>)
+SYMBOL(SIGTRAP, None, <signal.h>)
+SYMBOL(SIGURG, None, <signal.h>)
+SYMBOL(SIGVTALRM, None, <signal.h>)
+SYMBOL(SIGXCPU, None, <signal.h>)
+SYMBOL(SIGXFSZ, None, <signal.h>)
+SYMBOL(SIG_BLOCK, None, <signal.h>)
+SYMBOL(SIG_UNBLOCK, None, <signal.h>)
+SYMBOL(SIG_SETMASK, None, <signal.h>)
+SYMBOL(SA_NOCLDSTOP, None, <signal.h>)
+SYMBOL(SA_ONSTACK, None, <signal.h>)
+SYMBOL(SA_RESETHAND, None, <signal.h>)
+SYMBOL(SA_RESTART, None, <signal.h>)
+SYMBOL(SA_SIGINFO, None, <signal.h>)
+SYMBOL(SA_NOCLDWAIT, None, <signal.h>)
+SYMBOL(SA_NODEFER, None, <signal.h>)
+SYMBOL(SS_ONSTACK, None, <signal.h>)
+SYMBOL(SS_DISABLE, None, <signal.h>)
+SYMBOL(MINSIGSTKSZ, None, <signal.h>)
+SYMBOL(SIGSTKSZ, None, <signal.h>)
+SYMBOL(mcontext_t, None, <signal.h>)
+SYMBOL(ucontext_t, None, <signal.h>)
+SYMBOL(stack_t, None, <signal.h>)
+SYMBOL(siginfo_t, None, <signal.h>)
+SYMBOL(ILL_ILLOPC, None, <signal.h>)
+SYMBOL(ILL_ILLOPN, None, <signal.h>)
+SYMBOL(ILL_ILLADR, None, <signal.h>)
+SYMBOL(ILL_ILLTRP, None, <signal.h>)
+SYMBOL(ILL_PRVOPC, None, <signal.h>)
+SYMBOL(ILL_PRVREG, None, <signal.h>)
+SYMBOL(ILL_COPROC, None, <signal.h>)
+SYMBOL(ILL_BADSTK, None, <signal.h>)
+SYMBOL(FPE_INTDIV, None, <signal.h>)
+SYMBOL(FPE_INTOVF, None, <signal.h>)
+SYMBOL(FPE_FLTDIV, None, <signal.h>)
+SYMBOL(FPE_FLTOVF, None, <signal.h>)
+SYMBOL(FPE_FLTUND, None, <signal.h>)
+SYMBOL(FPE_FLTRES, None, <signal.h>)
+SYMBOL(FPE_FLTINV, None, <signal.h>)
+SYMBOL(FPE_FLTSUB, None, <signal.h>)
+SYMBOL(SEGV_MAPERR, None, <signal.h>)
+SYMBOL(SEGV_ACCERR, None, <signal.h>)
+SYMBOL(BUS_ADRALN, None, <signal.h>)
+SYMBOL(BUS_ADRERR, None, <signal.h>)
+SYMBOL(BUS_OBJERR, None, <signal.h>)
+SYMBOL(TRAP_BRKPT, None, <signal.h>)
+SYMBOL(TRAP_TRACE, None, <signal.h>)
+SYMBOL(CLD_EXITED, None, <signal.h>)
+SYMBOL(CLD_KILLED, None, <signal.h>)
+SYMBOL(CLD_DUMPED, None, <signal.h>)
+SYMBOL(CLD_TRAPPED, None, <signal.h>)
+SYMBOL(CLD_STOPPED, None, <signal.h>)
+SYMBOL(CLD_CONTINUED, None, <signal.h>)
+SYMBOL(SI_USER, None, <signal.h>)
+SYMBOL(SI_QUEUE, None, <signal.h>)
+SYMBOL(SI_TIMER, None, <signal.h>)
+SYMBOL(SI_ASYNCIO, None, <signal.h>)
+SYMBOL(SI_MESGQ, None, <signal.h>)
+SYMBOL(kill, None, <signal.h>)
+SYMBOL(killpg, None, <signal.h>)
+SYMBOL(psiginfo, None, <signal.h>)
+SYMBOL(psignal, None, <signal.h>)
+SYMBOL(pthread_kill, None, <signal.h>)
+SYMBOL(pthread_sigmask, None, <signal.h>)
+SYMBOL(sigaction, None, <signal.h>)
+SYMBOL(sigaddset, None, <signal.h>)
+SYMBOL(sigaltstack, None, <signal.h>)
+SYMBOL(sigdelset, None, <signal.h>)
+SYMBOL(sigemptyset, None, <signal.h>)
+SYMBOL(sigfillset, None, <signal.h>)
+SYMBOL(sighold, None, <signal.h>)
+SYMBOL(sigignore, None, <signal.h>)
+SYMBOL(siginterrupt, None, <signal.h>)
+SYMBOL(sigismember, None, <signal.h>)
+SYMBOL(sigpause, None, <signal.h>)
+SYMBOL(sigpending, None, <signal.h>)
+SYMBOL(sigprocmask, None, <signal.h>)
+SYMBOL(sigqueue, None, <signal.h>)
+SYMBOL(sigrelse, None, <signal.h>)
+SYMBOL(sigset, None, <signal.h>)
+SYMBOL(sigsuspend, None, <signal.h>)
+SYMBOL(sigtimedwait, None, <signal.h>)
+SYMBOL(sigwait, None, <signal.h>)
+SYMBOL(sigwaitinfo, None, <signal.h>)
+// Not in POSIX.1-2024 anymore
+SYMBOL(SIG_HOLD, None, <signal.h>)
+SYMBOL(sigstack, None, <signal.h>)
+SYMBOL(bsd_signal, None, <signal.h>)
+SYMBOL(sigmask, None, <signal.h>)
+SYMBOL(SIGPOLL, None, <signal.h>)
+SYMBOL(SIGPROF, None, <signal.h>)
+SYMBOL(POLL_IN, None, <signal.h>)
+SYMBOL(POLL_OUT, None, <signal.h>)
+SYMBOL(POLL_MSG, None, <signal.h>)
+SYMBOL(POLL_ERR, None, <signal.h>)
+SYMBOL(POLL_PRI, None, <signal.h>)
+SYMBOL(POLL_HUP, None, <signal.h>)
+
+// sys/time.h
+SYMBOL(timeval, None, <sys/time.h>)
+SYMBOL(timeval, None, <sys/select.h>)
+
+// sys/types.h
+SYMBOL(gid_t, None, <sys/types.h>)
+SYMBOL(gid_t, None, <grp.h>)
+SYMBOL(gid_t, None, <pwd.h>)
+SYMBOL(gid_t, None, <signal.h>)
+SYMBOL(gid_t, None, <stropts.h>)
+SYMBOL(gid_t, None, <sys/ipc.h>)
+SYMBOL(gid_t, None, <sys/stat.h>)
+SYMBOL(gid_t, None, <unistd.h>)
+SYMBOL(id_t, None, <sys/types.h>)
+SYMBOL(id_t, None, <sys/resource.h>)
+SYMBOL(pid_t, None, <sys/types.h>)
+SYMBOL(pid_t, None, <fcntl.h>)
+SYMBOL(pid_t, None, <sched.h>)
+SYMBOL(pid_t, None, <signal.h>)
+SYMBOL(pid_t, None, <spawn.h>)
+SYMBOL(pid_t, None, <sys/msg.h>)
+SYMBOL(pid_t, None, <sys/sem.h>)
+SYMBOL(pid_t, None, <sys/shm.h>)
+SYMBOL(pid_t, None, <sys/wait.h>)
+SYMBOL(pid_t, None, <termios.h>)
+SYMBOL(pid_t, None, <time.h>)
+SYMBOL(pid_t, None, <unistd.h>)
+SYMBOL(pid_t, None, <utmpx.h>)
+SYMBOL(uid_t, None, <sys/types.h>)
+SYMBOL(uid_t, None, <pwd.h>)
+SYMBOL(uid_t, None, <signal.h>)
+SYMBOL(uid_t, None, <stropts.h>)
+SYMBOL(uid_t, None, <sys/ipc.h>)
+SYMBOL(uid_t, None, <sys/stat.h>)
+SYMBOL(uid_t, None, <unistd.h>)
+
+// sys/wait.h
+SYMBOL(idtype_t, None, <sys/wait.h>)
+
+// time.h
+SYMBOL(clockid_t, None, <time.h>)
+SYMBOL(clockid_t, None, <sys/types.h>)
+SYMBOL(timer_t, None, <time.h>)
+SYMBOL(timer_t, None, <sys/types.h>)
+SYMBOL(CLOCK_MONOTONIC, None, <time.h>)
+SYMBOL(CLOCK_PROCESS_CPUTIME_ID, None, <time.h>)
+SYMBOL(CLOCK_REALTIME, None, <time.h>)
+SYMBOL(CLOCK_THREAD_CPUTIME_ID, None, <time.h>)
+SYMBOL(TIMER_ABSTIME, None, <time.h>)
+
+// clang-format on
diff --git a/clang/lib/Tooling/Inclusions/Stdlib/CxxPosixSymbolMap.inc b/clang/lib/Tooling/Inclusions/Stdlib/CxxPosixSymbolMap.inc
new file mode 100644
index 0000000000000..f1f0190779f5a
--- /dev/null
+++ b/clang/lib/Tooling/Inclusions/Stdlib/CxxPosixSymbolMap.inc
@@ -0,0 +1,458 @@
+//===-- CxxPosixSymbolMap.inc -----------------------------------*- C++ -*-===//
+//
+// This is a hand-curated list for C++ POSIX symbols that cannot be
+// parsed/extracted via the include-mapping tool (gen_std.py).
+//
+//===----------------------------------------------------------------------===//
+
+// clang-format off
+// prevent breaking <sys/types.h> -> <sys / types.h>
+
+// errno.h / cerrno
+SYMBOL(EBADE, None, <cerrno>)
+SYMBOL(EBADE, None, <errno.h>)
+SYMBOL(EBADFD, None, <cerrno>)
+SYMBOL(EBADFD, None, <errno.h>)
+SYMBOL(EBADR, None, <cerrno>)
+SYMBOL(EBADR, None, <errno.h>)
+SYMBOL(EBADRQC, None, <cerrno>)
+SYMBOL(EBADRQC, None, <errno.h>)
+SYMBOL(EBADSLT, None, <cerrno>)
+SYMBOL(EBADSLT, None, <errno.h>)
+SYMBOL(ECHRNG, None, <cerrno>)
+SYMBOL(ECHRNG, None, <errno.h>)
+SYMBOL(ECOMM, None, <cerrno>)
+SYMBOL(ECOMM, None, <errno.h>)
+SYMBOL(EDEADLOCK, None, <cerrno>)
+SYMBOL(EDEADLOCK, None, <errno.h>)
+SYMBOL(EDQUOT, None, <cerrno>)
+SYMBOL(EDQUOT, None, <errno.h>)
+SYMBOL(EHOSTDOWN, None, <cerrno>)
+SYMBOL(EHOSTDOWN, None, <errno.h>)
+SYMBOL(EHWPOISON, None, <cerrno>)
+SYMBOL(EHWPOISON, None, <errno.h>)
+SYMBOL(EISNAM, None, <cerrno>)
+SYMBOL(EISNAM, None, <errno.h>)
+SYMBOL(EKEYEXPIRED, None, <cerrno>)
+SYMBOL(EKEYEXPIRED, None, <errno.h>)
+SYMBOL(EKEYREJECTED, None, <cerrno>)
+SYMBOL(EKEYREJECTED, None, <errno.h>)
+SYMBOL(EKEYREVOKED, None, <cerrno>)
+SYMBOL(EKEYREVOKED, None, <errno.h>)
+SYMBOL(EL2HLT, None, <cerrno>)
+SYMBOL(EL2HLT, None, <errno.h>)
+SYMBOL(EL2NSYNC, None, <cerrno>)
+SYMBOL(EL2NSYNC, None, <errno.h>)
+SYMBOL(EL3HLT, None, <cerrno>)
+SYMBOL(EL3HLT, None, <errno.h>)
+SYMBOL(EL3RST, None, <cerrno>)
+SYMBOL(EL3RST, None, <errno.h>)
+SYMBOL(ELIBACC, None, <cerrno>)
+SYMBOL(ELIBACC, None, <errno.h>)
+SYMBOL(ELIBBAD, None, <cerrno>)
+SYMBOL(ELIBBAD, None, <errno.h>)
+SYMBOL(ELIBMAX, None, <cerrno>)
+SYMBOL(ELIBMAX, None, <errno.h>)
+SYMBOL(ELIBSCN, None, <cerrno>)
+SYMBOL(ELIBSCN, None, <errno.h>)
+SYMBOL(ELIBEXEC, None, <cerrno>)
+SYMBOL(ELIBEXEC, None, <errno.h>)
+SYMBOL(ELNRNG, None, <cerrno>)
+SYMBOL(ELNRNG, None, <errno.h>)
+SYMBOL(EMEDIUMTYPE, None, <cerrno>)
+SYMBOL(EMEDIUMTYPE, None, <errno.h>)
+SYMBOL(EMULTIHOP, None, <cerrno>)
+SYMBOL(EMULTIHOP, None, <errno.h>)
+SYMBOL(ENOANO, None, <cerrno>)
+SYMBOL(ENOANO, None, <errno.h>)
+SYMBOL(ENOKEY, None, <cerrno>)
+SYMBOL(ENOKEY, None, <errno.h>)
+SYMBOL(ENOMEDIUM, None, <cerrno>)
+SYMBOL(ENOMEDIUM, None, <errno.h>)
+SYMBOL(ENONET, None, <cerrno>)
+SYMBOL(ENONET, None, <errno.h>)
+SYMBOL(ENOPKG, None, <cerrno>)
+SYMBOL(ENOPKG, None, <errno.h>)
+SYMBOL(ENOTBLK, None, <cerrno>)
+SYMBOL(ENOTBLK, None, <errno.h>)
+SYMBOL(ENOTUNIQ, None, <cerrno>)
+SYMBOL(ENOTUNIQ, None, <errno.h>)
+SYMBOL(EPFNOSUPPORT, None, <cerrno>)
+SYMBOL(EPFNOSUPPORT, None, <errno.h>)
+SYMBOL(EREMCHG, None, <cerrno>)
+SYMBOL(EREMCHG, None, <errno.h>)
+SYMBOL(EREMOTE, None, <cerrno>)
+SYMBOL(EREMOTE, None, <errno.h>)
+SYMBOL(EREMOTEIO, None, <cerrno>)
+SYMBOL(EREMOTEIO, None, <errno.h>)
+SYMBOL(ERESTART, None, <cerrno>)
+SYMBOL(ERESTART, None, <errno.h>)
+SYMBOL(ERFKILL, None, <cerrno>)
+SYMBOL(ERFKILL, None, <errno.h>)
+SYMBOL(ESHUTDOWN, None, <cerrno>)
+SYMBOL(ESHUTDOWN, None, <errno.h>)
+SYMBOL(ESOCKTNOSUPPORT, None, <cerrno>)
+SYMBOL(ESOCKTNOSUPPORT, None, <errno.h>)
+SYMBOL(ESTALE, None, <cerrno>)
+SYMBOL(ESTALE, None, <errno.h>)
+SYMBOL(ESTRPIPE, None, <cerrno>)
+SYMBOL(ESTRPIPE, None, <errno.h>)
+SYMBOL(ETOOMANYREFS, None, <cerrno>)
+SYMBOL(ETOOMANYREFS, None, <errno.h>)
+SYMBOL(EUCLEAN, None, <cerrno>)
+SYMBOL(EUCLEAN, None, <errno.h>)
+SYMBOL(EUNATCH, None, <cerrno>)
+SYMBOL(EUNATCH, None, <errno.h>)
+SYMBOL(EUSERS, None, <cerrno>)
+SYMBOL(EUSERS, None, <errno.h>)
+SYMBOL(EXFULL, None, <cerrno>)
+SYMBOL(EXFULL, None, <errno.h>)
+
+// limits.h / climits
+SYMBOL(SSIZE_MAX, None, <climits>)
+SYMBOL(SSIZE_MAX, None, <limits.h>)
+
+// pthread.h
+SYMBOL(pthread_attr_t, None, <pthread.h>)
+SYMBOL(pthread_attr_t, None, <sys/types.h>)
+SYMBOL(pthread_attr_t, None, <csignal>)
+SYMBOL(pthread_attr_t, None, <signal.h>)
+SYMBOL(pthread_barrier_t, None, <pthread.h>)
+SYMBOL(pthread_barrier_t, None, <sys/types.h>)
+SYMBOL(pthread_barrierattr_t, None, <pthread.h>)
+SYMBOL(pthread_barrierattr_t, None, <sys/types.h>)
+SYMBOL(pthread_cond_t, None, <pthread.h>)
+SYMBOL(pthread_cond_t, None, <sys/types.h>)
+SYMBOL(pthread_condattr_t, None, <pthread.h>)
+SYMBOL(pthread_condattr_t, None, <sys/types.h>)
+SYMBOL(pthread_key_t, None, <pthread.h>)
+SYMBOL(pthread_key_t, None, <sys/types.h>)
+SYMBOL(pthread_mutex_t, None, <pthread.h>)
+SYMBOL(pthread_mutex_t, None, <sys/types.h>)
+SYMBOL(pthread_mutexattr_t, None, <pthread.h>)
+SYMBOL(pthread_mutexattr_t, None, <sys/types.h>)
+SYMBOL(pthread_once_t, None, <pthread.h>)
+SYMBOL(pthread_once_t, None, <sys/types.h>)
+SYMBOL(pthread_rwlock_t, None, <pthread.h>)
+SYMBOL(pthread_rwlock_t, None, <sys/types.h>)
+SYMBOL(pthread_rwlockattr_t, None, <pthread.h>)
+SYMBOL(pthread_rwlockattr_t, None, <sys/types.h>)
+SYMBOL(pthread_spinlock_t, None, <pthread.h>)
+SYMBOL(pthread_spinlock_t, None, <sys/types.h>)
+SYMBOL(pthread_t, None, <pthread.h>)
+SYMBOL(pthread_t, None, <csignal>)
+SYMBOL(pthread_t, None, <signal.h>)
+SYMBOL(pthread_t, None, <sys/types.h>)
+
+// signal.h / csignal - as of POSIX.1-2024
+// https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/signal.h.html
+SYMBOL(sigset_t, None, <csignal>)
+SYMBOL(sigset_t, None, <signal.h>)
+SYMBOL(sigevent, None, <csignal>)
+SYMBOL(sigevent, None, <signal.h>)
+SYMBOL(SIGEV_NONE, None, <csignal>)
+SYMBOL(SIGEV_NONE, None, <signal.h>)
+SYMBOL(SIGEV_SIGNAL, None, <csignal>)
+SYMBOL(SIGEV_SIGNAL, None, <signal.h>)
+SYMBOL(SIGEV_THREAD, None, <csignal>)
+SYMBOL(SIGEV_THREAD, None, <signal.h>)
+SYMBOL(sigval, None, <csignal>)
+SYMBOL(sigval, None, <signal.h>)
+SYMBOL(SIGRTMIN, None, <csignal>)
+SYMBOL(SIGRTMIN, None, <signal.h>)
+SYMBOL(SIGRTMAX, None, <csignal>)
+SYMBOL(SIGRTMAX, None, <signal.h>)
+SYMBOL(SIG2STR_MAX, None, <csignal>)
+SYMBOL(SIG2STR_MAX, None, <signal.h>)
+// The ISO C standard only requires the signal names SIGABRT, SIGFPE, SIGILL,
+// SIGINT, SIGSEGV, and SIGTERM to be defined. Those are picked up by the
+// script.
+SYMBOL(SIGALRM, None, <csignal>)
+SYMBOL(SIGALRM, None, <signal.h>)
+SYMBOL(SIGBUS, None, <csignal>)
+SYMBOL(SIGBUS, None, <signal.h>)
+SYMBOL(SIGCHLD, None, <csignal>)
+SYMBOL(SIGCHLD, None, <signal.h>)
+SYMBOL(SIGCONT, None, <csignal>)
+SYMBOL(SIGCONT, None, <signal.h>)
+SYMBOL(SIGHUP, None, <csignal>)
+SYMBOL(SIGHUP, None, <signal.h>)
+SYMBOL(SIGKILL, None, <csignal>)
+SYMBOL(SIGKILL, None, <signal.h>)
+SYMBOL(SIGPIPE, None, <csignal>)
+SYMBOL(SIGPIPE, None, <signal.h>)
+SYMBOL(SIGQUIT, None, <csignal>)
+SYMBOL(SIGQUIT, None, <signal.h>)
+SYMBOL(SIGSTOP, None, <csignal>)
+SYMBOL(SIGSTOP, None, <signal.h>)
+SYMBOL(SIGTSTP, None, <csignal>)
+SYMBOL(SIGTSTP, None, <signal.h>)
+SYMBOL(SIGTTIN, None, <csignal>)
+SYMBOL(SIGTTIN, None, <signal.h>)
+SYMBOL(SIGTTOU, None, <csignal>)
+SYMBOL(SIGTTOU, None, <signal.h>)
+SYMBOL(SIGUSR1, None, <csignal>)
+SYMBOL(SIGUSR1, None, <signal.h>)
+SYMBOL(SIGUSR2, None, <csignal>)
+SYMBOL(SIGUSR2, None, <signal.h>)
+SYMBOL(SIGWINCH, None, <csignal>)
+SYMBOL(SIGWINCH, None, <signal.h>)
+SYMBOL(SIGSYS, None, <csignal>)
+SYMBOL(SIGSYS, None, <signal.h>)
+SYMBOL(SIGTRAP, None, <csignal>)
+SYMBOL(SIGTRAP, None, <signal.h>)
+SYMBOL(SIGURG, None, <csignal>)
+SYMBOL(SIGURG, None, <signal.h>)
+SYMBOL(SIGVTALRM, None, <csignal>)
+SYMBOL(SIGVTALRM, None, <signal.h>)
+SYMBOL(SIGXCPU, None, <csignal>)
+SYMBOL(SIGXCPU, None, <signal.h>)
+SYMBOL(SIGXFSZ, No...
[truncated]
|
Hi @kadircet, |
91407e8
to
c4681df
Compare
Summary
This PR adds more symbol-header mappings that
clang-include-cleaner
,clangd
andclang-tidy
use to detect symbols that are used but not directly included (following the include-what-you-use model).Add mappings for missing POSIX symbols that are currently not handled. These mappings are placed in new dedicated files to avoid mixing non-standard symbols with the ISO C/C++ standard library mappings.
Addresses and closes multiple open issues:
struct timeval
#64336 –timeval
strsignal
signal
errno
Example diagnostic message from
clangd
:No header providing "pthread_t" is directly included (fixes available) - clangd(missing-includes)
Questions
We would appreciate input on the following points:
Is the existing proposal in [include-cleaner] Handle symbols from system headers. #66089 still planned to be completed?
Is it appropriate to maintain POSIX mappings in separate files, or should we integrate them into the existing mapping files despite them not being part of the standard library?
Is it ok to map some POSIX symbols (e.g.
strsignal
) also to C++ headers (<cstring>
), or should they map to C headers (<string.h>
) only?Thanks in advance for your time and feedback!