Blame SOURCES/glibc-rh1505492-undef-54.patch

00db10
commit ccb729df47188874401c655dda8d47b55cddd3b7
00db10
Author: Joseph Myers <joseph@codesourcery.com>
00db10
Date:   Wed Aug 19 00:50:17 2015 +0000
00db10
00db10
    Fix -Wundef warnings in login/tst-utmp.c.
00db10
    
00db10
    To remove -Wno-error=undef, we need to fix the remaining cases where
00db10
    there are -Wundef warnings in the testsuite.  One of those places is
00db10
    in login/tst-utmp.c.
00db10
    
00db10
    When included from tst-utmpx.c, <utmpx.h> is included instead of
00db10
    <utmp.h>, meaning the _HAVE_UT_* macros are not defined.  The test is
00db10
    prepared for them not being defined, in that all the relevant
00db10
    conditionals also include "defined UTMPX".  However, they test the
00db10
    _HAVE_UT_* macros first, so resulting in -Wundef warnings.
00db10
    
00db10
    This patch does the minimal fix of swapping the || operands.  This is
00db10
    logically correct - avoiding checking a macro we know will not be
00db10
    defined in the case where it is not defined.  It won't fix such
00db10
    warnings for the case where the toplevel bits/utmp.h is used and most
00db10
    _HAVE_UT_* aren't defined at all even when <utmp.h> is included, but
00db10
    that case doesn't apply to any current glibc configuration.  Fixing it
00db10
    would also be tricky in that, while glibc itself consistently uses
00db10
    _HAVE_UT_* in ways that would work with 0 instead of undefined,
00db10
    external packages that use the macros expect defined / undefined
00db10
    instead of 1 / 0 (codesearch.debian.net shows uses by util-linux,
00db10
    python-utmp, libsys-utmp-perl).
00db10
    
00db10
    Tested for x86_64.
00db10
    
00db10
            * login/tst-utmp.c [_HAVE_UT_TYPE || defined UTMPX]: Change
00db10
            conditional to [defined UTMPX || _HAVE_UT_TYPE].
00db10
            [_HAVE_UT_TV || defined UTMPX]: Change conditional to [defined
00db10
            UTMPX || _HAVE_UT_TV].
00db10
            [_HAVE_UT_TV - 0 || defined UTMPX]: Change conditional to [defined
00db10
            UTMPX || _HAVE_UT_TV - 0].
00db10
00db10
diff --git a/login/tst-utmp.c b/login/tst-utmp.c
00db10
index 7cc39cb2b7ff2dba..84945934e249ca25 100644
00db10
--- a/login/tst-utmp.c
00db10
+++ b/login/tst-utmp.c
00db10
@@ -39,7 +39,7 @@
00db10
 #endif
00db10
 
00db10
 
00db10
-#if _HAVE_UT_TYPE || defined UTMPX
00db10
+#if defined UTMPX || _HAVE_UT_TYPE
00db10
 
00db10
 /* Prototype for our test function.  */
00db10
 static int do_test (int argc, char *argv[]);
00db10
@@ -75,7 +75,7 @@ do_prepare (int argc, char *argv[])
00db10
 
00db10
 struct utmp entry[] =
00db10
 {
00db10
-#if _HAVE_UT_TV || defined UTMPX
00db10
+#if defined UTMPX || _HAVE_UT_TV
00db10
 #define UT(a)  .ut_tv = { .tv_sec = (a)}
00db10
 #else
00db10
 #define UT(a)  .ut_time = (a)
00db10
@@ -167,7 +167,7 @@ simulate_login (const char *line, const char *user)
00db10
 	    entry[n].ut_pid = (entry_pid += 27);
00db10
 	  entry[n].ut_type = USER_PROCESS;
00db10
 	  strncpy (entry[n].ut_user, user, sizeof (entry[n].ut_user));
00db10
-#if _HAVE_UT_TV - 0 || defined UTMPX
00db10
+#if defined UTMPX || _HAVE_UT_TV - 0
00db10
 	  entry[n].ut_tv.tv_sec = (entry_time += 1000);
00db10
 #else
00db10
           entry[n].ut_time = (entry_time += 1000);
00db10
@@ -201,7 +201,7 @@ simulate_logout (const char *line)
00db10
 	{
00db10
 	  entry[n].ut_type = DEAD_PROCESS;
00db10
 	  strncpy (entry[n].ut_user, "", sizeof (entry[n].ut_user));
00db10
-#if _HAVE_UT_TV - 0 || defined UTMPX
00db10
+#if defined UTMPX || _HAVE_UT_TV - 0
00db10
           entry[n].ut_tv.tv_sec = (entry_time += 1000);
00db10
 #else
00db10
           entry[n].ut_time = (entry_time += 1000);