diff --git a/libio/clearerr.c b/libio/clearerr.c
index 5d29fc500a0..77ac552fac1 100644
--- a/libio/clearerr.c
+++ b/libio/clearerr.c
@@ -27,6 +27,6 @@ clearerr (FILE *fp)
   _IO_funlockfile (fp);
 }
 
-#if defined weak_alias && !defined _IO_MTSAFE_IO
+#ifndef _IO_MTSAFE_IO
 weak_alias (clearerr, clearerr_unlocked)
 #endif
diff --git a/libio/fileops.c b/libio/fileops.c
index fb39bec63cd..618c0d5c311 100644
--- a/libio/fileops.c
+++ b/libio/fileops.c
@@ -468,11 +468,6 @@ int
 _IO_new_file_underflow (FILE *fp)
 {
   ssize_t count;
-#if 0
-  /* SysV does not make this test; take it out for compatibility */
-  if (fp->_flags & _IO_EOF_SEEN)
-    return (EOF);
-#endif
 
   if (fp->_flags & _IO_NO_READS)
     {
@@ -494,13 +489,9 @@ _IO_new_file_underflow (FILE *fp)
       _IO_doallocbuf (fp);
     }
 
-  /* Flush all line buffered files before reading. */
   /* FIXME This can/should be moved to genops ?? */
   if (fp->_flags & (_IO_LINE_BUF|_IO_UNBUFFERED))
     {
-#if 0
-      _IO_flush_all_linebuffered ();
-#else
       /* We used to flush all line-buffered stream.  This really isn't
 	 required by any standard.  My recollection is that
 	 traditional Unix systems did this for stdout.  stderr better
@@ -513,7 +504,6 @@ _IO_new_file_underflow (FILE *fp)
 	_IO_OVERFLOW (_IO_stdout, EOF);
 
       _IO_release_lock (_IO_stdout);
-#endif
     }
 
   _IO_switch_to_get_mode (fp);
@@ -813,10 +803,6 @@ _IO_new_file_sync (FILE *fp)
   delta = fp->_IO_read_ptr - fp->_IO_read_end;
   if (delta != 0)
     {
-#ifdef TODO
-      if (_IO_in_backup (fp))
-	delta -= eGptr () - Gbase ();
-#endif
       off64_t new_pos = _IO_SYSSEEK (fp, delta, 1);
       if (new_pos != (off64_t) EOF)
 	fp->_IO_read_end = fp->_IO_read_ptr;
@@ -838,10 +824,6 @@ _IO_file_sync_mmap (FILE *fp)
 {
   if (fp->_IO_read_ptr != fp->_IO_read_end)
     {
-#ifdef TODO
-      if (_IO_in_backup (fp))
-	delta -= eGptr () - Gbase ();
-#endif
       if (__lseek64 (fp->_fileno, fp->_IO_read_ptr - fp->_IO_buf_base,
 		     SEEK_SET)
 	  != fp->_IO_read_ptr - fp->_IO_buf_base)
diff --git a/libio/fputc.c b/libio/fputc.c
index 13b3b84a769..1e743eb74c9 100644
--- a/libio/fputc.c
+++ b/libio/fputc.c
@@ -40,7 +40,7 @@ fputc (int c, FILE *fp)
   return result;
 }
 
-#if defined weak_alias && !defined _IO_MTSAFE_IO
+#ifndef _IO_MTSAFE_IO
 #undef fputc_unlocked
 weak_alias (fputc, fputc_unlocked)
 #endif
diff --git a/libio/genops.c b/libio/genops.c
index 2b820c86d20..2fec221b997 100644
--- a/libio/genops.c
+++ b/libio/genops.c
@@ -194,24 +194,6 @@ _IO_free_backup_area (FILE *fp)
 }
 libc_hidden_def (_IO_free_backup_area)
 
-#if 0
-int
-_IO_switch_to_put_mode (FILE *fp)
-{
-  fp->_IO_write_base = fp->_IO_read_ptr;
-  fp->_IO_write_ptr = fp->_IO_read_ptr;
-  /* Following is wrong if line- or un-buffered? */
-  fp->_IO_write_end = (fp->_flags & _IO_IN_BACKUP
-		       ? fp->_IO_read_end : fp->_IO_buf_end);
-
-  fp->_IO_read_ptr = fp->_IO_read_end;
-  fp->_IO_read_base = fp->_IO_read_end;
-
-  fp->_flags |= _IO_CURRENTLY_PUTTING;
-  return 0;
-}
-#endif
-
 int
 __overflow (FILE *f, int ch)
 {
@@ -465,15 +447,6 @@ _IO_default_xsgetn (FILE *fp, void *data, size_t n)
 }
 libc_hidden_def (_IO_default_xsgetn)
 
-#if 0
-/* Seems not to be needed. --drepper */
-int
-_IO_sync (FILE *fp)
-{
-  return 0;
-}
-#endif
-
 FILE *
 _IO_default_setbuf (FILE *fp, char *p, ssize_t len)
 {
@@ -697,28 +670,6 @@ _IO_sungetc (FILE *fp)
   return result;
 }
 
-#if 0 /* Work in progress */
-/* Seems not to be needed.  */
-#if 0
-void
-_IO_set_column (FILE *fp, int c)
-{
-  if (c == -1)
-    fp->_column = -1;
-  else
-    fp->_column = c - (fp->_IO_write_ptr - fp->_IO_write_base);
-}
-#else
-int
-_IO_set_column (FILE *fp, int i)
-{
-  fp->_cur_column = i + 1;
-  return 0;
-}
-#endif
-#endif
-
-
 unsigned
 _IO_adjust_column (unsigned start, const char *line, int count)
 {
@@ -730,20 +681,6 @@ _IO_adjust_column (unsigned start, const char *line, int count)
 }
 libc_hidden_def (_IO_adjust_column)
 
-#if 0
-/* Seems not to be needed. --drepper */
-int
-_IO_get_column (FILE *fp)
-{
-  if (fp->_cur_column)
-    return _IO_adjust_column (fp->_cur_column - 1,
-			      fp->_IO_write_base,
-			      fp->_IO_write_ptr - fp->_IO_write_base);
-  return -1;
-}
-#endif
-
-
 int
 _IO_flush_all_lockp (int do_lock)
 {
@@ -964,10 +901,8 @@ _IO_remove_marker (struct _IO_marker *marker)
 	  return;
 	}
     }
