Commit 1864bd5f authored by James Donald's avatar James Donald Committed by Facebook GitHub Bot

Fix -Winvalid-return warnings in Singleton

Summary:
Resolves these warnings:
```
folly\Singleton.cpp(102,1): warning: function declared 'noreturn' should not return [-Winvalid-noreturn]
}
^
folly\Singleton.cpp(108,1): warning: function declared 'noreturn' should not return [-Winvalid-noreturn]
}
^
folly\Singleton.cpp(126,1): warning: function declared 'noreturn' should not return [-Winvalid-noreturn]
}
^
folly\Singleton.cpp(134,1): warning: function declared 'noreturn' should not return [-Winvalid-noreturn]
}
^
folly\Singleton.cpp(145,1): warning: function declared 'noreturn' should not return [-Winvalid-noreturn]
}
```

Reviewed By: mzlee, yfeldblum

Differential Revision: D21130719

fbshipit-source-id: a0f198d69c4fde44f9a5250b6915e36b6ee68642
parent 5ead4c5e
......@@ -99,12 +99,14 @@ std::string TypeDescriptor::name() const {
LOG(FATAL) << "Creating instance for unregistered singleton: " << type.name()
<< "\n"
<< "Stacktrace:\n" << (!trace.empty() ? trace : "(not available)");
folly::assume_unreachable();
}
[[noreturn]] void singletonWarnRegisterMockEarlyAndAbort(
const TypeDescriptor& type) {
LOG(FATAL) << "Registering mock before singleton was registered: "
<< type.name();
folly::assume_unreachable();
}
void singletonWarnDestroyInstanceLeak(
......@@ -123,6 +125,7 @@ void singletonWarnDestroyInstanceLeak(
[[noreturn]] void singletonWarnCreateCircularDependencyAndAbort(
const TypeDescriptor& type) {
LOG(FATAL) << "circular singleton dependency: " << type.name();
folly::assume_unreachable();
}
[[noreturn]] void singletonWarnCreateUnregisteredAndAbort(
......@@ -131,6 +134,7 @@ void singletonWarnDestroyInstanceLeak(
LOG(FATAL) << "Creating instance for unregistered singleton: " << type.name()
<< "\n"
<< "Stacktrace:\n" << (!trace.empty() ? trace : "(not available)");
folly::assume_unreachable();
}
[[noreturn]] void singletonWarnCreateBeforeRegistrationCompleteAndAbort(
......@@ -142,6 +146,7 @@ void singletonWarnDestroyInstanceLeak(
<< "folly::init, or singleton was requested before main() "
<< "(which is not allowed).\n"
<< "Stacktrace:\n" << (!trace.empty() ? trace : "(not available)");
folly::assume_unreachable();
}
void singletonPrintDestructionStackTrace(const TypeDescriptor& type) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment