diff options
| author | Philipp Stephani | 2017-06-13 13:55:44 +0200 |
|---|---|---|
| committer | Philipp Stephani | 2017-06-13 13:56:46 +0200 |
| commit | e408e9aa030a00cb1a61acdc729e8d6786b25fe3 (patch) | |
| tree | 2173ff44df3fd9d906721137eada524c9e029c0d | |
| parent | cc8aa484cdab6b2f33a8c95a5778193c762412b9 (diff) | |
| download | emacs-e408e9aa030a00cb1a61acdc729e8d6786b25fe3.tar.gz emacs-e408e9aa030a00cb1a61acdc729e8d6786b25fe3.zip | |
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.
| -rw-r--r-- | lib-src/make-docfile.c | 6 | ||||
| -rw-r--r-- | 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 9470bd635f5..85bcc8bc89c 100644 --- a/lib-src/make-docfile.c +++ b/lib-src/make-docfile.c | |||
| @@ -224,7 +224,11 @@ put_filename (char *filename) | |||
| 224 | 224 | ||
| 225 | for (tmp = filename; *tmp; tmp++) | 225 | for (tmp = filename; *tmp; tmp++) |
| 226 | { | 226 | { |
| 227 | if (IS_DIRECTORY_SEP (*tmp)) | 227 | /* Use separate variable to silence a Clang warning on macOS. |
| 228 | Clang takes offence of the additional set of parantheses | ||
| 229 | generated by the macro. */ | ||
| 230 | bool is_sep = IS_DIRECTORY_SEP (*tmp); | ||
| 231 | if (is_sep) | ||
| 228 | filename = tmp + 1; | 232 | filename = tmp + 1; |
| 229 | } | 233 | } |
| 230 | 234 | ||
diff --git a/lib/strftime.c b/lib/strftime.c index 99bee4ef978..18c899d2117 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) | |||
| 1123 | if (modifier == L_('E')) | 1123 | if (modifier == L_('E')) |
| 1124 | goto bad_format; | 1124 | goto bad_format; |
| 1125 | 1125 | ||
| 1126 | number_value = ns; | 1126 | { |
| 1127 | if (width == -1) | 1127 | /* Use a new variable here instead of reusing number_value |
| 1128 | width = 9; | 1128 | because Clang complains about the self-assignment |
| 1129 | else | 1129 | generated by DO_NUMBER. */ |
| 1130 | { | 1130 | ptrdiff_t n = ns; |
| 1131 | /* Take an explicit width less than 9 as a precision. */ | 1131 | if (width == -1) |
| 1132 | int j; | 1132 | width = 9; |
| 1133 | for (j = width; j < 9; j++) | 1133 | else |
| 1134 | number_value /= 10; | 1134 | { |
| 1135 | } | 1135 | /* Take an explicit width less than 9 as a precision. */ |
| 1136 | int j; | ||
| 1137 | for (j = width; j < 9; j++) | ||
| 1138 | n /= 10; | ||
| 1139 | } | ||
| 1136 | 1140 | ||
| 1137 | DO_NUMBER (width, number_value); | 1141 | DO_NUMBER (width, n); |
| 1142 | } | ||
| 1138 | #endif | 1143 | #endif |
| 1139 | 1144 | ||
| 1140 | case L_('n'): | 1145 | case L_('n'): |