Skip to content

Commit 2cb02e0

Browse files
committed
Update dr_mp3.h from mainstream to silence a bogus gcc-14 warning.
Silences an incorrect -Wstringop-overflow warning from gcc >= 14 Reference issue: #616
1 parent acffeb1 commit 2cb02e0

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

src/dr_libs/dr_mp3.h

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
MP3 audio decoder. Choice of public domain or MIT-0. See license statements at the end of this file.
3-
dr_mp3 - v0.7.0 - 2025-07-23
3+
dr_mp3 - v0.7.1 - TBD
44
55
David Reid - mackron@gmail.com
66
@@ -72,7 +72,7 @@ extern "C" {
7272

7373
#define DRMP3_VERSION_MAJOR 0
7474
#define DRMP3_VERSION_MINOR 7
75-
#define DRMP3_VERSION_REVISION 0
75+
#define DRMP3_VERSION_REVISION 1
7676
#define DRMP3_VERSION_STRING DRMP3_XSTRINGIFY(DRMP3_VERSION_MAJOR) "." DRMP3_XSTRINGIFY(DRMP3_VERSION_MINOR) "." DRMP3_XSTRINGIFY(DRMP3_VERSION_REVISION)
7777

7878
#include <stddef.h> /* For size_t. */
@@ -1227,6 +1227,14 @@ static float drmp3_L3_ldexp_q2(float y, int exp_q2)
12271227
return y;
12281228
}
12291229

1230+
/*
1231+
I've had reports of GCC 14 throwing an incorrect -Wstringop-overflow warning here. This is an attempt
1232+
to silence this warning.
1233+
*/
1234+
#if (defined(__GNUC__) && (__GNUC__ >= 14)) && !defined(__clang__)
1235+
#pragma GCC diagnostic push
1236+
#pragma GCC diagnostic ignored "-Wstringop-overflow"
1237+
#endif
12301238
static void drmp3_L3_decode_scalefactors(const drmp3_uint8 *hdr, drmp3_uint8 *ist_pos, drmp3_bs *bs, const drmp3_L3_gr_info *gr, float *scf, int ch)
12311239
{
12321240
static const drmp3_uint8 g_scf_partitions[3][28] = {
@@ -1288,6 +1296,9 @@ static void drmp3_L3_decode_scalefactors(const drmp3_uint8 *hdr, drmp3_uint8 *is
12881296
scf[i] = drmp3_L3_ldexp_q2(gain, iscf[i] << scf_shift);
12891297
}
12901298
}
1299+
#if (defined(__GNUC__) && (__GNUC__ >= 14)) && !defined(__clang__)
1300+
#pragma GCC diagnostic pop
1301+
#endif
12911302

12921303
static const float g_drmp3_pow43[129 + 16] = {
12931304
0,-1,-2.519842f,-4.326749f,-6.349604f,-8.549880f,-10.902724f,-13.390518f,-16.000000f,-18.720754f,-21.544347f,-24.463781f,-27.473142f,-30.567351f,-33.741992f,-36.993181f,
@@ -4981,6 +4992,9 @@ DIFFERENCES BETWEEN minimp3 AND dr_mp3
49814992
/*
49824993
REVISION HISTORY
49834994
================
4995+
v0.7.1 - TBD
4996+
- Silence a warning with GCC.
4997+
49844998
v0.7.0 - 2025-07-23
49854999
- The old `DRMP3_IMPLEMENTATION` has been removed. Use `DR_MP3_IMPLEMENTATION` instead. The reason for this change is that in the future everything will eventually be using the underscored naming convention in the future, so `drmp3` will become `dr_mp3`.
49865000
- API CHANGE: Seek origins have been renamed to match the naming convention used by dr_wav and my other libraries.

0 commit comments

Comments
 (0)