renamed GOOGLE_GLOG_DLL_DECL to GLOG_EXPORT

Use a consistent naming and avoid platform specific terms. Also remove
copy and paste code.
This commit is contained in:
Sergiu Deitsch 2021-12-14 20:28:39 +01:00 committed by Sergiu Deitsch
parent aa94e6b9ab
commit 9f0b7d3bfe
15 changed files with 109 additions and 266 deletions

View File

@ -697,7 +697,7 @@ target_compile_definitions (glogbase PUBLIC
PRIVATE GOOGLE_GLOG_IS_A_DLL)
generate_export_header (glog
EXPORT_MACRO_NAME GOOGLE_GLOG_DLL_DECL
EXPORT_MACRO_NAME GLOG_EXPORT
EXPORT_FILE_NAME ${CMAKE_CURRENT_BINARY_DIR}/glog/export.h)
string (STRIP "${glog_libraries_options_for_static_linking}" glog_libraries_options_for_static_linking)

View File

@ -78,10 +78,13 @@ def glog_library(namespace = "google", with_gflags = 1, **kwargs):
]
linux_or_darwin_copts = wasm_copts + [
"-DGLOG_EXPORT=__attribute__((visibility(\\\"default\\\")))",
# For src/utilities.cc.
"-DHAVE_SYS_SYSCALL_H",
# For src/logging.cc to create symlinks.
"-DHAVE_UNISTD_H",
"-fvisibility-inlines-hidden",
"-fvisibility=hidden",
]
freebsd_only_copts = [
@ -97,6 +100,7 @@ def glog_library(namespace = "google", with_gflags = 1, **kwargs):
]
windows_only_copts = [
"-DGLOG_EXPORT=__declspec(dllexport)",
"-DGLOG_NO_ABBREVIATED_SEVERITIES",
"-DHAVE_SNPRINTF",
"-I" + src_windows,
@ -150,15 +154,16 @@ def glog_library(namespace = "google", with_gflags = 1, **kwargs):
],
strip_include_prefix = "src",
defines = select({
# GOOGLE_GLOG_DLL_DECL is normally set by export.h, but that's not
# GLOG_EXPORT is normally set by export.h, but that's not
# generated for Bazel.
"@bazel_tools//src/conditions:windows": [
"GOOGLE_GLOG_DLL_DECL=__declspec(dllexport)",
"GLOG_EXPORT=",
"GLOG_DEPRECATED=__declspec(deprecated)",
"GLOG_NO_ABBREVIATED_SEVERITIES",
],
"//conditions:default": [
"GLOG_DEPRECATED=__attribute__((deprecated))",
"GLOG_EXPORT=__attribute__((visibility(\\\"default\\\")))",
],
}),
copts =

View File

@ -61,16 +61,16 @@
#include <glog/logging.h>
#define DECLARE_VARIABLE(type, shorttype, name, tn) \
namespace fL##shorttype { \
extern GOOGLE_GLOG_DLL_DECL type FLAGS_##name; \
} \
#define DECLARE_VARIABLE(type, shorttype, name, tn) \
namespace fL##shorttype { \
extern GLOG_EXPORT type FLAGS_##name; \
} \
using fL##shorttype::FLAGS_##name
#define DEFINE_VARIABLE(type, shorttype, name, value, meaning, tn) \
namespace fL##shorttype { \
GOOGLE_GLOG_DLL_DECL type FLAGS_##name(value); \
char FLAGS_no##name; \
} \
#define DEFINE_VARIABLE(type, shorttype, name, value, meaning, tn) \
namespace fL##shorttype { \
GLOG_EXPORT type FLAGS_##name(value); \
char FLAGS_no##name; \
} \
using fL##shorttype::FLAGS_##name
// bool specialization
@ -95,17 +95,17 @@
// Special case for string, because we have to specify the namespace
// std::string, which doesn't play nicely with our FLAG__namespace hackery.
#define DECLARE_string(name) \
namespace fLS { \
extern GOOGLE_GLOG_DLL_DECL std::string& FLAGS_##name; \
} \
#define DECLARE_string(name) \
namespace fLS { \
extern GLOG_EXPORT std::string& FLAGS_##name; \
} \
using fLS::FLAGS_##name
#define DEFINE_string(name, value, meaning) \
namespace fLS { \
std::string FLAGS_##name##_buf(value); \
GOOGLE_GLOG_DLL_DECL std::string& FLAGS_##name = FLAGS_##name##_buf; \
char FLAGS_no##name; \
} \
#define DEFINE_string(name, value, meaning) \
namespace fLS { \
std::string FLAGS_##name##_buf(value); \
GLOG_EXPORT std::string& FLAGS_##name = FLAGS_##name##_buf; \
char FLAGS_no##name; \
} \
using fLS::FLAGS_##name
#endif // HAVE_LIB_GFLAGS

View File

