glibc/login
Joseph Myers ccb729df47 Fix -Wundef warnings in login/tst-utmp.c.
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].
2015-08-19 00:50:17 +00:00
..
programs Update copyright dates not handled by scripts/update-copyrights. 2015-01-02 16:54:45 +00:00
Makefile Move tst-getlogin to login/ subdirectory. 2015-02-06 12:29:27 -08:00
Versions Move getlogin_r_chk to login/ subdir. 2013-05-06 15:58:44 -07:00
endutxent.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
forkpty.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
getlogin.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
getlogin_r.c Fix getlogin_r namespace (bug 18527). 2015-06-12 20:02:30 +00:00
getlogin_r_chk.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
getpt.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
getutent.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
getutent_r.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
getutid.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
getutid_r.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
getutline.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
getutline_r.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
getutmp.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
getutmpx.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
getutxent.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
getutxid.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
getutxline.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
grantpt.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
lastlog.h
login.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
login_tty.c * login/login_tty.c (login_tty): The Linux kernel can return EBUSY 2007-10-04 21:54:22 +00:00
logout.c Remove some references to bcopy/bcmp/bzero. 2015-01-13 11:12:55 -08:00
logwtmp.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
openpty.c Make sysdeps/posix bring in login subdir. 2015-07-23 17:04:22 -07:00
ptsname.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
ptsname_r_chk.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
pty.h Make sysdeps/posix bring in login subdir. 2015-07-23 17:04:22 -07:00
pututxline.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
setlogin.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
setutxent.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
tst-getlogin.c Move tst-getlogin to login/ subdirectory. 2015-02-06 12:29:27 -08:00
tst-grantpt.c Modify several tests to use test-skeleton.c 2014-11-05 15:24:08 +05:30
tst-ptsname.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
tst-utmp.c Fix -Wundef warnings in login/tst-utmp.c. 2015-08-19 00:50:17 +00:00
tst-utmpx.c
unlockpt.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
updwtmp.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
updwtmpx.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
utmp-private.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
utmp.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
utmp_file.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
utmpname.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
utmpxname.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00