Repository: mesos Updated Branches: refs/heads/master 57c0d02ba -> a4a23aa4c
Stout: Introduced configurable `UNIMPLEMENTED` macro. Review: https://reviews.apache.org/r/36829 Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/4fa8e61b Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/4fa8e61b Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/4fa8e61b Branch: refs/heads/master Commit: 4fa8e61b2f0c3d4f9486ec3d669e6a2358fe8cc4 Parents: 57c0d02 Author: Joris Van Remoortere <[email protected]> Authored: Fri Jul 31 15:13:16 2015 -0700 Committer: Michael Park <[email protected]> Committed: Fri Jul 31 15:42:03 2015 -0700 ---------------------------------------------------------------------- .../3rdparty/stout/include/Makefile.am | 1 + .../stout/include/stout/unimplemented.hpp | 43 ++++++++++++++++++++ 2 files changed, 44 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/4fa8e61b/3rdparty/libprocess/3rdparty/stout/include/Makefile.am ---------------------------------------------------------------------- diff --git a/3rdparty/libprocess/3rdparty/stout/include/Makefile.am b/3rdparty/libprocess/3rdparty/stout/include/Makefile.am index 2752fc4..ce85033 100644 --- a/3rdparty/libprocess/3rdparty/stout/include/Makefile.am +++ b/3rdparty/libprocess/3rdparty/stout/include/Makefile.am @@ -121,6 +121,7 @@ nobase_include_HEADERS = \ stout/tests/utils.hpp \ stout/thread_local.hpp \ stout/try.hpp \ + stout/unimplemented.hpp \ stout/unreachable.hpp \ stout/utils.hpp \ stout/uuid.hpp \ http://git-wip-us.apache.org/repos/asf/mesos/blob/4fa8e61b/3rdparty/libprocess/3rdparty/stout/include/stout/unimplemented.hpp ---------------------------------------------------------------------- diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/unimplemented.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/unimplemented.hpp new file mode 100644 index 0000000..a1a2a03 --- /dev/null +++ b/3rdparty/libprocess/3rdparty/stout/include/stout/unimplemented.hpp @@ -0,0 +1,43 @@ +/** + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef __STOUT_UNIMPLEMENTED_HPP__ +#define __STOUT_UNIMPLEMENTED_HPP__ + +// If the project is configured to use static assertions for +// unimplemented functions. +#ifdef ENABLE_STATIC_UNIMPLEMENTED +#define UNIMPLEMENTED static_assert(false, "Unimplemented function"); +#else +// Otherwise we display an error message at runtime and abort. + +#include <stdlib.h> + +#include <iostream> + +#include <stout/attributes.hpp> + +#define UNIMPLEMENTED Unimplemented(__func__, __FILE__, __LINE__) + +NORETURN inline void Unimplemented( + const char* function, + const char* file, + const int line) +{ + std::cerr << "Reached unimplemented function '" << function << "' at " + << file << ':' << line << std::endl; + abort(); +} +#endif + +#endif // __STOUT_UNIMPLEMENTED_HPP__
