File tree Expand file tree Collapse file tree 3 files changed +31
-1
lines changed
cdk/include/mysql/cdk/foundation Expand file tree Collapse file tree 3 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -299,7 +299,10 @@ endif()
299
299
if (CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 12.0 )
300
300
# Silence a warning produced by a regression in GCC 12.0 and newer
301
301
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106199
302
+ # Note: The stringop-overflow warnings are shown also during linking phase
303
+ # (observed with GCC 14.2)
302
304
add_compile_options (-Wno-stringop-overflow )
305
+ add_link_options (-Wno-stringop-overflow )
303
306
endif ()
304
307
305
308
Original file line number Diff line number Diff line change @@ -220,8 +220,14 @@ static size_t convert(bytes buf, T &val)
220
220
/*
221
221
If buf size is smaller than sizeof(T), convert 1,2,4 or 8 initial
222
222
bytes from the buffer: as much as fits into T.
223
+
224
+ Note: We check here that buffer size is big enough to store given amount
225
+ of bytes but compilers still complain under -Warray-bounds (seen on
226
+ Solaris with gcc 11.4).
223
227
*/
224
228
229
+ PUSH_ARRAY_BOUNDS_WARNING_CDK
230
+
225
231
if (buf.size () >= sizeof (T))
226
232
{
227
233
val= *(T*)buf.begin ();
@@ -252,6 +258,8 @@ static size_t convert(bytes buf, T &val)
252
258
return 1 ;
253
259
}
254
260
261
+ POP_ARRAY_BOUNDS_WARNING_CDK
262
+
255
263
// TODO: better error description
256
264
throw_error (cdkerrc::conversion_error,
257
265
" Number_codec: no data for conversion" );
Original file line number Diff line number Diff line change 42
42
#define DIAGNOSTIC_PUSH_CDK PRAGMA_CDK (warning (push))
43
43
#define DIAGNOSTIC_POP_CDK PRAGMA_CDK (warning (pop))
44
44
45
- #elif defined __GNUC__ || defined __clang__
45
+ #elif defined __GNUC__ || defined __clang__
46
46
47
47
#define PRAGMA_CDK (X ) _Pragma (#X)
48
48
#define DISABLE_WARNING_CDK (W ) PRAGMA_CDK(GCC diagnostic ignored #W)
113
113
#define POP_SYS_WARNINGS_CDK DIAGNOSTIC_POP_CDK
114
114
115
115
116
+ /*
117
+ Macros to disable false positives from -Warray-bounds checks for lines
118
+ of code that were manually verified to be correct.
119
+ */
120
+
121
+ #ifdef _MSC_VER
122
+
123
+ #define PUSH_ARRAY_BOUNDS_WARNING_CDK DIAGNOSTIC_PUSH_CDK
124
+ #define POP_ARRAY_BOUNDS_WARNING_CDK DIAGNOSTIC_POP_CDK
125
+
126
+ #else
127
+
128
+ #define PUSH_ARRAY_BOUNDS_WARNING_CDK \
129
+ DIAGNOSTIC_PUSH_CDK DISABLE_WARNING_CDK (-Warray-bounds)
130
+ #define POP_ARRAY_BOUNDS_WARNING_CDK DIAGNOSTIC_POP_CDK
131
+
132
+ #endif
133
+
134
+
116
135
// Avoid warnings from Protobuf includes
117
136
118
137
#if defined _MSC_VER
You can’t perform that action at this time.
0 commit comments