fix: addition standard equivalent of "pragma once"

Replacement of "pragma once" by its standard equivalent, to insure the compilation of the code by all compilers.
pull/913/head
Benoît Langlois 7 years ago
parent 7088644d3f
commit 5da067482a
No known key found for this signature in database
GPG Key ID: A2B011ADDA5FE3CE

@ -2,8 +2,8 @@
// Copyright(c) 2015 Gabi Melman. // Copyright(c) 2015 Gabi Melman.
// Distributed under the MIT License (http://opensource.org/licenses/MIT) // Distributed under the MIT License (http://opensource.org/licenses/MIT)
// //
#ifndef ASYNC_LOGGER_H
#pragma once #define ASYNC_LOGGER_H
// Very fast asynchronous logger (millions of logs per second on an average desktop) // Very fast asynchronous logger (millions of logs per second on an average desktop)
// Uses pre allocated lockfree queue for maximum throughput even under large number of threads. // Uses pre allocated lockfree queue for maximum throughput even under large number of threads.
@ -70,3 +70,4 @@ private:
} // namespace spdlog } // namespace spdlog
#include "details/async_logger_impl.h" #include "details/async_logger_impl.h"
#endif

@ -2,8 +2,8 @@
// Copyright(c) 2015 Gabi Melman. // Copyright(c) 2015 Gabi Melman.
// Distributed under the MIT License (http://opensource.org/licenses/MIT) // Distributed under the MIT License (http://opensource.org/licenses/MIT)
// //
#ifndef COMMON_H
#pragma once #define COMMON_H
#define SPDLOG_VERSION "0.17.0" #define SPDLOG_VERSION "0.17.0"
@ -186,3 +186,4 @@ using filename_t = std::string;
_err_handler("Unknown exeption in logger"); \ _err_handler("Unknown exeption in logger"); \
} }
} // namespace spdlog } // namespace spdlog
#endif

@ -1,4 +1,5 @@
#pragma once #ifndef STEP_FILE_SINK_H
#define STEP_FILE_SINK_H
#include "../../details/file_helper.h" #include "../../details/file_helper.h"
#include "../../details/null_mutex.h" #include "../../details/null_mutex.h"
@ -214,3 +215,4 @@ using step_file_sink_st = step_file_sink<details::null_mutex>;
} // namespace sinks } // namespace sinks
} // namespace spdlog } // namespace spdlog
#endif

@ -10,7 +10,8 @@
// then the client call will block until there is more room. // then the client call will block until there is more room.
// //
#pragma once #ifndef ASYNC_LOG_HELPER_H
#define ASYNC_LOG_HELPER_H
#include "../common.h" #include "../common.h"
#include "../details/log_msg.h" #include "../details/log_msg.h"
@ -331,3 +332,4 @@ inline void spdlog::details::async_log_helper::flush_sinks()
} }
_last_flush = os::now(); _last_flush = os::now();
} }
#endif

@ -3,7 +3,8 @@
// Distributed under the MIT License (http://opensource.org/licenses/MIT) // Distributed under the MIT License (http://opensource.org/licenses/MIT)
// //
#pragma once #ifndef ASYNC_LOGGER_IMPL_H
#define ASYNC_LOGGER_IMPL_H
// Async Logger implementation // Async Logger implementation
// Use an async_sink (queue per logger) to perform the logging in a worker thread // Use an async_sink (queue per logger) to perform the logging in a worker thread
@ -93,3 +94,4 @@ inline void spdlog::async_logger::_sink_it(details::log_msg &msg)
throw; throw;
} }
} }
#endif

@ -3,7 +3,8 @@
// Distributed under the MIT License (http://opensource.org/licenses/MIT) // Distributed under the MIT License (http://opensource.org/licenses/MIT)
// //
#pragma once #ifndef FILE_HELPER_H
#define FILE_HELPER_H
// Helper class for file sink // Helper class for file sink
// When failing to open a file, retry several times(5) with small delay between the tries(10 ms) // When failing to open a file, retry several times(5) with small delay between the tries(10 ms)
@ -149,3 +150,4 @@ private:
}; };
} // namespace details } // namespace details
} // namespace spdlog } // namespace spdlog
#endif

@ -3,7 +3,8 @@
// Distributed under the MIT License (http://opensource.org/licenses/MIT) // Distributed under the MIT License (http://opensource.org/licenses/MIT)
// //
#pragma once #ifndef LOG_MSG_H
#define LOG_MSG_H
#include "../common.h" #include "../common.h"
#include "../details/os.h" #include "../details/os.h"
@ -46,3 +47,4 @@ struct log_msg
}; };
} // namespace details } // namespace details
} // namespace spdlog } // namespace spdlog
#endif

