linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Including both linux/time.h and linux/input.h causes failure
@ 2020-01-29 15:14 Elichai Turkel
       [not found] ` <CALN7hC+f+D8xsaJBt+MCXDfk51oHCoQeUVmFydNdkW+_DeqTiw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Elichai Turkel @ 2020-01-29 15:14 UTC (permalink / raw)
  To: linux-api-u79uwXL29TY76Z2rM5mHXA

Hi,
The following header: <wrapper.h>:
```
#include <linux/input.h>
#include <linux/time.h>
```
Will cause the compiler to fail because of redefinition of a lot of
time related structs, that are declared once in `linux/time.h` and
then again via `bits/types/struct_timeval.h` which is included through
`linux/input.h > sys/time.h -> bits/types/struct_timeval.h`



Command: `gcc -I./headers_install/x86/include wrapper.h`
output:
```
In file included from wrapper.h:13:
./headers_install/x86/include/linux/time.h:16:8: error: redefinition
of ‘struct timeval’
   16 | struct timeval {
      |        ^~~~~~~
In file included from /usr/include/sys/time.h:25,
                 from ./headers_install/x86/include/linux/input.h:13,
                 from wrapper.h:8:
/usr/include/bits/types/struct_timeval.h:8:8: note: originally defined here
    8 | struct timeval
      |        ^~~~~~~
In file included from wrapper.h:13:
./headers_install/x86/include/linux/time.h:21:8: error: redefinition
of ‘struct timezone’
   21 | struct timezone {
      |        ^~~~~~~~
In file included from ./headers_install/x86/include/linux/input.h:13,
                 from wrapper.h:8:
/usr/include/sys/time.h:52:8: note: originally defined here
   52 | struct timezone
      |        ^~~~~~~~
In file included from wrapper.h:13:
./headers_install/x86/include/linux/time.h:30: warning: "ITIMER_REAL" redefined
   30 | #define ITIMER_REAL  0
      |
In file included from ./headers_install/x86/include/linux/input.h:13,
                 from wrapper.h:8:
/usr/include/sys/time.h:92: note: this is the location of the previous
definition
   92 | #define ITIMER_REAL ITIMER_REAL
      |
In file included from wrapper.h:13:
./headers_install/x86/include/linux/time.h:31: warning:
"ITIMER_VIRTUAL" redefined
   31 | #define ITIMER_VIRTUAL  1
      |
In file included from ./headers_install/x86/include/linux/input.h:13,
                 from wrapper.h:8:
/usr/include/sys/time.h:95: note: this is the location of the previous
definition
   95 | #define ITIMER_VIRTUAL ITIMER_VIRTUAL
      |
In file included from wrapper.h:13:
./headers_install/x86/include/linux/time.h:32: warning: "ITIMER_PROF" redefined
   32 | #define ITIMER_PROF  2
      |
In file included from ./headers_install/x86/include/linux/input.h:13,
                 from wrapper.h:8:
/usr/include/sys/time.h:99: note: this is the location of the previous
definition
   99 | #define ITIMER_PROF ITIMER_PROF
      |
In file included from wrapper.h:13:
./headers_install/x86/include/linux/time.h:39:8: error: redefinition
of ‘struct itimerval’
   39 | struct itimerval {
      |        ^~~~~~~~~
In file included from ./headers_install/x86/include/linux/input.h:13,
                 from wrapper.h:8:
/usr/include/sys/time.h:104:8: note: originally defined here
  104 | struct itimerval
      |        ^~~~~~~~~

```

-- 
PGP: 5607C93B5F86650C

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-01-30 14:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-29 15:14 Including both linux/time.h and linux/input.h causes failure Elichai Turkel
     [not found] ` <CALN7hC+f+D8xsaJBt+MCXDfk51oHCoQeUVmFydNdkW+_DeqTiw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2020-01-29 17:16   ` Carlos O'Donell
     [not found]     ` <88ab5e38-254a-430d-67cf-1840b0e51c35-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2020-01-30 14:12       ` Elichai Turkel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).