Consider
void SomeClass:setDropSiteEnabled(bool enabled)
{
qCDebug(lcQpaMime) << __FUNCTION__ << window() << enabled;
if (enabled) {
causes
foo.cpp:984: warning: C4258: 'enabled' : definition from the for loop is ignored; the definition from the enclosing scope is used
since
#define qCDebug(category, ...) \
for (bool enabled = category().isDebugEnabled(); Q_UNLIKELY(enabled); enabled = false) \
QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO, category().categoryName()).debug(__VA_ARGS__)
| For Gerrit Dashboard: QTBUG-36605 | ||||||
|---|---|---|---|---|---|---|
| # | Subject | Branch | Project | Status | CR | V |
| 77247,6 | Logging: Don't use for loop in qCDebug macros | dev | qt/qtbase | Status: MERGED | +2 | 0 |
| 77459,2 | Revert "Logging: Don't use for loop in qCDebug macros" | dev | qt/qtbase | Status: MERGED | +2 | 0 |