-#if 0
-    if _sbuf has a backup area that is no longer needed, should we delete
-    it now, or wait until the next underflow?
-#endif
+  /* FIXME: if _sbuf has a backup area that is no longer needed,
+     should we delete it now, or wait until the next underflow? */
 }
 
 #define BAD_DELTA EOF
@@ -1018,20 +953,6 @@ _IO_unsave_markers (FILE *fp)
   struct _IO_marker *mark = fp->_markers;
   if (mark)
     {
-#ifdef TODO
-      streampos offset = seekoff (0, ios::cur, ios::in);
-      if (offset != EOF)
-	{
-	  offset += eGptr () - Gbase ();
-	  for ( ; mark != NULL; mark = mark->_next)
-	    mark->set_streampos (mark->_pos + offset);
-	}
-    else
-      {
-	for ( ; mark != NULL; mark = mark->_next)
-	  mark->set_streampos (EOF);
-      }
-#endif
       fp->_markers = 0;
     }
 
@@ -1040,19 +961,6 @@ _IO_unsave_markers (FILE *fp)
 }
 libc_hidden_def (_IO_unsave_markers)
 
-#if 0
-/* Seems not to be needed. --drepper */
-int
-_IO_nobackup_pbackfail (FILE *fp, int c)
-{
-  if (fp->_IO_read_ptr > fp->_IO_read_base)
-	fp->_IO_read_ptr--;
-  if (c != EOF && *fp->_IO_read_ptr != c)
-      *fp->_IO_read_ptr = c;
-  return (unsigned char) c;
-}
-#endif
-
 int
 _IO_default_pbackfail (FILE *fp, int c)
 {
@@ -1200,24 +1108,4 @@ _IO_list_resetlock (void)
 }
 libc_hidden_def (_IO_list_resetlock)
 
