blob: 9ea5d9a6a27745c95d93449c7506ce11bb085f0d [file] [log] [blame]
# Mappings for GNU libc
[
{ include: [ "<bits/a.out.h>", private, "<a.out.h>", public ] },
{ include: [ "<bits/byteswap.h>", private, "<byteswap.h>", public ] },
{ include: [ "<bits/cmathcalls.h>", private, "<complex.h>", public ] },
{ include: [ "<bits/confname.h>", private, "<unistd.h>", public ] },
{ include: [ "<bits/dirent.h>", private, "<dirent.h>", public ] },
{ include: [ "<bits/dlfcn.h>", private, "<dlfcn.h>", public ] },
{ include: [ "<bits/elfclass.h>", private, "<link.h>", public ] },
{ include: [ "<bits/endian.h>", private, "<endian.h>", public ] },
{ include: [ "<bits/environments.h>", private, "<unistd.h>", public ] },
{ include: [ "<bits/errno.h>", private, "<errno.h>", public ] },
{ include: [ "<bits/error.h>", private, "<error.h>", public ] },
{ include: [ "<bits/fcntl.h>", private, "<fcntl.h>", public ] },
{ include: [ "<bits/fcntl2.h>", private, "<fcntl.h>", public ] },
{ include: [ "<bits/fenv.h>", private, "<fenv.h>", public ] },
{ include: [ "<bits/fenvinline.h>", private, "<fenv.h>", public ] },
{ include: [ "<bits/huge_val.h>", private, "<math.h>", public ] },
{ include: [ "<bits/huge_valf.h>", private, "<math.h>", public ] },
{ include: [ "<bits/huge_vall.h>", private, "<math.h>", public ] },
{ include: [ "<bits/ioctl-types.h>", private, "<sys/ioctl.h>", public ] },
{ include: [ "<bits/ioctls.h>", private, "<sys/ioctl.h>", public ] },
{ include: [ "<bits/ipc.h>", private, "<sys/ipc.h>", public ] },
{ include: [ "<bits/ipctypes.h>", private, "<sys/ipc.h>", public ] },
{ include: [ "<bits/libio-ldbl.h>", private, "<libio.h>", public ] },
{ include: [ "<bits/link.h>", private, "<link.h>", public ] },
{ include: [ "<bits/locale.h>", private, "<locale.h>", public ] },
{ include: [ "<bits/mathcalls.h>", private, "<math.h>", public ] },
{ include: [ "<bits/mathdef.h>", private, "<math.h>", public ] },
{ include: [ "<bits/mman.h>", private, "<sys/mman.h>", public ] },
{ include: [ "<bits/monetary-ldbl.h>", private, "<monetary.h>", public ] },
{ include: [ "<bits/mqueue.h>", private, "<mqueue.h>", public ] },
{ include: [ "<bits/mqueue2.h>", private, "<mqueue.h>", public ] },
{ include: [ "<bits/msq.h>", private, "<sys/msg.h>", public ] },
{ include: [ "<bits/nan.h>", private, "<math.h>", public ] },
{ include: [ "<bits/netdb.h>", private, "<netdb.h>", public ] },
{ include: [ "<bits/poll.h>", private, "<sys/poll.h>", private ] },
{ include: [ "<bits/posix1_lim.h>", private, "<limits.h>", public ] },
{ include: [ "<bits/posix2_lim.h>", private, "<limits.h>", public ] },
{ include: [ "<bits/posix_opt.h>", private, "<unistd.h>", public ] },
{ include: [ "<bits/printf-ldbl.h>", private, "<printf.h>", public ] },
{ include: [ "<bits/pthreadtypes.h>", private, "<pthread.h>", public ] },
{ include: [ "<bits/resource.h>", private, "<sys/resource.h>", public ] },
{ include: [ "<bits/sched.h>", private, "<sched.h>", public ] },
{ include: [ "<bits/select.h>", private, "<sys/select.h>", public ] },
{ include: [ "<bits/sem.h>", private, "<sys/sem.h>", public ] },
{ include: [ "<bits/semaphore.h>", private, "<semaphore.h>", public ] },
{ include: [ "<bits/setjmp.h>", private, "<setjmp.h>", public ] },
{ include: [ "<bits/shm.h>", private, "<sys/shm.h>", public ] },
{ include: [ "<bits/sigaction.h>", private, "<signal.h>", public ] },
{ include: [ "<bits/sigcontext.h>", private, "<signal.h>", public ] },
{ include: [ "<bits/siginfo.h>", private, "<signal.h>", public ] },
{ include: [ "<bits/signum.h>", private, "<signal.h>", public ] },
{ include: [ "<bits/sigset.h>", private, "<signal.h>", public ] },
{ include: [ "<bits/sigstack.h>", private, "<signal.h>", public ] },
{ include: [ "<bits/sigthread.h>", private, "<signal.h>", public ] },
{ include: [ "<bits/sockaddr.h>", private, "<sys/un.h>", public ] },
{ include: [ "<bits/socket.h>", private, "<sys/socket.h>", public ] },
{ include: [ "<bits/stab.def>", private, "<stab.h>", public ] },
{ include: [ "<bits/stat.h>", private, "<sys/stat.h>", public ] },
{ include: [ "<bits/statfs.h>", private, "<sys/statfs.h>", public ] },
{ include: [ "<bits/statvfs.h>", private, "<sys/statvfs.h>", public ] },
{ include: [ "<bits/stdio-ldbl.h>", private, "<stdio.h>", public ] },
{ include: [ "<bits/stdio-lock.h>", private, "<libio.h>", public ] },
{ include: [ "<bits/stdio.h>", private, "<stdio.h>", public ] },
{ include: [ "<bits/stdio2.h>", private, "<stdio.h>", public ] },
{ include: [ "<bits/stdio_lim.h>", private, "<stdio.h>", public ] },
{ include: [ "<bits/stdlib-ldbl.h>", private, "<stdlib.h>", public ] },
{ include: [ "<bits/stdlib.h>", private, "<stdlib.h>", public ] },
{ include: [ "<bits/string.h>", private, "<string.h>", public ] },
{ include: [ "<bits/string2.h>", private, "<string.h>", public ] },
{ include: [ "<bits/string3.h>", private, "<string.h>", public ] },
{ include: [ "<bits/stropts.h>", private, "<stropts.h>", public ] },
{ include: [ "<bits/sys_errlist.h>", private, "<stdio.h>", public ] },
{ include: [ "<bits/syscall.h>", private, "<sys/syscall.h>", private ] },
{ include: [ "<bits/syslog-ldbl.h>", private, "<sys/syslog.h>", private ] },
{ include: [ "<bits/syslog-path.h>", private, "<sys/syslog.h>", private ] },
{ include: [ "<bits/syslog.h>", private, "<sys/syslog.h>", private ] },
{ include: [ "<bits/termios.h>", private, "<termios.h>", public ] },
{ include: [ "<bits/time.h>", private, "<sys/time.h>", public ] },
{ include: [ "<bits/types.h>", private, "<sys/types.h>", public ] },
{ include: [ "<bits/uio.h>", private, "<sys/uio.h>", public ] },
{ include: [ "<bits/unistd.h>", private, "<unistd.h>", public ] },
{ include: [ "<bits/ustat.h>", private, "<sys/ustat.h>", private ] },
{ include: [ "<bits/utmp.h>", private, "<utmp.h>", public ] },
{ include: [ "<bits/utmpx.h>", private, "<utmpx.h>", public ] },
{ include: [ "<bits/utsname.h>", private, "<sys/utsname.h>", public ] },
{ include: [ "<bits/waitflags.h>", private, "<sys/wait.h>", public ] },
{ include: [ "<bits/waitstatus.h>", private, "<sys/wait.h>", public ] },
{ include: [ "<bits/wchar-ldbl.h>", private, "<wchar.h>", public ] },
{ include: [ "<bits/wchar.h>", private, "<wchar.h>", public ] },
{ include: [ "<bits/wchar2.h>", private, "<wchar.h>", public ] },
{ include: [ "<bits/xopen_lim.h>", private, "<limits.h>", public ] },
{ include: [ "<bits/xtitypes.h>", private, "<stropts.h>", public ] },
# Sometimes libc tells you what mapping to do via an '#error':
# # error "Never use <bits/dlfcn.h> directly; include <dlfcn.h> instead."
# ( cd /usr/include && grep -R '^ *# *error "Never use' * | perl -nle 'm/<([^>]+).*<([^>]+)/ && print qq@ { include: [ "<$1>", private, "<$2>", public ] },@' | sort )
{ include: [ "<bits/a.out.h>", private, "<a.out.h>", public ] },
{ include: [ "<bits/byteswap.h>", private, "<byteswap.h>", public ] },
{ include: [ "<bits/cmathcalls.h>", private, "<complex.h>", public ] },
{ include: [ "<bits/confname.h>", private, "<unistd.h>", public ] },
{ include: [ "<bits/dirent.h>", private, "<dirent.h>", public ] },
{ include: [ "<bits/dlfcn.h>", private, "<dlfcn.h>", public ] },
{ include: [ "<bits/elfclass.h>", private, "<link.h>", public ] },
{ include: [ "<bits/endian.h>", private, "<endian.h>", public ] },
{ include: [ "<bits/fcntl.h>", private, "<fcntl.h>", public ] },
{ include: [ "<bits/fenv.h>", private, "<fenv.h>", public ] },
{ include: [ "<bits/huge_val.h>", private, "<math.h>", public ] },
{ include: [ "<bits/huge_valf.h>", private, "<math.h>", public ] },
{ include: [ "<bits/huge_vall.h>", private, "<math.h>", public ] },
{ include: [ "<bits/in.h>", private, "<netinet/in.h>", public ] },
{ include: [ "<bits/inf.h>", private, "<math.h>", public ] },
{ include: [ "<bits/ioctl-types.h>", private, "<sys/ioctl.h>", public ] },
{ include: [ "<bits/ioctls.h>", private, "<sys/ioctl.h>", public ] },
{ include: [ "<bits/ipc.h>", private, "<sys/ipc.h>", public ] },
{ include: [ "<bits/locale.h>", private, "<locale.h>", public ] },
{ include: [ "<bits/mathdef.h>", private, "<math.h>", public ] },
{ include: [ "<bits/mathinline.h>", private, "<math.h>", public ] },
{ include: [ "<bits/mman.h>", private, "<sys/mman.h>", public ] },
{ include: [ "<bits/mqueue.h>", private, "<mqueue.h>", public ] },
{ include: [ "<bits/msq.h>", private, "<sys/msg.h>", public ] },
{ include: [ "<bits/nan.h>", private, "<math.h>", public ] },
{ include: [ "<bits/poll.h>", private, "<sys/poll.h>", private ] },
{ include: [ "<bits/predefs.h>", private, "<features.h>", public ] },
{ include: [ "<bits/resource.h>", private, "<sys/resource.h>", public ] },
{ include: [ "<bits/select.h>", private, "<sys/select.h>", public ] },
{ include: [ "<bits/semaphore.h>", private, "<semaphore.h>", public ] },
{ include: [ "<bits/sigcontext.h>", private, "<signal.h>", public ] },
{ include: [ "<bits/string.h>", private, "<string.h>", public ] },
{ include: [ "<bits/string2.h>", private, "<string.h>", public ] },
{ include: [ "<bits/string3.h>", private, "<string.h>", public ] },
{ include: [ "<bits/syscall.h>", private, "<sys/syscall.h>", private ] },
# Top-level #includes that just forward to another file:
# $ for i in /usr/include/*; do [ -f $i ] } && [ `wc -l < $i` = 1 ] } && echo $i; done
# (poll.h, syscall.h, syslog.h, ustat.h, wait.h).
# For each file, I looked at the list of canonical header files --
# http://www.opengroup.org/onlinepubs/9699919799/idx/head.html --
# to decide which of the two files is canonical. If neither is
# on the POSIX.1 1998 list, I just choose the top-level one.
{ include: [ "<sys/poll.h>", private, "<poll.h>", public ] },
{ include: [ "<sys/syscall.h>", private, "<syscall.h>", public ] },
{ include: [ "<sys/syslog.h>", private, "<syslog.h>", public ] },
{ include: [ "<sys/ustat.h>", private, "<ustat.h>", public ] },
{ include: [ "<wait.h>", private, "<sys/wait.h>", public ] },
# These are all files in bits/ that delegate to asm/ and linux/ to
# do all (or lots) of the work. Note these are private->private.
# $ for i in /usr/include/bits/*; do for dir in asm linux; do grep -H -e $dir/`basename $i` $i; done; done
{ include: [ "<linux/errno.h>", private, "<bits/errno.h>", private ] },
{ include: [ "<asm/ioctls.h>", private, "<bits/ioctls.h>", private ] },
{ include: [ "<asm/socket.h>", private, "<bits/socket.h>", private ] },
{ include: [ "<linux/socket.h>", private, "<bits/socket.h>", private ] },
# Some asm files have 32- and 64-bit variants:
# $ ls /usr/include/asm/*_{32,64}.h
{ include: [ "<asm/posix_types_32.h>", private, "<asm/posix_types.h>", public ] },
{ include: [ "<asm/posix_types_64.h>", private, "<asm/posix_types.h>", public ] },
{ include: [ "<asm/unistd_32.h>", private, "<asm/unistd.h>", private ] },
{ include: [ "<asm/unistd_64.h>", private, "<asm/unistd.h>", private ] },
# I don't know what grep would have found these. I found them
# via user report.
{ include: [ "<asm/errno.h>", private, "<errno.h>", public ] },
{ include: [ "<asm/errno-base.h>", private, "<errno.h>", public ] },
{ include: [ "<asm/ptrace-abi.h>", private, "<asm/ptrace.h>", public ] },
{ include: [ "<asm/unistd.h>", private, "<syscall.h>", public ] },
{ include: [ "<linux/limits.h>", private, "<limits.h>", public ] }, # PATH_MAX
{ include: [ "<linux/prctl.h>", private, "<sys/prctl.h>", public ] },
{ include: [ "<sys/ucontext.h>", private, "<ucontext.h>", public ] },
# Allow the C++ wrappers around C files. Without these mappings,
# if you #include <cstdio>, iwyu will tell you to replace it with
# <stdio.h>, which is where the symbols are actually defined. We
# inhibit that behavior to keep the <cstdio> alone. Note this is a
# public-to-public mapping: we don't want to *replace* <assert.h>
# with <cassert>, we just want to avoid suggesting changing
# <cassert> back to <assert.h>. (If you *did* want to replace
# assert.h with cassert, you'd change it to a public->private
# mapping.) Here is how I identified the files to map:
# $ for i in /usr/include/c++/4.4/c* ; do ls /usr/include/`basename $i | cut -b2-`.h /usr/lib/gcc/*/4.4/include/`basename $i | cut -b2-`.h 2>/dev/null ; done
{ include: [ "<assert.h>", public, "<cassert>", public ] },
{ include: [ "<complex.h>", public, "<ccomplex>", public ] },
{ include: [ "<ctype.h>", public, "<cctype>", public ] },
{ include: [ "<errno.h>", public, "<cerrno>", public ] },
{ include: [ "<fenv.h>", public, "<cfenv>", public ] },
{ include: [ "<float.h>", public, "<cfloat>", public ] },
{ include: [ "<inttypes.h>", public, "<cinttypes>", public ] },
{ include: [ "<iso646.h>", public, "<ciso646>", public ] },
{ include: [ "<limits.h>", public, "<climits>", public ] },
{ include: [ "<locale.h>", public, "<clocale>", public ] },
{ include: [ "<math.h>", public, "<cmath>", public ] },
{ include: [ "<setjmp.h>", public, "<csetjmp>", public ] },
{ include: [ "<signal.h>", public, "<csignal>", public ] },
{ include: [ "<stdarg.h>", public, "<cstdarg>", public ] },
{ include: [ "<stdbool.h>", public, "<cstdbool>", public ] },
{ include: [ "<stddef.h>", public, "<cstddef>", public ] },
{ include: [ "<stdint.h>", public, "<cstdint>", public ] },
{ include: [ "<stdio.h>", public, "<cstdio>", public ] },
{ include: [ "<stdlib.h>", public, "<cstdlib>", public ] },
{ include: [ "<string.h>", public, "<cstring>", public ] },
{ include: [ "<tgmath.h>", public, "<ctgmath>", public ] },
{ include: [ "<time.h>", public, "<ctime>", public ] },
{ include: [ "<wchar.h>", public, "<cwchar>", public ] },
{ include: [ "<wctype.h>", public, "<cwctype>", public ] },
]