@ -3,7 +3,8 @@
// Distributed under the MIT License (http://opensource.org/licenses/MIT) // Distributed under the MIT License (http://opensource.org/licenses/MIT)
// //
#pragma once #ifndef LOGGER_IMPL_H
#define LOGGER_IMPL_H
#include "../logger.h" #include "../logger.h"
@ -346,3 +347,4 @@ inline const std::vector<spdlog::sink_ptr> &spdlog::logger::sinks() const
{ {
return _sinks; return _sinks;
} }
#endif

@ -1,5 +1,3 @@
#pragma once
// //
// Copyright(c) 2018 Gabi Melman. // Copyright(c) 2018 Gabi Melman.
// Distributed under the MIT License (http://opensource.org/licenses/MIT) // Distributed under the MIT License (http://opensource.org/licenses/MIT)
@ -11,6 +9,9 @@
// enqueue_nowait(..) - will return immediatly with false if no room left in the queue // enqueue_nowait(..) - will return immediatly with false if no room left in the queue
// dequeue_for(..) - will block until the queue is not empty or timeout passed // dequeue_for(..) - will block until the queue is not empty or timeout passed
#ifndef MPMC_BLOCKING_Q_H
#define MPMC_BLOCKING_Q_H
#include <condition_variable> #include <condition_variable>
#include <mutex> #include <mutex>
#include <queue> #include <queue>
@ -82,3 +83,4 @@ private:
}; };
} // namespace details } // namespace details
} // namespace spdlog } // namespace spdlog
#endif

@ -3,7 +3,8 @@
// Distributed under the MIT License (http://opensource.org/licenses/MIT) // Distributed under the MIT License (http://opensource.org/licenses/MIT)
// //
#pragma once #ifndef NULL_MUTEX_H
#define NULL_MUTEX_H
#include <atomic> #include <atomic>
// null, no cost dummy "mutex" and dummy "atomic" int // null, no cost dummy "mutex" and dummy "atomic" int
@ -43,3 +44,4 @@ struct null_atomic_int
} // namespace details } // namespace details
} // namespace spdlog } // namespace spdlog
#endif

@ -2,7 +2,9 @@
// Copyright(c) 2015 Gabi Melman. // Copyright(c) 2015 Gabi Melman.
// Distributed under the MIT License (http://opensource.org/licenses/MIT) // Distributed under the MIT License (http://opensource.org/licenses/MIT)
// //
#pragma once
#ifndef OS_H
#define OS_H
#include "../common.h" #include "../common.h"
@ -429,3 +431,4 @@ inline bool in_terminal(FILE *file)
} // namespace os } // namespace os
} // namespace details } // namespace details
} // namespace spdlog } // namespace spdlog
#endif

@ -3,7 +3,8 @@
// Distributed under the MIT License (http://opensource.org/licenses/MIT) // Distributed under the MIT License (http://opensource.org/licenses/MIT)
// //
#pragma once #ifndef PATTERN_FORMATTER_IMPL_H
#define PATTERN_FORMATTER_IMPL_H
#include "../details/log_msg.h" #include "../details/log_msg.h"
#include "../details/os.h" #include "../details/os.h"
@ -705,3 +706,4 @@ inline void spdlog::pattern_formatter::format(details::log_msg &msg)
// write eol // write eol
msg.formatted << _eol; msg.formatted << _eol;
} }
#endif

@ -3,7 +3,8 @@
// Distributed under the MIT License (http://opensource.org/licenses/MIT) // Distributed under the MIT License (http://opensource.org/licenses/MIT)
// //
#pragma once #ifndef REGISTRY_H
#define REGISTRY_H
// Loggers registy of unique name->logger pointer // Loggers registy of unique name->logger pointer
// An attempt to create a logger with an already existing name will be ignored // An attempt to create a logger with an already existing name will be ignored
@ -261,3 +262,4 @@ using registry = registry_t<std::mutex>;
} // namespace details } // namespace details
} // namespace spdlog } // namespace spdlog
#endif

@ -3,7 +3,8 @@
// Distributed under the MIT License (http://opensource.org/licenses/MIT) // Distributed under the MIT License (http://opensource.org/licenses/MIT)
// //
#pragma once #ifndef SPDLOG_IMPL_H
#define SPDLOG_IMPL_H
// //
// Global registry functions // Global registry functions
@ -276,3 +277,4 @@ inline void spdlog::drop_all()
{ {
details::registry::instance().drop_all(); details::registry::instance().drop_all();
} }
#endif

@ -3,7 +3,8 @@
// Distributed under the MIT License (http://opensource.org/licenses/MIT) // Distributed under the MIT License (http://opensource.org/licenses/MIT)
// //
#pragma once #ifndef FORMATTER_H
#define FORMATTER_H
#include "details/log_msg.h" #include "details/log_msg.h"
@ -44,3 +45,4 @@ private:
} // namespace spdlog } // namespace spdlog
#include "details/pattern_formatter_impl.h" #include "details/pattern_formatter_impl.h"
#endif

@ -3,7 +3,8 @@
// Distributed under the MIT License (http://opensource.org/licenses/MIT) // Distributed under the MIT License (http://opensource.org/licenses/MIT)
// //
#pragma once #ifndef LOGGER_H
#define LOGGER_H
// Thread safe logger (except for set_pattern(..), set_formatter(..) and set_error_handler()) // Thread safe logger (except for set_pattern(..), set_formatter(..) and set_error_handler())
// Has name, log level, vector of std::shared sink pointers and formatter // Has name, log level, vector of std::shared sink pointers and formatter
@ -150,3 +151,4 @@ protected:
} // namespace spdlog } // namespace spdlog
#include "details/logger_impl.h" #include "details/logger_impl.h"
#endif

@ -3,7 +3,8 @@
// Distributed under the MIT License (http://opensource.org/licenses/MIT) // Distributed under the MIT License (http://opensource.org/licenses/MIT)
// //
#pragma once #ifndef ANDROID_SINK_H
#define ANDROID_SINK_H
#if defined(__ANDROID__) #if defined(__ANDROID__)
@ -89,3 +90,4 @@ private:
} // namespace spdlog } // namespace spdlog
#endif #endif
#endif

@ -3,7 +3,8 @@
// Distributed under the MIT License (http://opensource.org/licenses/MIT) // Distributed under the MIT License (http://opensource.org/licenses/MIT)
// //
#pragma once #ifndef ANSICOLOR_SINK_H
#define ANSICOLOR_SINK_H
#include "../common.h" #include "../common.h"
#include "../details/os.h" #include "../details/os.h"
@ -148,3 +149,4 @@ using ansicolor_stderr_sink_st = ansicolor_stderr_sink<details::null_mutex>;
} // namespace sinks } // namespace sinks
} // namespace spdlog } // namespace spdlog
#endif

@ -3,7 +3,9 @@
// Distributed under the MIT License (http://opensource.org/licenses/MIT) // Distributed under the MIT License (http://opensource.org/licenses/MIT)
// //
#pragma once #ifndef BASE_SINK_H
#define BASE_SINK_H
// //
// base sink templated over a mutex (either dummy or real) // base sink templated over a mutex (either dummy or real)
// concrete implementation should only override the _sink_it method. // concrete implementation should only override the _sink_it method.
@ -47,3 +49,4 @@ protected:
}; };
} // namespace sinks } // namespace sinks
} // namespace spdlog } // namespace spdlog
#endif

@ -3,7 +3,8 @@
// Distributed under the MIT License (http://opensource.org/licenses/MIT) // Distributed under the MIT License (http://opensource.org/licenses/MIT)
// //
#pragma once #ifndef DIST_SINK_H
#define DIST_SINK_H
#include "../details/log_msg.h" #include "../details/log_msg.h"
#include "../details/null_mutex.h" #include "../details/null_mutex.h"
@ -75,3 +76,4 @@ using dist_sink_st = dist_sink<details::null_mutex>;
} // namespace sinks } // namespace sinks
} // namespace spdlog } // namespace spdlog
#endif

@ -3,7 +3,8 @@
// Distributed under the MIT License (http://opensource.org/licenses/MIT) // Distributed under the MIT License (http://opensource.org/licenses/MIT)
// //
#pragma once #ifndef FILE_SINKS_H
#define FILE_SINKS_H
#include "../details/file_helper.h" #include "../details/file_helper.h"
#include "../details/null_mutex.h" #include "../details/null_mutex.h"
@ -253,3 +254,4 @@ using daily_file_sink_st = daily_file_sink<details::null_mutex>;
} // namespace sinks } // namespace sinks
} // namespace spdlog } // namespace spdlog
#endif

@ -3,7 +3,8 @@
// Distributed under the MIT License (http://opensource.org/licenses/MIT) // Distributed under the MIT License (http://opensource.org/licenses/MIT)
// //
#pragma once #ifndef MSVC_SINK_H
#define MSVC_SINK_H
#if defined(_WIN32) #if defined(_WIN32)
@ -42,3 +43,4 @@ using msvc_sink_st = msvc_sink<details::null_mutex>;
} // namespace spdlog } // namespace spdlog
#endif #endif
#endif

@ -3,7 +3,8 @@
// Distributed under the MIT License (http://opensource.org/licenses/MIT) // Distributed under the MIT License (http://opensource.org/licenses/MIT)
// //
#pragma once #ifndef NULL_SINK_H
#define NULL_SINK_H
#include "../details/null_mutex.h" #include "../details/null_mutex.h"
#include "base_sink.h" #include "base_sink.h"
@ -27,3 +28,4 @@ using null_sink_st = null_sink<details::null_mutex>;
} // namespace sinks } // namespace sinks
} // namespace spdlog } // namespace spdlog
#endif

