Avoid inlining logging functions

This commit is contained in:
nsubiron 2019-03-18 10:33:33 +01:00
parent 6cc90cea77
commit f9b2b10b02
2 changed files with 25 additions and 0 deletions

View File

@ -6,6 +6,8 @@
#pragma once
#include "carla/Platform.h"
#define LIBCARLA_LOG_LEVEL_DEBUG 10
#define LIBCARLA_LOG_LEVEL_INFO 20
#define LIBCARLA_LOG_LEVEL_WARNING 30
@ -46,6 +48,7 @@ namespace logging {
// https://stackoverflow.com/a/27375675
template <typename Arg, typename ... Args>
LIBCARLA_NOINLINE
static void write_to_stream(std::ostream &out, Arg &&arg, Args && ... args) {
out << std::boolalpha << std::forward<Arg>(arg);
using expander = int[];

View File

@ -0,0 +1,22 @@
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
// de Barcelona (UAB).
//
// This work is licensed under the terms of the MIT license.
// For a copy, see <https://opensource.org/licenses/MIT>.
#pragma once
#if defined(_MSC_VER)
# define LIBCARLA_FORCEINLINE __forceinline
# define LIBCARLA_NOINLINE __declspec(noinline)
#elif defined(__clang__)
# if defined(NDEBUG)
# define LIBCARLA_FORCEINLINE inline __attribute__((always_inline))
# else
# define LIBCARLA_FORCEINLINE inline
# endif // NDEBUG
# define LIBCARLA_NOINLINE __attribute__((noinline))
#else
# warning Compiler not supported.
# define LIBCARLA_NOINLINE
#endif