Skip to content

Commit e387982

Browse files
ignore deprecation warning inside the encoding header
Signed-off-by: Christian Rauch <[email protected]>
1 parent 23e84d3 commit e387982

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

sensor_msgs/include/sensor_msgs/image_encodings.hpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,16 @@ const std::regex cv_type_regex("(8|16|32|64)(U|S|F)C([0-9]*)");
122122
// Utility functions for inspecting an encoding string
123123
static inline bool isColor(const std::string & encoding)
124124
{
125+
#pragma GCC diagnostic push
126+
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
125127
return encoding == RGB8 || encoding == BGR8 ||
126128
encoding == RGBA8 || encoding == BGRA8 ||
127129
encoding == RGB16 || encoding == BGR16 ||
128130
encoding == RGBA16 || encoding == BGRA16 ||
129131
encoding == YUV422 || encoding == YUV422_YUY2 ||
130132
encoding == UYVY || encoding == YUYV ||
131133
encoding == NV21 || encoding == NV24;
134+
#pragma GCC diagnostic pop
132135
}
133136

134137
static inline bool isMono(const std::string & encoding)
@@ -191,6 +194,8 @@ static inline int numChannels(const std::string & encoding)
191194
return (m[3] == "") ? 1 : std::atoi(m[3].str().c_str());
192195
}
193196

197+
#pragma GCC diagnostic push
198+
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
194199
if (encoding == YUV422 ||
195200
encoding == YUV422_YUY2 ||
196201
encoding == UYVY ||
@@ -200,6 +205,7 @@ static inline int numChannels(const std::string & encoding)
200205
{
201206
return 2;
202207
}
208+
#pragma GCC diagnostic pop
203209

204210
throw std::runtime_error("Unknown encoding " + encoding);
205211
return -1;
@@ -243,6 +249,8 @@ static inline int bitDepth(const std::string & encoding)
243249
return std::atoi(m[0].str().c_str());
244250
}
245251

252+
#pragma GCC diagnostic push
253+
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
246254
if (encoding == YUV422 ||
247255
encoding == YUV422_YUY2 ||
248256
encoding == UYVY ||
@@ -252,6 +260,7 @@ static inline int bitDepth(const std::string & encoding)
252260
{
253261
return 8;
254262
}
263+
#pragma GCC diagnostic pop
255264

256265
throw std::runtime_error("Unknown encoding " + encoding);
257266
return -1;

0 commit comments

Comments
 (0)