@ -3,7 +3,8 @@
// Distributed under the MIT License (http://opensource.org/licenses/MIT) // Distributed under the MIT License (http://opensource.org/licenses/MIT)
// //
#pragma once #ifndef OSTREAM_SINK_H
#define OSTREAM_SINK_H
#include "../details/null_mutex.h" #include "../details/null_mutex.h"
#include "base_sink.h" #include "base_sink.h"
@ -47,3 +48,4 @@ using ostream_sink_st = ostream_sink<details::null_mutex>;
} // namespace sinks } // namespace sinks
} // namespace spdlog } // namespace spdlog
#endif

@ -3,7 +3,8 @@
// Distributed under the MIT License (http://opensource.org/licenses/MIT) // Distributed under the MIT License (http://opensource.org/licenses/MIT)
// //
#pragma once #ifndef SINK_H
#define SINK_H
#include "../details/log_msg.h" #include "../details/log_msg.h"
@ -42,3 +43,4 @@ inline level::level_enum sink::level() const
} // namespace sinks } // namespace sinks
} // namespace spdlog } // namespace spdlog
#endif

@ -3,7 +3,8 @@
// Distributed under the MIT License (http://opensource.org/licenses/MIT) // Distributed under the MIT License (http://opensource.org/licenses/MIT)
// //
#pragma once #ifndef STDOUT_SINKS_H
#define STDOUT_SINKS_H
#include "../details/null_mutex.h" #include "../details/null_mutex.h"
#include "base_sink.h" #include "base_sink.h"
@ -77,3 +78,4 @@ using stderr_sink_st = stderr_sink<details::null_mutex>;
} // namespace sinks } // namespace sinks
} // namespace spdlog } // namespace spdlog
#endif

@ -3,7 +3,8 @@
// Distributed under the MIT License (http://opensource.org/licenses/MIT) // Distributed under the MIT License (http://opensource.org/licenses/MIT)
// //
#pragma once #ifndef SYSLOG_SINK_H
#define SYSLOG_SINK_H
#include "../common.h" #include "../common.h"
@ -74,3 +75,4 @@ private:
} // namespace spdlog } // namespace spdlog
#endif #endif
#endif

@ -3,7 +3,8 @@
// Distributed under the MIT License (http://opensource.org/licenses/MIT) // Distributed under the MIT License (http://opensource.org/licenses/MIT)
// //
#pragma once #ifndef WINCOLOR_SINK_H
#define WINCOLOR_SINK_H
#include "../common.h" #include "../common.h"
#include "../details/null_mutex.h" #include "../details/null_mutex.h"
@ -142,3 +143,4 @@ using wincolor_stderr_sink_st = wincolor_stderr_sink<details::null_mutex>;
} // namespace sinks } // namespace sinks
} // namespace spdlog } // namespace spdlog
#endif

@ -3,7 +3,8 @@
// Distributed under the MIT License (http://opensource.org/licenses/MIT) // Distributed under the MIT License (http://opensource.org/licenses/MIT)
// //
#pragma once #ifndef WINDEBUG_SINK_H
#define WINDEBUG_SINK_H
#if defined(_WIN32) #if defined(_WIN32)
@ -25,3 +26,4 @@ using windebug_sink_st = msvc_sink_st;
} // namespace spdlog } // namespace spdlog
#endif #endif
#endif

@ -5,7 +5,8 @@
// spdlog main header file. // spdlog main header file.
// see example.cpp for usage example // see example.cpp for usage example
#pragma once #ifndef SPDLOG_H
#define SPDLOG_H
#include "common.h" #include "common.h"
#include "logger.h" #include "logger.h"
@ -202,3 +203,4 @@ void drop_all();
} // namespace spdlog } // namespace spdlog
#include "details/spdlog_impl.h" #include "details/spdlog_impl.h"
#endif

@ -3,7 +3,8 @@
// Distributed under the MIT License (http://opensource.org/licenses/MIT) // Distributed under the MIT License (http://opensource.org/licenses/MIT)
// //
#pragma once #ifndef TWEAKME_H
#define TWEAKME_H
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// //
@ -141,3 +142,4 @@
// //
// #define SPDLOG_LEVEL_NAMES { "MY TRACE", "MY DEBUG", "MY INFO", "MY WARNING", "MY ERROR", "MY CRITICAL", "OFF" } // #define SPDLOG_LEVEL_NAMES { "MY TRACE", "MY DEBUG", "MY INFO", "MY WARNING", "MY ERROR", "MY CRITICAL", "OFF" }
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#endif

Loading…
Cancel
Save