-
-#ifdef TODO
-#if defined(linux)
-#define IO_CLEANUP ;
-#endif
-
-#ifdef IO_CLEANUP
-  IO_CLEANUP
-#else
-struct __io_defs {
-    __io_defs() { }
-    ~__io_defs() { _IO_cleanup (); }
-};
-__io_defs io_defs__;
-#endif
-
-#endif /* TODO */
-
-#ifdef text_set_element
 text_set_element(__libc_atexit, _IO_cleanup);
-#endif
diff --git a/libio/getchar.c b/libio/getchar.c
index 8f8555f8c1e..0e3f4153c89 100644
--- a/libio/getchar.c
+++ b/libio/getchar.c
@@ -41,7 +41,7 @@ getchar (void)
   return result;
 }
 
-#if defined weak_alias && !defined _IO_MTSAFE_IO
+#ifndef _IO_MTSAFE_IO
 #undef getchar_unlocked
 weak_alias (getchar, getchar_unlocked)
 #endif
diff --git a/libio/iofdopen.c b/libio/iofdopen.c
index 21a53e30f6c..1f20eacb256 100644
--- a/libio/iofdopen.c
+++ b/libio/iofdopen.c
@@ -62,7 +62,7 @@ _IO_new_fdopen (int fd, const char *mode)
       read_write = _IO_NO_READS|_IO_IS_APPENDING;
       break;
     default:
-      MAYBE_SET_EINVAL;
+      __set_errno (EINVAL);
       return NULL;
   }
   for (i = 1; i < 5; ++i)
@@ -92,7 +92,7 @@ _IO_new_fdopen (int fd, const char *mode)
   if (((fd_flags & O_ACCMODE) == O_RDONLY && !(read_write & _IO_NO_WRITES))
       || ((fd_flags & O_ACCMODE) == O_WRONLY && !(read_write & _IO_NO_READS)))
     {
-      MAYBE_SET_EINVAL;
+      __set_errno (EINVAL);
       return NULL;
     }
 
diff --git a/libio/iogetdelim.c b/libio/iogetdelim.c
index f5b0991be8c..4f3ce5ed62c 100644
--- a/libio/iogetdelim.c
+++ b/libio/iogetdelim.c
@@ -45,7 +45,7 @@ _IO_getdelim (char **lineptr, size_t *n, int delimiter, FILE *fp)
 
   if (lineptr == NULL || n == NULL)
     {
-      MAYBE_SET_EINVAL;
+      __set_errno (EINVAL);
       return -1;
     }
   CHECK_FILE (fp, -1);
diff --git a/libio/iolibio.h b/libio/iolibio.h
index ceaa33a44bb..69e1c0e699c 100644
--- a/libio/iolibio.h
+++ b/libio/iolibio.h
@@ -59,9 +59,6 @@ struct obstack;
 extern int _IO_obstack_vprintf (struct obstack *, const char *, __gnuc_va_list)
        __THROW;
 extern int _IO_obstack_printf (struct obstack *, const char *, ...) __THROW;
-#ifndef _IO_pos_BAD
-#define _IO_pos_BAD ((off64_t)(-1))
-#endif
 #define _IO_clearerr(FP) ((FP)->_flags &= ~(_IO_ERR_SEEN|_IO_EOF_SEEN))
 #define _IO_fseek(__fp, __offset, __whence) \
   (_IO_seekoff_unlocked (__fp, __offset, __whence, _IOS_INPUT|_IOS_OUTPUT) \
diff --git a/libio/libio.h b/libio/libio.h
index d1516185667..1371161e025 100644
--- a/libio/libio.h
+++ b/libio/libio.h
@@ -124,6 +124,14 @@ typedef union
 #define _IO_DONT_CLOSE 0100000
 #define _IO_BOOLALPHA 0200000
 
+/* _IO_pos_BAD is an off64_t value indicating error, unknown, or EOF. */
+#define _IO_pos_BAD ((off64_t) -1)
+
+/* _IO_pos_adjust adjust an off64_t by some number of bytes. */
+#define _IO_pos_adjust(pos, delta) ((pos) += (delta))
+
+/* _IO_pos_0 is an off64_t value indicating beginning of file. */
+#define _IO_pos_0 ((off64_t) 0)
 
 struct _IO_jump_t;
 
diff --git a/libio/libioP.h b/libio/libioP.h
index ee23296ddba..8afe7032e3f 100644
--- a/libio/libioP.h
+++ b/libio/libioP.h
@@ -309,10 +309,6 @@ struct _IO_jump_t
     JUMP_FIELD(_IO_stat_t, __stat);
     JUMP_FIELD(_IO_showmanyc_t, __showmanyc);
     JUMP_FIELD(_IO_imbue_t, __imbue);
-#if 0
-    get_column;
-    set_column;
-#endif
 };
 
 /* We always allocate an extra word following an _IO_FILE.
@@ -710,19 +706,6 @@ extern off64_t _IO_seekpos_unlocked (FILE *, off64_t, int)
 
 extern int _IO_vscanf (const char *, va_list) __THROW;
 
-/* _IO_pos_BAD is an off64_t value indicating error, unknown, or EOF. */
-#ifndef _IO_pos_BAD
-# define _IO_pos_BAD ((off64_t) -1)
-#endif
-/* _IO_pos_adjust adjust an off64_t by some number of bytes. */
-#ifndef _IO_pos_adjust
-# define _IO_pos_adjust(pos, delta) ((pos) += (delta))
-#endif
-/* _IO_pos_0 is an off64_t value indicating beginning of file. */
-#ifndef _IO_pos_0
-# define _IO_pos_0 ((off64_t) 0)
-#endif
-
 #ifdef _IO_MTSAFE_IO
 /* check following! */
 # ifdef _IO_USE_OLD_IO_FILE
@@ -752,33 +735,19 @@ extern int _IO_vscanf (const char *, va_list) __THROW;
 # endif
 #endif
 
-#define _IO_va_start(args, last) va_start(args, last)
-
 extern struct _IO_fake_stdiobuf _IO_stdin_buf, _IO_stdout_buf, _IO_stderr_buf;
 
-#if 1
-# define COERCE_FILE(FILE) /* Nothing */
-#else
-/* This is part of the kludge for binary compatibility with old stdio. */
-# define COERCE_FILE(FILE) \
-  (((FILE)->_flags & _IO_MAGIC_MASK) == _OLD_MAGIC_MASK \
-    && (FILE) = *(FILE**)&((int*)fp)[1])
-#endif
-
-#ifdef EINVAL
-# define MAYBE_SET_EINVAL __set_errno (EINVAL)
-#else
-# define MAYBE_SET_EINVAL /* nothing */
-#endif
-
 #ifdef IO_DEBUG
-# define CHECK_FILE(FILE, RET) \
-	if ((FILE) == NULL) { MAYBE_SET_EINVAL; return RET; } \
-	else { COERCE_FILE(FILE); \
-	       if (((FILE)->_flags & _IO_MAGIC_MASK) != _IO_MAGIC) \
-	  { MAYBE_SET_EINVAL; return RET; }}
+# define CHECK_FILE(FILE, RET) do {			\
+    if ((FILE) == NULL ||				\
+	((FILE)->_flags & _IO_MAGIC_MASK) != _IO_MAGIC) \
+      {							\
+	__set_errno (EINVAL);				\
+	return RET;					\
+      }							\
+  } while (0)
 #else
-# define CHECK_FILE(FILE, RET) COERCE_FILE (FILE)
+# define CHECK_FILE(FILE, RET) do { } while (0)
 #endif
 
 static inline void
