Skip to content

Commit

Permalink
sync: from linuxdeepin/dtkcore
Browse files Browse the repository at this point in the history
Synchronize source files from linuxdeepin/dtkcore.

Source-pull-request: linuxdeepin/dtkcore#401
  • Loading branch information
deepin-ci-robot committed Jan 10, 2024
1 parent d10d292 commit 0caaef1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 41 deletions.
5 changes: 5 additions & 0 deletions cmake/DtkTools/DtkDBusMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ function(dtk_add_dbus_interface _sources _interface _relativename)
set(_params -m)
endif()

get_source_file_property(_skipincludeannotations ${_interface} SKIP_INCLUDE_ANNOTATIONS)
if(_skipincludeannotations)
set(_params ${_params} -S)
endif()

get_source_file_property(_classname ${_interface} CLASSNAME)
if(_classname)
set(_params ${_params} -c ${_classname})
Expand Down
38 changes: 0 additions & 38 deletions src/dtkcore_global.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,44 +10,6 @@
#error "DTK_VERSION or DTK_VERSION_STR not defined!"
#endif

void doubleLoadCheck()
{
// logic error
/*QFile f("/proc/self/maps");
if (!f.open(QIODevice::ReadOnly))
qFatal("%s", f.errorString().toLocal8Bit().data());
const QByteArray &data = f.readAll();
QTextStream ts(data);
QString modulePath;
while (Q_UNLIKELY(!ts.atEnd())) {
const QString line = ts.readLine();
const QStringList &maps = line.split(' ', QString::SplitBehavior::SkipEmptyParts);
if (Q_UNLIKELY(maps.size() < 6))
continue;
QFileInfo info(maps.value(5));
const QString &infoAbPath = info.absoluteFilePath();
if (modulePath == infoAbPath || !info.fileName().contains("dtkcore") || info.fileName().contains("dtkcore.so.2"))
continue;
if (modulePath.isEmpty()) {
modulePath = infoAbPath;
} else {
// modulePath != infoAbPath
QByteArray msg;
msg += modulePath + " and " + info.absoluteFilePath() + " both loaded";
qFatal("%s", msg.data());
}
}*/
}

// 在库被加载时就执行此函数
__attribute__((constructor)) void init()
{
doubleLoadCheck();
}

int dtkVersion()
{
return DTK_VERSION;

Check warning on line 15 in src/dtkcore_global.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Skipping configuration 'DTK_VERSION;DTK_VERSION_STR' since the value of 'DTK_VERSION' is unknown. Use -D if you want to check it. You can use -U to skip it explicitly.
Expand Down
13 changes: 10 additions & 3 deletions tools/qdbusxml2cpp/qdbusxml2cpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ static QString inputFile;
static bool skipNamespaces;
static bool verbose;
static bool includeMocs;
static bool skipIncludeAnnotations;
static QString commandLine;
static QStringList includes;
static QStringList wantedInterfaces;
Expand All @@ -56,6 +57,7 @@ static const char help[] =
" -N Don't use namespaces\n"
" -p <filename> Write the proxy code to <filename>\n"
" -v Be verbose.\n"
" -S Skip include annotation headers from \"types/\".\n"
" -V Show the program version and quit.\n"
"\n"
"If the file name given to the options -a and -p does not end in .cpp or .h, the\n"
Expand Down Expand Up @@ -158,6 +160,9 @@ static void parseCmdLine(QStringList args)
case 'N':
skipNamespaces = true;
break;
case 'S':
skipIncludeAnnotations = true;
break;

case '?':
case 'h':
Expand Down Expand Up @@ -625,9 +630,11 @@ static void writeProxy(const QString &filename, const QDBusIntrospection::Interf
}
}

for (const QString &annotation : annotations) {
if (annotation.indexOf('<') == -1) {
hs << "#include \"types/" << annotation.toLower() << ".h\"" << endl;
if (!skipIncludeAnnotations) {
for (const QString &annotation : annotations) {
if (annotation.indexOf('<') == -1) {
hs << "#include \"types/" << annotation.toLower() << ".h\"" << endl;
}
}
}
hs << endl;
Expand Down

0 comments on commit 0caaef1

Please sign in to comment.