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 { ...@@ -99,12 +99,14 @@ std::string TypeDescriptor::name() const {
LOG(FATAL) << "Creating instance for unregistered singleton: " << type.name() LOG(FATAL) << "Creating instance for unregistered singleton: " << type.name()
<< "\n" << "\n"
<< "Stacktrace:\n" << (!trace.empty() ? trace : "(not available)"); << "Stacktrace:\n" << (!trace.empty() ? trace : "(not available)");
folly::assume_unreachable();
} }
[[noreturn]] void singletonWarnRegisterMockEarlyAndAbort( [[noreturn]] void singletonWarnRegisterMockEarlyAndAbort(
const TypeDescriptor& type) { const TypeDescriptor& type) {
LOG(FATAL) << "Registering mock before singleton was registered: " LOG(FATAL) << "Registering mock before singleton was registered: "
<< type.name(); << type.name();
folly::assume_unreachable();
} }
void singletonWarnDestroyInstanceLeak( void singletonWarnDestroyInstanceLeak(
...@@ -123,6 +125,7 @@ void singletonWarnDestroyInstanceLeak( ...@@ -123,6 +125,7 @@ void singletonWarnDestroyInstanceLeak(
[[noreturn]] void singletonWarnCreateCircularDependencyAndAbort( [[noreturn]] void singletonWarnCreateCircularDependencyAndAbort(
const TypeDescriptor& type) { const TypeDescriptor& type) {
LOG(FATAL) << "circular singleton dependency: " << type.name(); LOG(FATAL) << "circular singleton dependency: " << type.name();
folly::assume_unreachable();
} }
[[noreturn]] void singletonWarnCreateUnregisteredAndAbort( [[noreturn]] void singletonWarnCreateUnregisteredAndAbort(
...@@ -131,6 +134,7 @@ void singletonWarnDestroyInstanceLeak( ...@@ -131,6 +134,7 @@ void singletonWarnDestroyInstanceLeak(
LOG(FATAL) << "Creating instance for unregistered singleton: " << type.name() LOG(FATAL) << "Creating instance for unregistered singleton: " << type.name()
<< "\n" << "\n"
<< "Stacktrace:\n" << (!trace.empty() ? trace : "(not available)"); << "Stacktrace:\n" << (!trace.empty() ? trace : "(not available)");
folly::assume_unreachable();
} }
[[noreturn]] void singletonWarnCreateBeforeRegistrationCompleteAndAbort( [[noreturn]] void singletonWarnCreateBeforeRegistrationCompleteAndAbort(
...@@ -142,6 +146,7 @@ void singletonWarnDestroyInstanceLeak( ...@@ -142,6 +146,7 @@ void singletonWarnDestroyInstanceLeak(
<< "folly::init, or singleton was requested before main() " << "folly::init, or singleton was requested before main() "
<< "(which is not allowed).\n" << "(which is not allowed).\n"
<< "Stacktrace:\n" << (!trace.empty() ? trace : "(not available)"); << "Stacktrace:\n" << (!trace.empty() ? trace : "(not available)");
folly::assume_unreachable();
} }
void singletonPrintDestructionStackTrace(const TypeDescriptor& type) { 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