mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-18 00:32:11 +01:00
Remove "static const uint32_t etc" from cgen
They trigger compiler warnings (-Wunused-const-variable) precisely because they're unused.
This commit is contained in:
1 parent
8ce3d657ee
commit
498b7138f3
5 files changed
+60
-77
No files matched your search
@@ -300,7 +300,7 @@ const char* play() {
|
||||
|
||||
if (quirk_honor_background_color_flag) {
|
||||
wuffs_gif__decoder__set_quirk_enabled(
|
||||
&dec, wuffs_gif__quirk_honor_background_color, true);
|
||||
&dec, WUFFS_GIF__QUIRK_HONOR_BACKGROUND_COLOR, true);
|
||||
}
|
||||
|
||||
wuffs_base__io_buffer src;
|
||||
|
||||
+18
-11
@@ -713,21 +713,28 @@ func (g *gen) gatherScalarConsts(b *buffer, n *a.Const) error {
|
||||
}
|
||||
|
||||
func (g *gen) writeConst(b *buffer, n *a.Const) error {
|
||||
if n.Public() {
|
||||
if cv := n.Value().ConstValue(); cv != nil {
|
||||
b.printf("#define %s %v\n\n", strings.ToUpper(g.pkgPrefix+n.QID()[1].Str(g.tm)), cv)
|
||||
}
|
||||
if !n.Public() {
|
||||
b.writes("#ifdef WUFFS_IMPLEMENTATION\n")
|
||||
}
|
||||
|
||||
b.writes("static const ")
|
||||
if err := g.writeCTypeName(b, n.XType(), "//\n"+g.pkgPrefix, n.QID()[1].Str(g.tm)); err != nil {
|
||||
return err
|
||||
if cv := n.Value().ConstValue(); cv != nil {
|
||||
b.printf("#define %s %v\n", strings.ToUpper(g.pkgPrefix+n.QID()[1].Str(g.tm)), cv)
|
||||
} else {
|
||||
b.writes("static const ")
|
||||
if err := g.writeCTypeName(b, n.XType(), "//\n"+g.pkgPrefix, n.QID()[1].Str(g.tm)); err != nil {
|
||||
return err
|
||||
}
|
||||
b.writes("//\n WUFFS_BASE__POTENTIALLY_UNUSED = ")
|
||||
if err := g.writeConstList(b, n.Value()); err != nil {
|
||||
return err
|
||||
}
|
||||
b.writes(";\n")
|
||||
}
|
||||
b.writes("//\n WUFFS_BASE__POTENTIALLY_UNUSED = ")
|
||||
if err := g.writeConstList(b, n.Value()); err != nil {
|
||||
return err
|
||||
|
||||
if !n.Public() {
|
||||
b.writes("#endif // WUFFS_IMPLEMENTATION\n")
|
||||
}
|
||||
b.writes(";\n\n")
|
||||
b.writeb('\n')
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -2845,10 +2845,6 @@ extern const char* wuffs_deflate__error__no_huffman_codes;
|
||||
|
||||
#define WUFFS_DEFLATE__DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE 1
|
||||
|
||||
static const uint64_t //
|
||||
wuffs_deflate__decoder_workbuf_len_max_incl_worst_case //
|
||||
WUFFS_BASE__POTENTIALLY_UNUSED = 1;
|
||||
|
||||
// ---------------- Struct Declarations
|
||||
|
||||
typedef struct wuffs_deflate__decoder__struct wuffs_deflate__decoder;
|
||||
@@ -3042,10 +3038,6 @@ extern const char* wuffs_lzw__error__bad_code;
|
||||
|
||||
#define WUFFS_LZW__DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE 0
|
||||
|
||||
static const uint64_t //
|
||||
wuffs_lzw__decoder_workbuf_len_max_incl_worst_case //
|
||||
WUFFS_BASE__POTENTIALLY_UNUSED = 0;
|
||||
|
||||
// ---------------- Struct Declarations
|
||||
|
||||
typedef struct wuffs_lzw__decoder__struct wuffs_lzw__decoder;
|
||||
@@ -3221,53 +3213,21 @@ extern const char* wuffs_gif__error__bad_palette;
|
||||
|
||||
#define WUFFS_GIF__DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE 1
|
||||
|
||||
static const uint64_t //
|
||||
wuffs_gif__decoder_workbuf_len_max_incl_worst_case //
|
||||
WUFFS_BASE__POTENTIALLY_UNUSED = 1;
|
||||
|
||||
#define WUFFS_GIF__QUIRK_DELAY_NUM_DECODED_FRAMES 1041635328
|
||||
|
||||
static const uint32_t //
|
||||
wuffs_gif__quirk_delay_num_decoded_frames //
|
||||
WUFFS_BASE__POTENTIALLY_UNUSED = 1041635328;
|
||||
|
||||
#define WUFFS_GIF__QUIRK_FIRST_FRAME_LOCAL_PALETTE_MEANS_BLACK_BACKGROUND \
|
||||
1041635329
|
||||
|
||||
static const uint32_t //
|
||||
wuffs_gif__quirk_first_frame_local_palette_means_black_background //
|
||||
WUFFS_BASE__POTENTIALLY_UNUSED = 1041635329;
|
||||
|
||||
#define WUFFS_GIF__QUIRK_HONOR_BACKGROUND_COLOR 1041635330
|
||||
|
||||
static const uint32_t //
|
||||
wuffs_gif__quirk_honor_background_color //
|
||||
WUFFS_BASE__POTENTIALLY_UNUSED = 1041635330;
|
||||
|
||||
#define WUFFS_GIF__QUIRK_IGNORE_TOO_MUCH_PIXEL_DATA 1041635331
|
||||
|
||||
static const uint32_t //
|
||||
wuffs_gif__quirk_ignore_too_much_pixel_data //
|
||||
WUFFS_BASE__POTENTIALLY_UNUSED = 1041635331;
|
||||
|
||||
#define WUFFS_GIF__QUIRK_IMAGE_BOUNDS_ARE_STRICT 1041635332
|
||||
|
||||
static const uint32_t //
|
||||
wuffs_gif__quirk_image_bounds_are_strict //
|
||||
WUFFS_BASE__POTENTIALLY_UNUSED = 1041635332;
|
||||
|
||||
#define WUFFS_GIF__QUIRK_REJECT_EMPTY_FRAME 1041635333
|
||||
|
||||
static const uint32_t //
|
||||
wuffs_gif__quirk_reject_empty_frame //
|
||||
WUFFS_BASE__POTENTIALLY_UNUSED = 1041635333;
|
||||
|
||||
#define WUFFS_GIF__QUIRK_REJECT_EMPTY_PALETTE 1041635334
|
||||
|
||||
static const uint32_t //
|
||||
wuffs_gif__quirk_reject_empty_palette //
|
||||
WUFFS_BASE__POTENTIALLY_UNUSED = 1041635334;
|
||||
|
||||
// ---------------- Struct Declarations
|
||||
|
||||
typedef struct wuffs_gif__decoder__struct wuffs_gif__decoder;
|
||||
@@ -3627,10 +3587,6 @@ extern const char* wuffs_gzip__error__bad_header;
|
||||
|
||||
#define WUFFS_GZIP__DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE 1
|
||||
|
||||
static const uint64_t //
|
||||
wuffs_gzip__decoder_workbuf_len_max_incl_worst_case //
|
||||
WUFFS_BASE__POTENTIALLY_UNUSED = 1;
|
||||
|
||||
// ---------------- Struct Declarations
|
||||
|
||||
typedef struct wuffs_gzip__decoder__struct wuffs_gzip__decoder;
|
||||
@@ -3790,10 +3746,6 @@ extern const char* wuffs_zlib__error__incorrect_dictionary;
|
||||
|
||||
#define WUFFS_ZLIB__DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE 1
|
||||
|
||||
static const uint64_t //
|
||||
wuffs_zlib__decoder_workbuf_len_max_incl_worst_case //
|
||||
WUFFS_BASE__POTENTIALLY_UNUSED = 1;
|
||||
|
||||
// ---------------- Struct Declarations
|
||||
|
||||
typedef struct wuffs_zlib__decoder__struct wuffs_zlib__decoder;
|
||||
@@ -5087,10 +5039,11 @@ wuffs_adler32__hasher__update(wuffs_adler32__hasher* self,
|
||||
|
||||
#if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__CRC32)
|
||||
|
||||
// ---------------- Status Codes Implementations
|
||||
// ---------------- Status Codes Implementations
|
||||
|
||||
// ---------------- Private Consts
|
||||
// ---------------- Private Consts
|
||||
|
||||
#ifdef WUFFS_IMPLEMENTATION
|
||||
static const uint32_t //
|
||||
wuffs_crc32__ieee_table[16][256] //
|
||||
WUFFS_BASE__POTENTIALLY_UNUSED = {
|
||||
@@ -5959,6 +5912,7 @@ static const uint32_t //
|
||||
225524183,
|
||||
},
|
||||
};
|
||||
#endif // WUFFS_IMPLEMENTATION
|
||||
|
||||
// ---------------- Private Initializer Prototypes
|
||||
|
||||
@@ -6159,12 +6113,15 @@ const char* wuffs_deflate__error__internal_error_inconsistent_n_bits =
|
||||
|
||||
// ---------------- Private Consts
|
||||
|
||||
#ifdef WUFFS_IMPLEMENTATION
|
||||
static const uint8_t //
|
||||
wuffs_deflate__code_order[19] //
|
||||
WUFFS_BASE__POTENTIALLY_UNUSED = {
|
||||
16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15,
|
||||
};
|
||||
#endif // WUFFS_IMPLEMENTATION
|
||||
|
||||
#ifdef WUFFS_IMPLEMENTATION
|
||||
static const uint8_t //
|
||||
wuffs_deflate__reverse8[256] //
|
||||
WUFFS_BASE__POTENTIALLY_UNUSED = {
|
||||
@@ -6188,7 +6145,9 @@ static const uint8_t //
|
||||
119, 247, 15, 143, 79, 207, 47, 175, 111, 239, 31, 159, 95, 223,
|
||||
63, 191, 127, 255,
|
||||
};
|
||||
#endif // WUFFS_IMPLEMENTATION
|
||||
|
||||
#ifdef WUFFS_IMPLEMENTATION
|
||||
static const uint32_t //
|
||||
wuffs_deflate__lcode_magic_numbers[32] //
|
||||
WUFFS_BASE__POTENTIALLY_UNUSED = {
|
||||
@@ -6199,7 +6158,9 @@ static const uint32_t //
|
||||
1073774672, 1073782864, 1073791056, 1073799248, 1073807104, 134217728,
|
||||
134217728, 134217728,
|
||||
};
|
||||
#endif // WUFFS_IMPLEMENTATION
|
||||
|
||||
#ifdef WUFFS_IMPLEMENTATION
|
||||
static const uint32_t //
|
||||
wuffs_deflate__dcode_magic_numbers[32] //
|
||||
WUFFS_BASE__POTENTIALLY_UNUSED = {
|
||||
@@ -6210,14 +6171,15 @@ static const uint32_t //
|
||||
1074790576, 1075314864, 1075839168, 1076887744, 1077936336, 1080033488,
|
||||
134217728, 134217728,
|
||||
};
|
||||
#endif // WUFFS_IMPLEMENTATION
|
||||
|
||||
static const uint32_t //
|
||||
wuffs_deflate__huffs_table_size //
|
||||
WUFFS_BASE__POTENTIALLY_UNUSED = 1024;
|
||||
#ifdef WUFFS_IMPLEMENTATION
|
||||
#define WUFFS_DEFLATE__HUFFS_TABLE_SIZE 1024
|
||||
#endif // WUFFS_IMPLEMENTATION
|
||||
|
||||
static const uint32_t //
|
||||
wuffs_deflate__huffs_table_mask //
|
||||
WUFFS_BASE__POTENTIALLY_UNUSED = 1023;
|
||||
#ifdef WUFFS_IMPLEMENTATION
|
||||
#define WUFFS_DEFLATE__HUFFS_TABLE_MASK 1023
|
||||
#endif // WUFFS_IMPLEMENTATION
|
||||
|
||||
// ---------------- Private Initializer Prototypes
|
||||
|
||||
@@ -8509,47 +8471,61 @@ const char* wuffs_gif__error__internal_error_inconsistent_ri_wi =
|
||||
|
||||
// ---------------- Private Consts
|
||||
|
||||
#ifdef WUFFS_IMPLEMENTATION
|
||||
static const uint32_t //
|
||||
wuffs_gif__interlace_start[5] //
|
||||
WUFFS_BASE__POTENTIALLY_UNUSED = {
|
||||
4294967295, 1, 2, 4, 0,
|
||||
};
|
||||
#endif // WUFFS_IMPLEMENTATION
|
||||
|
||||
#ifdef WUFFS_IMPLEMENTATION
|
||||
static const uint8_t //
|
||||
wuffs_gif__interlace_delta[5] //
|
||||
WUFFS_BASE__POTENTIALLY_UNUSED = {
|
||||
1, 2, 4, 8, 8,
|
||||
};
|
||||
#endif // WUFFS_IMPLEMENTATION
|
||||
|
||||
#ifdef WUFFS_IMPLEMENTATION
|
||||
static const uint8_t //
|
||||
wuffs_gif__interlace_count[5] //
|
||||
WUFFS_BASE__POTENTIALLY_UNUSED = {
|
||||
0, 1, 2, 4, 8,
|
||||
};
|
||||
#endif // WUFFS_IMPLEMENTATION
|
||||
|
||||
#ifdef WUFFS_IMPLEMENTATION
|
||||
static const uint8_t //
|
||||
wuffs_gif__animexts1dot0[11] //
|
||||
WUFFS_BASE__POTENTIALLY_UNUSED = {
|
||||
65, 78, 73, 77, 69, 88, 84, 83, 49, 46, 48,
|
||||
};
|
||||
#endif // WUFFS_IMPLEMENTATION
|
||||
|
||||
#ifdef WUFFS_IMPLEMENTATION
|
||||
static const uint8_t //
|
||||
wuffs_gif__netscape2dot0[11] //
|
||||
WUFFS_BASE__POTENTIALLY_UNUSED = {
|
||||
78, 69, 84, 83, 67, 65, 80, 69, 50, 46, 48,
|
||||
};
|
||||
#endif // WUFFS_IMPLEMENTATION
|
||||
|
||||
#ifdef WUFFS_IMPLEMENTATION
|
||||
static const uint8_t //
|
||||
wuffs_gif__iccrgbg1012[11] //
|
||||
WUFFS_BASE__POTENTIALLY_UNUSED = {
|
||||
73, 67, 67, 82, 71, 66, 71, 49, 48, 49, 50,
|
||||
};
|
||||
#endif // WUFFS_IMPLEMENTATION
|
||||
|
||||
#ifdef WUFFS_IMPLEMENTATION
|
||||
static const uint8_t //
|
||||
wuffs_gif__xmpdataxmp[11] //
|
||||
WUFFS_BASE__POTENTIALLY_UNUSED = {
|
||||
88, 77, 80, 32, 68, 97, 116, 97, 88, 77, 80,
|
||||
};
|
||||
#endif // WUFFS_IMPLEMENTATION
|
||||
|
||||
// ---------------- Private Initializer Prototypes
|
||||
|
||||
|
||||
@@ -267,7 +267,7 @@ const char* test_wuffs_deflate_decode_deflate_huffman_primlen_9() {
|
||||
int i;
|
||||
for (i = 0; i < 2; i++) {
|
||||
// Find the first unused (i.e. zero) entry in the i'th huffs table.
|
||||
int got = wuffs_deflate__huffs_table_size;
|
||||
int got = WUFFS_DEFLATE__HUFFS_TABLE_SIZE;
|
||||
while ((got > 0) && (dec.private_data.f_huffs[i][got - 1] == 0)) {
|
||||
got--;
|
||||
}
|
||||
|
||||
+8
-8
@@ -776,7 +776,7 @@ const char* test_wuffs_gif_decode_delay_num_frames_decoded() {
|
||||
RETURN_FAIL("q=%d: initialize: \"%s\"", q, status);
|
||||
}
|
||||
wuffs_gif__decoder__set_quirk_enabled(
|
||||
&dec, wuffs_gif__quirk_delay_num_decoded_frames, q);
|
||||
&dec, WUFFS_GIF__QUIRK_DELAY_NUM_DECODED_FRAMES, q);
|
||||
|
||||
while (true) {
|
||||
status = wuffs_gif__decoder__decode_frame_config(&dec, NULL, &src);
|
||||
@@ -817,7 +817,7 @@ const char* test_wuffs_gif_decode_empty_palette() {
|
||||
RETURN_FAIL("q=%d: initialize: \"%s\"", q, status);
|
||||
}
|
||||
wuffs_gif__decoder__set_quirk_enabled(
|
||||
&dec, wuffs_gif__quirk_reject_empty_palette, q);
|
||||
&dec, WUFFS_GIF__QUIRK_REJECT_EMPTY_PALETTE, q);
|
||||
|
||||
wuffs_base__image_config ic = ((wuffs_base__image_config){});
|
||||
status = wuffs_gif__decoder__decode_image_config(&dec, &ic, &src);
|
||||
@@ -888,7 +888,7 @@ const char* test_wuffs_gif_decode_background_color() {
|
||||
RETURN_FAIL("q=%d: initialize: \"%s\"", q, status);
|
||||
}
|
||||
wuffs_gif__decoder__set_quirk_enabled(
|
||||
&dec, wuffs_gif__quirk_honor_background_color, q);
|
||||
&dec, WUFFS_GIF__QUIRK_HONOR_BACKGROUND_COLOR, q);
|
||||
|
||||
wuffs_base__frame_config fc = ((wuffs_base__frame_config){});
|
||||
status = wuffs_gif__decoder__decode_frame_config(&dec, &fc, &src);
|
||||
@@ -929,7 +929,7 @@ const char* test_wuffs_gif_decode_first_frame_is_opaque() {
|
||||
RETURN_FAIL("q=%d: initialize: \"%s\"", q, status);
|
||||
}
|
||||
wuffs_gif__decoder__set_quirk_enabled(
|
||||
&dec, wuffs_gif__quirk_honor_background_color, q);
|
||||
&dec, WUFFS_GIF__QUIRK_HONOR_BACKGROUND_COLOR, q);
|
||||
|
||||
wuffs_base__image_config ic = ((wuffs_base__image_config){});
|
||||
status = wuffs_gif__decoder__decode_image_config(&dec, &ic, &src);
|
||||
@@ -971,7 +971,7 @@ const char* test_wuffs_gif_decode_frame_out_of_bounds() {
|
||||
RETURN_FAIL("q=%d: initialize: \"%s\"", q, status);
|
||||
}
|
||||
wuffs_gif__decoder__set_quirk_enabled(
|
||||
&dec, wuffs_gif__quirk_image_bounds_are_strict, q);
|
||||
&dec, WUFFS_GIF__QUIRK_IMAGE_BOUNDS_ARE_STRICT, q);
|
||||
|
||||
wuffs_base__image_config ic = ((wuffs_base__image_config){});
|
||||
status = wuffs_gif__decoder__decode_image_config(&dec, &ic, &src);
|
||||
@@ -1150,12 +1150,12 @@ const char* test_wuffs_gif_decode_zero_width_frame() {
|
||||
case 1:
|
||||
want = NULL;
|
||||
wuffs_gif__decoder__set_quirk_enabled(
|
||||
&dec, wuffs_gif__quirk_ignore_too_much_pixel_data, true);
|
||||
&dec, WUFFS_GIF__QUIRK_IGNORE_TOO_MUCH_PIXEL_DATA, true);
|
||||
break;
|
||||
case 2:
|
||||
want = wuffs_gif__error__bad_frame_size;
|
||||
wuffs_gif__decoder__set_quirk_enabled(
|
||||
&dec, wuffs_gif__quirk_reject_empty_frame, true);
|
||||
&dec, WUFFS_GIF__QUIRK_REJECT_EMPTY_FRAME, true);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1709,7 +1709,7 @@ const char* test_wuffs_gif_decode_pixel_data_too_much_with_quirk() {
|
||||
}
|
||||
|
||||
return do_test_wuffs_gif_decode_expecting(
|
||||
src, wuffs_gif__quirk_ignore_too_much_pixel_data, NULL, false);
|
||||
src, WUFFS_GIF__QUIRK_IGNORE_TOO_MUCH_PIXEL_DATA, NULL, false);
|
||||
}
|
||||
|
||||
const char* test_wuffs_gif_frame_dirty_rect() {
|
||||
|
||||
Reference in new issue
Block a user