blob: 79028f490037cf4b8964270affa0a1a00b3ec404 [file] [log] [blame]
Igor Murashkinaaebaa02015-01-26 10:55:53 -08001/*
2 * Copyright (C) 2015 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef ART_CMDLINE_DETAIL_CMDLINE_DEBUG_DETAIL_H_
18#define ART_CMDLINE_DETAIL_CMDLINE_DEBUG_DETAIL_H_
19
20#include <iostream>
21#ifndef CMDLINE_NDEBUG
22#define CMDLINE_DEBUG_LOG std::cerr
23#else
24#define CMDLINE_DEBUG_LOG ::art::detail::debug_log_ignore()
25#endif
26
27namespace art {
28 // Implementation details for some template querying. Don't look inside if you hate templates.
29 namespace detail {
30 struct debug_log_ignore {
31 // Ignore most of the normal operator<< usage.
32 template <typename T>
33 debug_log_ignore& operator<<(const T&) { return *this; }
34 // Ignore std::endl and the like.
35 debug_log_ignore& operator<<(std::ostream& (*)(std::ostream&) ) { return *this; }
36 };
37 } // namespace detail // NOLINT [readability/namespace] [5]
38} // namespace art
39
40#endif // ART_CMDLINE_DETAIL_CMDLINE_DEBUG_DETAIL_H_