Skip to content

Commit 1e4d816

Browse files
Merge pull request #410 from treefrogframework/actions_yml5
Fix compilarion error in debug build
2 parents def5dc7 + a91fa80 commit 1e4d816

22 files changed

+97
-65
lines changed

.github/workflows/actions.yml

Lines changed: 53 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,18 @@ jobs:
2020
sudo rm -f /usr/bin/qmake
2121
sudo ln -sf /usr/bin/qmake6 /usr/bin/qmake
2222
qmake -v
23+
- name: configure for debug
24+
run: |
25+
./configure --prefix=/usr/local --spec=linux-g++ --enable-debug
26+
- name: make for debug
27+
run: |
28+
make -j4 -C src
29+
sudo make -C src install
30+
make -j4 -C tools
31+
sudo make -C tools install
2332
- name: configure
24-
run: ./configure --prefix=/usr/local --spec=linux-g++
33+
run: |
34+
./configure --prefix=/usr/local --spec=linux-g++
2535
- name: make
2636
run: |
2737
make -j4 -C src
@@ -63,8 +73,18 @@ jobs:
6373
sudo rm -f /usr/bin/qmake
6474
sudo ln -sf /usr/bin/qmake6 /usr/bin/qmake
6575
qmake -v
76+
- name: configure for debug
77+
run: |
78+
./configure --prefix=/usr/local --enable-shared-mongoc --enable-shared-lz4 --spec=linux-clang --enable-debug
79+
- name: make for debug
80+
run: |
81+
make -j4 -C src
82+
sudo make -C src install
83+
make -j4 -C tools
84+
sudo make -C tools install
6685
- name: configure
67-
run: ./configure --prefix=/usr/local --enable-shared-mongoc --enable-shared-lz4 --spec=linux-clang
86+
run: |
87+
./configure --prefix=/usr/local --enable-shared-mongoc --enable-shared-lz4 --spec=linux-clang
6888
- name: make
6989
run: |
7090
make -j4 -C src
@@ -106,6 +126,15 @@ jobs:
106126
sudo rm -f /usr/bin/qmake
107127
sudo ln -sf /usr/bin/qmake6 /usr/bin/qmake
108128
qmake -v
129+
- name: configure for debug
130+
run: |
131+
./configure --prefix=/usr/local --spec=linux-g++ --enable-debug
132+
- name: make for debug
133+
run: |
134+
make -j4 -C src
135+
sudo make -C src install
136+
make -j4 -C tools
137+
sudo make -C tools install
109138
- name: configure
110139
run: |
111140
./configure --prefix=/usr/local --spec=linux-g++
@@ -145,8 +174,18 @@ jobs:
145174
run: |
146175
which pkg-config || brew install pkg-config
147176
brew install qt6 jq
177+
- name: configure for debug
178+
run: |
179+
./configure --prefix=/usr/local --enable-debug
180+
- name: build for debug
181+
run: |
182+
make -j4 -C src
183+
sudo make -C src install
184+
make -j4 -C tools
185+
sudo make -C tools install
148186
- name: configure
149-
run: ./configure --prefix=/usr/local
187+
run: |
188+
./configure --prefix=/usr/local
150189
- name: build
151190
run: |
152191
make -j4 -C src
@@ -166,8 +205,18 @@ jobs:
166205
run: |
167206
which pkg-config || brew install pkg-config
168207
brew install qt6 jq mongo-c-driver gflags glog lz4
208+
- name: configure for debug
209+
run: |
210+
./configure --prefix=/usr/local --enable-shared-mongoc --enable-shared-glog --enable-shared-lz4 --enable-debug
211+
- name: build for debug
212+
run: |
213+
make -j4 -C src
214+
sudo make -C src install
215+
make -j4 -C tools
216+
sudo make -C tools install
169217
- name: configure
170-
run: ./configure --prefix=/usr/local --enable-shared-mongoc --enable-shared-glog --enable-shared-lz4
218+
run: |
219+
./configure --prefix=/usr/local --enable-shared-mongoc --enable-shared-glog --enable-shared-lz4
171220
- name: build
172221
run: |
173222
make -j4 -C src

src/tabstractwebsocket.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ bool TAbstractWebSocket::searchEndpoint(const THttpRequestHeader &header)
167167