@ -78,7 +78,7 @@ _START_GOOGLE_NAMESPACE_
// Demangle "mangled". On success, return true and write the
// demangled symbol name to "out". Otherwise, return false.
// "out" is modified even if demangling is unsuccessful.
bool GOOGLE_GLOG_DLL_DECL Demangle(const char *mangled, char *out, size_t out_size);
bool GLOG_EXPORT Demangle(const char *mangled, char *out, size_t out_size);
_END_GOOGLE_NAMESPACE_

View File

@ -43,16 +43,7 @@
// whenever an ERROR occurs in production.
// FATAL:
// Use for undesired and unexpected events that the program cannot recover
// from.
// Annoying stuff for windows -- makes sure clients can import these functions
#ifndef GOOGLE_GLOG_DLL_DECL
# if defined(_WIN32) && !defined(__CYGWIN__)
# define GOOGLE_GLOG_DLL_DECL __declspec(dllimport)
# else
# define GOOGLE_GLOG_DLL_DECL
# endif
#endif
// from.
// Variables of type LogSeverity are widely taken to lie in the range
// [0, NUM_SEVERITIES-1]. Be careful to preserve this assumption if
@ -76,7 +67,7 @@ const int INFO = GLOG_INFO, WARNING = GLOG_WARNING,
#define DFATAL_LEVEL FATAL
#endif
extern GOOGLE_GLOG_DLL_DECL const char* const LogSeverityNames[NUM_SEVERITIES];
extern GLOG_EXPORT const char* const LogSeverityNames[NUM_SEVERITIES];
// NDEBUG usage helpers related to (RAW_)DCHECK:
//

View File

