Apache Mesos
unimplemented.hpp
Go to the documentation of this file.
1 // Licensed under the Apache License, Version 2.0 (the "License");
2 // you may not use this file except in compliance with the License.
3 // You may obtain a copy of the License at
4 //
5 // http://www.apache.org/licenses/LICENSE-2.0
6 //
7 // Unless required by applicable law or agreed to in writing, software
8 // distributed under the License is distributed on an "AS IS" BASIS,
9 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 // See the License for the specific language governing permissions and
11 // limitations under the License.
12 
13 #ifndef __STOUT_UNIMPLEMENTED_HPP__
14 #define __STOUT_UNIMPLEMENTED_HPP__
15 
16 // If the project is configured to use static assertions for
17 // unimplemented functions.
18 #ifdef ENABLE_STATIC_UNIMPLEMENTED
19 #define UNIMPLEMENTED static_assert(false, "Unimplemented function");
20 #else
21 // Otherwise we display an error message at runtime and abort.
22 
23 #include <stdlib.h>
24 
25 #include <iostream>
26 
27 #include <stout/attributes.hpp>
28 
29 #define UNIMPLEMENTED Unimplemented(__func__, __FILE__, __LINE__)
30 
31 NORETURN inline void Unimplemented(
32  const char* function,
33  const char* file,
34  const int line)
35 {
36  std::cerr << "Reached unimplemented function '" << function << "' at "
37  << file << ':' << line << std::endl;
38  abort();
39 }
40 #endif
41 
42 #endif // __STOUT_UNIMPLEMENTED_HPP__
URI file(const std::string &path)
Creates a file URI with the given path on the local host.
Definition: file.hpp:33
NORETURN void Unimplemented(const char *function, const char *file, const int line)
Definition: unimplemented.hpp:31
#define NORETURN
Definition: attributes.hpp:20