168168
int TAbstractWebSocket::parse(QByteArray &recvData)
169169
{
170-
tSystemDebug("parse enter data len:{} sid:{}", (int64_t)recvData.length(), socketDescriptor());
170+
tSystemDebug("parse enter data len:{} sid:{}", (qint64)recvData.length(), socketDescriptor());
171171
if (websocketFrames().isEmpty()) {
172172
websocketFrames().append(TWebSocketFrame());
173173
} else {
@@ -259,7 +259,7 @@ int TAbstractWebSocket::parse(QByteArray &recvData)
259259
}
260260

261261
tSystemDebug("WebSocket parse header pos: {}", devhdr->pos());
262-
tSystemDebug("WebSocket payload length:{}", pfrm->payloadLength());
262+
tSystemDebug("WebSocket payload length:{}", (quint64)pfrm->payloadLength());
263263

264264
int hdrlen = hdr.length() - devhdr->bytesAvailable();
265265
ds.skipRawData(hdrlen); // Forwards the pos
@@ -269,7 +269,7 @@ int TAbstractWebSocket::parse(QByteArray &recvData)
269269
case TWebSocketFrame::HeaderParsed: // fall through
270270
case TWebSocketFrame::MoreData: {
271271
tSystemDebug("WebSocket reading payload: available length:{}", dev->bytesAvailable());
272-
tSystemDebug("WebSocket parsing length to read:{} current buf len:{}", pfrm->payloadLength(), (int64_t)pfrm->payload().size());
272+
tSystemDebug("WebSocket parsing length to read:{} current buf len:{}", (quint64)pfrm->payloadLength(), (qint64)pfrm->payload().size());
273273
uint64_t size = std::min((uint64_t)(pfrm->payloadLength() - pfrm->payload().size()), (uint64_t)dev->bytesAvailable());
274274
if (Q_UNLIKELY(size == 0)) {
275275
Q_ASSERT(0);
@@ -293,14 +293,14 @@ int TAbstractWebSocket::parse(QByteArray &recvData)
293293
}
294294
}
295295
pfrm->payload().resize(pfrm->payload().size() + size);
296-
tSystemDebug("WebSocket payload curent buf len: {}", (int64_t)pfrm->payload().length());
296+
tSystemDebug("WebSocket payload curent buf len: {}", (qint64)pfrm->payload().length());
297297

298298
if ((uint64_t)pfrm->payload().size() == pfrm->payloadLength()) {
299299
pfrm->setState(TWebSocketFrame::Completed);
300-
tSystemDebug("Parse Completed payload len: {}", (int64_t)pfrm->payload().size());
300+
tSystemDebug("Parse Completed payload len: {}", (qint64)pfrm->payload().size());
301301
} else {
302302
pfrm->setState(TWebSocketFrame::MoreData);
303-
tSystemDebug("Parse MoreData payload len: {}", (int64_t)pfrm->payload().size());
303+
tSystemDebug("Parse MoreData payload len: {}", (qint64)pfrm->payload().size());
304304
}
305305
break;
306306
}