diff --git a/libio/oldfileops.c b/libio/oldfileops.c
index 5a0f246411c..b53dcacbbc7 100644
--- a/libio/oldfileops.c
+++ b/libio/oldfileops.c
@@ -294,11 +294,6 @@ attribute_compat_text_section
 _IO_old_file_underflow (FILE *fp)
 {
   ssize_t count;
-#if 0
-  /* SysV does not make this test; take it out for compatibility */
-  if (fp->_flags & _IO_EOF_SEEN)
-    return (EOF);
-#endif
 
   if (fp->_flags & _IO_NO_READS)
     {
@@ -516,10 +511,6 @@ _IO_old_file_seekoff (FILE *fp, off64_t offset, int dir, int mode)
 			      + (fp->_IO_read_end - fp->_IO_read_base));
       if (rel_offset >= 0)
 	{
-#if 0
-	  if (_IO_in_backup (fp))
-	    _IO_switch_to_main_get_area (fp);
-#endif
 	  if (rel_offset <= fp->_IO_read_end - fp->_IO_read_base)
 	    {
 	      _IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base + rel_offset,
diff --git a/libio/oldiofdopen.c b/libio/oldiofdopen.c
index 17930c2786f..cec6642fc40 100644
--- a/libio/oldiofdopen.c
+++ b/libio/oldiofdopen.c
@@ -60,7 +60,7 @@ _IO_old_fdopen (int fd, const char *mode)
       read_write = _IO_NO_READS|_IO_IS_APPENDING;
       break;
     default:
-      MAYBE_SET_EINVAL;
+      __set_errno (EINVAL);
       return NULL;
   }
   if (mode[0] == '+' || (mode[0] == 'b' && mode[1] == '+'))
diff --git a/libio/oldpclose.c b/libio/oldpclose.c
index f02a05fc376..d2975206a3d 100644
--- a/libio/oldpclose.c
+++ b/libio/oldpclose.c
@@ -32,16 +32,12 @@
 #include "stdio.h"
 #include <errno.h>
 
+/* Does not actually test that stream was created by popen(). Instead,
+   it depends on the filebuf::sys_close() virtual to Do The Right Thing. */
 int
 attribute_compat_text_section
 __old_pclose (FILE *fp)
 {
-#if 0
-  /* Does not actually test that stream was created by popen(). Instead,
-     it depends on the filebuf::sys_close() virtual to Do The Right Thing. */
-  if (fp is not a proc_file)
-    return -1;
-#endif
   return _IO_old_fclose (fp);
 }
 
diff --git a/libio/pclose.c b/libio/pclose.c
index 74851b55ba3..052efaa31ed 100644
--- a/libio/pclose.c
+++ b/libio/pclose.c
@@ -29,15 +29,11 @@
 #include <errno.h>
 #include <shlib-compat.h>
 
+/* Does not actually test that stream was created by popen(). Instead,
+   it depends on the filebuf::sys_close() virtual to Do The Right Thing. */
 int
 __new_pclose (FILE *fp)
 {
-#if 0
-  /* Does not actually test that stream was created by popen(). Instead,
-     it depends on the filebuf::sys_close() virtual to Do The Right Thing. */
-  if (fp is not a proc_file)
-    return -1;
-#endif
   return _IO_new_fclose (fp);
 }
 
diff --git a/libio/tst-mmap-eofsync.c b/libio/tst-mmap-eofsync.c
index e8ef7271489..0c568e8eb5e 100644
--- a/libio/tst-mmap-eofsync.c
+++ b/libio/tst-mmap-eofsync.c
@@ -60,7 +60,6 @@ do_test (void)
   printf ("feof = %d, ferror = %d immediately after fgets\n",
 	  feof (f), ferror (f));
 
-#if 1
   c = fgetc (f);
   if (c == EOF)
     printf ("fgetc -> EOF (feof = %d, ferror = %d)\n",
@@ -71,7 +70,6 @@ do_test (void)
 	      c, feof (f), ferror (f));
       result = 1;
     }
-#endif
 
   c = write (temp_fd, text2, sizeof text2 - 1);
   if (c == sizeof text2 - 1)
diff --git a/libio/wfileops.c b/libio/wfileops.c
index aecbf0d86d7..8bb4fd78c9f 100644
--- a/libio/wfileops.c
+++ b/libio/wfileops.c
@@ -196,13 +196,9 @@ _IO_wfile_underflow (FILE *fp)
       _IO_wdoallocbuf (fp);
     }
 
