linux-test-project / ltp

Linux Test Project (mailing list: https://lists.linux.it/listinfo/ltp)
https://linux-test-project.readthedocs.io/
GNU General Public License v2.0
2.3k stars 1.01k forks source link

include/tst_timer.h: avoid redefinition of kernel structures #895

Closed ffontaine closed 2 years ago

ffontaine commented 2 years ago

ifndef doesn't work on struct resulting in the following build failure (e.g. on sh4 which includes linux/time_types.h as soon as sys/socket.h is included):

In file included from ../../include/libsigwait.h:11,
                 from sigwait.c:9:
../../include/tst_timer.h:103:8: error: redefinition of ‘struct __kernel_old_timeval’
  103 | struct __kernel_old_timeval {
      |        ^~~~~~~~~~~~~~~~~~~~
In file included from /builds/sh4/host/sh4-buildroot-linux-uclibc/sysroot/usr/include/asm/sockios.h:5,
                 from /builds/sh4/host/sh4-buildroot-linux-uclibc/sysroot/usr/include/asm-generic/socket.h:6,
                 from /builds/sh4/host/sh4-buildroot-linux-uclibc/sysroot/usr/include/asm/socket.h:1,
                 from /builds/sh4/host/sh4-buildroot-linux-uclibc/sysroot/usr/include/bits/socket.h:362,
                 from /builds/sh4/host/sh4-buildroot-linux-uclibc/sysroot/usr/include/sys/socket.h:39,
                 from ../../include/tst_safe_net.h:9,
                 from ../../include/tst_test.h:96,
                 from ../../include/libsigwait.h:10,
                 from sigwait.c:9:
/builds/sh4/host/sh4-buildroot-linux-uclibc/sysroot/usr/include/linux/time_types.h:25:8: note: originally defined here
   25 | struct __kernel_old_timeval {
      |        ^~~~~~~~~~~~~~~~~~~~
In file included from ../../include/libsigwait.h:11,
                 from sigwait.c:9:
../../include/tst_timer.h:109:8: error: redefinition of ‘struct __kernel_old_timespec’
  109 | struct __kernel_old_timespec {
      |        ^~~~~~~~~~~~~~~~~~~~~

Fixes:

Signed-off-by: Fabrice Fontaine fontaine.fabrice@gmail.com

pevik commented 2 years ago

Reviewed-by: Petr Vorel <pvorel@suse.cz>

LGTM, but wait for the others. Please next time use our mailing list (we use github just for the CI and issues) http://lists.linux.it/listinfo/ltp

@wangli5665 @metan-ucw @richiejp

metan-ucw commented 2 years ago

Applied, thanks.

pevik commented 3 months ago

Back at the time it was merged in 12986b755a5ca03fb4f6c07f299c694fdb35db69.