Patchwork [roland/Wshadow] -Wshadow

login
register
mail settings
Submitter Roland McGrath
Date Oct. 13, 2014, 7:32 p.m.
Message ID <20141013193220.9CF4E2C3AFA@topped-with-meat.com>
Download mbox | patch
Permalink /patch/3214/
State New
Headers show

Comments

Roland McGrath - Oct. 13, 2014, 7:32 p.m.
I got it in my head some time back that there were some bugs in the past
that would have been noticed earlier if we used -Wshadow.  I don't recall
any specific cases that might have made me think that.  I took a crack at
adding -Werror=shadow to +gccwarn in Makeconfig and fixing up the errors.
I did a bunch but there are still a bunch more, so I am not proposing the
patch to actually add -Werror=shadow.

There were a lot more of these than I had anticipated.  Some of the ones
that still remain are sticky enough that I lost inspiration to go fix them
up.  There are a lot of errors in math code that I am afraid to touch at
all.

Most of the changes I did here had no effect on the generated code (aside
from assertion line numbers).  A few had harmless-looking effects.  But a
few produced substantial diffs in the disassembly and I haven't bothered to
analyze them to figure out how harmless they really appear to be or what
triggered them.  There are no 'make check' regressions on x86_64-linux-gnu,
but I don't want to put the changes in without either analyzing the
nontrivial code generation effects more thoroughly or having someone else
review the changes and confirm they are harmless.

I can't really tell if it would be worthwhile to do all the work necessary
to get the whole codebase clean for -Werror=shadow.  I'm probably not going
to put any more time into myself any time soon unless other folks jump in.


Thanks,
Roland


2014-10-13  Roland McGrath  <roland@hack.frob.com>

	* locale/programs/ld-ctype.c (charclass_charcode_ellipsis): Remove
	superfluous block-local variable SEQ.
	(allocate_arrays): Remove superfluous block-local variables IDX, LEN.

	* locale/programs/ld-collate.c (insert_value): Rename inner-block
	local variable RESULT to FOUND.
	(collate_read): Likewise.  Remove superfluous block-local variable PTR.
	(collate_output): Use C99 mixed declaration for function-local
	variable RUNP.  Remove superfluous block-local variables I.

	* locale/programs/locarchive.c (show_archive_content): Rename
	parameter VERBOSE to BE_VERBOSE.

	* locale/programs/locfile.c (write_locale_data): Drop function-local
	variable CNT.

	* iconv/iconv_prog.c (write_output): Rename parameter OUTPUT_FILE to
	OUTPUT_FILENAME.
	(process_block, process_fd, process_file): Likewise.

	* elf/dl-iteratephdr.c (__dl_iterate_phdr): Drop function-local
	variable L.

	* elf/dl-sym.c (do_sym): Rename block-local variable L to NEXT.

	* elf/dl-cache.c (SEARCH_CACHE): Remove superfluous block-local
	variable KEY.

	* elf/dl-deps.c (_dl_map_object_deps): Rename block-local variable
	RUNP to MAP_RUNP.

	* sysdeps/unix/sysv/linux/dl-origin.c (_dl_get_origin): Rename
	block-local variable LEN to PATH_LEN.

	* elf/dl-fini.c (_dl_sort_fini): Remove superfluous block-local
	variables RUNP and I.

	* resolv/res_hconf.c (_res_hconf_reorder_addrs): Use C99 for-statement
	declaration for I and J.

	* resolv/res_init.c (res_setoptions): Rename parameter OPTIONS to OPTS.
	Remove superfluous block-local variable I.

	* sysdeps/unix/sysv/linux/ifaddrs.c (getifaddrs_internal):
	Drop shadowing inner-block declaration of local variable IDX.

	* inet/rcmd.c (rcmd_af): Drop shadowing inner-block
	declaration of local variable NUM.

	* sysdeps/unix/sysv/linux/x86/elision-conf.c
	(elision_init): Rename parameter ENVIRON to ENVP.

	* sysdeps/unix/sysv/linux/x86_64/lowlevellock.h
	(lll_cond_lock, lll_cond_trylock, lll_lock, lll_robust_cond_lock):
	Prepend _ to local variable names inside statement expression.
	(lll_robust_lock, lll_robust_timedlock, lll_timedlock, lll_trylock):
	Likewise.
	* sysdeps/x86/elide.h (ELIDE_TRYLOCK): Likewise.
	* nptl/pthreadP.h (CANCELLATION_P): Likewise.
	* elf/dl-version.c (make_string): Likewise.

	* sysdeps/unix/sysv/linux/getsysstats.c (__get_nprocs): Move
	function-local variable L inside blocks where it's used.

	* termios/tcgetsid.c (tcgetsid): Use C99 mixed declarations for PGRP
	and PID.

	* io/ftw.c (ftw_startup): Drop function-local variable SAVE_ERR.

	* posix/wordexp.c (parse_param): Rename parameter QUOTED to
	PARAM_QUOTED.  Rename inner-block locals OFFSET to DOLLARS_OFFSET and
	TILDE_OFFSET.

	* sysdeps/posix/getaddrinfo.c (gaih_inet): Drop shadowing inner-block
	declaration of local variable RC.

	* posix/regcomp.c (create_initial_state): Rename inner-block local
	variable ERR to MERGE_ERR.

	* dirent/scandir.c (SCANDIR): Rename parameter SELECT to SELECTOR.
	* dirent/scandirat.c (SCANDIRAT): Likewise.

	* time/strptime_l.c (__strptime_internal): Rename inner-block local
	variables FMT to SUBFMT.

	* malloc/hooks.c (realloc_check): Drop shadowing inner-block
	declaration of local variable NB.

	* stdio-common/printf-parsemb.c (__parse_one_specwc): Move
	function-local variable N into inner blocks.

	* stdio-common/vfscanf.c (__va_copy): New macro, define if not already
	defined.
	(_IO_vfwscanf: ARG): Always use __va_copy.  Rename local variable ARG
	inside statement expression to ARGCOPY.
	(_IO_vfwscanf): Rename parameter S to STREAM.
	(inchar, ORIENT): Update uses.

	* stdio-common/vfprintf.c (vfprintf): Move block-local variable
	FUNCTION_DONE in main processing loop into an inside block so it
	won't be shadowed.

	* stdio-common/printf_fphex.c (__printf_fphex): Remove superfluous
	block-local variable WIDTH in the SPECIAL case.

	* sysdeps/x86_64/nptl/tls.h (THREAD_SELF): Rename local variable
	__SELF inside statement expression to __THREAD_SELF.

	* stdlib/strtod_l.c (____STRTOF_INTERNAL): Rename inner-block local
	variable RETVAL to RESULT.  Move function-level START_OF_DIGITS and
	STARTP local variables' declarations to their initialization sites.
	(____STRTOF_INTERNAL: got_limb): Rename block-local variable CNT
	to ZERO_COUNT.
	(__mpn_lshift_1): Rename block-local variable I inside statement
	expression to _I.

	* sysdeps/unix/sysv/linux/x86_64/sysdep.h (INTERNAL_SYSCALL_NCS):
	Rename local variable RESULTVAR to NCS_RESULT.
	(INTERNAL_SYSCALL_NCS_TYPES): Likewise.

	* iconv/gconv_int.h (norm_add_slashes): Use _ prefix on local
	variables inside the statement expression.
	* stdlib/setenv.c (KNOWN_VALUE): Likewise.

	* iconv/gconv_simple.c (BODY for internal_utf8_loop): Rename local
	variable STEP to STEP_SIZE.

	* locale/localeinfo.h (enum value_type): Prefix elements with "vt_".
	* locale/programs/locale.c (DEFINE_ELEMENT): Prepend the prefix here.
	* locale/loadlocale.c (DEFINE_ELEMENT): Likewise.
	(_nl_intern_locale_data): Update user.
	* locale/programs/locale.c (print_item): Likewise.

Patch

--- a/dirent/scandir.c
+++ b/dirent/scandir.c
@@ -34,13 +34,13 @@ 
 
 
 int
-SCANDIR (dir, namelist, select, cmp)
+SCANDIR (dir, namelist, selector, cmp)
      const char *dir;
      DIRENT_TYPE ***namelist;
-     int (*select) (const DIRENT_TYPE *);
+     int (*selector) (const DIRENT_TYPE *);
      int (*cmp) (const DIRENT_TYPE **, const DIRENT_TYPE **);
 {
-  return SCANDIRAT (AT_FDCWD, dir, namelist, select, cmp);
+  return SCANDIRAT (AT_FDCWD, dir, namelist, selector, cmp);
 }
 
 #ifdef _DIRENT_MATCHES_DIRENT64
--- a/dirent/scandirat.c
+++ b/dirent/scandirat.c
@@ -52,11 +52,11 @@  __scandir_cancel_handler (void *arg)
 
 
 int
-SCANDIRAT (dfd, dir, namelist, select, cmp)
+SCANDIRAT (dfd, dir, namelist, selector, cmp)
      int dfd;
      const char *dir;
      DIRENT_TYPE ***namelist;
-     int (*select) (const DIRENT_TYPE *);
+     int (*selector) (const DIRENT_TYPE *);
      int (*cmp) (const DIRENT_TYPE **, const DIRENT_TYPE **);
 {
   DIR *dp = __opendirat (dfd, dir);
@@ -79,12 +79,12 @@  SCANDIRAT (dfd, dir, namelist, select, cmp)
 
   while ((d = READDIR (dp)) != NULL)
     {
-      int use_it = select == NULL;
+      int use_it = selector == NULL;
 
       if (! use_it)
 	{
-	  use_it = select (d);
-	  /* The select function might have changed errno.  It was
+	  use_it = (*selector) (d);
+	  /* The SELECTOR function might have changed errno.  It was
 	     zero before and it need to be again to make the latter
 	     tests work.  */
 	  __set_errno (0);
@@ -95,7 +95,7 @@  SCANDIRAT (dfd, dir, namelist, select, cmp)
 	  DIRENT_TYPE *vnew;
 	  size_t dsize;
 
-	  /* Ignore errors from select or readdir */
+	  /* Ignore errors from SELECTOR or readdir.  */
 	  __set_errno (0);
 
 	  if (__glibc_unlikely (c.cnt == vsize))
--- a/elf/dl-cache.c
+++ b/elf/dl-cache.c
@@ -75,8 +75,6 @@  do									      \
 	       found.  So we have to find the beginning.  */		      \
 	    while (middle > 0)						      \
 	      {								      \
-		__typeof__ (cache->libs[0].key) key;			      \
-									      \
 		key = cache->libs[middle - 1].key;			      \
 		/* Make sure string table indices are not bogus before	      \
 		   using them.  */					      \
--- a/elf/dl-deps.c
+++ b/elf/dl-deps.c
@@ -629,11 +629,11 @@  Filters not supported with LD_TRACE_PRELINKING"));
 	  unsigned int k = nlist - 1;
 	  while (k > i)
 	    {
-	      struct link_map **runp = l_initfini[k]->l_initfini;
-	      if (runp != NULL)
+	      struct link_map **map_runp = l_initfini[k]->l_initfini;
+	      if (map_runp != NULL)
 		/* Look through the dependencies of the object.  */
-		while (*runp != NULL)
-		  if (__glibc_unlikely (*runp++ == thisp))
+		while (*map_runp != NULL)
+		  if (__glibc_unlikely (*map_runp++ == thisp))
 		    {
 		      /* Move the current object to the back past the last
 			 object with it as the dependency.  */
--- a/elf/dl-fini.c
+++ b/elf/dl-fini.c
@@ -101,7 +101,7 @@  _dl_sort_fini (struct link_map **maps, size_t nmaps, char *used, Lmid_t ns)
 		  {
 		    /* If a cycle exists with a link time dependency,
 		       preserve the latter.  */
-		    struct link_map **runp = thisp->l_initfini;
+		    runp = thisp->l_initfini;
 		    if (runp != NULL)
 		      while (*runp != NULL)
 			if (__glibc_unlikely (*runp++ == maps[k]))
@@ -246,8 +246,8 @@  _dl_fini (void)
 		      ElfW(Addr) *array =
 			(ElfW(Addr) *) (l->l_addr
 					+ l->l_info[DT_FINI_ARRAY]->d_un.d_ptr);
-		      unsigned int i = (l->l_info[DT_FINI_ARRAYSZ]->d_un.d_val
-					/ sizeof (ElfW(Addr)));
+		      i = (l->l_info[DT_FINI_ARRAYSZ]->d_un.d_val
+                           / sizeof (ElfW(Addr)));
 		      while (i-- > 0)
 			((fini_t) array[i]) ();
 		    }
--- a/elf/dl-iteratephdr.c
+++ b/elf/dl-iteratephdr.c
@@ -33,7 +33,6 @@  int
 __dl_iterate_phdr (int (*callback) (struct dl_phdr_info *info,
 				    size_t size, void *data), void *data)
 {
-  struct link_map *l;
   struct dl_phdr_info info;
   int ret = 0;
 
@@ -61,7 +60,7 @@  __dl_iterate_phdr (int (*callback) (struct dl_phdr_info *info,
       }
 #endif
 
-  for (l = GL(dl_ns)[ns]._ns_loaded; l != NULL; l = l->l_next)
+  for (struct link_map *l = GL(dl_ns)[ns]._ns_loaded; l != NULL; l = l->l_next)
     {
       info.dlpi_addr = l->l_real->l_addr;
       info.dlpi_name = l->l_real->l_name;
--- a/elf/dl-sym.c
+++ b/elf/dl-sym.c
@@ -154,11 +154,11 @@  do_sym (void *handle, const char *name, void *who,
 RTLD_NEXT used in code not dynamically loaded"));
 	}
 
-      struct link_map *l = match;
-      while (l->l_loader != NULL)
-	l = l->l_loader;
+      struct link_map *next = match;
+      while (next->l_loader != NULL)
+	next = next->l_loader;
 
-      result = GLRO(dl_lookup_symbol_x) (name, match, &ref, l->l_local_scope,
+      result = GLRO(dl_lookup_symbol_x) (name, match, &ref, next->l_local_scope,
 					 vers, 0, 0, match);
     }
   else
--- a/elf/dl-version.c
+++ b/elf/dl-version.c
@@ -30,19 +30,19 @@ 
 
 #define make_string(string, rest...) \
   ({									      \
-    const char *all[] = { string, ## rest };				      \
-    size_t len, cnt;							      \
-    char *result, *cp;							      \
+    const char *_all[] = { string, ## rest };				      \
+    size_t _len, _cnt;							      \
+    char *_result, *_cp;						      \
 									      \
-    len = 1;								      \
-    for (cnt = 0; cnt < sizeof (all) / sizeof (all[0]); ++cnt)		      \
-      len += strlen (all[cnt]);						      \
+    _len = 1;								      \
+    for (_cnt = 0; _cnt < sizeof (_all) / sizeof (_all[0]); ++_cnt)	      \
+      _len += strlen (_all[_cnt]);					      \
 									      \
-    cp = result = alloca (len);						      \
-    for (cnt = 0; cnt < sizeof (all) / sizeof (all[0]); ++cnt)		      \
-      cp = __stpcpy (cp, all[cnt]);					      \
+    _cp = _result = alloca (_len);					      \
+    for (_cnt = 0; _cnt < sizeof (_all) / sizeof (_all[0]); ++_cnt)	      \
+      _cp = __stpcpy (_cp, _all[_cnt]);					      \
 									      \
-    result;								      \
+    _result;								      \
   })
 
 
--- a/iconv/gconv_int.h
+++ b/iconv/gconv_int.h
@@ -123,34 +123,34 @@  __libc_lock_define (extern, __gconv_lock attribute_hidden)
 
 /* The gconv functions expects the name to be in upper case and complete,
    including the trailing slashes if necessary.  */
-#define norm_add_slashes(str,suffix) \
+#define norm_add_slashes(str, suffix) \
   ({									      \
-    const char *cp = (str);						      \
-    char *result;							      \
-    char *tmp;								      \
-    size_t cnt = 0;							      \
-    const size_t suffix_len = strlen (suffix);				      \
+    const char *_cp = (str);						      \
+    char *_result;							      \
+    char *_tmp;								      \
+    size_t _cnt = 0;							      \
+    const size_t _suffix_len = strlen (suffix);				      \
 									      \
-    while (*cp != '\0')							      \
-      if (*cp++ == '/')							      \
-	++cnt;								      \
+    while (*_cp != '\0')						      \
+      if (*_cp++ == '/')						      \
+	++_cnt;								      \
 									      \
-    tmp = result = __alloca (cp - (str) + 3 + suffix_len);		      \
-    cp = (str);								      \
-    while (*cp != '\0')							      \
-      *tmp++ = __toupper_l (*cp++, _nl_C_locobj_ptr);			      \
-    if (cnt < 2)							      \
+    _tmp = _result = __alloca (_cp - (str) + 3 + _suffix_len);		      \
+    _cp = (str);							      \
+    while (*_cp != '\0')						      \
+      *_tmp++ = __toupper_l (*_cp++, _nl_C_locobj_ptr);			      \
+    if (_cnt < 2)							      \
       {									      \
-	*tmp++ = '/';							      \
-	if (cnt < 1)							      \
+	*_tmp++ = '/';							      \
+	if (_cnt < 1)							      \
 	  {								      \
-	    *tmp++ = '/';						      \
-	    if (suffix_len != 0)					      \
-	      tmp = __mempcpy (tmp, suffix, suffix_len);		      \
+	    *_tmp++ = '/';						      \
+	    if (_suffix_len != 0)					      \
+	      _tmp = __mempcpy (_tmp, suffix, _suffix_len);		      \
 	  }								      \
       }									      \
-    *tmp = '\0';							      \
-    result;								      \
+    *_tmp = '\0';							      \
+    _result;								      \
   })
 
 
--- a/iconv/gconv_simple.c
+++ b/iconv/gconv_simple.c
@@ -892,14 +892,14 @@  ucs4le_internal_loop_single (struct __gconv_step *step,
       *outptr++ = (unsigned char) wc;					      \
     else if (__glibc_likely (wc <= 0x7fffffff))				      \
       {									      \
-	size_t step;							      \
+	size_t step_size;						      \
 	unsigned char *start;						      \
 									      \
-	for (step = 2; step < 6; ++step)				      \
-	  if ((wc & (~(uint32_t)0 << (5 * step + 1))) == 0)		      \
+	for (step_size = 2; step_size < 6; ++step_size)			      \
+	  if ((wc & (~(uint32_t)0 << (5 * step_size + 1))) == 0)	      \
 	    break;							      \
 									      \
-	if (__glibc_unlikely (outptr + step > outend))			      \
+	if (__glibc_unlikely (outptr + step_size > outend))		      \
 	  {								      \
 	    /* Too long.  */						      \
 	    result = __GCONV_FULL_OUTPUT;				      \
@@ -907,14 +907,14 @@  ucs4le_internal_loop_single (struct __gconv_step *step,
 	  }								      \
 									      \
 	start = outptr;							      \
-	*outptr = (unsigned char) (~0xff >> step);			      \
-	outptr += step;							      \
+	*outptr = (unsigned char) (~0xff >> step_size);			      \
+	outptr += step_size;						      \
 	do								      \
 	  {								      \
-	    start[--step] = 0x80 | (wc & 0x3f);				      \
+	    start[--step_size] = 0x80 | (wc & 0x3f);			      \
 	    wc >>= 6;							      \
 	  }								      \
-	while (step > 1);						      \
+	while (step_size > 1);						      \
 	start[0] |= wc;							      \
       }									      \
     else								      \
--- a/iconv/iconv_prog.c
+++ b/iconv/iconv_prog.c
@@ -433,7 +433,7 @@  warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
 
 static int
 write_output (const char *outbuf, const char *outptr, FILE **output,
-	      const char *output_file)
+	      const char *output_filename)
 {
   /* We have something to write out.  */
   int errno_save = errno;
@@ -441,9 +441,9 @@  write_output (const char *outbuf, const char *outptr, FILE **output,
   if (*output == NULL)
     {
       /* Determine output file.  */
-      if (output_file != NULL && strcmp (output_file, "-") != 0)
+      if (output_filename != NULL && strcmp (output_filename, "-") != 0)
 	{
-	  *output = fopen (output_file, "w");
+	  *output = fopen (output_filename, "w");
 	  if (*output == NULL)
 	    error (EXIT_FAILURE, errno, _("cannot open output file"));
 	}
@@ -468,7 +468,7 @@  conversion stopped due to problem in writing the output"));
 
 static int
 process_block (iconv_t cd, char *addr, size_t len, FILE **output,
-	       const char *output_file)
+	       const char *output_filename)
 {
 #define OUTBUF_SIZE	32768
   const char *start = addr;
@@ -495,7 +495,7 @@  process_block (iconv_t cd, char *addr, size_t len, FILE **output,
 
       if (outptr != outbuf)
 	{
-	  ret = write_output (outbuf, outptr, output, output_file);
+	  ret = write_output (outbuf, outptr, output, output_filename);
 	  if (ret != 0)
 	    break;
 	}
@@ -510,7 +510,7 @@  process_block (iconv_t cd, char *addr, size_t len, FILE **output,
 
 	  if (outptr != outbuf)
 	    {
-	      ret = write_output (outbuf, outptr, output, output_file);
+	      ret = write_output (outbuf, outptr, output, output_filename);
 	      if (ret != 0)
 		break;
 	    }
@@ -556,7 +556,7 @@  incomplete character or shift sequence at end of buffer"));
 
 
 static int
-process_fd (iconv_t cd, int fd, FILE **output, const char *output_file)
+process_fd (iconv_t cd, int fd, FILE **output, const char *output_filename)
 {
   /* we have a problem with reading from a desriptor since we must not
      provide the iconv() function an incomplete character or shift
@@ -630,16 +630,17 @@  process_fd (iconv_t cd, int fd, FILE **output, const char *output_file)
       }
 
   /* Now we have all the input in the buffer.  Process it in one run.  */
-  return process_block (cd, inbuf, actlen, output, output_file);
+  return process_block (cd, inbuf, actlen, output, output_filename);
 }
 
 
 static int
-process_file (iconv_t cd, FILE *input, FILE **output, const char *output_file)
+process_file (iconv_t cd, FILE *input, FILE **output,
+              const char *output_filename)
 {
   /* This should be safe since we use this function only for `stdin' and
      we haven't read anything so far.  */
-  return process_fd (cd, fileno (input), output, output_file);
+  return process_fd (cd, fileno (input), output, output_filename);
 }
 
 
--- a/inet/rcmd.c
+++ b/inet/rcmd.c
@@ -241,7 +241,6 @@  rcmd: socket: All ports in use\n"));
 		__write(s, "", 1);
 		lport = 0;
 	} else {
-		char num[8];
 		int s2 = rresvport_af(&lport, ai->ai_family), s3;
 		socklen_t len = ai->ai_addrlen;
 
--- a/io/ftw.c
+++ b/io/ftw.c
@@ -635,7 +635,6 @@  ftw_startup (const char *dir, int is_nftw, void *func, int descriptors,
   struct ftw_data data;
   struct STAT st;
   int result = 0;
-  int save_err;
   int cwdfd = -1;
   char *cwd = NULL;
   char *cp;
@@ -803,8 +802,8 @@  ftw_startup (const char *dir, int is_nftw, void *func, int descriptors,
     }
 
   /* Free all memory.  */
- out_fail:
-  save_err = errno;
+ out_fail:;
+  int save_err = errno;
   __tdestroy (data.known_objects, free);
   free (data.dirbuf);
   __set_errno (save_err);
--- a/locale/loadlocale.c
+++ b/locale/loadlocale.c
@@ -47,7 +47,7 @@  static const size_t _nl_category_num_items[] =
 #define DEFINE_CATEGORY(category, category_name, items, a) \
 static const enum value_type _nl_value_type_##category[] = { NO_PAREN items };
 #define DEFINE_ELEMENT(element, element_name, optstd, type, rest...) \
-  [_NL_ITEM_INDEX (element)] = type,
+  [_NL_ITEM_INDEX (element)] = vt_##type,
 #include "categories.def"
 #undef DEFINE_CATEGORY
 
@@ -144,7 +144,7 @@  _nl_intern_locale_data (int category, const void *data, size_t datasize)
       if ((category == LC_CTYPE
 	   && cnt >= (sizeof (_nl_value_type_LC_CTYPE)
 		      / sizeof (_nl_value_type_LC_CTYPE[0])))
-	  || __builtin_expect (_nl_value_types[category][cnt] != word, 1))
+	  || __builtin_expect (_nl_value_types[category][cnt] != vt_word, 1))
 	newdata->values[cnt].string = newdata->filedata + idx;
       else
 	{
--- a/locale/localeinfo.h
+++ b/locale/localeinfo.h
@@ -113,17 +113,17 @@  enum coll_sort_rule
 /* We can map the types of the entries into a few categories.  */
 enum value_type
 {
-  none,
-  string,
-  stringarray,
-  byte,
-  bytearray,
-  word,
-  stringlist,
-  wordarray,
-  wstring,
-  wstringarray,
-  wstringlist
+  vt_none,
+  vt_string,
+  vt_stringarray,
+  vt_byte,
+  vt_bytearray,
+  vt_word,
+  vt_stringlist,
+  vt_wordarray,
+  vt_wstring,
+  vt_wstringarray,
+  vt_wstringlist
 };
 
 
--- a/locale/programs/ld-collate.c
+++ b/locale/programs/ld-collate.c
@@ -977,17 +977,17 @@  insert_value (struct linereader *ldfile, const char *symstr, size_t symlen,
       void *ptr = elem;
       if (find_entry (&collate->elem_table, symstr, symlen, &ptr) != 0)
 	{
-	  void *result;
+	  void *found;
 	  struct symbol_t *sym = NULL;
 
 	  /* It's also collation element.  Therefore it's either a
 	     collating symbol or it's a character which is not
 	     supported by the character set.  In the later case we
 	     simply create a dummy entry.  */
-	  if (find_entry (&collate->sym_table, symstr, symlen, &result) == 0)
+	  if (find_entry (&collate->sym_table, symstr, symlen, &found) == 0)
 	    {
 	      /* It's a collation symbol.  */
-	      sym = (struct symbol_t *) result;
+	      sym = found;
 
 	      elem = sym->order;
 	    }
@@ -2116,7 +2116,6 @@  collate_output (struct localedef_t *locale, const struct charmap_t *charmap,
   uint32_t elem_size;
   uint32_t *elem_table;
   int i;
-  struct element_t *runp;
 
   init_locale_data (&file, nelems);
   add_locale_uint32 (&file, nrules);
@@ -2230,7 +2229,6 @@  collate_output (struct localedef_t *locale, const struct charmap_t *charmap,
 		&& (runp->mbs[runp->nmbs - 1]
 		    == runp->mbnext->mbs[runp->nmbs - 1] + 1))
 	      {
-		int i;
 		struct element_t *series_startp = runp;
 		struct element_t *curp;
 
@@ -2289,8 +2287,6 @@  collate_output (struct localedef_t *locale, const struct charmap_t *charmap,
 		/* A single entry.  Simply add the index and the length and
 		   string (except for the first character which is already
 		   tested for).  */
-		int i;
-
 		/* Output the weight info.  */
 		weightidx = output_weight (&weightpool, collate, runp);
 
@@ -2402,7 +2398,7 @@  collate_output (struct localedef_t *locale, const struct charmap_t *charmap,
      larger to avoid extremely long search times.  We can achieve
      good results with a 40% larger table than there are entries.  */
   elem_size = 0;
-  runp = collate->start;
+  struct element_t *runp = collate->start;
   while (runp != NULL)
     {
       if (runp->mbs != NULL && runp->weights != NULL && !runp->is_character)
@@ -3313,7 +3309,6 @@  error while adding equivalent collating symbol"));
 	      else
 		{
 		  struct symbol_t *symbp;
-		  void *ptr;
 
 		  if (find_entry (&collate->sym_table, startmb, lenmb,
 				  &ptr) == 0)
@@ -3535,10 +3530,10 @@  error while adding equivalent collating symbol"));
 		}
 	      else
 		{
-		  void *result;
+		  void *found;
 
 		  if (find_entry (&collate->sym_table, symstr, symlen,
-				  &result) != 0)
+				  &found) != 0)
 		    /* No collating symbol, it's an error.  */
 		    goto err_label;
 
--- a/locale/programs/ld-ctype.c
+++ b/locale/programs/ld-ctype.c
@@ -1700,7 +1700,6 @@  to-value character sequence is smaller than from-value sequence"));
 	    }
 	  else if (handle_digits == 2)
 	    {
-	      struct charseq *seq;
 	      /* We must store the digit values.  */
 	      if (ctype->outdigits_act >= 10)
 		{
@@ -3994,9 +3993,9 @@  allocate_arrays (struct locale_ctype_t *ctype, const struct charmap_t *charmap,
 	{
 	  /* Search for the place where to insert this string.
 	     XXX Better use a real sorting algorithm later.  */
-	  size_t idx = 0;
 	  int replace = 0;
 
+          idx = 0;
 	  while (idx < number)
 	    {
 	      int res = wcscmp ((const wchar_t *) sorted[idx]->from,
@@ -4059,7 +4058,6 @@  allocate_arrays (struct locale_ctype_t *ctype, const struct charmap_t *charmap,
       to_len = 0;
       for (size_t cnt = 0; cnt < number; ++cnt)
 	{
-	  size_t len;
 	  struct translit_to_t *srunp;
 
 	  ctype->translit_from_idx[cnt] = from_len;
--- a/locale/programs/locale.c
+++ b/locale/programs/locale.c
@@ -138,7 +138,8 @@  struct category
 
 /* We have all categories defined in `categories.def'.  Now construct
    the description and data structure used for all categories.  */
-#define DEFINE_ELEMENT(Item, More...) { Item, ## More },
+#define DEFINE_ELEMENT(item, name, std, type, rest...) \
+  { item, name, std, vt_##type ,##rest },
 #define DEFINE_CATEGORY(category, name, items, postload) \
     static struct cat_item category##_desc[] =				      \
       {									      \
@@ -826,7 +827,7 @@  print_item (struct cat_item *item)
 {
   switch (item->value_type)
     {
-    case string:
+    case vt_string:
       if (show_keyword_name)
 	printf ("%s=\"", item->name);
       fputs (nl_langinfo (item->item_id) ? : "", stdout);
@@ -834,7 +835,7 @@  print_item (struct cat_item *item)
 	putchar ('"');
       putchar ('\n');
       break;
-    case stringarray:
+    case vt_stringarray:
       {
 	const char *val;
 	int cnt;
@@ -859,7 +860,7 @@  print_item (struct cat_item *item)
 	putchar ('\n');
       }
       break;
-    case stringlist:
+    case vt_stringlist:
       {
 	int first = 1;
 	const char *val = nl_langinfo (item->item_id) ? : "";
@@ -878,7 +879,7 @@  print_item (struct cat_item *item)
 	putchar ('\n');
       }
       break;
-    case byte:
+    case vt_byte:
       {
 	const char *val = nl_langinfo (item->item_id);
 
@@ -890,7 +891,7 @@  print_item (struct cat_item *item)
 	putchar ('\n');
       }
       break;
-    case bytearray:
+    case vt_bytearray:
       {
 	const char *val = nl_langinfo (item->item_id);
 	int cnt = val ? strlen (val) : 0;
@@ -908,7 +909,7 @@  print_item (struct cat_item *item)
 	printf ("%d\n", cnt == 0 || *val == '\177' ? -1 : *val);
       }
       break;
-    case word:
+    case vt_word:
       {
 	union { unsigned int word; char *string; } val;
 	val.string = nl_langinfo (item->item_id);
@@ -918,7 +919,7 @@  print_item (struct cat_item *item)
 	printf ("%d\n", val.word);
       }
       break;
-    case wordarray:
+    case vt_wordarray:
       {
 	int first = 1;
 	union { unsigned int *wordarray; char *string; } val;
@@ -935,9 +936,9 @@  print_item (struct cat_item *item)
 	putchar ('\n');
       }
       break;
-    case wstring:
-    case wstringarray:
-    case wstringlist:
+    case vt_wstring:
+    case vt_wstringarray:
+    case vt_wstringlist:
       /* We don't print wide character information since the same
 	 information is available in a multibyte string.  */
     default:
--- a/locale/programs/locarchive.c
+++ b/locale/programs/locarchive.c
@@ -1629,7 +1629,7 @@  dataentcmp (const void *a, const void *b)
 
 
 void
-show_archive_content (const char *fname, int verbose)
+show_archive_content (const char *fname, int be_verbose)
 {
   struct locarhandle ah;
   struct locarhead *head;
@@ -1660,7 +1660,7 @@  show_archive_content (const char *fname, int verbose)
   /* Sort the names.  */
   qsort (names, used, sizeof (struct nameent), nameentcmp);
 
-  if (verbose)
+  if (be_verbose)
     {
       struct dataent *files;
       struct sumhashent *sumhashtab;
--- a/locale/programs/locfile.c
+++ b/locale/programs/locfile.c
@@ -699,7 +699,7 @@  void
 write_locale_data (const char *output_path, int catidx, const char *category,
 		   struct locale_file *file)
 {
-  size_t cnt, step, maxiov;
+  size_t step, maxiov;
   int fd;
   char *fname;
   const char **other_paths;
@@ -724,7 +724,7 @@  write_locale_data (const char *output_path, int catidx, const char *category,
       /* The data will be added to the archive.  For now we simply
 	 generate the image which will be written.  First determine
 	 the size.  */
-      int cnt;
+      size_t cnt;
       void *endp;
 
       to_archive[catidx].size = 0;
@@ -812,7 +812,7 @@  cannot open output file `%s' for category `%s'"), fname, category));
 
   /* Write the data using writev.  But we must take care for the
      limitation of the implementation.  */
-  for (cnt = 0; cnt < n_elem; cnt += step)
+  for (size_t cnt = 0; cnt < n_elem; cnt += step)
     {
       step = n_elem - cnt;
       if (maxiov > 0)
--- a/malloc/hooks.c
+++ b/malloc/hooks.c
@@ -370,7 +370,6 @@  realloc_check (void *oldmem, size_t bytes, const void *caller)
     {
       if (top_check () >= 0)
         {
-          INTERNAL_SIZE_T nb;
           checked_request2size (bytes + 1, nb);
           newmem = _int_realloc (&main_arena, oldp, oldsize, nb);
         }
--- a/nptl/pthreadP.h
+++ b/nptl/pthreadP.h
@@ -227,8 +227,8 @@  extern int __pthread_debug attribute_hidden;
 /* Cancellation test.  */
 #define CANCELLATION_P(self) \
   do {									      \
-    int cancelhandling = THREAD_GETMEM (self, cancelhandling);		      \
-    if (CANCEL_ENABLED_AND_CANCELED (cancelhandling))			      \
+    int _cancelhandling = THREAD_GETMEM (self, cancelhandling);		      \
+    if (CANCEL_ENABLED_AND_CANCELED (_cancelhandling))			      \
       {									      \
 	THREAD_SETMEM (self, result, PTHREAD_CANCELED);			      \
 	__do_cancel ();							      \
--- a/posix/regcomp.c
+++ b/posix/regcomp.c
@@ -1036,11 +1036,11 @@  create_initial_state (re_dfa_t *dfa)
 	    int dest_idx = dfa->edests[node_idx].elems[0];
 	    if (!re_node_set_contains (&init_nodes, dest_idx))
 	      {
-		reg_errcode_t err = re_node_set_merge (&init_nodes,
-						       dfa->eclosures
-						       + dest_idx);
-		if (err != REG_NOERROR)
-		  return err;
+		reg_errcode_t merge_err = re_node_set_merge (&init_nodes,
+                                                             dfa->eclosures
+                                                             + dest_idx);
+		if (merge_err != REG_NOERROR)
+		  return merge_err;
 		i = 0;
 	      }
 	  }
--- a/posix/wordexp.c
+++ b/posix/wordexp.c
@@ -1218,7 +1218,7 @@  static int
 internal_function
 parse_param (char **word, size_t *word_length, size_t *max_length,
 	     const char *words, size_t *offset, int flags, wordexp_t *pwordexp,
-	     const char *ifs, const char *ifs_white, int quoted)
+	     const char *ifs, const char *ifs_white, int param_quoted)
 {
   /* We are poised just after "$" */
   enum action
@@ -1474,7 +1474,7 @@  envsubst:
 	  return *word ? 0 : WRDE_NOSPACE;
 	}
       /* Is it `$*' or `$@' (unquoted) ? */
-      else if (*env == '*' || (*env == '@' && !quoted))
+      else if (*env == '*' || (*env == '@' && !param_quoted))
 	{
 	  size_t plist_len = 0;
 	  int p;
@@ -1500,7 +1500,7 @@  envsubst:
       else
 	{
 	  /* Must be a quoted `$@' */
-	  assert (*env == '@' && quoted);
+	  assert (*env == '@' && param_quoted);
 
 	  /* Each parameter is a separate word ("$@") */
 	  if (__libc_argc == 2)
@@ -1599,8 +1599,6 @@  envsubst:
 	  expanded = w_newword (&exp_len, &exp_maxl);
 	  for (p = pattern; p && *p; p++)
 	    {
-	      size_t offset;
-
 	      switch (*p)
 		{
 		case '"':
@@ -1634,10 +1632,11 @@  envsubst:
 		    }
 		  break;
 
-		case '$':
-		  offset = 0;
+		case '$':;
+                  size_t dollars_offset = 0;
 		  error = parse_dollars (&expanded, &exp_len, &exp_maxl, p,
-					 &offset, flags, NULL, NULL, NULL, 1);
+					 &dollars_offset, flags,
+                                         NULL, NULL, NULL, 1);
 		  if (error)
 		    {
 		      if (free_value)
@@ -1648,16 +1647,16 @@  envsubst:
 		      goto do_error;
 		    }
 
-		  p += offset;
+		  p += dollars_offset;
 		  continue;
 
 		case '~':
 		  if (quoted || exp_len)
 		    break;
 
-		  offset = 0;
+		  size_t tilde_offset = 0;
 		  error = parse_tilde (&expanded, &exp_len, &exp_maxl, p,
-				       &offset, 0);
+				       &tilde_offset, 0);
 		  if (error)
 		    {
 		      if (free_value)
@@ -1668,7 +1667,7 @@  envsubst:
 		      goto do_error;
 		    }
 
-		  p += offset;
+		  p += tilde_offset;
 		  continue;
 
 		case '\\':
@@ -1940,7 +1939,7 @@  envsubst:
   if (value == NULL)
     return 0;
 
-  if (quoted || !pwordexp)
+  if (param_quoted || !pwordexp)
     {
       /* Quoted - no field split */
       *word = w_addstr (*word, word_length, max_length, value);
--- a/resolv/res_hconf.c
+++ b/resolv/res_hconf.c
@@ -386,7 +386,6 @@  void
 _res_hconf_reorder_addrs (struct hostent *hp)
 {
 #if defined SIOCGIFCONF && defined SIOCGIFNETMASK
-  int i, j;
   /* Number of interfaces.  */
   static int num_ifs = -1;
   /* We need to protect the dynamic buffer handling.  */
@@ -474,11 +473,11 @@  _res_hconf_reorder_addrs (struct hostent *hp)
     return;
 
   /* Find an address for which we have a direct connection.  */
-  for (i = 0; hp->h_addr_list[i]; ++i)
+  for (int i = 0; hp->h_addr_list[i]; ++i)
     {
       struct in_addr *haddr = (struct in_addr *) hp->h_addr_list[i];
 
-      for (j = 0; j < num_ifs; ++j)
+      for (int j = 0; j < num_ifs; ++j)
 	{
 	  u_int32_t if_addr    = ifaddrs[j].u.ipv4.addr;
 	  u_int32_t if_netmask = ifaddrs[j].u.ipv4.mask;
--- a/resolv/res_init.c
+++ b/resolv/res_init.c
@@ -477,14 +477,14 @@  __res_vinit(res_state statp, int preinit) {
 
 static void
 internal_function
-res_setoptions(res_state statp, const char *options, const char *source) {
-	const char *cp = options;
+res_setoptions(res_state statp, const char *opts, const char *source) {
+	const char *cp = opts;
 	int i;
 
 #ifdef DEBUG
 	if (statp->options & RES_DEBUG)
 		printf(";; res_setoptions(\"%s\", \"%s\")...\n",
-		       options, source);
+		       opts, source);
 #endif
 	while (*cp) {
 		/* skip leading and inner runs of spaces */
@@ -545,7 +545,6 @@  res_setoptions(res_state statp, const char *options, const char *source) {
 		    { STRnLEN ("use-vc"), 0, RES_USEVC }
 		  };
 #define noptions (sizeof (options) / sizeof (options[0]))
-		  int i;
 		  for (i = 0; i < noptions; ++i)
 		    if (strncmp (cp, options[i].str, options[i].len) == 0)
 		      {
--- a/stdio-common/printf-parsemb.c
+++ b/stdio-common/printf-parsemb.c
@@ -62,7 +62,6 @@  __parse_one_specmb (const UCHAR_T *format, size_t posn,
 		    struct printf_spec *spec, size_t *max_ref_arg)
 #endif
 {
-  unsigned int n;
   size_t nargs = 0;
 
   /* Skip the '%'.  */
@@ -85,7 +84,7 @@  __parse_one_specmb (const UCHAR_T *format, size_t posn,
     {
       const UCHAR_T *begin = format;
 
-      n = read_int (&format);
+      int n = read_int (&format);
 
       if (n != 0 && *format == L_('$'))
 	/* Is positional parameter.  */
@@ -161,7 +160,7 @@  __parse_one_specmb (const UCHAR_T *format, size_t posn,
       if (ISDIGIT (*format))
 	{
 	  /* The width argument might be found in a positional parameter.  */
-	  n = read_int (&format);
+	  int n = read_int (&format);
 
 	  if (n != 0 && *format == L_('$'))
 	    {
@@ -204,7 +203,7 @@  __parse_one_specmb (const UCHAR_T *format, size_t posn,
 
 	  if (ISDIGIT (*format))
 	    {
-	      n = read_int (&format);
+	      int n = read_int (&format);
 
 	      if (n != 0 && *format == L_('$'))
 		{
--- a/stdio-common/printf_fphex.c
+++ b/stdio-common/printf_fphex.c
@@ -240,8 +240,6 @@  __printf_fphex (FILE *fp,
 
   if (special)
     {
-      int width = info->width;
-
       if (negative || info->showsign || info->space)
 	--width;
       width -= 3;
--- a/stdio-common/vfprintf.c
+++ b/stdio-common/vfprintf.c
@@ -1965,7 +1965,6 @@  do_positional:
 	while (1)
 	  {
 	    extern printf_function **__printf_function_table;
-	    int function_done;
 
 	    if (spec <= UCHAR_MAX
 		&& __printf_function_table != NULL
@@ -1980,7 +1979,7 @@  do_positional:
 		  ptr[i] = &args_value[specs[nspecs_done].data_arg + i];
 
 		/* Call the function.  */
-		function_done = __printf_function_table[(size_t) spec]
+		int function_done = __printf_function_table[(size_t) spec]
 		  (s, &specs[nspecs_done].info, ptr);
 
 		if (function_done != -2)
@@ -2017,8 +2016,8 @@  do_positional:
 		ptr[i] = &args_value[specs[nspecs_done].data_arg + i];
 
 	      /* Call the function.  */
-	      function_done = printf_unknown (s, &specs[nspecs_done].info,
-					      ptr);
+	      int function_done = printf_unknown (s, &specs[nspecs_done].info,
+                                                  ptr);
 
 	      /* If an error occurred we don't have information about #
 		 of chars.  */
--- a/stdio-common/vfscanf.c
+++ b/stdio-common/vfscanf.c
@@ -82,7 +82,7 @@ 
 # define ungetc_not_eof(c, s)	((void) (--read_in,			      \
 					 _IO_sputbackwc (s, c)))
 # define inchar()	(c == WEOF ? ((errno = inchar_errno), WEOF)	      \
-			 : ((c = _IO_getwc_unlocked (s)),		      \
+			 : ((c = _IO_getwc_unlocked (stream)),		      \
 			    (void) (c != WEOF				      \
 				    ? ++read_in				      \
 				    : (size_t) (inchar_errno = errno)), c))
@@ -92,7 +92,7 @@ 
 # define ISDIGIT(Ch)	  iswdigit (Ch)
 # define ISXDIGIT(Ch)	  iswxdigit (Ch)
 # define TOLOWER(Ch)	  towlower (Ch)
-# define ORIENT	  if (_IO_fwide (s, 1) != 1) return WEOF
+# define ORIENT	  if (_IO_fwide (stream, 1) != 1) return WEOF
 # define __strtoll_internal	__wcstoll_internal
 # define __strtoull_internal	__wcstoull_internal
 # define __strtol_internal	__wcstol_internal
@@ -114,7 +114,7 @@ 
 # define ungetc_not_eof(c, s)	((void) (--read_in,			      \
 					 _IO_sputbackc (s, (unsigned char) c)))
 # define inchar()	(c == EOF ? ((errno = inchar_errno), EOF)	      \
-			 : ((c = _IO_getc_unlocked (s)),		      \
+			 : ((c = _IO_getc_unlocked (stream)),		      \
 			    (void) (c != EOF				      \
 				    ? ++read_in				      \
 				    : (size_t) (inchar_errno = errno)), c))
@@ -123,9 +123,9 @@ 
 # define ISDIGIT(Ch)	  __isdigit_l (Ch, loc)
 # define ISXDIGIT(Ch)	  __isxdigit_l (Ch, loc)
 # define TOLOWER(Ch)	  __tolower_l ((unsigned char) (Ch), loc)
-# define ORIENT	  if (_IO_vtable_offset (s) == 0			      \
-			      && _IO_fwide (s, -1) != -1)		      \
-			    return EOF
+# define ORIENT	  if (_IO_vtable_offset (stream) == 0			      \
+                      && _IO_fwide (stream, -1) != -1)			      \
+		    return EOF
 
 # define L_(Str)	Str
 # define CHAR_T		char
@@ -192,16 +192,20 @@  struct ptrs_to_free
   char **ptrs[32];
 };
 
+#ifndef __va_copy
+# define __va_copy(dst, src)	(dst) = (va_list) (src)
+#endif
+
 /* Read formatted input from S according to the format string
    FORMAT, using the argument list in ARG.
    Return the number of assignments made, or -1 for an input error.  */
 #ifdef COMPILE_WSCANF
 int
-_IO_vfwscanf (_IO_FILE *s, const wchar_t *format, _IO_va_list argptr,
+_IO_vfwscanf (_IO_FILE *stream, const wchar_t *format, _IO_va_list argptr,
 	      int *errp)
 #else
 int
-_IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
+_IO_vfscanf_internal (_IO_FILE *stream, const char *format, _IO_va_list argptr,
 		      int *errp)
 #endif
 {
@@ -303,17 +307,13 @@  _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
     }									    \
   while (0)
 
-#ifdef __va_copy
   __va_copy (arg, argptr);
-#else
-  arg = (va_list) argptr;
-#endif
 
 #ifdef ORIENT
   ORIENT;
 #endif
 
-  ARGCHECK (s, format);
+  ARGCHECK (stream, format);
 
  {
 #ifndef COMPILE_WSCANF
@@ -337,7 +337,7 @@  _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
  }
 
   /* Lock the stream.  */
-  LOCK_STREAM (s);
+  LOCK_STREAM (stream);
 
 
 #ifndef COMPILE_WSCANF
@@ -352,35 +352,14 @@  _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
       /* Extract the next argument, which is of type TYPE.
 	 For a %N$... spec, this is the Nth argument from the beginning;
 	 otherwise it is the next argument after the state now in ARG.  */
-#ifdef __va_copy
-# define ARG(type)	(argpos == 0 ? va_arg (arg, type) :		      \
+#define ARG(type)	(argpos == 0 ? va_arg (arg, type) :		      \
 			 ({ unsigned int pos = argpos;			      \
-			    va_list arg;				      \
-			    __va_copy (arg, argptr);			      \
+			    va_list argcopy;				      \
+			    __va_copy (argcopy, argptr);		      \
 			    while (--pos > 0)				      \
-			      (void) va_arg (arg, void *);		      \
-			    va_arg (arg, type);				      \
+			      (void) va_arg (argcopy, void *);		      \
+			    va_arg (argcopy, type);			      \
 			  }))
-#else
-# if 0
-      /* XXX Possible optimization.  */
-#  define ARG(type)	(argpos == 0 ? va_arg (arg, type) :		      \
-			 ({ va_list arg = (va_list) argptr;		      \
-			    arg = (va_list) ((char *) arg		      \
-					     + (argpos - 1)		      \
-					     * __va_rounded_size (void *));   \
-			    va_arg (arg, type);				      \
-			 }))
-# else
-#  define ARG(type)	(argpos == 0 ? va_arg (arg, type) :		      \
-			 ({ unsigned int pos = argpos;			      \
-			    va_list arg = (va_list) argptr;		      \
-			    while (--pos > 0)				      \
-			      (void) va_arg (arg, void *);		      \
-			    va_arg (arg, type);				      \
-			  }))
-# endif
-#endif
 
 #ifndef COMPILE_WSCANF
       if (!isascii ((unsigned char) *f))
@@ -396,7 +375,7 @@  _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
 		    input_error ();
 		  else if (c != (unsigned char) *f++)
 		    {
-		      ungetc_not_eof (c, s);
+		      ungetc_not_eof (c, stream);
 		      conv_error ();
 		    }
 		}
@@ -435,7 +414,7 @@  _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
 
 	  if (__glibc_unlikely (c != fc))
 	    {
-	      ungetc (c, s);
+	      ungetc (c, stream);
 	      conv_error ();
 	    }
 
@@ -539,7 +518,7 @@  _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
 	    }
 	  /* In __isoc99_*scanf %as, %aS and %a[ extension is not
 	     supported at all.  */
-	  if (s->_flags2 & _IO_FLAGS2_SCANF_STD)
+	  if (stream->_flags2 & _IO_FLAGS2_SCANF_STD)
 	    {
 	      --f;
 	      break;
@@ -602,7 +581,7 @@  _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
 	      input_error ();
 	  while (ISSPACE (c));
 	  __set_errno (save_errno);
-	  ungetc (c, s);
+	  ungetc (c, stream);
 	  skip_space = 0;
 	}
 
@@ -614,7 +593,7 @@  _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
 	    input_error ();
 	  if (__glibc_unlikely (c != fc))
 	    {
-	      ungetc_not_eof (c, s);
+	      ungetc_not_eof (c, stream);
 	      conv_error ();
 	    }
 	  break;
@@ -1002,7 +981,7 @@  _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
 		{
 		  if (ISSPACE (c))
 		    {
-		      ungetc_not_eof (c, s);
+		      ungetc_not_eof (c, stream);
 		      break;
 		    }
 
@@ -1192,7 +1171,7 @@  _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
 	      {
 		if (ISSPACE (c))
 		  {
-		    ungetc_not_eof (c, s);
+		    ungetc_not_eof (c, stream);
 		    break;
 		  }
 
@@ -1459,12 +1438,12 @@  _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
 		      wint_t extra_wcdigit = __towctrans (L'0' + n, map);
 
 		      /*  Convert it to multibyte representation.  */
-		      mbstate_t state;
-		      memset (&state, '\0', sizeof (state));
+		      mbstate_t dstate;
+		      memset (&dstate, '\0', sizeof (dstate));
 
 		      char extra_mbdigit[MB_LEN_MAX];
 		      size_t mblen
-			= __wcrtomb (extra_mbdigit, extra_wcdigit, &state);
+			= __wcrtomb (extra_mbdigit, extra_wcdigit, &dstate);
 
 		      if (mblen == (size_t) -1)
 			{
@@ -1554,9 +1533,9 @@  _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
 		      /* We are pushing all read characters back.  */
 		      if (cmpp > mbdigits[n])
 			{
-			  ungetc (c, s);
+			  ungetc (c, stream);
 			  while (--cmpp > mbdigits[n])
-			    ungetc_not_eof ((unsigned char) *cmpp, s);
+			    ungetc_not_eof ((unsigned char) *cmpp, stream);
 			  c = (unsigned char) *cmpp;
 			}
 
@@ -1606,9 +1585,10 @@  _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
 			      /* We are pushing all read characters back.  */
 			      if (cmpp > mbdigits[n])
 				{
-				  ungetc (c, s);
+				  ungetc (c, stream);
 				  while (--cmpp > mbdigits[n])
-				    ungetc_not_eof ((unsigned char) *cmpp, s);
+				    ungetc_not_eof ((unsigned char) *cmpp,
+                                                    stream);
 				  c = (unsigned char) *cmpp;
 				}
 
@@ -1658,9 +1638,9 @@  _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
 			  if (cmpp > thousands)
 			    {
 			      wpsize -= cmpp - thousands;
-			      ungetc (c, s);
+			      ungetc (c, stream);
 			      while (--cmpp > thousands)
-				ungetc_not_eof ((unsigned char) *cmpp, s);
+				ungetc_not_eof ((unsigned char) *cmpp, stream);
 			      c = (unsigned char) *cmpp;
 			    }
 			  break;
@@ -1724,9 +1704,10 @@  _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
 			    if (cmpp > thousands)
 			      {
 				wpsize -= cmpp - thousands;
-				ungetc (c, s);
+				ungetc (c, stream);
 				while (--cmpp > thousands)
-				  ungetc_not_eof ((unsigned char) *cmpp, s);
+				  ungetc_not_eof ((unsigned char) *cmpp,
+                                                  stream);
 				c = (unsigned char) *cmpp;
 			      }
 			    break;
@@ -1770,14 +1751,14 @@  _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
 		{
 		  /* The last read character is not part of the number
 		     anymore.  */
-		  ungetc (c, s);
+		  ungetc (c, stream);
 
 		  conv_error ();
 		}
 	    }
 	  else
 	    /* The just read character is not part of the number anymore.  */
-	    ungetc (c, s);
+	    ungetc (c, stream);
 
 	  /* Convert the number.  */
 	  ADDW (L_('\0'));
@@ -1940,7 +1921,7 @@  _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
 		    }
 		  else
 		    /* Never mind.  */
-		    ungetc (c, s);
+		    ungetc (c, stream);
 		}
 	      goto scan_float;
 	    }
@@ -2005,7 +1986,7 @@  _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
 		    {
 		      /* The last read character is not part of the number
 			 anymore.  */
-		      ungetc (c, s);
+		      ungetc (c, stream);
 		      break;
 		    }
 #else
@@ -2074,7 +2055,7 @@  _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
 			{
 			  /* The last read character is not part of the number
 			     anymore.  */
-			  ungetc (c, s);
+			  ungetc (c, stream);
 			  break;
 			}
 		    }
@@ -2117,11 +2098,11 @@  _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
 #else
 	      char mbdigits[12][MB_LEN_MAX + 1];
 
-	      mbstate_t state;
-	      memset (&state, '\0', sizeof (state));
+	      mbstate_t dstate;
+	      memset (&dstate, '\0', sizeof (dstate));
 
 	      bool match_so_far = wpsize == 0;
-	      size_t mblen = __wcrtomb (mbdigits[11], wcdigits[11], &state);
+	      size_t mblen = __wcrtomb (mbdigits[11], wcdigits[11], &dstate);
 	      if (mblen != (size_t) -1)
 		{
 		  mbdigits[11][mblen] = '\0';
@@ -2161,8 +2142,7 @@  _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
 #ifndef COMPILE_WSCANF
 		      memset (&state, '\0', sizeof (state));
 
-		      size_t mblen = __wcrtomb (mbdigits[n], wcdigits[n],
-						&state);
+                      mblen = __wcrtomb (mbdigits[n], wcdigits[n], &state);
 		      if (mblen == (size_t) -1)
 			{
 			  if (n == 10)
@@ -2274,9 +2254,10 @@  _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
 			      /* We are pushing all read characters back.  */
 			      if (cmpp > mbdigits[n])
 				{
-				  ungetc (c, s);
+				  ungetc (c, stream);
 				  while (--cmpp > mbdigits[n])
-				    ungetc_not_eof ((unsigned char) *cmpp, s);
+				    ungetc_not_eof ((unsigned char) *cmpp,
+                                                    stream);
 				  c = (unsigned char) *cmpp;
 				}
 #endif
@@ -2286,7 +2267,7 @@  _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
 			    {
 			      /* The last read character is not part
 				 of the number anymore.  */
-			      ungetc (c, s);
+			      ungetc (c, stream);
 			      break;
 			    }
 			}
@@ -2448,7 +2429,7 @@  _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
 			    {
 			      /* The current character is not in the
 				 scanset.  */
-			      ungetc (c, s);
+			      ungetc (c, stream);
 			      goto out;
 			    }
 
@@ -2460,7 +2441,7 @@  _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
 			    break;
 			  if ((wint_t) *runp == c && not_in)
 			    {
-			      ungetc (c, s);
+			      ungetc (c, stream);
 			      goto out;
 			    }
 
@@ -2470,7 +2451,7 @@  _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
 
 		  if (runp == twend && !not_in)
 		    {
-		      ungetc (c, s);
+		      ungetc (c, stream);
 		      goto out;
 		    }
 
@@ -2539,7 +2520,7 @@  _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
 		{
 		  if (wp[c] == not_in)
 		    {
-		      ungetc_not_eof (c, s);
+		      ungetc_not_eof (c, stream);
 		      break;
 		    }
 
@@ -2680,7 +2661,7 @@  _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
 			    {
 			      /* The current character is not in the
 				 scanset.  */
-			      ungetc (c, s);
+			      ungetc (c, stream);
 			      goto out2;
 			    }
 
@@ -2692,7 +2673,7 @@  _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
 			    break;
 			  if ((wint_t) *runp == c && not_in)
 			    {
-			      ungetc (c, s);
+			      ungetc (c, stream);
 			      goto out2;
 			    }
 
@@ -2702,7 +2683,7 @@  _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
 
 		  if (runp == twend && !not_in)
 		    {
-		      ungetc (c, s);
+		      ungetc (c, stream);
 		      goto out2;
 		    }
 
@@ -2767,7 +2748,7 @@  _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
 		{
 		  if (wp[c] == not_in)
 		    {
-		      ungetc_not_eof (c, s);
+		      ungetc_not_eof (c, stream);
 		      break;
 		    }
 
@@ -2898,12 +2879,12 @@  _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
       do
 	c = inchar ();
       while (ISSPACE (c));
-      ungetc (c, s);
+      ungetc (c, stream);
     }
 
  errout:
   /* Unlock stream.  */
-  UNLOCK_STREAM (s);
+  UNLOCK_STREAM (stream);
 
   if (use_malloc)
     free (wp);
--- a/stdlib/setenv.c
+++ b/stdlib/setenv.c
@@ -79,8 +79,8 @@  static void *known_values;
 
 # define KNOWN_VALUE(Str) \
   ({									      \
-    void *value = tfind (Str, &known_values, (__compar_fn_t) strcmp);	      \
-    value != NULL ? *(char **) value : NULL;				      \
+    void *_value = tfind (Str, &known_values, (__compar_fn_t) strcmp);	      \
+    _value != NULL ? *(char **) _value : NULL;				      \
   })
 # define STORE_VALUE(Str) \
   tsearch (Str, &known_values, (__compar_fn_t) strcmp)
--- a/stdlib/strtod_l.c
+++ b/stdlib/strtod_l.c
@@ -458,9 +458,9 @@  str_to_mpn (const STRING_TYPE *str, int digcnt, mp_limb_t *n, mp_size_t *nsize,
       mp_limb_t *__ptr = (ptr);						\
       if (__builtin_constant_p (count) && count == BITS_PER_MP_LIMB)	\
 	{								\
-	  mp_size_t i;							\
-	  for (i = (size) - 1; i > 0; --i)				\
-	    __ptr[i] = __ptr[i - 1];					\
+	  mp_size_t _i;							\
+	  for (_i = (size) - 1; _i > 0; --_i)				\
+	    __ptr[_i] = __ptr[_i - 1];					\
 	  __ptr[0] = (limb);						\
 	}								\
       else								\
@@ -515,8 +515,6 @@  ____STRTOF_INTERNAL (nptr, endptr, group, loc)
 
   /* Running pointer after the last character processed in the string.  */
   const STRING_TYPE *cp, *tp;
-  /* Start of significant part of the number.  */
-  const STRING_TYPE *startp, *start_of_digits;
   /* Points at the character following the integer and fractional digits.  */
   const STRING_TYPE *expp;
   /* Total number of digit and number of digits in integer part.  */
@@ -647,7 +645,7 @@  ____STRTOF_INTERNAL (nptr, endptr, group, loc)
       if (lowc == L_('n') && STRNCASECMP (cp, L_("nan"), 3) == 0)
 	{
 	  /* Return NaN.  */
-	  FLOAT retval = NAN;
+	  FLOAT result = NAN;
 
 	  cp += 3;
 
@@ -677,7 +675,7 @@  ____STRTOF_INTERNAL (nptr, endptr, group, loc)
 
 		  mant = STRTOULL (startp + 1, &endp, 0);
 		  if (endp == cp)
-		    SET_MANTISSA (retval, mant);
+		    SET_MANTISSA (result, mant);
 
 		  /* Consume the closing brace.  */
 		  ++cp;
@@ -687,7 +685,7 @@  ____STRTOF_INTERNAL (nptr, endptr, group, loc)
 	  if (endptr != NULL)
 	    *endptr = (STRING_TYPE *) cp;
 
-	  return retval;
+	  return result;
 	}
 
       /* It is really a text we do not recognize.  */
@@ -707,7 +705,7 @@  ____STRTOF_INTERNAL (nptr, endptr, group, loc)
     }
 
   /* Record the start of the digits, in case we will check their grouping.  */
-  start_of_digits = startp = cp;
+  const STRING_TYPE *start_of_digits = cp;
 
   /* Ignore leading zeroes.  This helps us to avoid useless computations.  */
 #ifdef USE_WIDE_CHAR
@@ -777,7 +775,7 @@  ____STRTOF_INTERNAL (nptr, endptr, group, loc)
 
   /* Remember first significant digit and read following characters until the
      decimal point, exponent character or any non-FP number character.  */
-  startp = cp;
+  const STRING_TYPE *startp = cp;
   dig_no = 0;
   while (1)
     {
@@ -1349,7 +1347,6 @@  ____STRTOF_INTERNAL (nptr, endptr, group, loc)
     int neg_exp;
     int more_bits;
     int need_frac_digits;
-    mp_limb_t cy;
     mp_limb_t *psrc = den;
     mp_limb_t *pdest = num;
     const struct mp_power *ttab = &_fpioconst_pow10[0];
@@ -1470,7 +1467,7 @@  ____STRTOF_INTERNAL (nptr, endptr, group, loc)
 	/* Don't call `mpn_shift' with a count of zero since the specification
 	   does not allow this.  */
 	(void) __mpn_lshift (den, den, densize, cnt);
-	cy = __mpn_lshift (num, num, numsize, cnt);
+	mp_limb_t cy = __mpn_lshift (num, num, numsize, cnt);
 	if (cy != 0)
 	  num[numsize++] = cy;
       }
@@ -1502,15 +1499,15 @@  ____STRTOF_INTERNAL (nptr, endptr, group, loc)
 #define got_limb							      \
 	      if (bits == 0)						      \
 		{							      \
-		  int cnt;						      \
+		  int zero_count;					      \
 		  if (quot == 0)					      \
-		    cnt = BITS_PER_MP_LIMB;				      \
+		    zero_count = BITS_PER_MP_LIMB;			      \
 		  else							      \
-		    count_leading_zeros (cnt, quot);			      \
-		  exponent -= cnt;					      \
-		  if (BITS_PER_MP_LIMB - cnt > MANT_DIG)		      \
+		    count_leading_zeros (zero_count, quot);		      \
+		  exponent -= zero_count;				      \
+		  if (BITS_PER_MP_LIMB - zero_count > MANT_DIG)		      \
 		    {							      \
-		      used = MANT_DIG + cnt;				      \
+		      used = MANT_DIG + zero_count;			      \
 		      retval[0] = quot >> (BITS_PER_MP_LIMB - used);	      \
 		      bits = MANT_DIG + 1;				      \
 		    }							      \
@@ -1521,7 +1518,7 @@  ____STRTOF_INTERNAL (nptr, endptr, group, loc)
 		      if (RETURN_LIMB_SIZE > 1)				      \
 			retval[1] = 0;					      \
 		      retval[0] = quot;					      \
-		      bits = -cnt;					      \
+		      bits = -zero_count;				      \
 		    }							      \
 		}							      \
 	      else if (bits + BITS_PER_MP_LIMB <= MANT_DIG)		      \
@@ -1654,7 +1651,6 @@  ____STRTOF_INTERNAL (nptr, endptr, group, loc)
 	  if (numsize < densize)
 	    {
 	      mp_size_t empty = densize - numsize;
-	      int i;
 
 	      if (bits <= 0)
 		exponent -= empty * BITS_PER_MP_LIMB;
@@ -1682,7 +1678,6 @@  ____STRTOF_INTERNAL (nptr, endptr, group, loc)
 		      used = MANT_DIG - bits;
 		      if (used >= BITS_PER_MP_LIMB)
 			{
-			  int i;
 			  (void) __mpn_lshift (&retval[used
 						       / BITS_PER_MP_LIMB],
 					       retval,
@@ -1703,7 +1698,6 @@  ____STRTOF_INTERNAL (nptr, endptr, group, loc)
 	    }
 	  else
 	    {
-	      int i;
 	      assert (numsize == densize);
 	      for (i = numsize; i > 0; --i)
 		num[i] = num[i - 1];
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -576,7 +576,6 @@  gaih_inet (const char *name, const struct gaih_service *service,
 				  + 16 * sizeof(char));
 	      assert (tmpbuf == NULL);
 	      tmpbuf = alloca_account (tmpbuflen, alloca_used);
-	      int rc;
 	      struct hostent th;
 	      struct hostent *h;
 	      int herrno;
@@ -1154,7 +1153,7 @@  gaih_inet (const char *name, const struct gaih_service *service,
 		  idn_flags |= IDNA_USE_STD3_ASCII_RULES;
 
 		char *out;
-		int rc = __idna_to_unicode_lzlz (canon, &out, idn_flags);
+                rc = __idna_to_unicode_lzlz (canon, &out, idn_flags);
 		if (rc != IDNA_SUCCESS)
 		  {
 		    if (rc == IDNA_MALLOC_ERROR)
--- a/sysdeps/unix/sysv/linux/dl-origin.c
+++ b/sysdeps/unix/sysv/linux/dl-origin.c
@@ -62,13 +62,13 @@  _dl_get_origin (void)
 	 a copy and strip out trailing slashes.  */
       if (GLRO(dl_origin_path) != NULL)
 	{
-	  size_t len = strlen (GLRO(dl_origin_path));
-	  result = (char *) malloc (len + 1);
+	  size_t path_len = strlen (GLRO(dl_origin_path));
+	  result = (char *) malloc (path_len + 1);
 	  if (result == NULL)
 	    result = (char *) -1;
 	  else
 	    {
-	      char *cp = __mempcpy (result, GLRO(dl_origin_path), len);
+	      char *cp = __mempcpy (result, GLRO(dl_origin_path), path_len);
 	      while (cp > result + 1 && cp[-1] == '/')
 		--cp;
 	      *cp = '\0';
--- a/sysdeps/unix/sysv/linux/getsysstats.c
+++ b/sysdeps/unix/sysv/linux/getsysstats.c
@@ -144,11 +144,10 @@  __get_nprocs (void)
 
   const int flags = O_RDONLY | O_CLOEXEC;
   int fd = open_not_cancel_2 ("/sys/devices/system/cpu/online", flags);
-  char *l;
   int result = 0;
   if (fd != -1)
     {
-      l = next_line (fd, buffer, &cp, &re, buffer_end);
+      char *l = next_line (fd, buffer, &cp, &re, buffer_end);
       if (l != NULL)
 	do
 	  {
@@ -196,6 +195,7 @@  __get_nprocs (void)
     {
       result = 0;
 
+      char *l;
       while ((l = next_line (fd, buffer, &cp, &re, buffer_end)) != NULL)
 	/* The current format of /proc/stat has all the cpu* entries
 	   at the front.  We assume here that stays this way.  */
--- a/sysdeps/unix/sysv/linux/ifaddrs.c
+++ b/sysdeps/unix/sysv/linux/ifaddrs.c
@@ -734,8 +734,8 @@  getifaddrs_internal (struct ifaddrs **ifap)
 		 address, use the name from the interface entry.  */
 	      if (ifas[ifa_index].ifa.ifa_name == NULL)
 		{
-		  int idx = map_newlink (ifam->ifa_index - 1, ifas,
-					 map_newlink_data, newlink);
+                  idx = map_newlink (ifam->ifa_index - 1, ifas,
+                                     map_newlink_data, newlink);
 		  if (__glibc_unlikely (idx == -1))
 		    goto try_again;
 		  ifas[ifa_index].ifa.ifa_name = ifas[idx].ifa.ifa_name;
--- a/sysdeps/unix/sysv/linux/x86/elision-conf.c
+++ b/sysdeps/unix/sysv/linux/x86/elision-conf.c
@@ -60,7 +60,7 @@  int __pthread_force_elision attribute_hidden;
 static void
 elision_init (int argc __attribute__ ((unused)),
 	      char **argv  __attribute__ ((unused)),
-	      char **environ)
+	      char **envp)
 {
   __elision_available = HAS_RTM;
 #ifdef ENABLE_LOCK_ELISION
--- a/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h
+++ b/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h
@@ -157,22 +157,22 @@ 
 #endif
 
 #define lll_trylock(futex) \
-  ({ int ret;								      \
+  ({ int _ret;								      \
      __asm __volatile (__lll_trylock_asm				      \
-		       : "=a" (ret), "=m" (futex)			      \
+		       : "=a" (_ret), "=m" (futex)			      \
 		       : "r" (LLL_LOCK_INITIALIZER_LOCKED), "m" (futex),      \
 			 "0" (LLL_LOCK_INITIALIZER)			      \
 		       : "memory");					      \
-     ret; })
+     _ret; })
 
 #define lll_cond_trylock(futex) \
-  ({ int ret;								      \
+  ({ int _ret;								      \
      __asm __volatile (LOCK_INSTR "cmpxchgl %2, %1"			      \
-		       : "=a" (ret), "=m" (futex)			      \
+		       : "=a" (_ret), "=m" (futex)			      \
 		       : "r" (LLL_LOCK_INITIALIZER_WAITERS),		      \
 			 "m" (futex), "0" (LLL_LOCK_INITIALIZER)	      \
 		       : "memory");					      \
-     ret; })
+     _ret; })
 
 #if defined NOT_IN_libc || defined UP
 # define __lll_lock_asm_start LOCK_INSTR "cmpxchgl %4, %2\n\t"		      \
@@ -189,7 +189,7 @@ 
 
 #define lll_lock(futex, private) \
   (void)								      \
-    ({ int ignore1, ignore2, ignore3;					      \
+    ({ int _ignore1, _ignore2, _ignore3;				      \
        if (__builtin_constant_p (private) && (private) == LLL_PRIVATE)	      \
 	 __asm __volatile (__lll_lock_asm_start				      \
 			   "1:\tlea %2, %%" RDI_LP "\n"			      \
@@ -199,8 +199,8 @@ 
 			   "4:\tadd $128, %%" RSP_LP "\n"		      \
 			   ".cfi_adjust_cfa_offset -128\n"		      \
 			   "24:"					      \
-			   : "=S" (ignore1), "=&D" (ignore2), "=m" (futex),   \
-			     "=a" (ignore3)				      \
+			   : "=S" (_ignore1), "=&D" (_ignore2), "=m" (futex), \
+			     "=a" (_ignore3)				      \
 			   : "0" (1), "m" (futex), "3" (0)		      \
 			   : "cx", "r11", "cc", "memory");		      \
        else								      \
@@ -212,14 +212,14 @@ 
 			   "4:\tadd $128, %%" RSP_LP "\n"		      \
 			   ".cfi_adjust_cfa_offset -128\n"		      \
 			   "24:"					      \
-			   : "=S" (ignore1), "=D" (ignore2), "=m" (futex),    \
-			     "=a" (ignore3)				      \
+			   : "=S" (_ignore1), "=D" (_ignore2), "=m" (futex),  \
+			     "=a" (_ignore3)				      \
 			   : "1" (1), "m" (futex), "3" (0), "0" (private)     \
 			   : "cx", "r11", "cc", "memory");		      \
     })									      \
 
 #define lll_robust_lock(futex, id, private) \
-  ({ int result, ignore1, ignore2;					      \
+  ({ int _result, _ignore1, _ignore2;					      \
     __asm __volatile (LOCK_INSTR "cmpxchgl %4, %2\n\t"			      \
 		      "jz 24f\n"					      \
 		      "1:\tlea %2, %%" RDI_LP "\n"			      \
@@ -229,15 +229,15 @@ 
 		      "4:\tadd $128, %%" RSP_LP "\n"			      \
 		      ".cfi_adjust_cfa_offset -128\n"			      \
 		      "24:"						      \
-		      : "=S" (ignore1), "=D" (ignore2), "=m" (futex),	      \
-			"=a" (result)					      \
+		      : "=S" (_ignore1), "=D" (_ignore2), "=m" (futex),	      \
+			"=a" (_result)					      \
 		      : "1" (id), "m" (futex), "3" (0), "0" (private)	      \
 		      : "cx", "r11", "cc", "memory");			      \
-    result; })
+    _result; })
 
 #define lll_cond_lock(futex, private) \
   (void)								      \
-    ({ int ignore1, ignore2, ignore3;					      \
+    ({ int _ignore1, _ignore2, _ignore3;				      \
        __asm __volatile (LOCK_INSTR "cmpxchgl %4, %2\n\t"		      \
 			 "jz 24f\n"					      \
 			 "1:\tlea %2, %%" RDI_LP "\n"			      \
@@ -247,14 +247,14 @@ 
 			 "4:\tadd $128, %%" RSP_LP "\n"			      \
 			 ".cfi_adjust_cfa_offset -128\n"		      \
 			 "24:"						      \
-			 : "=S" (ignore1), "=D" (ignore2), "=m" (futex),      \
-			   "=a" (ignore3)				      \
+			 : "=S" (_ignore1), "=D" (_ignore2), "=m" (futex),    \
+			   "=a" (_ignore3)				      \
 			 : "1" (2), "m" (futex), "3" (0), "0" (private)	      \
 			 : "cx", "r11", "cc", "memory");		      \
     })
 
 #define lll_robust_cond_lock(futex, id, private) \
-  ({ int result, ignore1, ignore2;					      \
+  ({ int _result, _ignore1, _ignore2;					      \
     __asm __volatile (LOCK_INSTR "cmpxchgl %4, %2\n\t"			      \
 		      "jz 24f\n"					      \
 		      "1:\tlea %2, %%" RDI_LP "\n"			      \
@@ -264,15 +264,15 @@ 
 		      "4:\tadd $128, %%" RSP_LP "\n"			      \
 		      ".cfi_adjust_cfa_offset -128\n"			      \
 		      "24:"						      \
-		      : "=S" (ignore1), "=D" (ignore2), "=m" (futex),	      \
-			"=a" (result)					      \
+		      : "=S" (_ignore1), "=D" (_ignore2), "=m" (futex),	      \
+			"=a" (_result)					      \
 		      : "1" (id | FUTEX_WAITERS), "m" (futex), "3" (0),	      \
 			"0" (private)					      \
 		      : "cx", "r11", "cc", "memory");			      \
-    result; })
+    _result; })
 
 #define lll_timedlock(futex, timeout, private) \
-  ({ int result, ignore1, ignore2, ignore3;				      \
+  ({ int _result, _ignore1, _ignore2, _ignore3;				      \
      __asm __volatile (LOCK_INSTR "cmpxchgl %1, %4\n\t"			      \
 		       "jz 24f\n"					      \
 		       "1:\tlea %4, %%" RDI_LP "\n"			      \
@@ -283,12 +283,12 @@ 
 		       "4:\tadd $128, %%" RSP_LP "\n"			      \
 		       ".cfi_adjust_cfa_offset -128\n"			      \
 		       "24:"						      \
-		       : "=a" (result), "=D" (ignore1), "=S" (ignore2),	      \
-			 "=&d" (ignore3), "=m" (futex)			      \
+		       : "=a" (_result), "=D" (_ignore1), "=S" (_ignore2),    \
+			 "=&d" (_ignore3), "=m" (futex)			      \
 		       : "0" (0), "1" (1), "m" (futex), "m" (timeout),	      \
 			 "2" (private)					      \
 		       : "memory", "cx", "cc", "r10", "r11");		      \
-     result; })
+     _result; })
 
 extern int __lll_timedlock_elision (int *futex, short *adapt_count,
 					 const struct timespec *timeout,
@@ -298,7 +298,7 @@  extern int __lll_timedlock_elision (int *futex, short *adapt_count,
   __lll_timedlock_elision(&(futex), &(adapt_count), timeout, private)
 
 #define lll_robust_timedlock(futex, timeout, id, private) \
-  ({ int result, ignore1, ignore2, ignore3;				      \
+  ({ int _result, _ignore1, _ignore2, _ignore3;				      \
      __asm __volatile (LOCK_INSTR "cmpxchgl %1, %4\n\t"			      \
 		       "jz 24f\n\t"					      \
 		       "1:\tlea %4, %%" RDI_LP "\n"			      \
@@ -309,12 +309,12 @@  extern int __lll_timedlock_elision (int *futex, short *adapt_count,
 		       "4:\tadd $128, %%" RSP_LP "\n"			      \
 		       ".cfi_adjust_cfa_offset -128\n"			      \
 		       "24:"						      \
-		       : "=a" (result), "=D" (ignore1), "=S" (ignore2),       \
-			 "=&d" (ignore3), "=m" (futex)			      \
+		       : "=a" (_result), "=D" (_ignore1), "=S" (_ignore2),    \
+			 "=&d" (_ignore3), "=m" (futex)			      \
 		       : "0" (0), "1" (id), "m" (futex), "m" (timeout),	      \
 			 "2" (private)					      \
 		       : "memory", "cx", "cc", "r10", "r11");		      \
-     result; })
+     _result; })
 
 #if defined NOT_IN_libc || defined UP
 # define __lll_unlock_asm_start LOCK_INSTR "decl %0\n\t"		      \
--- a/sysdeps/unix/sysv/linux/x86_64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
@@ -217,30 +217,28 @@ 
 # undef INTERNAL_SYSCALL_DECL
 # define INTERNAL_SYSCALL_DECL(err) do { } while (0)
 
-# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
+# define INTERNAL_SYSCALL_NCS(name, err, nr, args...)			      \
   ({									      \
-    unsigned long int resultvar;					      \
+    unsigned long int ncs_result;					      \
     LOAD_ARGS_##nr (args)						      \
     LOAD_REGS_##nr							      \
-    asm volatile (							      \
-    "syscall\n\t"							      \
-    : "=a" (resultvar)							      \
-    : "0" (name) ASM_ARGS_##nr : "memory", "cc", "r11", "cx");		      \
-    (long int) resultvar; })
+    asm volatile ("syscall"						      \
+		  : "=a" (ncs_result)					      \
+		  : "0" (name) ASM_ARGS_##nr : "memory", "cc", "r11", "cx");  \
+    (long int) ncs_result; })
 # undef INTERNAL_SYSCALL
 # define INTERNAL_SYSCALL(name, err, nr, args...) \
   INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, ##args)
 
-# define INTERNAL_SYSCALL_NCS_TYPES(name, err, nr, args...) \
+# define INTERNAL_SYSCALL_NCS_TYPES(name, err, nr, args...)		      \
   ({									      \
-    unsigned long int resultvar;					      \
+    unsigned long int ncs_result;					      \
     LOAD_ARGS_TYPES_##nr (args)						      \
     LOAD_REGS_TYPES_##nr (args)						      \
-    asm volatile (							      \
-    "syscall\n\t"							      \
-    : "=a" (resultvar)							      \
-    : "0" (name) ASM_ARGS_##nr : "memory", "cc", "r11", "cx");		      \
-    (long int) resultvar; })
+    asm volatile ("syscall"						      \
+		  : "=a" (ncs_result)					      \
+		  : "0" (name) ASM_ARGS_##nr : "memory", "cc", "r11", "cx");  \
+    (long int) ncs_result; })
 # undef INTERNAL_SYSCALL_TYPES
 # define INTERNAL_SYSCALL_TYPES(name, err, nr, args...) \
   INTERNAL_SYSCALL_NCS_TYPES (__NR_##name, err, nr, ##args)
--- a/sysdeps/x86/elide.h
+++ b/sysdeps/x86/elide.h
@@ -83,14 +83,14 @@  elision_adapt(signed char *adapt_count, unsigned int status)
    ADAPT_COUNT is a pointer to per-lock state variable.  */
 
 #define ELIDE_TRYLOCK(adapt_count, is_lock_free, write) ({	\
-  int ret = 0;						\
+  int _ret = 0;						\
   if (__elision_aconf.retry_try_xbegin > 0)		\
     {  							\
       if (write)					\
         _xabort (_ABORT_NESTED_TRYLOCK);		\
-      ret = ELIDE_LOCK (adapt_count, is_lock_free);     \
+      _ret = ELIDE_LOCK (adapt_count, is_lock_free);     \
     }							\
-    ret;						\
+    _ret;						\
     })
 
 /* Returns true if lock defined by IS_LOCK_FREE was elided.  */
--- a/sysdeps/x86_64/nptl/tls.h
+++ b/sysdeps/x86_64/nptl/tls.h
@@ -177,13 +177,13 @@  typedef struct
 
    The contained asm must *not* be marked volatile since otherwise
    assignments like
-	pthread_descr self = thread_self();
+	pthread_descr self = THREAD_SELF;
    do not get optimized away.  */
 # define THREAD_SELF \
-  ({ struct pthread *__self;						      \
-     asm ("mov %%fs:%c1,%0" : "=r" (__self)				      \
+  ({ struct pthread *__thread_self;					      \
+     asm ("mov %%fs:%c1,%0" : "=r" (__thread_self)			      \
 	  : "i" (offsetof (struct pthread, header.self)));	 	      \
-     __self;})
+     __thread_self;})
 
 /* Magic for libthread_db to know how to do THREAD_SELF.  */
 # define DB_THREAD_SELF_INCLUDE  <sys/reg.h> /* For the FS constant.  */
--- a/termios/tcgetsid.c
+++ b/termios/tcgetsid.c
@@ -26,8 +26,6 @@  pid_t
 tcgetsid (fd)
      int fd;
 {
-  pid_t pgrp;
-  pid_t sid;
 #ifdef TIOCGSID
   static int tiocgsid_does_not_work;
 
@@ -51,11 +49,11 @@  tcgetsid (fd)
     }
 #endif
 
-  pgrp = tcgetpgrp (fd);
+  pid_t pgrp = tcgetpgrp (fd);
   if (pgrp == -1)
     return (pid_t) -1;
 
-  sid = getsid (pgrp);
+  pid_t sid = getsid (pgrp);
   if (sid == -1 && errno == ESRCH)
     __set_errno (ENOTTY);
 
--- a/time/strptime_l.c
+++ b/time/strptime_l.c
@@ -792,12 +792,12 @@  __strptime_internal (rp, fmt, tmp, statep LOCALE_PARAM)
 	      /* Match locale's alternate date and time format.  */
 	      if (s.decided != raw)
 		{
-		  const char *fmt = _NL_CURRENT (LC_TIME, ERA_D_T_FMT);
+		  const char *subfmt = _NL_CURRENT (LC_TIME, ERA_D_T_FMT);
 
-		  if (*fmt == '\0')
-		    fmt = _NL_CURRENT (LC_TIME, D_T_FMT);
+		  if (*subfmt == '\0')
+		    subfmt = _NL_CURRENT (LC_TIME, D_T_FMT);
 
-		  if (!recursive (fmt))
+		  if (!recursive (subfmt))
 		    {
 		      if (s.decided == loc)
 			return NULL;
@@ -806,7 +806,7 @@  __strptime_internal (rp, fmt, tmp, statep LOCALE_PARAM)
 		    }
 		  else
 		    {
-		      if (strcmp (fmt, HERE_D_T_FMT))
+		      if (strcmp (subfmt, HERE_D_T_FMT))
 			s.decided = loc;
 		      s.want_xday = 1;
 		      break;
@@ -956,12 +956,12 @@  __strptime_internal (rp, fmt, tmp, statep LOCALE_PARAM)
 	    case 'x':
 	      if (s.decided != raw)
 		{
-		  const char *fmt = _NL_CURRENT (LC_TIME, ERA_D_FMT);
+		  const char *subfmt = _NL_CURRENT (LC_TIME, ERA_D_FMT);
 
-		  if (*fmt == '\0')
-		    fmt = _NL_CURRENT (LC_TIME, D_FMT);
+		  if (*subfmt == '\0')
+		    subfmt = _NL_CURRENT (LC_TIME, D_FMT);
 
-		  if (!recursive (fmt))
+		  if (!recursive (subfmt))
 		    {
 		      if (s.decided == loc)
 			return NULL;
@@ -970,7 +970,7 @@  __strptime_internal (rp, fmt, tmp, statep LOCALE_PARAM)
 		    }
 		  else
 		    {
-		      if (strcmp (fmt, HERE_D_FMT))
+		      if (strcmp (subfmt, HERE_D_FMT))
 			s.decided = loc;
 		      break;
 		    }
@@ -982,12 +982,12 @@  __strptime_internal (rp, fmt, tmp, statep LOCALE_PARAM)
 	    case 'X':
 	      if (s.decided != raw)
 		{
-		  const char *fmt = _NL_CURRENT (LC_TIME, ERA_T_FMT);
+		  const char *subfmt = _NL_CURRENT (LC_TIME, ERA_T_FMT);
 
-		  if (*fmt == '\0')
-		    fmt = _NL_CURRENT (LC_TIME, T_FMT);
+		  if (*subfmt == '\0')
+		    subfmt = _NL_CURRENT (LC_TIME, T_FMT);
 
-		  if (!recursive (fmt))
+		  if (!recursive (subfmt))
 		    {
 		      if (s.decided == loc)
 			return NULL;
@@ -996,7 +996,7 @@  __strptime_internal (rp, fmt, tmp, statep LOCALE_PARAM)
 		    }
 		  else
 		    {
-		      if (strcmp (fmt, HERE_T_FMT))
+		      if (strcmp (subfmt, HERE_T_FMT))
 			s.decided = loc;
 		      break;
 		    }