-  /* Flush all line buffered files before reading. */
   /* FIXME This can/should be moved to genops ?? */
   if (fp->_flags & (_IO_LINE_BUF | _IO_UNBUFFERED))
     {
-#if 0
-      _IO_flush_all_linebuffered ();
-#else
       /* We used to flush all line-buffered stream.  This really isn't
 	 required by any standard.  My recollection is that
 	 traditional Unix systems did this for stdout.  stderr better
@@ -215,7 +211,6 @@ _IO_wfile_underflow (FILE *fp)
 	_IO_OVERFLOW (_IO_stdout, EOF);
 
       _IO_release_lock (_IO_stdout);
-#endif
     }
 
   _IO_switch_to_get_mode (fp);
diff --git a/libio/wgenops.c b/libio/wgenops.c
index 2d61bc96524..a2413ec20a2 100644
--- a/libio/wgenops.c
+++ b/libio/wgenops.c
@@ -426,26 +426,6 @@ _IO_free_wbackup_area (FILE *fp)
 }
 libc_hidden_def (_IO_free_wbackup_area)
 
-#if 0
-int
-_IO_switch_to_wput_mode (FILE *fp)
-{
-  fp->_wide_data->_IO_write_base = fp->_wide_data->_IO_read_ptr;
-  fp->_wide_data->_IO_write_ptr = fp->_wide_data->_IO_read_ptr;
-  /* Following is wrong if line- or un-buffered? */
-  fp->_wide_data->_IO_write_end = (fp->_flags & _IO_IN_BACKUP
-				   ? fp->_wide_data->_IO_read_end
-				   : fp->_wide_data->_IO_buf_end);
-
-  fp->_wide_data->_IO_read_ptr = fp->_wide_data->_IO_read_end;
-  fp->_wide_data->_IO_read_base = fp->_wide_data->_IO_read_end;
-
-  fp->_flags |= _IO_CURRENTLY_PUTTING;
-  return 0;
-}
-#endif
-
-
 static int
 save_for_wbackup (FILE *fp, wchar_t *end_p)
 {
@@ -624,20 +604,6 @@ _IO_unsave_wmarkers (FILE *fp)
   struct _IO_marker *mark = fp->_markers;
   if (mark)
     {
-#ifdef TODO
-      streampos offset = seekoff (0, ios::cur, ios::in);
-      if (offset != EOF)
-	{
-	  offset += eGptr () - Gbase ();
-	  for ( ; mark != NULL; mark = mark->_next)
-	    mark->set_streampos (mark->_pos + offset);
-	}
-    else
-      {
-	for ( ; mark != NULL; mark = mark->_next)
-	  mark->set_streampos (EOF);
-      }
-#endif
       fp->_markers = 0;
     }
 
diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
index 8f0a6f8cf28..ae412e4b844 100644
--- a/stdio-common/vfprintf.c
+++ b/stdio-common/vfprintf.c
@@ -58,7 +58,7 @@
 	}								      \
       if (Format == NULL)						      \
 	{								      \
-	  MAYBE_SET_EINVAL;						      \
+	  __set_errno (EINVAL);						      \
 	  return -1;							      \
 	}								      \
     } while (0)
diff --git a/stdio-common/vfscanf.c b/stdio-common/vfscanf.c
index a519a57b8fd..3263268c7ea 100644
--- a/stdio-common/vfscanf.c
+++ b/stdio-common/vfscanf.c
@@ -172,7 +172,7 @@
 	}								      \
       else if (format == NULL)						      \
 	{								      \
-	  MAYBE_SET_EINVAL;						      \
+	  __set_errno (EINVAL);						      \
 	  return EOF;							      \
 	}								      \
     } while (0)