@ -69,15 +69,6 @@
#include <glog/export.h>
#endif
// Annoying stuff for windows -- makes sure clients can import these functions
#ifndef GOOGLE_GLOG_DLL_DECL
# if defined(_WIN32) && !defined(__CYGWIN__)
# define GOOGLE_GLOG_DLL_DECL __declspec(dllimport)
# else
# define GOOGLE_GLOG_DLL_DECL
# endif
#endif
// We care a lot about number of bits things take up. Unfortunately,
// systems define their bit-specific ints in a lot of different ways.
// We use our own way, and have a typedef to get there.
@ -127,7 +118,7 @@ typedef unsigned __int64 uint64;
typedef double WallTime;
struct GOOGLE_GLOG_DLL_DECL LogMessageTime {
struct GLOG_EXPORT LogMessageTime {
LogMessageTime();
LogMessageTime(std::tm t);
LogMessageTime(std::time_t timestamp, WallTime now);
@ -407,7 +398,7 @@ typedef void(*CustomPrefixCallback)(std::ostream& s, const LogMessageInfo& l, vo
#ifndef DECLARE_VARIABLE
#define DECLARE_VARIABLE(type, shorttype, name, tn) \
namespace fL##shorttype { \
extern GOOGLE_GLOG_DLL_DECL type FLAGS_##name; \
extern GLOG_EXPORT type FLAGS_##name; \
} \
using fL##shorttype::FLAGS_##name
@ -429,7 +420,7 @@ typedef void(*CustomPrefixCallback)(std::ostream& s, const LogMessageInfo& l, vo
// std::string, which doesn't play nicely with our FLAG__namespace hackery.
#define DECLARE_string(name) \
namespace fLS { \
extern GOOGLE_GLOG_DLL_DECL std::string& FLAGS_##name; \
extern GLOG_EXPORT std::string& FLAGS_##name; \
} \
using fLS::FLAGS_##name
#endif
@ -621,19 +612,19 @@ DECLARE_bool(log_utc_time);
// Initialize google's logging library. You will see the program name
// specified by argv0 in log outputs.
GOOGLE_GLOG_DLL_DECL void InitGoogleLogging(const char* argv0);
GLOG_EXPORT void InitGoogleLogging(const char* argv0);
#ifdef GLOG_CUSTOM_PREFIX_SUPPORT
GOOGLE_GLOG_DLL_DECL void InitGoogleLogging(const char* argv0,
CustomPrefixCallback prefix_callback,
void* prefix_callback_data = NULL);
GLOG_EXPORT void InitGoogleLogging(const char* argv0,
CustomPrefixCallback prefix_callback,
void* prefix_callback_data = NULL);
#endif
// Check if google's logging library has been initialized.
GOOGLE_GLOG_DLL_DECL bool IsGoogleLoggingInitialized();
GLOG_EXPORT bool IsGoogleLoggingInitialized();
// Shutdown google's logging library.
GOOGLE_GLOG_DLL_DECL void ShutdownGoogleLogging();
GLOG_EXPORT void ShutdownGoogleLogging();
#if defined(__GNUC__)
typedef void (*logging_fail_func_t)() __attribute__((noreturn));
@ -642,12 +633,12 @@ typedef void (*logging_fail_func_t)();
#endif
// Install a function which will be called after LOG(FATAL).
GOOGLE_GLOG_DLL_DECL void InstallFailureFunction(logging_fail_func_t fail_func);
GLOG_EXPORT void InstallFailureFunction(logging_fail_func_t fail_func);
// Enable/Disable old log cleaner.
GOOGLE_GLOG_DLL_DECL void EnableLogCleaner(unsigned int overdue_days);
GOOGLE_GLOG_DLL_DECL void DisableLogCleaner();
GOOGLE_GLOG_DLL_DECL void SetApplicationFingerprint(const std::string& fingerprint);
GLOG_EXPORT void EnableLogCleaner(unsigned int overdue_days);
GLOG_EXPORT void DisableLogCleaner();
GLOG_EXPORT void SetApplicationFingerprint(const std::string& fingerprint);
class LogSink; // defined below
@ -771,17 +762,17 @@ inline void MakeCheckOpValueString(std::ostream* os, const T& v) {
// Overrides for char types provide readable values for unprintable
// characters.
template <> GOOGLE_GLOG_DLL_DECL
template <> GLOG_EXPORT
void MakeCheckOpValueString(std::ostream* os, const char& v);
template <> GOOGLE_GLOG_DLL_DECL
template <> GLOG_EXPORT
void MakeCheckOpValueString(std::ostream* os, const signed char& v);
template <> GOOGLE_GLOG_DLL_DECL
template <> GLOG_EXPORT
void MakeCheckOpValueString(std::ostream* os, const unsigned char& v);
// This is required because nullptr is only present in c++ 11 and later.
#if @ac_cv_cxx11_nullptr_t@ && __cplusplus >= 201103L
// Provide printable value for nullptr_t
template <> GOOGLE_GLOG_DLL_DECL
template <> GLOG_EXPORT
void MakeCheckOpValueString(std::ostream* os, const std::nullptr_t& v);
#endif
@ -806,7 +797,7 @@ LogSeverity NormalizeSeverity(LogSeverity s);
// base::BuildCheckOpString(exprtext, base::Print<T1>, &v1,
// base::Print<T2>, &v2), however this approach has complications
// related to volatile arguments and function-pointer arguments).
class GOOGLE_GLOG_DLL_DECL CheckOpMessageBuilder {
class GLOG_EXPORT CheckOpMessageBuilder {
public:
// Inserts "exprtext" and " (" to the stream.
explicit CheckOpMessageBuilder(const char *exprtext);
@ -939,7 +930,7 @@ typedef std::string _Check_string;
// Helper functions for string comparisons.
// To avoid bloat, the definitions are in logging.cc.
#define DECLARE_CHECK_STROP_IMPL(func, expected) \
GOOGLE_GLOG_DLL_DECL std::string* Check##func##expected##Impl( \
GLOG_EXPORT std::string* Check##func##expected##Impl( \
const char* s1, const char* s2, const char* names);
DECLARE_CHECK_STROP_IMPL(strcmp, true)
DECLARE_CHECK_STROP_IMPL(strcmp, false)
@ -1257,7 +1248,7 @@ struct CrashReason;
// Returns true if FailureSignalHandler is installed.
// Needs to be exported since it's used by the signalhandler_unittest.
GOOGLE_GLOG_DLL_DECL bool IsFailureSignalHandlerInstalled();
GLOG_EXPORT bool IsFailureSignalHandlerInstalled();
} // namespace glog_internal_namespace_
#define LOG_EVERY_N(severity, n) \
@ -1435,7 +1426,7 @@ namespace base_logging {
// LogMessage::LogStream is a std::ostream backed by this streambuf.
// This class ignores overflow and leaves two bytes at the end of the
// buffer to allow for a '\n' and '\0'.
class GOOGLE_GLOG_DLL_DECL LogStreamBuf : public std::streambuf {
class GLOG_EXPORT LogStreamBuf : public std::streambuf {
public:
// REQUIREMENTS: "len" must be >= 2 to account for the '\n' and '\0'.
LogStreamBuf(char *buf, int len) {
@ -1463,7 +1454,7 @@ class GOOGLE_GLOG_DLL_DECL LogStreamBuf : public std::streambuf {
// You shouldn't actually use LogMessage's constructor to log things,
// though. You should use the LOG() macro (and variants thereof)
// above.
class GOOGLE_GLOG_DLL_DECL LogMessage {
class GLOG_EXPORT LogMessage {
public:
enum {
// Passing kNoLogPrefix for the line number disables the
@ -1481,7 +1472,7 @@ public:
// http://msdn.microsoft.com/en-us/library/3tdb471s(VS.80).aspx
// Let's just ignore the warning.
GLOG_MSVC_PUSH_DISABLE_WARNING(4275)
class GOOGLE_GLOG_DLL_DECL LogStream : public std::ostream {
class GLOG_EXPORT LogStream : public std::ostream {
GLOG_MSVC_POP_WARNING()
public:
LogStream(char *buf, int len, int64 ctr)
@ -1618,7 +1609,7 @@ private:
// This class happens to be thread-hostile because all instances share
// a single data buffer, but since it can only be created just before
// the process dies, we don't worry so much.
class GOOGLE_GLOG_DLL_DECL LogMessageFatal : public LogMessage {
class GLOG_EXPORT LogMessageFatal : public LogMessage {
public:
LogMessageFatal(const char* file, int line);
LogMessageFatal(const char* file, int line, const CheckOpString& result);
@ -1679,12 +1670,12 @@ T* CheckNotNull(const char *file, int line, const char *names, T* t) {
// Allow folks to put a counter in the LOG_EVERY_X()'ed messages. This
// only works if ostream is a LogStream. If the ostream is not a
// LogStream you'll get an assert saying as much at runtime.
GOOGLE_GLOG_DLL_DECL std::ostream& operator<<(std::ostream &os,
GLOG_EXPORT std::ostream& operator<<(std::ostream &os,
const PRIVATE_Counter&);
// Derived class for PLOG*() above.
class GOOGLE_GLOG_DLL_DECL ErrnoLogMessage : public LogMessage {
class GLOG_EXPORT ErrnoLogMessage : public LogMessage {
public:
ErrnoLogMessage(const char* file, int line, LogSeverity severity, int64 ctr,
void (LogMessage::*send_method)());
@ -1702,7 +1693,7 @@ class GOOGLE_GLOG_DLL_DECL ErrnoLogMessage : public LogMessage {
// logging macros. This avoids compiler warnings like "value computed
// is not used" and "statement has no effect".
class GOOGLE_GLOG_DLL_DECL LogMessageVoidify {
class GLOG_EXPORT LogMessageVoidify {
public:
LogMessageVoidify() { }
// This has to be an operator with a precedence lower than << but
@ -1713,19 +1704,19 @@ class GOOGLE_GLOG_DLL_DECL LogMessageVoidify {
// Flushes all log files that contains messages that are at least of
// the specified severity level. Thread-safe.
GOOGLE_GLOG_DLL_DECL void FlushLogFiles(LogSeverity min_severity);
GLOG_EXPORT void FlushLogFiles(LogSeverity min_severity);
// Flushes all log files that contains messages that are at least of
// the specified severity level. Thread-hostile because it ignores
// locking -- used for catastrophic failures.
GOOGLE_GLOG_DLL_DECL void FlushLogFilesUnsafe(LogSeverity min_severity);
GLOG_EXPORT void FlushLogFilesUnsafe(LogSeverity min_severity);
//
// Set the destination to which a particular severity level of log
// messages is sent. If base_filename is "", it means "don't log this
// severity". Thread-safe.
//
GOOGLE_GLOG_DLL_DECL void SetLogDestination(LogSeverity severity,
GLOG_EXPORT void SetLogDestination(LogSeverity severity,
const char* base_filename);
//
@ -1734,7 +1725,7 @@ GOOGLE_GLOG_DLL_DECL void SetLogDestination(LogSeverity severity,
// you don't call this function, the symlink basename is the
// invocation name of the program. Thread-safe.
//
GOOGLE_GLOG_DLL_DECL void SetLogSymlink(LogSeverity severity,
GLOG_EXPORT void SetLogSymlink(LogSeverity severity,
const char* symlink_basename);
//
@ -1742,7 +1733,7 @@ GOOGLE_GLOG_DLL_DECL void SetLogSymlink(LogSeverity severity,
// Users should subclass LogSink and override send to do whatever they want.
// Implementations must be thread-safe because a shared instance will
// be called from whichever thread ran the LOG(XXX) line.
class GOOGLE_GLOG_DLL_DECL LogSink {
class GLOG_EXPORT LogSink {
public:
virtual ~LogSink();
@ -1782,8 +1773,8 @@ class GOOGLE_GLOG_DLL_DECL LogSink {
};
// Add or remove a LogSink as a consumer of logging data. Thread-safe.
GOOGLE_GLOG_DLL_DECL void AddLogSink(LogSink *destination);
GOOGLE_GLOG_DLL_DECL void RemoveLogSink(LogSink *destination);
GLOG_EXPORT void AddLogSink(LogSink *destination);
GLOG_EXPORT void RemoveLogSink(LogSink *destination);
//
// Specify an "extension" added to the filename specified via
@ -1791,7 +1782,7 @@ GOOGLE_GLOG_DLL_DECL void RemoveLogSink(LogSink *destination);
// often used to append the port we're listening on to the logfile
// name. Thread-safe.
//
GOOGLE_GLOG_DLL_DECL void SetLogFilenameExtension(
GLOG_EXPORT void SetLogFilenameExtension(
const char* filename_extension);
//
@ -1799,12 +1790,12 @@ GOOGLE_GLOG_DLL_DECL void SetLogFilenameExtension(
// are logged to stderr (in addition to logging to the usual log
// file(s)). Thread-safe.
//
GOOGLE_GLOG_DLL_DECL void SetStderrLogging(LogSeverity min_severity);
GLOG_EXPORT void SetStderrLogging(LogSeverity min_severity);
//
// Make it so that all log messages go only to stderr. Thread-safe.
//
GOOGLE_GLOG_DLL_DECL void LogToStderr();
GLOG_EXPORT void LogToStderr();
//
// Make it so that all log messages of at least a particular severity are
@ -1812,15 +1803,15 @@ GOOGLE_GLOG_DLL_DECL void LogToStderr();
// usual log file(s)). The list of addresses is just a string containing
// the email addresses to send to (separated by spaces, say). Thread-safe.
//
GOOGLE_GLOG_DLL_DECL void SetEmailLogging(LogSeverity min_severity,
GLOG_EXPORT void SetEmailLogging(LogSeverity min_severity,
const char* addresses);
// A simple function that sends email. dest is a commma-separated
// list of addressess. Thread-safe.
GOOGLE_GLOG_DLL_DECL bool SendEmail(const char *dest,
GLOG_EXPORT bool SendEmail(const char *dest,
const char *subject, const char *body);
GOOGLE_GLOG_DLL_DECL const std::vector<std::string>& GetLoggingDirectories();
GLOG_EXPORT const std::vector<std::string>& GetLoggingDirectories();
// For tests only: Clear the internal [cached] list of logging directories to
// force a refresh the next time GetLoggingDirectories is called.
@ -1830,13 +1821,13 @@ void TestOnly_ClearLoggingDirectoriesList();
// Returns a set of existing temporary directories, which will be a
// subset of the directories returned by GetLogginDirectories().
// Thread-safe.
GOOGLE_GLOG_DLL_DECL void GetExistingTempDirectories(
GLOG_EXPORT void GetExistingTempDirectories(
std::vector<std::string>* list);
// Print any fatal message again -- useful to call from signal handler
// so that the last thing in the output is the fatal message.
// Thread-hostile, but a race is unlikely.
GOOGLE_GLOG_DLL_DECL void ReprintFatalMessage();
GLOG_EXPORT void ReprintFatalMessage();
// Truncate a log file that may be the append-only output of multiple
// processes and hence can't simply be renamed/reopened (typically a
@ -1845,17 +1836,16 @@ GOOGLE_GLOG_DLL_DECL void ReprintFatalMessage();
// be racing with other writers, this approach has the potential to
// lose very small amounts of data. For security, only follow symlinks
// if the path is /proc/self/fd/*
GOOGLE_GLOG_DLL_DECL void TruncateLogFile(const char *path,
uint64 limit, uint64 keep);
GLOG_EXPORT void TruncateLogFile(const char* path, uint64 limit, uint64 keep);
// Truncate stdout and stderr if they are over the value specified by
// --max_log_size; keep the final 1MB. This function has the same
// race condition as TruncateLogFile.
GOOGLE_GLOG_DLL_DECL void TruncateStdoutStderr();
GLOG_EXPORT void TruncateStdoutStderr();
// Return the string representation of the provided LogSeverity level.
// Thread-safe.
GOOGLE_GLOG_DLL_DECL const char* GetLogSeverityName(LogSeverity severity);
GLOG_EXPORT const char* GetLogSeverityName(LogSeverity severity);
// ---------------------------------------------------------------------
// Implementation details that are not useful to most clients
@ -1870,7 +1860,7 @@ GOOGLE_GLOG_DLL_DECL const char* GetLogSeverityName(LogSeverity severity);
namespace base {
class GOOGLE_GLOG_DLL_DECL Logger {
class GLOG_EXPORT Logger {
public:
virtual ~Logger();
@ -1899,12 +1889,12 @@ class GOOGLE_GLOG_DLL_DECL Logger {
// Get the logger for the specified severity level. The logger
// remains the property of the logging module and should not be
// deleted by the caller. Thread-safe.
extern GOOGLE_GLOG_DLL_DECL Logger* GetLogger(LogSeverity level);
extern GLOG_EXPORT Logger* GetLogger(LogSeverity level);
// Set the logger for the specified severity level. The logger
// becomes the property of the logging module and should not
// be deleted by the caller. Thread-safe.
extern GOOGLE_GLOG_DLL_DECL void SetLogger(LogSeverity level, Logger* logger);
extern GLOG_EXPORT void SetLogger(LogSeverity level, Logger* logger);
}
@ -1919,14 +1909,14 @@ extern GOOGLE_GLOG_DLL_DECL void SetLogger(LogSeverity level, Logger* logger);
// cases, you do not need to check the error code and you can directly
// use the value of "buf". It will never have an undefined value.
// DEPRECATED: Use StrError(int) instead.
GOOGLE_GLOG_DLL_DECL int posix_strerror_r(int err, char *buf, size_t len);
GLOG_EXPORT int posix_strerror_r(int err, char *buf, size_t len);
// A thread-safe replacement for strerror(). Returns a string describing the
// given POSIX error code.
GOOGLE_GLOG_DLL_DECL std::string StrError(int err);
GLOG_EXPORT std::string StrError(int err);
// A class for which we define operator<<, which does nothing.
class GOOGLE_GLOG_DLL_DECL NullStream : public LogMessage::LogStream {
class GLOG_EXPORT NullStream : public LogMessage::LogStream {
public:
// Initialize the LogStream so the messages can be written somewhere
// (they'll never be actually displayed). This will be needed if a
@ -1955,7 +1945,7 @@ inline NullStream& operator<<(NullStream &str, const T &) { return str; }
// Similar to NullStream, but aborts the program (without stack
// trace), like LogMessageFatal.
class GOOGLE_GLOG_DLL_DECL NullStreamFatal : public NullStream {
class GLOG_EXPORT NullStreamFatal : public NullStream {
public:
NullStreamFatal() { }
NullStreamFatal(const char* file, int line, const CheckOpString& result) :
@ -1986,13 +1976,13 @@ class GOOGLE_GLOG_DLL_DECL NullStreamFatal : public NullStream {
// to use the failure signal handler for all threads. The stack trace
// will be shown only for the thread that receives the signal. In other
// words, stack traces of other threads won't be shown.
GOOGLE_GLOG_DLL_DECL void InstallFailureSignalHandler();
GLOG_EXPORT void InstallFailureSignalHandler();
// Installs a function that is used for writing the failure dump. "data"
// is the pointer to the beginning of a message to be written, and "size"
// is the size of the message. You should not expect the data is
// terminated with '\0'.
GOOGLE_GLOG_DLL_DECL void InstallFailureWriter(
GLOG_EXPORT void InstallFailureWriter(
void (*writer)(const char* data, size_t size));
@ac_google_end_namespace@

View File

@ -44,15 +44,6 @@
#include <glog/logging.h>
#include <glog/vlog_is_on.h>
// Annoying stuff for windows -- makes sure clients can import these functions
#ifndef GOOGLE_GLOG_DLL_DECL
# if defined(_WIN32) && !defined(__CYGWIN__)
# define GOOGLE_GLOG_DLL_DECL __declspec(dllimport)
# else
# define GOOGLE_GLOG_DLL_DECL
# endif
#endif
#if defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wvariadic-macros"
@ -179,11 +170,9 @@ static inline void RawLogStub__(int /* ignored */, ...) {
// Logs format... at "severity" level, reporting it
// as called from file:line.
// This does not allocate memory or acquire locks.
GOOGLE_GLOG_DLL_DECL void RawLog__(LogSeverity severity,
const char* file,
int line,
const char* format, ...)
@ac_cv___attribute___printf_4_5@;
GLOG_EXPORT void RawLog__(LogSeverity severity, const char* file, int line,
const char* format, ...)
@ac_cv___attribute___printf_4_5@;
@ac_google_end_namespace@

View File

@ -63,15 +63,6 @@
#include <glog/log_severity.h>
// Annoying stuff for windows -- makes sure clients can import these functions
#ifndef GOOGLE_GLOG_DLL_DECL
# if defined(_WIN32) && !defined(__CYGWIN__)
# define GOOGLE_GLOG_DLL_DECL __declspec(dllimport)
# else
# define GOOGLE_GLOG_DLL_DECL
# endif
#endif
#if defined(__GNUC__)
// We emit an anonymous static int* variable at every VLOG_IS_ON(n) site.
// (Normally) the first time every VLOG_IS_ON(n) site is hit,
@ -100,8 +91,7 @@
// one needs to supply the exact --vmodule pattern that applied to them.
// (If no --vmodule pattern applied to them
// the value of FLAGS_v will continue to control them.)
extern GOOGLE_GLOG_DLL_DECL int SetVLOGLevel(const char* module_pattern,
int log_level);
extern GLOG_EXPORT int SetVLOGLevel(const char* module_pattern, int log_level);
// Various declarations needed for VLOG_IS_ON above: =========================
@ -120,10 +110,9 @@ struct SiteFlag {
// verbose_level is the argument to VLOG_IS_ON
// We will return the return value for VLOG_IS_ON
// and if possible set *site_flag appropriately.
extern GOOGLE_GLOG_DLL_DECL bool InitVLOG3__(
extern GLOG_EXPORT bool InitVLOG3__(
@ac_google_namespace@::SiteFlag* site_flag,
@ac_google_namespace@::int32* site_default,
const char* fname,
@ac_google_namespace@::int32* site_default, const char* fname,
@ac_google_namespace@::int32 verbose_level);
#endif // BASE_VLOG_IS_ON_H_

View File

@ -68,12 +68,12 @@ using std::vector;
_START_GOOGLE_NAMESPACE_
extern GOOGLE_GLOG_DLL_DECL void (*g_logging_fail_func)();
extern GLOG_EXPORT void (*g_logging_fail_func)();
_END_GOOGLE_NAMESPACE_
#undef GOOGLE_GLOG_DLL_DECL
#define GOOGLE_GLOG_DLL_DECL
#undef GLOG_EXPORT
#define GLOG_EXPORT
static inline string GetTempDir() {
#ifndef GLOG_OS_WINDOWS

View File

@ -1906,7 +1906,8 @@ void LogMessage::RecordCrashReason(
#endif
}
GOOGLE_GLOG_DLL_DECL logging_fail_func_t g_logging_fail_func = reinterpret_cast<logging_fail_func_t>(&abort);
GLOG_EXPORT logging_fail_func_t g_logging_fail_func =
reinterpret_cast<logging_fail_func_t>(&abort);
void InstallFailureFunction(logging_fail_func_t fail_func) {
g_logging_fail_func = fail_func;

View File

@ -54,7 +54,7 @@ _START_GOOGLE_NAMESPACE_
// .... ...
//
// "result" must not be NULL.
GOOGLE_GLOG_DLL_DECL int GetStackTrace(void** result, int max_depth, int skip_count);
GLOG_EXPORT int GetStackTrace(void** result, int max_depth, int skip_count);
_END_GOOGLE_NAMESPACE_

View File

@ -121,7 +121,7 @@ typedef int (*SymbolizeCallback)(int fd,
char* out,
size_t out_size,
uint64_t relocation);
GOOGLE_GLOG_DLL_DECL
GLOG_EXPORT
void InstallSymbolizeCallback(SymbolizeCallback callback);
// Installs a callback function, which will be called instead of
@ -152,7 +152,7 @@ _START_GOOGLE_NAMESPACE_
// symbol name to "out". The symbol name is demangled if possible
// (supports symbols generated by GCC 3.x or newer). Otherwise,
// returns false.
GOOGLE_GLOG_DLL_DECL bool Symbolize(void *pc, char *out, size_t out_size);
GLOG_EXPORT bool Symbolize(void* pc, char* out, size_t out_size);
_END_GOOGLE_NAMESPACE_

View File

@ -63,19 +63,15 @@ _START_GOOGLE_NAMESPACE_
namespace glog_internal_namespace_ {
// Used by logging_unittests.cc so can't make it static here.
GOOGLE_GLOG_DLL_DECL bool SafeFNMatch_(const char* pattern,
size_t patt_len,
const char* str,
size_t str_len);
GLOG_EXPORT bool SafeFNMatch_(const char* pattern, size_t patt_len,
const char* str, size_t str_len);
// Implementation of fnmatch that does not need 0-termination
// of arguments and does not allocate any memory,
// but we only support "*" and "?" wildcards, not the "[...]" patterns.
// It's not a static function for the unittest.
GOOGLE_GLOG_DLL_DECL bool SafeFNMatch_(const char* pattern,
size_t patt_len,
const char* str,
size_t str_len) {
GLOG_EXPORT bool SafeFNMatch_(const char* pattern, size_t patt_len,
const char* str, size_t str_len) {
size_t p = 0;
size_t s = 0;
while (1) {

View File

@ -122,11 +122,11 @@ enum { STDIN_FILENO = 0, STDOUT_FILENO = 1, STDERR_FILENO = 2 };
* name vsnprintf, since windows defines that (but not snprintf (!)).
*/
#ifndef HAVE_SNPRINTF
extern int GOOGLE_GLOG_DLL_DECL snprintf(char *str, size_t size,
const char *format, ...);
extern int GLOG_EXPORT snprintf(char* str, size_t size, const char* format,
...);
#endif
extern int GOOGLE_GLOG_DLL_DECL safe_vsnprintf(char *str, size_t size,
const char *format, va_list ap);
extern int GLOG_EXPORT safe_vsnprintf(char* str, size_t size,
const char* format, va_list ap);
#define vsnprintf(str, size, format, ap) safe_vsnprintf(str, size, format, ap)
#ifndef va_copy
#define va_copy(dst, src) (dst) = (src)
@ -158,11 +158,12 @@ enum { PTHREAD_ONCE_INIT = 0 }; // important that this be 0! for SpinLock
#endif // HAVE_PTHREAD
#ifndef HAVE_LOCALTIME_R
extern GOOGLE_GLOG_DLL_DECL struct tm* localtime_r(const time_t* timep, struct tm* result);
extern GLOG_EXPORT struct tm* localtime_r(const time_t* timep,
struct tm* result);
#endif // not HAVE_LOCALTIME_R
#ifndef HAVE_GMTIME_R
extern GOOGLE_GLOG_DLL_DECL struct tm* gmtime_r(const time_t* timep, struct tm* result);
extern GLOG_EXPORT struct tm* gmtime_r(const time_t* timep, struct tm* result);
#endif // not HAVE_GMTIME_R
inline char* strerror_r(int errnum, char* buf, size_t buflen) {

View File

@ -1,119 +0,0 @@
#!/bin/sh
# Copyright (c) 2008, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# * Neither the name of Google Inc. nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# ---
# Author: Craig Silverstein
# Copied from google-perftools and modified by Shinichiro Hamaji
#
# This script is meant to be run at distribution-generation time, for
# instance by autogen.sh. It does some of the work configure would
# normally do, for windows systems. In particular, it expands all the
# @...@ variables found in .in files, and puts them here, in the windows
# directory.
#
# This script should be run before any new release.
if [ -z "$1" ]; then
echo "USAGE: $0 <src/ directory>"
exit 1
fi
DLLDEF_MACRO_NAME="GLOG_DLL_DECL"
# The text we put in every .h files we create. As a courtesy, we'll
# include a helpful comment for windows users as to how to use
# GLOG_DLL_DECL. Apparently sed expands \n into a newline. Good!
DLLDEF_DEFINES="\
// NOTE: if you are statically linking the template library into your binary\n\
// (rather than using the template .dll), set '/D $DLLDEF_MACRO_NAME='\n\
// as a compiler flag in your project file to turn off the dllimports.\n\
#ifndef $DLLDEF_MACRO_NAME\n\
# define $DLLDEF_MACRO_NAME __declspec(dllimport)\n\
#endif"
# Read all the windows config info into variables
# In order for the 'set' to take, this requires putting all in a subshell.
(
while read define varname value; do
[ "$define" != "#define" ] && continue
eval "$varname='$value'"
done
# Process all the .in files in the "glog" subdirectory
mkdir -p "$1/windows/glog"
for file in `echo "$1"/glog/*.in`; do
echo "Processing $file"
outfile="$1/windows/glog/`basename $file .in`"
echo "\
// This file is automatically generated from $file
// using src/windows/preprocess.sh.
// DO NOT EDIT!
" > "$outfile"
# Besides replacing @...@, we also need to turn on dllimport
# We also need to replace hash by hash_compare (annoying we hard-code :-( )
sed -e "s!@ac_windows_dllexport@!$DLLDEF_MACRO_NAME!g" \
-e "s!@ac_windows_dllexport_defines@!$DLLDEF_DEFINES!g" \
-e "s!@ac_cv_cxx_hash_map@!$HASH_MAP_H!g" \
-e "s!@ac_cv_cxx_hash_namespace@!$HASH_NAMESPACE!g" \
-e "s!@ac_cv_cxx_hash_set@!$HASH_SET_H!g" \
-e "s!@ac_cv_have_stdint_h@!0!g" \
-e "s!@ac_cv_have_systypes_h@!0!g" \
-e "s!@ac_cv_have_inttypes_h@!0!g" \
-e "s!@ac_cv_have_unistd_h@!0!g" \
-e "s!@ac_cv_have_uint16_t@!0!g" \
-e "s!@ac_cv_have_u_int16_t@!0!g" \
-e "s!@ac_cv_have___uint16@!1!g" \
-e "s!@ac_cv_have_libgflags@!0!g" \
-e "s!@ac_cv_have___builtin_expect@!0!g" \
-e "s!@ac_cv_cxx_using_operator@!1!g" \
-e "s!@ac_cv___attribute___noreturn@!__declspec(noreturn)!g" \
-e "s!@ac_cv___attribute___noinline@!!g" \
-e "s!@ac_cv___attribute___printf_4_5@!!g" \
-e "s!@ac_google_attribute@!${HAVE___ATTRIBUTE__:-0}!g" \
-e "s!@ac_google_end_namespace@!$_END_GOOGLE_NAMESPACE_!g" \
-e "s!@ac_google_namespace@!$GOOGLE_NAMESPACE!g" \
-e "s!@ac_google_start_namespace@!$_START_GOOGLE_NAMESPACE_!g" \
-e "s!@ac_htmlparser_namespace@!$HTMLPARSER_NAMESPACE!g" \
-e "s!\\bhash\\b!hash_compare!g" \
"$file" >> "$outfile"
done
) < "$1/windows/config.h"
# log_severity.h isn't a .in file.
echo "\
// This file is automatically generated from $1/glog/log_severity.h
// using src/windows/preprocess.sh.
// DO NOT EDIT!
" > "$1/windows/glog/log_severity.h"
cat "$1/glog/log_severity.h" >> "$1/windows/glog/log_severity.h"
echo "DONE"