This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch master updated. glibc-2.20-271-g49051f8


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  49051f8ea4551229fa656eba04031af51a5491c5 (commit)
      from  9114625bad23441c89eac5a7dcf319a9714ca31f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=49051f8ea4551229fa656eba04031af51a5491c5

commit 49051f8ea4551229fa656eba04031af51a5491c5
Author: Joseph Myers <joseph@codesourcery.com>
Date:   Thu Nov 27 16:01:04 2014 +0000

    Fix libio/bug-ungetwc1.c warning.
    
    This patch fixes a warning "variable 'wc' set but not used" in
    libio/bug-ungetwc1.c.
    
    The test didn't verify much about the results of the functions it
    called.  This patch makes it check the result of getwc (thereby fixing
    the warning), check end of file does not arrive too late in the getwc
    loop, and check EOF is no longer set after ungetwc.
    
    Tested for x86_64.
    
    	* libio/bug-ungetwc1.c (do_test): Verify results of getwc and
    	feof.

diff --git a/ChangeLog b/ChangeLog
index 9090877..7fdc85d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2014-11-27  Joseph Myers  <joseph@codesourcery.com>
 
+	* libio/bug-ungetwc1.c (do_test): Verify results of getwc and
+	feof.
+
 	* dlfcn/failtestmod.c (constr): Do not store result of dlsym in a
 	variable.
 
diff --git a/libio/bug-ungetwc1.c b/libio/bug-ungetwc1.c
index 8ed6acd..56a3d33 100644
--- a/libio/bug-ungetwc1.c
+++ b/libio/bug-ungetwc1.c
@@ -53,8 +53,22 @@ do_test (void)
   /* Read from the file. */
   fp = fopen (fname, "r");
 
+  size_t i = 0;
   while (!feof (fp))
-    wc = getwc (fp);
+    {
+      wc = getwc (fp);
+      if (i >= sizeof (write_chars))
+	{
+	  printf ("Did not get end-of-file when expected.\n");
+	  return 1;
+	}
+      else if (wc != (write_chars[i] ? write_chars[i] : WEOF))
+	{
+	  printf ("Unexpected %lu from getwc.\n", (unsigned long int) wc);
+	  return 1;
+	}
+      i++;
+    }
   printf ("\nThe end-of-file indicator is set.\n");
 
   /* Unget a wide character. */
@@ -63,7 +77,10 @@ do_test (void)
 
   /* Check the end-of-file indicator. */
   if (feof (fp))
-    printf ("The end-of-file indicator is still set.\n");
+    {
+      printf ("The end-of-file indicator is still set.\n");
+      return 1;
+    }
   else
     printf ("The end-of-file flag is cleared.\n");
 

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog            |    3 +++
 libio/bug-ungetwc1.c |   21 +++++++++++++++++++--
 2 files changed, 22 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]