diff options
| -rw-r--r-- | SConstruct | 24 | ||||
| -rw-r--r-- | massage_messages.py | 66 | ||||
| -rw-r--r-- | src/modinfo.h | 4 | ||||
| -rw-r--r-- | src/nexusinterface.cpp | 4 | ||||
| -rw-r--r-- | src/shared/stackdata.cpp | 2 |
5 files changed, 87 insertions, 13 deletions
@@ -260,7 +260,7 @@ def setup_IWYU(env): not dir.startswith(env['SEVENZIPPATH']): # Put the .iwyu in the same place as the .obj targ = os.path.splitext(str(target[i]))[0] - env.IWYU(targ + '.iwyu', s) + env.Depends(env.IWYU(targ + '.iwyu', s), target[i]) def shared_emitter(target, source, env): DoIWYU(env, source, target) @@ -274,12 +274,13 @@ def setup_IWYU(env): SCons.Defaults.StaticObjectEmitter = static_emitter def emitter(target, source, env): - env.Depends(target, '$IWYU_MAPPING_FILE') + env.Depends(target, ('$IWYU_MAPPING_FILE', '$IWYU_MASSAGE')) return target, source + # Note to self: command 2>&1 | other command appears to work as I would hope iwyu = SCons.Builder.Builder( action=[ - '-$IWYU $IWYU_FLAGS -Xiwyu --mapping_file=$IWYU_MAPPING_FILE $IWYU_COMCOM $SOURCE', + '-$IWYU $IWYU_FLAGS -Xiwyu --mapping_file=$IWYU_MAPPING_FILE $IWYU_COMCOM $SOURCE 2>&1 | $IWYU_MASSAGE', Touch('$TARGET') ], emitter=emitter, @@ -308,8 +309,14 @@ def setup_IWYU(env): '-fdiagnostics-format=msvc', '-fno-show-column', # clang says it sets this to 1700 but pretty sure vc12 is 1800 - '-fmsc-version=1800', - ] + #'-fmsc-version=1800', '-D_MSC_VER=1800', + '-fmsc-version=1700', + # clang and qt don't agree about these because clang says its gcc 4.2 and + # QT doesn't realise it's clang + '-DQ_COMPILER_INITIALIZER_LISTS', + '-DQ_COMPILER_DECLTYPE', + '-DQ_COMPILER_VARIADIC_TEMPLATES', +] if env['CONFIG'] == 'debug': env['IWYU_FLAGS'] += [ '-D_DEBUG' ] @@ -317,10 +324,14 @@ def setup_IWYU(env): env['IWYU_DEFSUFFIX'] = '' env['IWYU_INCPREFIX'] = '-I' env['IWYU_INCSUFFIX'] = '' - env['IWYU_COMCOM'] = '$IWYU_CPPDEFFLAGS $IWYU_CPPINCFLAGS $CCPDBFLAGS' + env['IWYU_INCLUDEPREFIX'] = '-include' # Amazingly this works without a space + env['IWYU_INCLUDESUFFIX'] = '' + env['IWYU_COMCOM'] = '$IWYU_CPPDEFFLAGS $IWYU_CPPINCFLAGS $IWYU_PCHFILES $CCPDBFLAGS' env['IWYU_CPPDEFFLAGS'] = '${_defines(IWYU_DEFPREFIX, CPPDEFINES, IWYU_DEFSUFFIX, __env__)}' env['IWYU_CPPINCFLAGS'] = '$( ${_concat(IWYU_INCPREFIX, CPPPATH, IWYU_INCSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)' + env['IWYU_PCHFILES'] = '$( ${_concat(IWYU_INCLUDEPREFIX, PCHSTOP, IWYU_INCLUDESUFFIX, __env__, target=TARGET, source=SOURCE)} $)' env['IWYU_MAPPING_FILE'] = env.File('#/qtmappings.imp') + env['IWYU_MASSAGE'] = env.File('#/massage_messages.py') # Create base environment @@ -442,6 +453,7 @@ else: # doesn't currently generate an output file (use the output instead!). if 'IWYU' in env: setup_IWYU(env) + # /OPT:REF removes unreferenced code # for release, use /OPT:ICF (comdat folding: coalesce identical blocks of code) diff --git a/massage_messages.py b/massage_messages.py index 656c48bd..c1b31c96 100644 --- a/massage_messages.py +++ b/massage_messages.py @@ -5,8 +5,70 @@ import fileinput import re +removing = None + +includes = dict + +foundline = 0 + for line in fileinput.input(): # Look for '\) : ([^:])?:' # Replace with ') : \1 I0000: - line.rstrip() - print re.sub(r'\)\s*:\s*([^:]*):', r') : \1 I0000:', line)
\ No newline at end of file + line = line.rstrip() + if removing: + if line == '': + removing = None + print + continue + else: + # Really we should stash these so that if we get a 'class xxx' in the + # add lines we can print it here. also we could do the case fixing. + m = re.match(r'- #include [<"](.*)[">] +// lines (.*)-', line) + if m: + # If there is an added line with the same class, print it here + print '%s(%s) : warning I0001: Unnecessary include of %s' % (removing, m.group(2), m.group(1)) + foundline = m.group(1) + else: + m = re.match(r'- (.*); +// lines (.*)-', line) + if m: + print '%s(%s) : warning I0002: Unnecessary forward ref of %s' % (removing, m.group(2), m.group(1)) + foundline = m.group(1) + else: + print '********* I got confused **********' + + line = re.sub(r'\)\s*:\s*([^:]*):', r') : \1 I1234:', line) + # Sadly qt doesn't seem to support 'info' in the issues tab. + line = re.sub(r': note I1234:', r': warning I1234:', line) + print line + if line.endswith(' should remove these lines:'): + removing = (line.split(' '))[0] + elif line.endswith(' should add these lines:'): + adding = (line.split(' '))[0] + +# also process the other lines +""" + +source/organizer/aboutdialog.h should add these lines: +#include <QObject> // for Q_OBJECT, slots +#include <QString> // for QString +class QListWidgetItem; +class QWidget; + +source/organizer/aboutdialog.h should remove these lines: +- #include <QListWidgetItem> // lines 25-25 +- #include <utility> // lines 28-28 +- #include <vector> // lines 27-27 +- class DownloadManager; // lines 47-47 + +The full include-list for source/organizer/aboutdialog.h: +#include <QDialog> // for QDialog +#include <QObject> // for Q_OBJECT, slots +#include <QString> // for QString +#include <map> // for map +class QListWidgetItem; +class QWidget; +namespace Ui { class AboutDialog; } // lines 31-31 +--- +""" + +# added lines should come after the first entry with a line number. diff --git a/src/modinfo.h b/src/modinfo.h index da97b09b..d9de60e8 100644 --- a/src/modinfo.h +++ b/src/modinfo.h @@ -1047,7 +1047,7 @@ public: virtual QString notes() const { return ""; }
virtual QDateTime creationTime() const { return QDateTime(); }
virtual QString absolutePath() const;
- virtual MOBase::VersionInfo getNewestVersion() const { return ""; }
+ virtual MOBase::VersionInfo getNewestVersion() const { return QString(); }
virtual QString getInstallationFile() const { return ""; }
virtual int getFixedPriority() const { return INT_MAX; }
virtual int getNexusID() const { return -1; }
@@ -1099,7 +1099,7 @@ public: virtual QString notes() const { return ""; }
virtual QDateTime creationTime() const;
virtual QString absolutePath() const;
- virtual MOBase::VersionInfo getNewestVersion() const { return ""; }
+ virtual MOBase::VersionInfo getNewestVersion() const { return QString(); }
virtual QString getInstallationFile() const { return ""; }
virtual int getNexusID() const { return -1; }
virtual std::vector<QString> getIniTweaks() const { return std::vector<QString>(); }
diff --git a/src/nexusinterface.cpp b/src/nexusinterface.cpp index dc027be4..b4775e2d 100644 --- a/src/nexusinterface.cpp +++ b/src/nexusinterface.cpp @@ -217,8 +217,8 @@ void NexusInterface::interpretNexusFileName(const QString &fileName, QString &mo QString r3Highlight(fileName);
r3Highlight.insert(result.position(3) + result.length(3), "* ").insert(result.position(3), " *");
- selection.addChoice(candidate.c_str(), r3Highlight, strtol(candidate.c_str(), nullptr, 10));
- selection.addChoice(candidate2.c_str() + offset, r2Highlight, abs(strtol(candidate2.c_str() + offset, nullptr, 10)));
+ selection.addChoice(candidate.c_str(), r3Highlight, static_cast<int>(strtol(candidate.c_str(), nullptr, 10)));
+ selection.addChoice(candidate2.c_str() + offset, r2Highlight, static_cast<int>(abs(strtol(candidate2.c_str() + offset, nullptr, 10))));
if (selection.exec() == QDialog::Accepted) {
modID = selection.getChoiceData().toInt();
} else {
diff --git a/src/shared/stackdata.cpp b/src/shared/stackdata.cpp index 6c5a0968..18daaf7b 100644 --- a/src/shared/stackdata.cpp +++ b/src/shared/stackdata.cpp @@ -24,7 +24,7 @@ static void initDbgIfNecess() firstCall = false;
}
if (!::SymInitialize(process, NULL, TRUE)) {
- printf("failed to initialize symbols: %d", ::GetLastError());
+ printf("failed to initialize symbols: %lu", ::GetLastError());
}
initialized.insert(::GetCurrentProcessId());
}
|
