Commit Graph

13 Commits

Author SHA1 Message Date
Alejandro Colomar 16df68dbb7 Add mappings for <bits/struct_stat.h>
struct stat members are implemented through macros and other
stuff, which is defined in that headers, so map the header to the
same headers that struct stat is mapped.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
2022-09-03 12:37:20 +02:00
Alejandro Colomar 57044c7e43 Add mappings for <bits/types/siginfo_t.h>
siginfo_t members are implemented through macros and other stuff,
which is defined in that header, so map the header to the same
headers that siginfo_t is mapped.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
2022-09-03 12:37:20 +02:00
Alejandro Colomar 58f925f063 Add mappings for <bits/mman-shared.h>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
2022-09-03 12:37:20 +02:00
Alejandro Colomar 75623bce3b Fix mapping for <bits/syscall.h>
SYS_xxx macros, which are implemented in glibc in
<bits/syscall.h>, are intended to be included from
<sys/syscall.h>.  See syscall(2), amd also see the following:

$ grepc -k 'SYS_[a-z]\w+' /usr/include | head
/usr/include/x86_64-linux-gnu/bits/syscall.h:35:# define SYS_accept __NR_accept
/usr/include/x86_64-linux-gnu/bits/syscall.h:39:# define SYS_accept4 __NR_accept4
/usr/include/x86_64-linux-gnu/bits/syscall.h:43:# define SYS_access __NR_access
/usr/include/x86_64-linux-gnu/bits/syscall.h:47:# define SYS_acct __NR_acct
/usr/include/x86_64-linux-gnu/bits/syscall.h:51:# define SYS_acl_get __NR_acl_get
/usr/include/x86_64-linux-gnu/bits/syscall.h:55:# define SYS_acl_set __NR_acl_set
/usr/include/x86_64-linux-gnu/bits/syscall.h:59:# define SYS_add_key __NR_add_key
/usr/include/x86_64-linux-gnu/bits/syscall.h:63:# define SYS_adjtimex __NR_adjtimex
/usr/include/x86_64-linux-gnu/bits/syscall.h:67:# define SYS_afs_syscall __NR_afs_syscall
/usr/include/x86_64-linux-gnu/bits/syscall.h:71:# define SYS_alarm __NR_alarm
$ grep -rn bits/syscall.h /usr/include
/usr/include/x86_64-linux-gnu/bits/syscall.h:5:# error "Never use <bits/syscall.h> directly; include <sys/syscall.h> instead."
/usr/include/x86_64-linux-gnu/sys/syscall.h:27:   programs expect the traditional form SYS_*.  <bits/syscall.h>
/usr/include/x86_64-linux-gnu/sys/syscall.h:29:#include <bits/syscall.h>

I removed duplicate mappings, and also removed the mapping for
<syscall.h>, which is an undocumented feature of glibc.  Portable
programs should stick to <sys/syscall.h> (and unportable ones
too, since there's no gain apart from those 4 bytes).

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
2022-09-01 19:44:29 +02:00
fanquake d3e7eb40b4 Add additional termios.h mappings
```cpp
include <bits/termios-c_lflag.h>  // for ECHO
include <bits/termios-struct.h>   // for termios
include <bits/termios-tcflow.h>   // for TCSANOW

void SetStdinEcho(bool enable)
{
    struct termios tty;
    tcgetattr(STDIN_FILENO, &tty);
    if (!enable) {
        tty.c_lflag &= ~ECHO;
    } else {
        tty.c_lflag |= ECHO;
    }
    (void)tcsetattr(STDIN_FILENO, TCSANOW, &tty);
}
```
2022-04-21 21:13:12 +02:00
Omar Sandoval 44480a2de0 Add export from <stdint.h> to <inttypes.h>
IWYU currently warns for this example:

  $ cat test.c
  #include <inttypes.h>
  #include <stdio.h>

  int main(void)
  {
          uint64_t x = UINT64_C(1234);
          printf("%" PRIu64 "\n", x);
          return 0;
  }
  $ include-what-you-use test.c

  test.c should add these lines:
  #include <stdint.h>    // for UINT64_C, uint64_t

  test.c should remove these lines:

  The full include-list for test.c:
  #include <inttypes.h>  // for PRIu64
  #include <stdint.h>    // for UINT64_C, uint64_t
  #include <stdio.h>     // for printf
  ---

However, the C standard states that "the header <inttypes.h> includes
the header <stdint.h>". So, this program shouldn't need to include
<stdint.h>.

Some mappings were previously added for individual symbols from
<stdint.h> (e.g., commit 24f9fdf0af ("Add more mappings for
[u]intptr_t"), but it's more accurate to export everything. Get rid of
the symbol mappings and add an include mapping.
2021-12-04 20:25:50 +01:00
Kim Grasman f050226101 Add mapping from <bits/time.h> to <time.h>
This makes <time.h> a valid provider of CLOCKS_PER_SEC and other symbols
declared in <bits/time.h>.

Not entirely sure how this fares with older glibc versions, but my
suspicion is <time.h> is a better candidate than <sys/time.h> in the
general case.
2020-11-01 18:59:43 +01:00
Volodymyr Sapsai 13cffc8c9a Add more libc mapping(s). 2016-02-01 21:50:10 -08:00
Kim Grasman ba2ac2148e Fix #245: SOCK_STREAM attributed to bits/socket_type.h
Add both internal and external mappings.
2016-01-02 16:57:53 +01:00
Volodymyr Sapsai 147dfb6dd9 Specify public STL headers explicitly (issue #132).
Add STL mapping suitable for different STL implementations instead of relying
on libstdc++ mappings to provide all public STL headers implicitly.
2014-09-28 17:54:48 +00:00
Volodymyr Sapsai 14c56d8f43 Update GNU libc file mappings (issue #131). 2014-05-10 14:00:44 +00:00
Volodymyr Sapsai 04be6e8e3d Clean up IWYU header mappings. No functional change intended. 2014-05-10 13:45:46 +00:00
Volodymyr Sapsai a6c6e5238c Read private to public mappings from external file. Patch by Kim Gräsman. 2012-10-14 22:39:30 +00:00