Commit 5d5f647f authored by Tobias Hunger's avatar Tobias Hunger

Fix preprocessor directives

 * The standard says all preprocessor directives have to start
   at column 0.
parent 726c3345
......@@ -195,13 +195,13 @@ QT_END_NAMESPACE
#ifdef MACROSDEBUG
Q_DECL_EXPORT char xDumpInBuffer[10000];
Q_DECL_EXPORT char xDumpOutBuffer[1000000];
#define inBuffer xDumpInBuffer
#define outBuffer xDumpOutBuffer
# define inBuffer xDumpInBuffer
# define outBuffer xDumpOutBuffer
#else
Q_DECL_EXPORT char qDumpInBuffer[10000];
Q_DECL_EXPORT char qDumpOutBuffer[1000000];
#define inBuffer qDumpInBuffer
#define outBuffer qDumpOutBuffer
# define inBuffer qDumpInBuffer
# define outBuffer qDumpOutBuffer
#endif
namespace {
......@@ -994,7 +994,7 @@ void qDumpInnerValueHelper(QDumper &d, const char *type, const void *addr,
}
break;
case 'O':
#ifndef QT_BOOTSTRAPPED
# ifndef QT_BOOTSTRAPPED
if (isEqual(type, "QObject *")) {
if (addr) {
const QObject *ob = reinterpret_cast<const QObject *>(addr);
......@@ -1010,7 +1010,7 @@ void qDumpInnerValueHelper(QDumper &d, const char *type, const void *addr,
d.putItem("numchild", 0);
}
}
#endif
# endif
break;
case 'S':
if (isEqual(type, "QString")) {
......@@ -1246,13 +1246,13 @@ static void qDumpQDateTime(QDumper &d)
d.putHash("isNull", date.isNull());
d.putHash("toTime_t", (long)date.toTime_t());
d.putHash("toString", date.toString());
#if QT_VERSION >= 0x040500
# if QT_VERSION >= 0x040500
d.putHash("toString_(ISO)", date.toString(Qt::ISODate));
d.putHash("toString_(SystemLocale)", date.toString(Qt::SystemLocaleDate));
d.putHash("toString_(Locale)", date.toString(Qt::LocaleDate));
#endif
# endif
#if 0
# if 0
d.beginHash();
d.putItem("name", "toUTC");
d.putItem("exp", "(("NSX"QDateTime"NSY"*)").put(d.data).put(")"
......@@ -1260,9 +1260,9 @@ static void qDumpQDateTime(QDumper &d)
d.putItem("type", NS"QDateTime");
d.putItem("numchild", "1");
d.endHash();
#endif
# endif
#if 0
# if 0
d.beginHash();
d.putItem("name", "toLocalTime");
d.putItem("exp", "(("NSX"QDateTime"NSY"*)").put(d.data).put(")"
......@@ -1270,7 +1270,7 @@ static void qDumpQDateTime(QDumper &d)
d.putItem("type", NS"QDateTime");
d.putItem("numchild", "1");
d.endHash();
#endif
# endif
d.endChildren();
}
......@@ -2079,13 +2079,13 @@ static void qDumpQVariantHelper(const QVariant *v, QString *value,
*value = QLatin1Char('"') + v->toString() + QLatin1Char('"');
*numchild = 0;
break;
#if QT_VERSION >= 0x040500
# if QT_VERSION >= 0x040500
case QVariant::StringList:
*exp = QString(QLatin1String("(*('"NS"QStringList'*)%1)"))
.arg((quintptr)v);
*numchild = v->toStringList().size();
break;
#endif
# endif
case QVariant::Int:
*value = QString::number(v->toInt());
*numchild= 0;
......@@ -2094,7 +2094,7 @@ static void qDumpQVariantHelper(const QVariant *v, QString *value,
*value = QString::number(v->toDouble());
*numchild = 0;
break;
#ifndef QT_BOOTSTRAPPED
# ifndef QT_BOOTSTRAPPED
case QVariant::Point: {
const QPoint p = v->toPoint();
*value = QString::fromLatin1("%1, %2").arg(p.x()).arg(p.y());
......@@ -2138,8 +2138,8 @@ static void qDumpQVariantHelper(const QVariant *v, QString *value,
}
*numchild = 0;
break;
#endif // QT_BOOTSTRAPPED
#if USE_QT_GUI
# endif // QT_BOOTSTRAPPED
# if USE_QT_GUI
case QVariant::Font:
*value = qvariant_cast<QFont>(*v).toString();
break;
......@@ -2147,16 +2147,16 @@ static void qDumpQVariantHelper(const QVariant *v, QString *value,
*value = qvariant_cast<QColor>(*v).name();
break;
case QVariant::KeySequence:
#ifndef QT_NO_SHORTCUT
# ifndef QT_NO_SHORTCUT
*value = qvariant_cast<QKeySequence>(*v).toString();
#else
# else
*value = QString::fromLatin1("Disabled by QT_NO_SHORTCUT");
#endif
# endif
break;
case QVariant::SizePolicy:
*value = sizePolicyValue(qvariant_cast<QSizePolicy>(*v));
break;
#endif
# endif
default: {
static const char *qTypeFormat = sizeof(void *) == sizeof(long)
? "'"NS"%s "NS"qVariantValue<"NS"%s >'(*('"NS"QVariant'*)0x%lx)"
......@@ -3476,12 +3476,12 @@ static void handleProtocolVersion2and3(QDumper &d)
qDumpStdMap(d);
break;
case 'A':
#ifndef QT_BOOTSTRAPPED
# ifndef QT_BOOTSTRAPPED
if (isEqual(type, "QAbstractItemModel"))
qDumpQAbstractItemModel(d);
else if (isEqual(type, "QAbstractItem"))
qDumpQAbstractItem(d);
#endif
# endif
break;
case 'B':
if (isEqual(type, "QByteArray"))
......@@ -3504,12 +3504,12 @@ static void handleProtocolVersion2and3(QDumper &d)
qDumpStdSet(d);
break;
case 'F':
#ifndef QT_BOOTSTRAPPED
# ifndef QT_BOOTSTRAPPED
if (isEqual(type, "QFile"))
qDumpQFile(d);
else if (isEqual(type, "QFileInfo"))
qDumpQFileInfo(d);
#endif
# endif
break;
case 'H':
if (isEqual(type, "QHash"))
......@@ -3522,25 +3522,25 @@ static void handleProtocolVersion2and3(QDumper &d)
qDumpStdList(d);
break;
case 'I':
#if USE_QT_GUI
# if USE_QT_GUI
if (isEqual(type, "QImage"))
qDumpQImage(d);
else if (isEqual(type, "QImageData"))
qDumpQImageData(d);
#endif
# endif
break;
case 'L':
#ifndef QT_BOOTSTRAPPED
# ifndef QT_BOOTSTRAPPED
if (isEqual(type, "QList"))
qDumpQList(d);
else if (isEqual(type, "QLinkedList"))
qDumpQLinkedList(d);
else if (isEqual(type, "QLocale"))
qDumpQLocale(d);
#endif
# endif
break;
case 'M':
#ifndef QT_BOOTSTRAPPED
# ifndef QT_BOOTSTRAPPED
if (isEqual(type, "QMap"))
qDumpQMap(d);
else if (isEqual(type, "QMapNode"))
......@@ -3549,10 +3549,10 @@ static void handleProtocolVersion2and3(QDumper &d)
qDumpQModelIndex(d);
else if (isEqual(type, "QMultiMap"))
qDumpQMultiMap(d);
#endif
# endif
break;
case 'O':
#ifndef QT_BOOTSTRAPPED
# ifndef QT_BOOTSTRAPPED
if (isEqual(type, "QObject"))
qDumpQObject(d);
else if (isEqual(type, "QObjectPropertyList"))
......@@ -3571,43 +3571,43 @@ static void handleProtocolVersion2and3(QDumper &d)
qDumpQObjectSlotList(d);
else if (isEqual(type, "QObjectChildList"))
qDumpQObjectChildList(d);
#endif
# endif
break;
case 'P':
#if USE_QT_GUI
# if USE_QT_GUI
if (isEqual(type, "QPixmap"))
qDumpQPixmap(d);
#endif
#ifndef QT_BOOTSTRAPPED
# endif
# ifndef QT_BOOTSTRAPPED
if (isEqual(type, "QPoint"))
qDumpQPoint(d);
else if (isEqual(type, "QPointF"))
qDumpQPointF(d);
#endif
# endif
break;
case 'R':
#ifndef QT_BOOTSTRAPPED
# ifndef QT_BOOTSTRAPPED
if (isEqual(type, "QRect"))
qDumpQRect(d);
else if (isEqual(type, "QRectF"))
qDumpQRectF(d);
#endif
# endif
break;
case 'S':
if (isEqual(type, "QString"))
qDumpQString(d);
else if (isEqual(type, "QStringList"))
qDumpQStringList(d);
#ifndef QT_BOOTSTRAPPED
# ifndef QT_BOOTSTRAPPED
else if (isEqual(type, "QSet"))
qDumpQSet(d);
else if (isEqual(type, "QStack"))
qDumpQVector(d);
#if QT_VERSION >= 0x040500
# if QT_VERSION >= 0x040500
else if (isEqual(type, "QSharedPointer"))
qDumpQSharedPointer(d);
#endif
#endif // QT_BOOTSTRAPPED
# endif
# endif // QT_BOOTSTRAPPED
else if (isEqual(type, "QSize"))
qDumpQSize(d);
else if (isEqual(type, "QSizeF"))
......@@ -3634,13 +3634,13 @@ static void handleProtocolVersion2and3(QDumper &d)
qDumpStdWString(d);
break;
case 'T':
#ifndef QT_BOOTSTRAPPED
# ifndef QT_BOOTSTRAPPED
if (isEqual(type, "QTextCodec"))
qDumpQTextCodec(d);
#endif
# endif
break;
case 'V':
#ifndef QT_BOOTSTRAPPED
# ifndef QT_BOOTSTRAPPED
if (isEqual(type, "QVariantList")) { // resolve typedef
d.outerType = "QList";
d.innerType = "QVariant";
......@@ -3651,15 +3651,15 @@ static void handleProtocolVersion2and3(QDumper &d)
} else if (isEqual(type, "QVector")) {
qDumpQVector(d);
}
#endif
# endif
break;
case 'W':
#ifndef QT_BOOTSTRAPPED
#if QT_VERSION >= 0x040500
# ifndef QT_BOOTSTRAPPED
# if QT_VERSION >= 0x040500
if (isEqual(type, "QWeakPointer"))
qDumpQWeakPointer(d);
#endif
#endif
# endif
# endif
break;
}
......@@ -3954,9 +3954,9 @@ void *qDumpObjectData440(
}
else {
#ifndef QT_BOOTSTRAPPED
# ifndef QT_BOOTSTRAPPED
qDebug() << "Unsupported protocol version" << protocolVersion;
#endif
# endif
}
return outBuffer;
}
......@@ -198,7 +198,7 @@ using namespace TextEditor;
const char *DebuggerManager::stateName(int s)
{
#define SN(x) case x: return #x;
# define SN(x) case x: return #x;
switch (s) {
SN(DebuggerNotReady)
SN(EngineStarting)
......@@ -221,7 +221,7 @@ const char *DebuggerManager::stateName(int s)
SN(EngineShuttingDown)
}
return "<unknown>";
#undef SN
# undef SN
}
......@@ -345,7 +345,7 @@ DebuggerManager::DebuggerManager(DebuggerPlugin *plugin)
DebuggerManager::~DebuggerManager()
{
#define doDelete(ptr) delete ptr; ptr = 0
# define doDelete(ptr) delete ptr; ptr = 0
doDelete(scriptEngine);
doDelete(pdbEngine);
doDelete(gdbEngine);
......@@ -364,7 +364,7 @@ DebuggerManager::~DebuggerManager()
doDelete(scriptEngine);
doDelete(cdbEngine);
doDelete(tcfEngine);
#undef doDelete
# undef doDelete
DebuggerManagerPrivate::instance = 0;
delete d;
}
......
......@@ -224,9 +224,9 @@ void GdbEngine::updateSubItemClassic(const WatchData &data0)
{
PRECONDITION;
WatchData data = data0;
#if DEBUG_SUBITEM
# if DEBUG_SUBITEM
qDebug() << "UPDATE SUBITEM:" << data.toString();
#endif
# endif
QTC_ASSERT(data.isValid(), return);
// in any case we need the type first
......@@ -235,16 +235,16 @@ void GdbEngine::updateSubItemClassic(const WatchData &data0)
// Let's play safe, though.
if (!data.variable.isEmpty()) {
// Update: It does so for out-of-scope watchers.
#if 1
# if 1
qDebug() << "FIXME: GdbEngine::updateSubItem:"
<< data.toString() << "should not happen";
#else
# else
data.setType(WatchData::msgNotInScope());
data.setValue(WatchData::msgNotInScope());
data.setHasChildren(false);
insertData(data);
return;
#endif
# endif
}
// The WatchVarCreate handler will receive type information
// and re-insert a WatchData item with correct type, so
......@@ -261,9 +261,9 @@ void GdbEngine::updateSubItemClassic(const WatchData &data0)
if (data.isChildrenNeeded() && isPointerType(data.type)
&& !hasDebuggingHelperForType(data.type)) {
// We sometimes know what kind of children pointers have
#if DEBUG_SUBITEM
# if DEBUG_SUBITEM
qDebug() << "IT'S A POINTER";
#endif
# endif
if (theDebuggerBoolSetting(AutoDerefPointers)) {
// Try automatic dereferentiation
......@@ -286,9 +286,9 @@ void GdbEngine::updateSubItemClassic(const WatchData &data0)
}
if (data.isValueNeeded() && hasDebuggingHelperForType(data.type)) {
#if DEBUG_SUBITEM
# if DEBUG_SUBITEM
qDebug() << "UPDATE SUBITEM: CUSTOMVALUE";
#endif
# endif
runDebuggingHelperClassic(data,
manager()->watchHandler()->isExpandedIName(data.iname));
return;
......@@ -296,9 +296,9 @@ void GdbEngine::updateSubItemClassic(const WatchData &data0)
/*
if (data.isValueNeeded() && data.exp.isEmpty()) {
#if DEBUG_SUBITEM
# if DEBUG_SUBITEM
qDebug() << "UPDATE SUBITEM: NO EXPRESSION?";
#endif
# endif
data.setError("<no expression given>");
insertData(data);
return;
......@@ -306,9 +306,9 @@ void GdbEngine::updateSubItemClassic(const WatchData &data0)
*/
if (data.isValueNeeded() && data.variable.isEmpty()) {
#if DEBUG_SUBITEM
# if DEBUG_SUBITEM
qDebug() << "UPDATE SUBITEM: VARIABLE NEEDED FOR VALUE";
#endif
# endif
createGdbVariableClassic(data);
// the WatchVarCreate handler will re-insert a WatchData
// item, with valueNeeded() set.
......@@ -317,9 +317,9 @@ void GdbEngine::updateSubItemClassic(const WatchData &data0)
if (data.isValueNeeded()) {
QTC_ASSERT(!data.variable.isEmpty(), return); // tested above
#if DEBUG_SUBITEM
# if DEBUG_SUBITEM
qDebug() << "UPDATE SUBITEM: VALUE";
#endif
# endif
QByteArray cmd = "-var-evaluate-expression \"" + data.iname + '"';
postCommand(cmd, WatchUpdate,
CB(handleEvaluateExpressionClassic), QVariant::fromValue(data));
......@@ -327,17 +327,17 @@ void GdbEngine::updateSubItemClassic(const WatchData &data0)
}
if (data.isChildrenNeeded() && hasDebuggingHelperForType(data.type)) {
#if DEBUG_SUBITEM
# if DEBUG_SUBITEM
qDebug() << "UPDATE SUBITEM: CUSTOMVALUE WITH CHILDREN";
#endif
# endif
runDebuggingHelperClassic(data, true);
return;
}
if (data.isChildrenNeeded() && data.variable.isEmpty()) {
#if DEBUG_SUBITEM
# if DEBUG_SUBITEM
qDebug() << "UPDATE SUBITEM: VARIABLE NEEDED FOR CHILDREN";
#endif
# endif
createGdbVariableClassic(data);
// the WatchVarCreate handler will re-insert a WatchData
// item, with childrenNeeded() set.
......@@ -353,9 +353,9 @@ void GdbEngine::updateSubItemClassic(const WatchData &data0)
}
if (data.isHasChildrenNeeded() && hasDebuggingHelperForType(data.type)) {
#if DEBUG_SUBITEM
# if DEBUG_SUBITEM
qDebug() << "UPDATE SUBITEM: CUSTOMVALUE WITH CHILDREN";
#endif
# endif
runDebuggingHelperClassic(data,
manager()->watchHandler()->isExpandedIName(data.iname));
return;
......@@ -363,9 +363,9 @@ void GdbEngine::updateSubItemClassic(const WatchData &data0)
//#if !X
if (data.isHasChildrenNeeded() && data.variable.isEmpty()) {
#if DEBUG_SUBITEM
# if DEBUG_SUBITEM
qDebug() << "UPDATE SUBITEM: VARIABLE NEEDED FOR CHILDCOUNT";
#endif
# endif
createGdbVariableClassic(data);
// the WatchVarCreate handler will re-insert a WatchData
// item, with childrenNeeded() set.
......
......@@ -657,13 +657,13 @@ void GdbEngine::readGdbStandardOutput()
scan = newstart;
if (end == start)
continue;
#if defined(Q_OS_WIN)
# if defined(Q_OS_WIN)
if (m_inbuffer.at(end - 1) == '\r') {
--end;
if (end == start)
continue;
}
#endif
# endif
m_busy = true;
handleResponse(QByteArray::fromRawData(m_inbuffer.constData() + start, end - start));
m_busy = false;
......@@ -1149,7 +1149,7 @@ void GdbEngine::handleAqcuiredInferior()
tryLoadDebuggingHelpers();
#ifndef Q_OS_MAC
# ifndef Q_OS_MAC
// intentionally after tryLoadDebuggingHelpers(),
// otherwise we'd interrupt solib loading.
if (theDebuggerBoolSetting(AllPluginBreakpoints)) {
......@@ -1166,7 +1166,7 @@ void GdbEngine::handleAqcuiredInferior()
postCommand("set auto-solib-add off");
postCommand("set stop-on-solib-events 0");
}
#endif
# endif
// It's nicer to see a bit of the world we live in.
reloadModulesInternal();
......@@ -2847,7 +2847,7 @@ void GdbEngine::handleStackListFrames(const GdbResponse &response)
stackFrames.append(parseStackFrame(stack.childAt(i), i));
const StackFrame &frame = stackFrames.back();
#if defined(Q_OS_WIN)
# if defined(Q_OS_WIN)
const bool isBogus =
// Assume this is wrong and points to some strange stl_algobase
// implementation. Happens on Karsten's XP system with Gdb 5.50
......@@ -2863,7 +2863,7 @@ void GdbEngine::handleStackListFrames(const GdbResponse &response)
showStatusMessage(tr("Jumping out of bogus frame..."), 1000);
return;
}
#endif
# endif
// Initialize top frame to the first valid frame.
const bool isValid = frame.isUsable() && !frame.function.isEmpty();
......@@ -3401,11 +3401,11 @@ void GdbEngine::updateWatchDataHelper(const WatchData &data)
{
//m_pendingRequests = 0;
PENDING_DEBUG("UPDATE WATCH DATA");
#if DEBUG_PENDING
# if DEBUG_PENDING
//qDebug() << "##############################################";
qDebug() << "UPDATE MODEL, FOUND INCOMPLETE:";
//qDebug() << data.toString();
#endif
# endif
updateSubItemClassic(data);
//PENDING_DEBUG("INTERNAL TRIGGERING UPDATE WATCH MODEL");
......
......@@ -1151,26 +1151,26 @@ void TrkGdbAdapter::handleTrkResult(const TrkResult &result)
logMessage(QLatin1String("Ignoring stop at 0"));
}
#if 1
# if 1
// We almost always need register values, so get them
// now before informing gdb about the stop.s
//qDebug() << "Auto-fetching registers";
sendTrkMessage(0x12,
TrkCB(handleAndReportReadRegistersAfterStop),
trkReadRegistersMessage());
#else
# else
// As a source-line step typically consists of
// several instruction steps, better avoid the multiple
// roundtrips through TRK in favour of an additional
// roundtrip through gdb. But gdb will ask for all registers.
#if 1
# if 1
sendGdbServerMessage("S05", "Target stopped");
#else
# else
QByteArray ba = "T05";
appendRegister(&ba, RegisterPSGdb, addr);
sendGdbServerMessage(ba, "Registers");
#endif
#endif
# endif
# endif
break;
}
case TrkNotifyException: { // 0x91 Notify Exception (obsolete)
......@@ -1522,14 +1522,14 @@ void TrkGdbAdapter::tryAnswerGdbMemoryRequest(bool buffered)
// Happens when chunks are not combined
QTC_ASSERT(false, /**/);
debugMessage("CHUNKS NOT COMBINED");
#ifdef MEMORY_DEBUG
# ifdef MEMORY_DEBUG
qDebug() << "CHUNKS NOT COMBINED";
it = m_snapshot.memory.begin();
et = m_snapshot.memory.end();
for ( ; it != et; ++it)
qDebug() << hexNumber(it.key().from) << hexNumber(it.key().to);
qDebug() << "WANTED" << wanted.from << wanted.to;
#endif
# endif
sendGdbServerMessage("E22", "");
return;
}
......
......@@ -172,9 +172,9 @@ void StackWindow::copyContentsToClipboard()
str += '\n';
}
QClipboard *clipboard = QApplication::clipboard();
#ifdef Q_WS_X11
# ifdef Q_WS_X11
clipboard->setText(str, QClipboard::Selection);
#endif
# endif
clipboard->setText(str, QClipboard::Clipboard);
}
......
......@@ -733,7 +733,7 @@ void FakeVimPluginPrivate::setActionChecked(const QString &code, bool check)
void FakeVimPluginPrivate::windowCommand(int key)
{
#define control(n) (256 + n)
# define control(n) (256 + n)
QString code;
switch (key) {
case 'c': case 'C': case control('c'):
......@@ -756,7 +756,7 @@ void FakeVimPluginPrivate::windowCommand(int key)
code = Core::Constants::GOTO_OTHER_SPLIT;
break;
}
#undef control
# undef control