src/tactioncontext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ int64_t TActionContext::writeResponse(THttpResponseHeader &header, QIODevice *bo
459459
{
460460

461461
header.setContentLength(length);
462-
tSystemDebug("content-length: {}", (int64_t)header.contentLength());
462+
tSystemDebug("content-length: {}", (qint64)header.contentLength());
463463
header.setRawHeader(QByteArrayLiteral("Server"), QByteArrayLiteral("TreeFrog server"));
464464
header.setCurrentDate();
465465

src/tactionthread.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ void TActionThread::run()
112112
try {
113113
for (;;) {
114114
QList<THttpRequest> requests = readRequest(_httpSocket);
115-
tSystemDebug("HTTP request count: {}", (int64_t)requests.count());
115+
tSystemDebug("HTTP request count: {}", (qint64)requests.count());
116116

117117
if (requests.isEmpty()) {
118118
break;

src/tepoll.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ void TEpoll::dispatchEvents()
216216
Q_ASSERT(sd->buffer == nullptr);
217217

218218
QByteArray secKey = sd->header.rawHeader("Sec-WebSocket-Key");
219-
tSystemDebug("secKey: {}", secKey.data());
219+
tSystemDebug("secKey: {}", (const char*)secKey.data());
220220
int newsocket = TApplicationServerBase::duplicateSocket(sock->socketDescriptor());
221221

222222
// Switch to WebSocket

src/tepollhttpsocket.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ bool TEpollHttpSocket::seekRecvBuffer(int pos)
138138
QByteArray connectionHeader = header.rawHeader("Connection").toLower();
139139
if (connectionHeader.contains("upgrade")) {
140140
QByteArray upgradeHeader = header.rawHeader("Upgrade").toLower();
141-
tSystemDebug("Upgrade: {}", upgradeHeader.data());
141+
tSystemDebug("Upgrade: {}", (const char*)upgradeHeader.data());
142142

143143
if (upgradeHeader == "websocket") {
144144
if (TWebSocket::searchEndpoint(header)) {

src/tepollwebsocket.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ TEpollWebSocket::TEpollWebSocket(int socketDescriptor, const QHostAddress &addre
3131
TEpollSocket(socketDescriptor, Tf::SocketState::Connected, address),
3232
TAbstractWebSocket(header)
3333
{
34-
tSystemDebug("TEpollWebSocket [{:#x}]", (uintptr_t)this);
34+
tSystemDebug("TEpollWebSocket [{:#x}]", (quintptr)this);
3535
socketManager.insert(socketDescriptor, this);
3636
_recvBuffer.reserve(BUFFER_RESERVE_SIZE);
3737
}
@@ -40,7 +40,7 @@ TEpollWebSocket::TEpollWebSocket(int socketDescriptor, const QHostAddress &addre
4040
TEpollWebSocket::~TEpollWebSocket()
4141
{
4242
socketManager.remove(socketDescriptor());
43-
tSystemDebug("~TEpollWebSocket [{:#x}]", (uintptr_t)this);
43+
tSystemDebug("~TEpollWebSocket [{:#x}]", (quintptr)this);
4444
}
4545

4646

@@ -77,7 +77,7 @@ bool TEpollWebSocket::isBinaryRequest() const
7777

7878
void TEpollWebSocket::sendTextForPublish(const QString &text, const QObject *except)
7979
{
80-
tSystemDebug("sendText text len:{} (pid:{})", (int64_t)text.length(), (int)QCoreApplication::applicationPid());
80+
tSystemDebug("sendText text len:{} (pid:{})", (qint64)text.length(), (int)QCoreApplication::applicationPid());
8181
if (except != this) {
8282
TAbstractWebSocket::sendText(text);
8383
}
@@ -86,7 +86,7 @@ void TEpollWebSocket::sendTextForPublish(const QString &text, const QObject *exc
8686

8787
void TEpollWebSocket::sendBinaryForPublish(const QByteArray &binary, const QObject *except)
8888
{
89-
tSystemDebug("sendBinary binary len:{} (pid:{})", (int64_t)binary.length(), (int)QCoreApplication::applicationPid());
89+
tSystemDebug("sendBinary binary len:{} (pid:{})", (qint64)binary.length(), (int)QCoreApplication::applicationPid());
9090
if (except != this) {
9191
TAbstractWebSocket::sendBinary(binary);
9292
}
@@ -95,7 +95,7 @@ void TEpollWebSocket::sendBinaryForPublish(const QByteArray &binary, const QObje
9595

9696
void TEpollWebSocket::sendPong(const QByteArray &data)
9797
{
98-
tSystemDebug("sendPong data len:{} (pid:{})", (int64_t)data.length(), (int)QCoreApplication::applicationPid());
98+
tSystemDebug("sendPong data len:{} (pid:{})", (qint64)data.length(), (int)QCoreApplication::applicationPid());
9999
TAbstractWebSocket::sendPong(data);
100100
}
101101

src/test/buildtest/foo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ QJsonArray Foo::getAllJson()
132132
QJsonArray array;
133133
TMongoODMapper<FooObject> mapper;
134134

135-
if (mapper.find() > 0) {
135+
if (mapper.find()) {
136136
while (mapper.next()) {
137137
array.append(QJsonValue(QJsonObject::fromVariantMap(Foo(mapper.value()).toVariantMap())));
138138
}

src/test/redis/redis.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ void TestRedis::setexGet()
164164
QCOMPARE(res, QByteArray()); // empty
165165
bool ok = redis.setEx(key, value, secs);
166166
QCOMPARE(ok, true); // set ok
167-
Tf::msleep(Tf::random(50, 1900)); // sleep
167+
Tf::msleep(Tf::random(50, 1700)); // sleep
168168
res = redis.get(key); // get value
169169
QCOMPARE(res, value);
170170
}

src/tfnamespace.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,8 @@ enum class SocketState : int {
254254

255255
constexpr auto KeepEmptyParts = Qt::KeepEmptyParts;
256256
constexpr auto SkipEmptyParts = Qt::SkipEmptyParts;
257+
constexpr auto ReadOnly = QIODeviceBase::ReadOnly;
258+
constexpr auto WriteOnly = QIODeviceBase::WriteOnly;
257259
} // namespace Tf
258260

259261

src/tglobal.h

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,13 @@ constexpr auto TF_SRC_REVISION = 2956;
66
#include <QMetaType>
77
#include <QIODevice>
88
#include <QtGlobal>
9+
#include <version>
910

1011

12+
#if (!defined(Q_OS_WIN) && (defined(__cpp_lib_format) || __has_include(<format>))) || (defined(_MSC_VER) && _MSC_VER >= 1930) // std::format
13+
#define TF_HAVE_STD_FORMAT
14+
#endif
15+
1116
#define T_DEFINE_CONTROLLER(TYPE) T_DEFINE_TYPE(TYPE)
1217
#define T_DEFINE_VIEW(TYPE) T_DEFINE_TYPE(TYPE)
1318
#define T_DEFINE_TYPE(TYPE) \
@@ -168,16 +173,6 @@ constexpr auto TF_SRC_REVISION = 2956;
168173
#define tTrace TDebug(Tf::TraceLevel).trace
169174

170175

171-
namespace Tf {
172-
constexpr auto ReadOnly = QIODeviceBase::ReadOnly;
173-
constexpr auto WriteOnly = QIODeviceBase::WriteOnly;
174-
}
175-
176-
177-
#if (!defined(Q_OS_WIN) && defined(__cpp_lib_format)) || (defined(_MSC_VER) && _MSC_VER >= 1930) // std::format
178-
#define TF_HAVE_STD_FORMAT
179-
#endif
180-
181176
#include "tfexception.h"
182177
#include "tfnamespace.h"
183178
#include "tdeclexport.h"

src/tkvsdatabasepool.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ void TKvsDatabasePool::pool(TKvsDatabase &database)
313313
if (database.isOpen()) {
314314
cachedDatabase[engine].push(database.connectionName());
315315
lastCachedTime[engine].store((uint)std::time(nullptr));
316-
tSystemDebug("Pooled KVS database: {} count:{}", qUtf8Printable(database.connectionName()), (int64_t)cachedDatabase->count());
316+
tSystemDebug("Pooled KVS database: {} count:{}", qUtf8Printable(database.connectionName()), (qint64)cachedDatabase->count());
317317
} else {
318318
tSystemWarn("Closed KVS database connection, name: {}", qUtf8Printable(database.connectionName()));
319319
availableNames[engine].push(database.connectionName());

src/tpublisher.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ void TPublisher::unsubscribeFromAll(TAbstractWebSocket *socket)
168168
}
169169
}
170170

171-
tSystemDebug("total topics: {}", (int64_t)pubobj.count());
171+
tSystemDebug("total topics: {}", (qint64)pubobj.count());
172172
}
173173

174174

@@ -282,6 +282,6 @@ void TPublisher::release(const QString &topic)
282282
Pub *pub = pubobj.take(topic);
283283
if (pub) {
284284
delete pub;
285-
tSystemDebug("release topic: {} (total topics:{})", qUtf8Printable(topic), (int64_t)pubobj.count());
285+
tSystemDebug("release topic: {} (total topics:{})", qUtf8Printable(topic), (qint64)pubobj.count());
286286
}
287287
}

src/tsharedmemory_unix.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ bool TSharedMemory::attach()
144144
}
145145

146146
_size = st.st_size;
147-
tSystemDebug("SharedMemory attached. name:{} size:{}", qUtf8Printable(_name), _size);
147+
tSystemDebug("SharedMemory attached. name:{} size:{}", qUtf8Printable(_name), (quint64)_size);
148148
return true;
149149

150150
error:

src/tsharedmemoryallocator.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ void TSharedMemoryAllocator::setbrk(bool initial)
139139
}
140140

141141
pb_header = (Tf::program_break_header_t *)_sharedMemory->data();
142-
tSystemDebug("addr = {:#x}", (uintptr_t)_sharedMemory->data());
142+
tSystemDebug("addr = {:#x}", (quint64)_sharedMemory->data());
143143

144144
// Checks checksum
145145
uint64_t ck = (uint64_t)_sharedMemory->size() * (uint64_t)_sharedMemory->size();
@@ -150,7 +150,7 @@ void TSharedMemoryAllocator::setbrk(bool initial)
150150
pb_header->endg = _sharedMemory->size();
151151
pb_header->checksum = (uint64_t)_sharedMemory->size() * (uint64_t)_sharedMemory->size();
152152
}
153-
tSystemDebug("checksum = {}", pb_header->checksum);
153+
tSystemDebug("checksum = {}", (qint64)pb_header->checksum);
154154

155155
_origin = pb_header->start() + sizeof(Tf::alloc_header_t);
156156
}
@@ -427,7 +427,7 @@ void TSharedMemoryAllocator::summary() const
427427
}
428428

429429
tSystemDebug("-- memory block summary --");
430-
tSystemDebug("table info: blocks = {}, free = {}, used = {}", countBlocks(), countFreeBlocks(), pb_header->at.used);
430+
tSystemDebug("table info: blocks = {}, free = {}, used = {}", countBlocks(), countFreeBlocks(), (quint64)pb_header->at.used);
431431
}
432432

433433
// Debug function to print the entire link list
@@ -441,11 +441,11 @@ void TSharedMemoryAllocator::dump() const
441441
Tf::alloc_header_t *cur = pb_header->alloc_head();
442442

443443
tSystemDebug("-- memory block information --");
444-
tSystemDebug("table info: blocks = {}, free = {}, used = {}, free-size = {}, segment-size = {}", countBlocks(), countFreeBlocks(), pb_header->at.used, sizeOfFreeBlocks(), dataSegmentSize());
445-
tSystemDebug("block info: head = {:#x}, tail = {:#x}", (uintptr_t)pb_header->alloc_head(), (uintptr_t)pb_header->alloc_tail());
444+
tSystemDebug("table info: blocks = {}, free = {}, used = {}, free-size = {}, segment-size = {}", countBlocks(), countFreeBlocks(), (quint64)pb_header->at.used, (quint64)sizeOfFreeBlocks(), (quint64)dataSegmentSize());
445+
tSystemDebug("block info: head = {:#x}, tail = {:#x}", (quint64)pb_header->alloc_head(), (quint64)pb_header->alloc_tail());
446446
while (cur) {
447447
tSystemDebug("addr = {:#x}, size = {}, freed = {}, next = {:#x}, prev = {:#x}",
448-
(uintptr_t)cur, cur->size, cur->freed, (uintptr_t)cur->next(), (uintptr_t)cur->prev());
448+
(quint64)cur, cur->size, cur->freed, (quint64)cur->next(), (quint64)cur->prev());
449449
cur = cur->next();
450450
}
451451
}

src/tsharedmemorykvsdriver.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@ bool TSharedMemoryKvsDriver::open(const QString &db, const QString &, const QStr
7575

7676
_allocator = TSharedMemoryAllocator::attach(_name);
7777
if (_allocator) {
78-
tSystemDebug("SharedMemory attach. name:{} size:{}", qUtf8Printable(_name), _allocator->mapSize());
78+
tSystemDebug("SharedMemory attach. name:{} size:{}", qUtf8Printable(_name), (quint64)_allocator->mapSize());
7979
_size = _allocator->mapSize();
8080
} else {
81-
tSystemError("SharedMemory attach error. name:{}", qUtf8Printable(_name));
81+
tSystemError("SharedMemory attach error. name:{}", qUtf8Printable(_name));
8282
}
8383
return true;
8484
}

src/tsystembus.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ void TSystemBus::readBus()
112112
void TSystemBus::writeBus()
113113
{
114114
QMutexLocker locker(&mutexWrite);
115-
tSystemDebug("TSystemBus::writeBus len:{}", (int64_t)sendBuffer.length());
115+
tSystemDebug("TSystemBus::writeBus len:{}", (qint64)sendBuffer.length());
116116

117117
for (;;) {
118118
int len = busSocket->write(sendBuffer.data(), sendBuffer.length());

src/tthreadapplicationserver_linux.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ void TThreadApplicationServer::run()
115115
Tf::msleep(1);
116116
}
117117

118-
tSystemDebug("thread ptr: {}", (uint64_t)thread);
118+
tSystemDebug("thread ptr: {}", (quint64)thread);
119119
thread->setSocketDescriptor(socketDescriptor);
120120
thread->start();
121121
}

src/tthreadapplicationserver_qt.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ void TThreadApplicationServer::stop()
8383

8484
void TThreadApplicationServer::incomingConnection(qintptr socketDescriptor)
8585
{
86-
tSystemDebug("incomingConnection sd:{} thread count:{} max:{}", (int64_t)socketDescriptor, TActionThread::threadCount(), maxThreads);
86+
tSystemDebug("incomingConnection sd:{} thread count:{} max:{}", (qint64)socketDescriptor, TActionThread::threadCount(), maxThreads);
8787
TActionThread *thread;
8888
while (!threadPoolPtr()->pop(thread)) {
8989
std::this_thread::yield();

0 commit comments

Comments
 (0)