mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-06-14 12:31:25 +00:00
Pacify -Wunused-but-set-variable from gcc 16 and clang 13
* src/coding.c: Remove file wide ignore pragma for -Wunused-but-set-variable. (detect_coding_XXX) <consumed_chars>: Mention that this variable might need to be declared with the MAYBE_UNUSED attribute. (detect_coding_utf_8, detect_coding_emacs_mule, detect_coding_iso_2022) (encode_designation_at_bol, detect_coding_sjis, detect_coding_big5) (detect_coding_ccl, detect_coding_charset) <consumed_chars>: Use the MAYBE_UNUSED attribute.
This commit is contained in:
parent
4fcc8a473a
commit
51ae6e12b9
1 changed files with 12 additions and 14 deletions
26
src/coding.c
26
src/coding.c
|
|
@ -159,6 +159,9 @@ detect_coding_XXX (struct coding_system *coding,
|
|||
const unsigned char *src = coding->source;
|
||||
const unsigned char *src_end = coding->source + coding->src_bytes;
|
||||
bool multibytep = coding->src_multibyte;
|
||||
/* Some encodings do not need this variable, however it is incremented in the
|
||||
ONE_MORE_BYTE macro. In that case mark it with MAYBE_UNUSED to silence
|
||||
compiler warnings. */
|
||||
ptrdiff_t consumed_chars = 0;
|
||||
int found = 0;
|
||||
...;
|
||||
|
|
@ -652,11 +655,6 @@ growable_destination (struct coding_system *coding)
|
|||
consumed_chars++; \
|
||||
} while (0)
|
||||
|
||||
/* Suppress clang warnings about consumed_chars never being used.
|
||||
Although correct, the warnings are too much trouble to code around. */
|
||||
#if 13 <= __clang_major__ - defined __apple_build_version__
|
||||
# pragma clang diagnostic ignored "-Wunused-but-set-variable"
|
||||
#endif
|
||||
|
||||
/* Safely get two bytes from the source text pointed by SRC which ends
|
||||
at SRC_END, and set C1 and C2 to those bytes while skipping the
|
||||
|
|
@ -1135,7 +1133,7 @@ detect_coding_utf_8 (struct coding_system *coding,
|
|||
const unsigned char *src = coding->source, *src_base;
|
||||
const unsigned char *src_end = coding->source + coding->src_bytes;
|
||||
bool multibytep = coding->src_multibyte;
|
||||
ptrdiff_t consumed_chars = 0;
|
||||
MAYBE_UNUSED ptrdiff_t consumed_chars = 0;
|
||||
bool bom_found = 0;
|
||||
ptrdiff_t nchars = coding->head_ascii;
|
||||
|
||||
|
|
@ -1843,7 +1841,7 @@ detect_coding_emacs_mule (struct coding_system *coding,
|
|||
const unsigned char *src = coding->source, *src_base;
|
||||
const unsigned char *src_end = coding->source + coding->src_bytes;
|
||||
bool multibytep = coding->src_multibyte;
|
||||
ptrdiff_t consumed_chars = 0;
|
||||
MAYBE_UNUSED ptrdiff_t consumed_chars = 0;
|
||||
int c;
|
||||
int found = 0;
|
||||
|
||||
|
|
@ -2933,7 +2931,7 @@ detect_coding_iso_2022 (struct coding_system *coding,
|
|||
bool single_shifting = 0;
|
||||
int id;
|
||||
int c, c1;
|
||||
ptrdiff_t consumed_chars = 0;
|
||||
MAYBE_UNUSED ptrdiff_t consumed_chars = 0;
|
||||
int i;
|
||||
int rejected = 0;
|
||||
int found = 0;
|
||||
|
|
@ -4321,7 +4319,7 @@ encode_designation_at_bol (struct coding_system *coding,
|
|||
/* Table of charsets to be designated to each graphic register. */
|
||||
int r[4];
|
||||
int c, found = 0, reg;
|
||||
ptrdiff_t produced_chars = 0;
|
||||
MAYBE_UNUSED ptrdiff_t produced_chars = 0;
|
||||
bool multibytep = coding->dst_multibyte;
|
||||
Lisp_Object attrs;
|
||||
Lisp_Object charset_list;
|
||||
|
|
@ -4583,7 +4581,7 @@ detect_coding_sjis (struct coding_system *coding,
|
|||
const unsigned char *src = coding->source, *src_base;
|
||||
const unsigned char *src_end = coding->source + coding->src_bytes;
|
||||
bool multibytep = coding->src_multibyte;
|
||||
ptrdiff_t consumed_chars = 0;
|
||||
MAYBE_UNUSED ptrdiff_t consumed_chars = 0;
|
||||
int found = 0;
|
||||
int c;
|
||||
Lisp_Object attrs, charset_list;
|
||||
|
|
@ -4638,7 +4636,7 @@ detect_coding_big5 (struct coding_system *coding,
|
|||
const unsigned char *src = coding->source, *src_base;
|
||||
const unsigned char *src_end = coding->source + coding->src_bytes;
|
||||
bool multibytep = coding->src_multibyte;
|
||||
ptrdiff_t consumed_chars = 0;
|
||||
MAYBE_UNUSED ptrdiff_t consumed_chars = 0;
|
||||
int found = 0;
|
||||
int c;
|
||||
|
||||
|
|
@ -5076,7 +5074,7 @@ detect_coding_ccl (struct coding_system *coding,
|
|||
const unsigned char *src = coding->source, *src_base;
|
||||
const unsigned char *src_end = coding->source + coding->src_bytes;
|
||||
bool multibytep = coding->src_multibyte;
|
||||
ptrdiff_t consumed_chars = 0;
|
||||
MAYBE_UNUSED ptrdiff_t consumed_chars = 0;
|
||||
int found = 0;
|
||||
unsigned char *valids;
|
||||
ptrdiff_t head_ascii = coding->head_ascii;
|
||||
|
|
@ -5371,7 +5369,7 @@ detect_coding_charset (struct coding_system *coding,
|
|||
const unsigned char *src = coding->source, *src_base;
|
||||
const unsigned char *src_end = coding->source + coding->src_bytes;
|
||||
bool multibytep = coding->src_multibyte;
|
||||
ptrdiff_t consumed_chars = 0;
|
||||
MAYBE_UNUSED ptrdiff_t consumed_chars = 0;
|
||||
Lisp_Object attrs, valids, name;
|
||||
int found = 0;
|
||||
ptrdiff_t head_ascii = coding->head_ascii;
|
||||
|
|
@ -7100,7 +7098,7 @@ produce_chars (struct coding_system *coding, Lisp_Object translation_table,
|
|||
if (coding->src_multibyte)
|
||||
{
|
||||
bool multibytep = 1;
|
||||
ptrdiff_t consumed_chars = 0;
|
||||
MAYBE_UNUSED ptrdiff_t consumed_chars = 0;
|
||||
|
||||
while (1)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue