Skip to content

Commit f9a13e1

Browse files
committed
Replace DS2_FALLTHROUGH with standard [[fallthrough]]
With C++17, we have the `[[fallthrough]]` attribute to indicate a fallthrough on a switch case. Adopt that consistently and apply it to a few sites that were missing the attribute.
1 parent 21dc774 commit f9a13e1

File tree

4 files changed

+5
-18
lines changed

4 files changed

+5
-18
lines changed

Headers/DebugServer2/Utils/CompilerSupport.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,6 @@
2727
#define DS2_ATTRIBUTE_PRINTF(FORMAT, START)
2828
#endif
2929

30-
#if defined(COMPILER_GCC)
31-
#if __GNUC__ > 6
32-
#define DS2_FALLTHROUGH [[fallthrough]]
33-
#else
34-
#define DS2_FALLTHROUGH
35-
#endif
36-
#elif defined(COMPILER_CLANG)
37-
#define DS2_FALLTHROUGH [[clang::fallthrough]]
38-
#else
39-
#define DS2_FALLTHROUGH
40-
#endif
41-
4230
#if defined(COMPILER_MSVC)
4331
#define DS2_ATTRIBUTE_PACKED "DS2_ATTRIBUTE_PACKED not implemented on MSVC"
4432
#elif defined(COMPILER_GCC) || defined(COMPILER_CLANG)

Sources/Core/X86/HardwareBreakpointManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ ErrorCode HardwareBreakpointManager::isValid(Address const &address,
210210
break;
211211
case 8:
212212
DS2LOG(Warning, "8-byte breakpoints not supported on all architectures");
213-
DS2_FALLTHROUGH;
213+
[[fallthrough]];
214214

215215
case 2:
216216
case 4:

Sources/GDBRemote/DebugSessionImpl.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,8 @@ ErrorCode DebugSessionImplBase::queryStopInfo(Session &session, Thread *thread,
189189
case StopInfo::kEventNone:
190190
stop.event = StopInfo::kEventStop;
191191
stop.reason = StopInfo::kReasonNone;
192-
DS2_FALLTHROUGH;
192+
[[fallthrough]];
193193

194-
// fall-through from kEventNone.
195194
case StopInfo::kEventStop: {
196195
// Thread name won't be available if the process has exited or has been
197196
// killed.

Sources/Host/POSIX/ProcessSpawner.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -355,9 +355,9 @@ ErrorCode ProcessSpawner::run(std::function<bool()> preExecAction) {
355355

356356
for (size_t n = 0; n < 3; n++) {
357357
switch (_descriptors[n].mode) {
358-
// intentional fall-through to kRedirectConsole
359358
case kRedirectUnset:
360359
_descriptors[n].mode = kRedirectConsole;
360+
[[fallthrough]];
361361
case kRedirectConsole:
362362
// do nothing
363363
break;
@@ -390,10 +390,10 @@ ErrorCode ProcessSpawner::run(std::function<bool()> preExecAction) {
390390

391391
case kRedirectBuffer:
392392
_outputBuffer.clear();
393-
// fall-through
393+
[[fallthrough]];
394394
case kRedirectDelegate:
395395
startRedirectThread = true;
396-
// fall-through
396+
[[fallthrough]];
397397
case kRedirectTerminal:
398398
if (term[RD] == -1) {
399399
if (!open_terminal(term)) {

0 commit comments

Comments
 (0)