Skip to content

Commit

Permalink
Clang compilation bugfixs
Browse files Browse the repository at this point in the history
  • Loading branch information
saleyn committed Oct 18, 2014
1 parent 496e6dd commit 09b1e65
Show file tree
Hide file tree
Showing 10 changed files with 81 additions and 32 deletions.
2 changes: 1 addition & 1 deletion include/utxx/config_validator.hpp
Expand Up @@ -161,7 +161,7 @@ namespace config {
, BRANCH // May not have value, but may have children
};

struct option;
class option;

template <typename T>
class typed_val {
Expand Down
1 change: 1 addition & 0 deletions include/utxx/detail/running_stat_impl.hpp
Expand Up @@ -63,6 +63,7 @@ namespace detail {
#ifdef UTXX_RUNNING_MINMAX_DEBUG
size_t capacity() const { return derived_this()->capacity(); }
#endif

public:
minmax_impl()
: m_min_idx(0)
Expand Down
22 changes: 0 additions & 22 deletions include/utxx/logger.hpp
Expand Up @@ -37,28 +37,6 @@ namespace utxx {

class logger;

enum log_level {
NOLOGGING = 0
, LEVEL_NONE = 0
, LEVEL_TRACE5 = 1 << 5 | 1 << 0
, LEVEL_TRACE4 = 1 << 5 | 1 << 1
, LEVEL_TRACE3 = 1 << 5 | 1 << 2
, LEVEL_TRACE2 = 1 << 5 | 1 << 3
, LEVEL_TRACE1 = 1 << 5 | 1 << 4
, LEVEL_TRACE = 1 << 5
, LEVEL_DEBUG = 1 << 6
, LEVEL_INFO = 1 << 7
, LEVEL_WARNING = 1 << 8
, LEVEL_ERROR = 1 << 9
, LEVEL_FATAL = 1 << 10
, LEVEL_ALERT = 1 << 11
, LEVEL_LOG = 1 << 12
, LEVEL_NO_DEBUG = LEVEL_INFO | LEVEL_WARNING | LEVEL_ERROR | LEVEL_FATAL | LEVEL_ALERT | LEVEL_LOG
, LEVEL_NO_TRACE = LEVEL_NO_DEBUG | LEVEL_DEBUG
, LEVEL_LOG_ALL = LEVEL_NO_TRACE | LEVEL_TRACE1 | LEVEL_TRACE2 | LEVEL_TRACE3 |
LEVEL_TRACE4 | LEVEL_TRACE5
};

} // namespace utxx

#include <utxx/logger/logger.hpp>
Expand Down
3 changes: 2 additions & 1 deletion include/utxx/logger/logger.hpp
Expand Up @@ -52,6 +52,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include <utxx/config_tree.hpp>
#include <boost/thread/mutex.hpp>

#include <utxx/logger/logger_enums.hpp>
#include <utxx/logger/logger_impl.hpp>
#ifndef _MSC_VER
# include <utxx/synch.hpp>
Expand Down Expand Up @@ -204,7 +205,7 @@ class logger : boost::noncopyable {

void set_timestamp(char* buf, time_t seconds) const;

friend class logger_impl;
friend struct logger_impl;

/// To be called by <logger_impl> child to register a delegate to be
/// invoked on a call to LOG_*() macros.
Expand Down
64 changes: 64 additions & 0 deletions include/utxx/logger/logger_enums.hpp
@@ -0,0 +1,64 @@
//----------------------------------------------------------------------------
/// \file logger_enums.hpp
//----------------------------------------------------------------------------
/// \brief Logging framework
//----------------------------------------------------------------------------
// Author: Serge Aleynikov
// Created: 2009-11-25
//----------------------------------------------------------------------------
/*
***** BEGIN LICENSE BLOCK *****
This file is part of the utxx open-source project.
Copyright (C) 2010 Serge Aleynikov <saleyn@gmail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
***** END LICENSE BLOCK *****
*/

#ifndef _UTXX_LOGGER_ENUMS_HPP_
#define _UTXX_LOGGER_ENUMS_HPP_

namespace utxx {

class logger;

enum log_level {
NOLOGGING = 0
, LEVEL_NONE = 0
, LEVEL_TRACE5 = 1 << 5 | 1 << 0
, LEVEL_TRACE4 = 1 << 5 | 1 << 1
, LEVEL_TRACE3 = 1 << 5 | 1 << 2
, LEVEL_TRACE2 = 1 << 5 | 1 << 3
, LEVEL_TRACE1 = 1 << 5 | 1 << 4
, LEVEL_TRACE = 1 << 5
, LEVEL_DEBUG = 1 << 6
, LEVEL_INFO = 1 << 7
, LEVEL_WARNING = 1 << 8
, LEVEL_ERROR = 1 << 9
, LEVEL_FATAL = 1 << 10
, LEVEL_ALERT = 1 << 11
, LEVEL_LOG = 1 << 12
, LEVEL_NO_DEBUG = LEVEL_INFO | LEVEL_WARNING | LEVEL_ERROR | LEVEL_FATAL | LEVEL_ALERT | LEVEL_LOG
, LEVEL_NO_TRACE = LEVEL_NO_DEBUG | LEVEL_DEBUG
, LEVEL_LOG_ALL = LEVEL_NO_TRACE | LEVEL_TRACE1 | LEVEL_TRACE2 | LEVEL_TRACE3 |
LEVEL_TRACE4 | LEVEL_TRACE5
};

} // namespace utxx

#endif // _UTXX_LOGGER_ENUMS_HPP_
2 changes: 1 addition & 1 deletion include/utxx/logger/logger_impl.hpp
Expand Up @@ -43,13 +43,13 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include <utxx/meta.hpp>
#include <utxx/error.hpp>
#include <utxx/singleton.hpp>
#include <utxx/logger/logger_enums.hpp>
#include <utxx/logger.hpp>
#include <utxx/path.hpp>
#include <utxx/convert.hpp>
#include <utxx/variant_tree.hpp>
#include <utxx/print.hpp>
#include <vector>

struct T;
namespace utxx {

Expand Down
4 changes: 2 additions & 2 deletions include/utxx/multi_file_async_logger.hpp
Expand Up @@ -96,7 +96,7 @@ struct basic_multi_file_async_logger {

/// Stream information associated with a file descriptor
/// used internally by the async logger
struct stream_info;
class stream_info;

/// Internal stream identifier
class file_id;
Expand Down Expand Up @@ -519,7 +519,7 @@ stream_info {
msg_writer on_write; // Message writer functor
stream_reconnecter on_reconnect; // Stream reconnecter

template <typename T> friend class basic_multi_file_async_logger;
template <typename T> friend struct basic_multi_file_async_logger;

public:
std::string name;
Expand Down
2 changes: 2 additions & 0 deletions include/utxx/persist_array.hpp
Expand Up @@ -329,7 +329,9 @@ namespace utxx {

//Get the address of the mapped region
void* addr = region.get_address();
#ifndef NDEBUG
size_t size = region.get_size();
#endif

m_file.swap(shmf);
m_region.swap(region);
Expand Down
5 changes: 4 additions & 1 deletion include/utxx/running_stat.hpp
Expand Up @@ -152,6 +152,8 @@ struct basic_moving_average
detail::minmax_impl<basic_moving_average<T,N,FastMinMax>, T, FastMinMax>
base;

friend base;

explicit basic_moving_average(size_t a_capacity = 0)
: MASK(N ? N-1 : a_capacity-1)
, m_data(m_samples)
Expand Down Expand Up @@ -269,7 +271,8 @@ struct basic_moving_average
T max() const { return base::max(); }

protected:
template <class D, class U, class F> friend class detail::minmax_impl;
template <typename D, typename U, bool F> friend struct detail::minmax_impl;

size_t begin_idx() const { return m_end - size(); }
size_t end_idx() const { return m_end; }
T data(size_t a_idx) const { return m_data[a_idx & MASK]; }
Expand Down
8 changes: 4 additions & 4 deletions include/utxx/variant_tree.hpp
Expand Up @@ -349,7 +349,7 @@ class basic_variant_tree : public basic_variant_tree_base<Ch>
path_type p(path);
const base* t = navigate(this, p, (const int*)NULL, false);
if (t)
try { return t->get_value<T>(detail::variant_translator<T>()); }
try { return t->template get_value<T>(detail::variant_translator<T>()); }
catch (...) { throw_bad_type<T>(path, t->data()); }
return default_value;
}
Expand All @@ -367,7 +367,7 @@ class basic_variant_tree : public basic_variant_tree_base<Ch>
// if (!t->data().is_type<T>())
// throw_bad_type<T>(path, t->data());
// return boost::optional<T>(t->get<T>());
try { return t->get_value<T>(detail::variant_translator<T>()); }
try { return t->template get_value<T>(detail::variant_translator<T>()); }
catch (...) { throw_bad_type<T>(path, t->data()); }
}
return boost::optional<T>();
Expand Down Expand Up @@ -563,7 +563,7 @@ class basic_variant_tree : public basic_variant_tree_base<Ch>
static void translate_data(base& a_tree, const T& a_tr) {
for (iterator it = a_tree.begin(), e = a_tree.end(); it != e; ++it)
translate_data(it->second, a_tr);
a_tree.data() = *a_tr.put_value(a_tree.get_value<std::string>());
a_tree.data() = *a_tr.put_value(a_tree.template get_value<std::string>());
}

private:
Expand All @@ -579,7 +579,7 @@ class basic_variant_tree : public basic_variant_tree_base<Ch>
translate_data(it.begin(), it.end(), a_tr);
// Get the value as string and attempt to convert it to variant
this->put_child(a_node->first,
*a_tr.put_value(a_node->second.get_value<std::string>()));
*a_tr.put_value(a_node->second.template get_value<std::string>()));
}

template <class Stream>
Expand Down

0 comments on commit 09b1e65

Please sign in to comment.