]> git.eshelyaron.com Git - emacs.git/commitdiff
Silence two Clang warnings by introducing additional local variables
authorPhilipp Stephani <phst@google.com>
Tue, 13 Jun 2017 11:55:44 +0000 (13:55 +0200)
committerPhilipp Stephani <phst@google.com>
Tue, 13 Jun 2017 11:56:46 +0000 (13:56 +0200)
* lib/strftime.c (libc_hidden_def):
* lib-src/make-docfile.c (put_filename): Introduce local variables to
silence Clang warnings.

lib-src/make-docfile.c
lib/strftime.c

index 9470bd635f5ccadbe6bb304f4d4963995e8b1a94..85bcc8bc89c0504c6899557fdac1862338293ae8 100644 (file)
@@ -224,7 +224,11 @@ put_filename (char *filename)
 
   for (tmp = filename; *tmp; tmp++)
     {
-      if (IS_DIRECTORY_SEP (*tmp))
+      /* Use separate variable to silence a Clang warning on macOS.
+         Clang takes offence of the additional set of parantheses
+         generated by the macro.  */
+      bool is_sep = IS_DIRECTORY_SEP (*tmp);
+      if (is_sep)
        filename = tmp + 1;
     }
 
index 99bee4ef978048e89b8a386b31aa70ac8441217f..18c899d211723d71ec8235b2f8f0d0fa14a67b56 100644 (file)
@@ -1123,18 +1123,23 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize)
           if (modifier == L_('E'))
             goto bad_format;
 
-          number_value = ns;
-          if (width == -1)
-            width = 9;
-          else
-            {
-              /* Take an explicit width less than 9 as a precision.  */
-              int j;
-              for (j = width; j < 9; j++)
-                number_value /= 10;
-            }
+          {
+            /* Use a new variable here instead of reusing number_value
+               because Clang complains about the self-assignment
+               generated by DO_NUMBER.  */
+            ptrdiff_t n = ns;
+            if (width == -1)
+              width = 9;
+            else
+              {
+                /* Take an explicit width less than 9 as a precision.  */
+                int j;
+                for (j = width; j < 9; j++)
+                  n /= 10;
+              }
 
-          DO_NUMBER (width, number_value);
+            DO_NUMBER (width, n);
+          }
 #endif
 
         case L_('n'):