ccb729df47
To remove -Wno-error=undef, we need to fix the remaining cases where there are -Wundef warnings in the testsuite. One of those places is in login/tst-utmp.c. When included from tst-utmpx.c, <utmpx.h> is included instead of <utmp.h>, meaning the _HAVE_UT_* macros are not defined. The test is prepared for them not being defined, in that all the relevant conditionals also include "defined UTMPX". However, they test the _HAVE_UT_* macros first, so resulting in -Wundef warnings. This patch does the minimal fix of swapping the || operands. This is logically correct - avoiding checking a macro we know will not be defined in the case where it is not defined. It won't fix such warnings for the case where the toplevel bits/utmp.h is used and most _HAVE_UT_* aren't defined at all even when <utmp.h> is included, but that case doesn't apply to any current glibc configuration. Fixing it would also be tricky in that, while glibc itself consistently uses _HAVE_UT_* in ways that would work with 0 instead of undefined, external packages that use the macros expect defined / undefined instead of 1 / 0 (codesearch.debian.net shows uses by util-linux, python-utmp, libsys-utmp-perl). Tested for x86_64. * login/tst-utmp.c [_HAVE_UT_TYPE || defined UTMPX]: Change conditional to [defined UTMPX || _HAVE_UT_TYPE]. [_HAVE_UT_TV || defined UTMPX]: Change conditional to [defined UTMPX || _HAVE_UT_TV]. [_HAVE_UT_TV - 0 || defined UTMPX]: Change conditional to [defined UTMPX || _HAVE_UT_TV - 0]. |
||
---|---|---|
.. | ||
programs | ||
endutxent.c | ||
forkpty.c | ||
getlogin_r_chk.c | ||
getlogin_r.c | ||
getlogin.c | ||
getpt.c | ||
getutent_r.c | ||
getutent.c | ||
getutid_r.c | ||
getutid.c | ||
getutline_r.c | ||
getutline.c | ||
getutmp.c | ||
getutmpx.c | ||
getutxent.c | ||
getutxid.c | ||
getutxline.c | ||
grantpt.c | ||
lastlog.h | ||
login_tty.c | ||
login.c | ||
logout.c | ||
logwtmp.c | ||
Makefile | ||
openpty.c | ||
ptsname_r_chk.c | ||
ptsname.c | ||
pty.h | ||
pututxline.c | ||
setlogin.c | ||
setutxent.c | ||
tst-getlogin.c | ||
tst-grantpt.c | ||
tst-ptsname.c | ||
tst-utmp.c | ||
tst-utmpx.c | ||
unlockpt.c | ||
updwtmp.c | ||
updwtmpx.c | ||
utmp_file.c | ||
utmp-private.h | ||
utmp.h | ||
utmpname.c | ||
utmpxname.c | ||
Versions |