[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master e408e9a: Silence two Clang warnings by introducing
From: |
Philipp Stephani |
Subject: |
[Emacs-diffs] master e408e9a: Silence two Clang warnings by introducing additional local variables |
Date: |
Tue, 13 Jun 2017 08:04:23 -0400 (EDT) |
branch: master
commit e408e9aa030a00cb1a61acdc729e8d6786b25fe3
Author: Philipp Stephani <address@hidden>
Commit: Philipp Stephani <address@hidden>
Silence two Clang warnings by introducing additional local variables
* 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 | 6 +++++-
lib/strftime.c | 27 ++++++++++++++++-----------
2 files changed, 21 insertions(+), 12 deletions(-)
diff --git a/lib-src/make-docfile.c b/lib-src/make-docfile.c
index 9470bd6..85bcc8b 100644
--- a/lib-src/make-docfile.c
+++ b/lib-src/make-docfile.c
@@ -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;
}
diff --git a/lib/strftime.c b/lib/strftime.c
index 99bee4e..18c899d 100644
--- a/lib/strftime.c
+++ b/lib/strftime.c
@@ -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'):
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master e408e9a: Silence two Clang warnings by introducing additional local variables,
Philipp Stephani <=