Fix warnings reported by -Wshadow: Part6: main directory

Now that all warnings are taken care of, add warning flag -Wshadow to
configure.

Note: Enabling this flag for C++ generates some useless warnings about
some function parameters shadowing class member function names. So, only
enabling this warning for C code.

Change-Id: I53ffb763483fec675a3358c5e64a737a03b93eb1
diff --git a/aomdec.c b/aomdec.c
index 1adb495..1889a08 100644
--- a/aomdec.c
+++ b/aomdec.c
@@ -839,7 +839,7 @@
 
       if (single_file) {
         if (use_y4m) {
-          char buf[Y4M_BUFFER_SIZE] = { 0 };
+          char y4m_buf[Y4M_BUFFER_SIZE] = { 0 };
           size_t len = 0;
           if (img->fmt == AOM_IMG_FMT_I440 || img->fmt == AOM_IMG_FMT_I44016) {
             fprintf(stderr, "Cannot produce y4m output for 440 sampling.\n");
@@ -848,21 +848,22 @@
           if (frame_out == 1) {
             // Y4M file header
             len = y4m_write_file_header(
-                buf, sizeof(buf), aom_input_ctx.width, aom_input_ctx.height,
-                &aom_input_ctx.framerate, img->fmt, img->bit_depth);
+                y4m_buf, sizeof(y4m_buf), aom_input_ctx.width,
+                aom_input_ctx.height, &aom_input_ctx.framerate, img->fmt,
+                img->bit_depth);
             if (do_md5) {
-              MD5Update(&md5_ctx, (md5byte *)buf, (unsigned int)len);
+              MD5Update(&md5_ctx, (md5byte *)y4m_buf, (unsigned int)len);
             } else {
-              fputs(buf, outfile);
+              fputs(y4m_buf, outfile);
             }
           }
 
           // Y4M frame header
-          len = y4m_write_frame_header(buf, sizeof(buf));
+          len = y4m_write_frame_header(y4m_buf, sizeof(y4m_buf));
           if (do_md5) {
-            MD5Update(&md5_ctx, (md5byte *)buf, (unsigned int)len);
+            MD5Update(&md5_ctx, (md5byte *)y4m_buf, (unsigned int)len);
           } else {
-            fputs(buf, outfile);
+            fputs(y4m_buf, outfile);
           }
         } else {
           if (frame_out == 1) {
diff --git a/aomenc.c b/aomenc.c
index d0e7b5a..1d803d3 100644
--- a/aomenc.c
+++ b/aomenc.c
@@ -1286,9 +1286,10 @@
    * specified on the command line.
    */
   if (!stream->config.have_kf_max_dist) {
-    double framerate = (double)global->framerate.num / global->framerate.den;
-    if (framerate > 0.0)
-      stream->config.cfg.kf_max_dist = (unsigned int)(5.0 * framerate);
+    double global_framerate =
+        (double)global->framerate.num / global->framerate.den;
+    if (global_framerate > 0.0)
+      stream->config.cfg.kf_max_dist = (unsigned int)(5.0 * global_framerate);
   }
 }
 
@@ -2115,10 +2116,10 @@
           } else {
             const int64_t input_pos = ftello(input.file);
             const int64_t input_pos_lagged = input_pos - lagged_count;
-            const int64_t limit = input.length;
+            const int64_t input_limit = input.length;
 
             rate = cx_time ? input_pos_lagged * (int64_t)1000000 / cx_time : 0;
-            remaining = limit - input_pos + lagged_count;
+            remaining = input_limit - input_pos + lagged_count;
           }
 
           average_rate =
diff --git a/configure b/configure
index bf68b62..8f4debd 100755
--- a/configure
+++ b/configure
@@ -576,6 +576,10 @@
         check_add_cflags -Wuninitialized
         check_add_cflags -Wunused-variable
         check_add_cflags -Wsign-compare
+        # Enabling the following warning for C++ generates some useless warnings
+        # about some function parameters shadowing class member function names.
+        # So, only enable this warning for C code.
+        check_cflags "-Wshadow" && add_cflags_only "-Wshadow"
         case ${CC} in
           *clang*)
               # libaom and/or clang have issues with aliasing: