Merge pull request #431 from romkatv/disallow_prefix
Protect macros from user code to the left of them
This commit is contained in:
commit
5c576f78c4
1
AUTHORS
1
AUTHORS
@ -18,6 +18,7 @@ Guillaume Dumont <dumont.guillaume@gmail.com>
|
|||||||
Michael Tanner <michael@tannertaxpro.com>
|
Michael Tanner <michael@tannertaxpro.com>
|
||||||
MiniLight <MiniLightAR@Gmail.com>
|
MiniLight <MiniLightAR@Gmail.com>
|
||||||
romange <romange@users.noreply.github.com>
|
romange <romange@users.noreply.github.com>
|
||||||
|
Roman Perepelitsa <roman.perepelitsa@gmail.com>
|
||||||
Sergiu Deitsch <sergiu.deitsch@gmail.com>
|
Sergiu Deitsch <sergiu.deitsch@gmail.com>
|
||||||
tbennun <tbennun@gmail.com>
|
tbennun <tbennun@gmail.com>
|
||||||
Teddy Reed <teddy@prosauce.org>
|
Teddy Reed <teddy@prosauce.org>
|
||||||
|
|||||||
@ -37,6 +37,7 @@ MiniLight <MiniLightAR@Gmail.com>
|
|||||||
Peter Collingbourne <pcc@google.com>
|
Peter Collingbourne <pcc@google.com>
|
||||||
Rodrigo Queiro <rodrigoq@google.com>
|
Rodrigo Queiro <rodrigoq@google.com>
|
||||||
romange <romange@users.noreply.github.com>
|
romange <romange@users.noreply.github.com>
|
||||||
|
Roman Perepelitsa <roman.perepelitsa@gmail.com>
|
||||||
Sergiu Deitsch <sergiu.deitsch@gmail.com>
|
Sergiu Deitsch <sergiu.deitsch@gmail.com>
|
||||||
Shinichiro Hamaji <hamaji@google.com>
|
Shinichiro Hamaji <hamaji@google.com>
|
||||||
tbennun <tbennun@gmail.com>
|
tbennun <tbennun@gmail.com>
|
||||||
|
|||||||
@ -568,8 +568,10 @@ class LogSink; // defined below
|
|||||||
LOG_TO_STRING_##severity(static_cast<std::vector<std::string>*>(outvec)).stream()
|
LOG_TO_STRING_##severity(static_cast<std::vector<std::string>*>(outvec)).stream()
|
||||||
|
|
||||||
#define LOG_IF(severity, condition) \
|
#define LOG_IF(severity, condition) \
|
||||||
|
static_cast<void>(0), \
|
||||||
!(condition) ? (void) 0 : @ac_google_namespace@::LogMessageVoidify() & LOG(severity)
|
!(condition) ? (void) 0 : @ac_google_namespace@::LogMessageVoidify() & LOG(severity)
|
||||||
#define SYSLOG_IF(severity, condition) \
|
#define SYSLOG_IF(severity, condition) \
|
||||||
|
static_cast<void>(0), \
|
||||||
!(condition) ? (void) 0 : @ac_google_namespace@::LogMessageVoidify() & SYSLOG(severity)
|
!(condition) ? (void) 0 : @ac_google_namespace@::LogMessageVoidify() & SYSLOG(severity)
|
||||||
|
|
||||||
#define LOG_ASSERT(condition) \
|
#define LOG_ASSERT(condition) \
|
||||||
@ -859,6 +861,7 @@ DECLARE_CHECK_STROP_IMPL(strcasecmp, false)
|
|||||||
&@ac_google_namespace@::LogMessage::SendToLog)
|
&@ac_google_namespace@::LogMessage::SendToLog)
|
||||||
|
|
||||||
#define PLOG_IF(severity, condition) \
|
#define PLOG_IF(severity, condition) \
|
||||||
|
static_cast<void>(0), \
|
||||||
!(condition) ? (void) 0 : @ac_google_namespace@::LogMessageVoidify() & PLOG(severity)
|
!(condition) ? (void) 0 : @ac_google_namespace@::LogMessageVoidify() & PLOG(severity)
|
||||||
|
|
||||||
// A CHECK() macro that postpends errno if the condition is false. E.g.
|
// A CHECK() macro that postpends errno if the condition is false. E.g.
|
||||||
@ -1004,22 +1007,28 @@ const LogSeverity GLOG_0 = GLOG_ERROR;
|
|||||||
#else // !DCHECK_IS_ON()
|
#else // !DCHECK_IS_ON()
|
||||||
|
|
||||||
#define DLOG(severity) \
|
#define DLOG(severity) \
|
||||||
|
static_cast<void>(0), \
|
||||||
true ? (void) 0 : @ac_google_namespace@::LogMessageVoidify() & LOG(severity)
|
true ? (void) 0 : @ac_google_namespace@::LogMessageVoidify() & LOG(severity)
|
||||||
|
|
||||||
#define DVLOG(verboselevel) \
|
#define DVLOG(verboselevel) \
|
||||||
(true || !VLOG_IS_ON(verboselevel)) ?\
|
static_cast<void>(0), \
|
||||||
|
(true || !VLOG_IS_ON(verboselevel)) ? \
|
||||||
(void) 0 : @ac_google_namespace@::LogMessageVoidify() & LOG(INFO)
|
(void) 0 : @ac_google_namespace@::LogMessageVoidify() & LOG(INFO)
|
||||||
|
|
||||||
#define DLOG_IF(severity, condition) \
|
#define DLOG_IF(severity, condition) \
|
||||||
|
static_cast<void>(0), \
|
||||||
(true || !(condition)) ? (void) 0 : @ac_google_namespace@::LogMessageVoidify() & LOG(severity)
|
(true || !(condition)) ? (void) 0 : @ac_google_namespace@::LogMessageVoidify() & LOG(severity)
|
||||||
|
|
||||||
#define DLOG_EVERY_N(severity, n) \
|
#define DLOG_EVERY_N(severity, n) \
|
||||||
|
static_cast<void>(0), \
|
||||||
true ? (void) 0 : @ac_google_namespace@::LogMessageVoidify() & LOG(severity)
|
true ? (void) 0 : @ac_google_namespace@::LogMessageVoidify() & LOG(severity)
|
||||||
|
|
||||||
#define DLOG_IF_EVERY_N(severity, condition, n) \
|
#define DLOG_IF_EVERY_N(severity, condition, n) \
|
||||||
|
static_cast<void>(0), \
|
||||||
(true || !(condition))? (void) 0 : @ac_google_namespace@::LogMessageVoidify() & LOG(severity)
|
(true || !(condition))? (void) 0 : @ac_google_namespace@::LogMessageVoidify() & LOG(severity)
|
||||||
|
|
||||||
#define DLOG_ASSERT(condition) \
|
#define DLOG_ASSERT(condition) \
|
||||||
|
static_cast<void>(0), \
|
||||||
true ? (void) 0 : LOG_ASSERT(condition)
|
true ? (void) 0 : LOG_ASSERT(condition)
|
||||||
|
|
||||||
// MSVC warning C4127: conditional expression is constant
|
// MSVC warning C4127: conditional expression is constant
|
||||||
|
|||||||
@ -572,8 +572,10 @@ class LogSink; // defined below
|
|||||||
LOG_TO_STRING_##severity(static_cast<std::vector<std::string>*>(outvec)).stream()
|
LOG_TO_STRING_##severity(static_cast<std::vector<std::string>*>(outvec)).stream()
|
||||||
|
|
||||||
#define LOG_IF(severity, condition) \
|
#define LOG_IF(severity, condition) \
|
||||||
|
static_cast<void>(0), \
|
||||||
!(condition) ? (void) 0 : google::LogMessageVoidify() & LOG(severity)
|
!(condition) ? (void) 0 : google::LogMessageVoidify() & LOG(severity)
|
||||||
#define SYSLOG_IF(severity, condition) \
|
#define SYSLOG_IF(severity, condition) \
|
||||||
|
static_cast<void>(0), \
|
||||||
!(condition) ? (void) 0 : google::LogMessageVoidify() & SYSLOG(severity)
|
!(condition) ? (void) 0 : google::LogMessageVoidify() & SYSLOG(severity)
|
||||||
|
|
||||||
#define LOG_ASSERT(condition) \
|
#define LOG_ASSERT(condition) \
|
||||||
@ -863,6 +865,7 @@ DECLARE_CHECK_STROP_IMPL(strcasecmp, false)
|
|||||||
&google::LogMessage::SendToLog)
|
&google::LogMessage::SendToLog)
|
||||||
|
|
||||||
#define PLOG_IF(severity, condition) \
|
#define PLOG_IF(severity, condition) \
|
||||||
|
static_cast<void>(0), \
|
||||||
!(condition) ? (void) 0 : google::LogMessageVoidify() & PLOG(severity)
|
!(condition) ? (void) 0 : google::LogMessageVoidify() & PLOG(severity)
|
||||||
|
|
||||||
// A CHECK() macro that postpends errno if the condition is false. E.g.
|
// A CHECK() macro that postpends errno if the condition is false. E.g.
|
||||||
@ -1007,22 +1010,28 @@ const LogSeverity GLOG_0 = GLOG_ERROR;
|
|||||||
#else // !DCHECK_IS_ON()
|
#else // !DCHECK_IS_ON()
|
||||||
|
|
||||||
#define DLOG(severity) \
|
#define DLOG(severity) \
|
||||||
|
static_cast<void>(0), \
|
||||||
true ? (void) 0 : google::LogMessageVoidify() & LOG(severity)
|
true ? (void) 0 : google::LogMessageVoidify() & LOG(severity)
|
||||||
|
|
||||||
#define DVLOG(verboselevel) \
|
#define DVLOG(verboselevel) \
|
||||||
(true || !VLOG_IS_ON(verboselevel)) ?\
|
static_cast<void>(0), \
|
||||||
|
(true || !VLOG_IS_ON(verboselevel)) ? \
|
||||||
(void) 0 : google::LogMessageVoidify() & LOG(INFO)
|
(void) 0 : google::LogMessageVoidify() & LOG(INFO)
|
||||||
|
|
||||||
#define DLOG_IF(severity, condition) \
|
#define DLOG_IF(severity, condition) \
|
||||||
|
static_cast<void>(0), \
|
||||||
(true || !(condition)) ? (void) 0 : google::LogMessageVoidify() & LOG(severity)
|
(true || !(condition)) ? (void) 0 : google::LogMessageVoidify() & LOG(severity)
|
||||||
|
|
||||||
#define DLOG_EVERY_N(severity, n) \
|
#define DLOG_EVERY_N(severity, n) \
|
||||||
|
static_cast<void>(0), \
|
||||||
true ? (void) 0 : google::LogMessageVoidify() & LOG(severity)
|
true ? (void) 0 : google::LogMessageVoidify() & LOG(severity)
|
||||||
|
|
||||||
#define DLOG_IF_EVERY_N(severity, condition, n) \
|
#define DLOG_IF_EVERY_N(severity, condition, n) \
|
||||||
|
static_cast<void>(0), \
|
||||||
(true || !(condition))? (void) 0 : google::LogMessageVoidify() & LOG(severity)
|
(true || !(condition))? (void) 0 : google::LogMessageVoidify() & LOG(severity)
|
||||||
|
|
||||||
#define DLOG_ASSERT(condition) \
|
#define DLOG_ASSERT(condition) \
|
||||||
|
static_cast<void>(0), \
|
||||||
true ? (void) 0 : LOG_ASSERT(condition)
|
true ? (void) 0 : LOG_ASSERT(condition)
|
||||||
|
|
||||||
// MSVC warning C4127: conditional expression is constant
|
// MSVC warning C4127: conditional expression is constant
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user