1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 06:20:55 -08:00

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.
This commit is contained in:
Philipp Stephani 2017-06-13 13:55:44 +02:00
parent cc8aa484cd
commit e408e9aa03
2 changed files with 21 additions and 12 deletions

View file

@ -224,7 +224,11 @@ put_filename (char *filename)
for (tmp = filename; *tmp; tmp++) 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; filename = tmp + 1;
} }

View file

@ -1123,7 +1123,11 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize)
if (modifier == L_('E')) if (modifier == L_('E'))
goto bad_format; goto bad_format;
number_value = ns; {
/* 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) if (width == -1)
width = 9; width = 9;
else else
@ -1131,10 +1135,11 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize)
/* Take an explicit width less than 9 as a precision. */ /* Take an explicit width less than 9 as a precision. */
int j; int j;
for (j = width; j < 9; j++) for (j = width; j < 9; j++)
number_value /= 10; n /= 10;
} }
DO_NUMBER (width, number_value); DO_NUMBER (width, n);
}
#endif #endif
case L_('n'): case L_('n'):