Skip to content

Commit e1e7b37

Browse files
committed
Disable -Wimplicit-fallthrough for these two files.
These two files contain code with multiple switch statements, where one case "fall through" to the next case. As it's not currently clear if this is intentional or not, rather than modifying the code in any way (regression risk), use GCC diagnostic pragmas to disable this warning for only these two files, with BUGBUG marking to encourage review by someone more familiar with this code.
1 parent 4276526 commit e1e7b37

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

libraries/USBHost/src/confdescparser.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,17 @@ e-mail : [email protected]
1919
#error "Never include confdescparser.h directly; include Usb.h instead"
2020
#else
2121

22+
#pragma GCC diagnostic push // Available since GCC 4.6.4
23+
/*
24+
* BUGBUG -- Enabled and review all `-Wimplicit-fallthrough` messages
25+
* This code has multiple switch statements that "fall through" to the
26+
* next case -- but it's not always clear if this is intentional or not.
27+
* Review and commenting of code, and reducing cyclomatic complexity
28+
* are highly recommended....
29+
*/
30+
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
31+
32+
2233
#define __CONFDESCPARSER_H__
2334

2435
#include <stdint.h>
@@ -220,4 +231,6 @@ void ConfigDescParser<CLASS_ID, SUBCLASS_ID, PROTOCOL_ID, MASK>::PrintHidDescrip
220231
}
221232

222233

234+
#pragma GCC diagnostic pop
235+
223236
#endif // __CONFDESCPARSER_H__

libraries/USBHost/src/parsetools.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,19 @@ e-mail : [email protected]
2323
#include <stdint.h>
2424
//#include "Arduino.h"
2525

26+
#pragma GCC diagnostic push // Available since GCC 4.6.4
27+
/*
28+
* BUGBUG -- Enabled and review all `-Wimplicit-fallthrough` messages
29+
* This code has multiple switch statements that "fall through" to the
30+
* next case -- but it's not always clear if this is intentional or not.
31+
* Review and commenting of code, and reducing cyclomatic complexity
32+
* are highly recommended....
33+
*/
34+
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
35+
36+
37+
38+
2639
struct MultiValueBuffer {
2740
uint8_t valueSize;
2841
void *pValue;
@@ -140,4 +153,7 @@ class PTPListParser {
140153
bool Parse(uint8_t **pp, uint32_t *pcntdn, PTP_ARRAY_EL_FUNC pf, const void *me = NULL);
141154
};
142155

156+
157+
#pragma GCC diagnostic pop
158+
143159
#endif // __PARSETOOLS_H__

0 commit comments

Comments
 (0)