diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2015-10-17 17:48:34 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2016-03-12 17:29:36 +0000 |
commit | 6417bbde8565e0be2d049426b71e6fda538e4440 (patch) | |
tree | 8e60f1edf1f8e0f07fc1e6eed23e44389bdb9a67 /src/plugins/platforms/openwfd | |
parent | 8c0ae00dd603bfe5aa99b5b2db8c1ffdaa6cd45e (diff) |
QtBase (remainder): use printf-style qWarning/qDebug where possible (I)
The printf-style version of QDebug expands to a lot less code than the
std::ostream-style version. Of course, you pay in type safety (but
compilers warn about it these days), you cannot stream complex Qt
types and streaming QStrings is awkward, but in many cases you
actually improve on readability.
But the main reason is that something that's not supposed to be
executed under normal operation has no business bloating executable
code size.
This is not an attempt at converting all qWarnings() to printf-style,
only the low-hanging fruit.
In this first part, replace
qWarning() << ""
with
qWarning("...").
Had to fix broken qImDebug() definition. Instead of defining it as
a nullary macro in the QT_NO_DEBUG case and as a variadic macro in
the other, define it in both cases, as is customary, as a non-function
macro so that overload selection works without requiring variadic
macro support of the compiler.
Saves e.g. ~250b in text size in QtPrintSupport on optimized GCC 5.3
AMD64 builds.
Change-Id: Ie30fe2f7942115d5dbf99fff1750ae0d477c379f
Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
Diffstat (limited to 'src/plugins/platforms/openwfd')
6 files changed, 20 insertions, 20 deletions
diff --git a/src/plugins/platforms/openwfd/qopenwfddevice.cpp b/src/plugins/platforms/openwfd/qopenwfddevice.cpp index 1a4ba59817..710c07b643 100644 --- a/src/plugins/platforms/openwfd/qopenwfddevice.cpp +++ b/src/plugins/platforms/openwfd/qopenwfddevice.cpp @@ -55,11 +55,11 @@ QOpenWFDDevice::QOpenWFDDevice(QOpenWFDIntegration *integration, WFDint device_e { mDevice = wfdCreateDevice(WFD_DEFAULT_DEVICE_ID,WFD_NONE); if (mDevice == WFD_INVALID_HANDLE) - qDebug() << "failed to create device"; + qDebug("failed to create device"); mEvent = wfdCreateEvent(mDevice,0); if (mEvent == WFD_INVALID_HANDLE) - qDebug() << "failed to create event handle"; + qDebug("failed to create event handle"); //initialize pipelines for device. wfdEnumeratePipelines(mDevice,WFD_NONE,0,WFD_NONE); @@ -181,22 +181,22 @@ void QOpenWFDDevice::readEvents(WFDtime wait) case WFD_EVENT_NONE: return; case WFD_EVENT_DESTROYED: - qDebug() << "Event or Device destoryed!"; + qDebug("Event or Device destoryed!"); return; case WFD_EVENT_PORT_ATTACH_DETACH: handlePortAttachDetach(); break; case WFD_EVENT_PORT_PROTECTION_FAILURE: - qDebug() << "Port protection event handling not implemented"; + qDebug("Port protection event handling not implemented"); break; case WFD_EVENT_PIPELINE_BIND_SOURCE_COMPLETE: handlePipelineBindSourceComplete(); break; case WFD_EVENT_PIPELINE_BIND_MASK_COMPLETE: - qDebug() << "Pipeline bind mask event handling not implemented"; + qDebug("Pipeline bind mask event handling not implemented"); break; default: - qDebug() << "Not recognised event type"; + qDebug("Not recognised event type"); break; } @@ -206,10 +206,10 @@ void QOpenWFDDevice::readEvents(WFDtime wait) void QOpenWFDDevice::initializeGbmAndEgl() { - qDebug() << "initializing GBM and EGL"; + qDebug("initializing GBM and EGL"); int fd = wfdGetDeviceAttribi(mDevice,WFD_DEVICE_ID); if (fd < 0) { - qDebug() << "failed to get WFD_DEVICE_ID"; + qDebug("failed to get WFD_DEVICE_ID"); } mGbmDevice = gbm_create_device(fd); @@ -221,12 +221,12 @@ void QOpenWFDDevice::initializeGbmAndEgl() EGLint minor, major; if (!eglInitialize(mEglDisplay,&major,&minor)) { - qDebug() << "failed to initialize egl"; + qDebug("failed to initialize egl"); } QByteArray eglExtensions = eglQueryString(mEglDisplay, EGL_EXTENSIONS); if (!eglExtensions.contains("EGL_KHR_surfaceless_opengl")) { - qDebug() << "This egl implementation does not have the required EGL extension EGL_KHR_surfaceless_opengl"; + qDebug("This egl implementation does not have the required EGL extension EGL_KHR_surfaceless_opengl"); } eglBindAPI(EGL_OPENGL_ES_API); @@ -238,7 +238,7 @@ void QOpenWFDDevice::initializeGbmAndEgl() mEglContext = eglCreateContext(mEglDisplay,NULL,EGL_NO_CONTEXT,contextAttribs); if (mEglContext == EGL_NO_CONTEXT) { - qDebug() << "Failed to create EGL context"; + qDebug("Failed to create EGL context"); } eglCreateImage = (PFNEGLCREATEIMAGEKHRPROC) eglGetProcAddress("eglCreateImageKHR"); @@ -269,7 +269,7 @@ void QOpenWFDDevice::handlePortAttachDetach() for (int i = 0; i < mPorts.size(); i++) { if (mPorts.at(i)->portId() == id) { indexToAdd = i; - qDebug() << "found index to attach"; + qDebug("found index to attach"); break; } } @@ -301,7 +301,7 @@ void QOpenWFDDevice::handlePipelineBindSourceComplete() WFDint overflow = wfdGetEventAttribi(mDevice,mEvent, WFD_EVENT_PIPELINE_BIND_QUEUE_OVERFLOW); if (overflow == WFD_TRUE) { - qDebug() << "PIPELINE_BIND_QUEUE_OVERFLOW event occurred"; + qDebug("PIPELINE_BIND_QUEUE_OVERFLOW event occurred"); } WFDint pipelineId = wfdGetEventAttribi(mDevice,mEvent,WFD_EVENT_PIPELINE_BIND_PIPELINE_ID); diff --git a/src/plugins/platforms/openwfd/qopenwfdglcontext.cpp b/src/plugins/platforms/openwfd/qopenwfdglcontext.cpp index 31d369ae00..cf267ea203 100644 --- a/src/plugins/platforms/openwfd/qopenwfdglcontext.cpp +++ b/src/plugins/platforms/openwfd/qopenwfdglcontext.cpp @@ -61,7 +61,7 @@ bool QOpenWFDGLContext::makeCurrent(QPlatformSurface *surface) EGLDisplay display = mWfdDevice->eglDisplay(); EGLContext context = mWfdDevice->eglContext(); if (!eglMakeCurrent(display,EGL_NO_SURFACE,EGL_NO_SURFACE,context)) { - qDebug() << "GLContext: eglMakeCurrent FAILED!"; + qDebug("GLContext: eglMakeCurrent FAILED!"); } QPlatformWindow *window = static_cast<QPlatformWindow *>(surface); diff --git a/src/plugins/platforms/openwfd/qopenwfdintegration.cpp b/src/plugins/platforms/openwfd/qopenwfdintegration.cpp index 26fc93fc11..71e2b381fc 100644 --- a/src/plugins/platforms/openwfd/qopenwfdintegration.cpp +++ b/src/plugins/platforms/openwfd/qopenwfdintegration.cpp @@ -79,7 +79,7 @@ QOpenWFDIntegration::QOpenWFDIntegration() QOpenWFDIntegration::~QOpenWFDIntegration() { //don't delete screens since they are deleted by the devices - qDebug() << "deleting platform integration"; + qDebug("deleting platform integration"); for (int i = 0; i < mDevices.size(); i++) { delete mDevices[i]; } diff --git a/src/plugins/platforms/openwfd/qopenwfdoutputbuffer.cpp b/src/plugins/platforms/openwfd/qopenwfdoutputbuffer.cpp index dc560b98da..4d0de7b0d4 100644 --- a/src/plugins/platforms/openwfd/qopenwfdoutputbuffer.cpp +++ b/src/plugins/platforms/openwfd/qopenwfdoutputbuffer.cpp @@ -69,7 +69,7 @@ QOpenWFDOutputBuffer::~QOpenWFDOutputBuffer() { wfdDestroySource(mPort->device()->handle(),mWfdSource); if (!mPort->device()->eglDestroyImage(mPort->device()->eglDisplay(),mEglImage)) { - qDebug() << "could not delete eglImage"; + qDebug("could not delete eglImage"); } gbm_bo_destroy(mGbm_buffer); @@ -83,6 +83,6 @@ void QOpenWFDOutputBuffer::bindToCurrentFbo() GL_RENDERBUFFER, mRbo); if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) { - qDebug() << "framebuffer not ready!"; + qDebug("framebuffer not ready!"); } } diff --git a/src/plugins/platforms/openwfd/qopenwfdport.cpp b/src/plugins/platforms/openwfd/qopenwfdport.cpp index 73d1fb99e7..33254fe83c 100644 --- a/src/plugins/platforms/openwfd/qopenwfdport.cpp +++ b/src/plugins/platforms/openwfd/qopenwfdport.cpp @@ -80,7 +80,7 @@ void QOpenWFDPort::attach() Q_ASSERT(actualNumberOfPortModes == numberOfPortModes); if (!actualNumberOfPortModes) { - qDebug() << "didn't find any available port modes"; + qDebug("didn't find any available port modes"); return; } @@ -94,7 +94,7 @@ void QOpenWFDPort::attach() mPixelSize = setNativeResolutionMode(); if (mPixelSize.isEmpty()) { - qDebug() << "Could not set native resolution mode in QOpenWFPort"; + qDebug("Could not set native resolution mode in QOpenWFPort"); } WFDfloat physicalWFDSize[2]; diff --git a/src/plugins/platforms/openwfd/qopenwfdscreen.cpp b/src/plugins/platforms/openwfd/qopenwfdscreen.cpp index f8a61dbb68..ab394fa594 100644 --- a/src/plugins/platforms/openwfd/qopenwfdscreen.cpp +++ b/src/plugins/platforms/openwfd/qopenwfdscreen.cpp @@ -65,7 +65,7 @@ QOpenWFDScreen::QOpenWFDScreen(QOpenWFDPort *port) EGLContext context = mPort->device()->eglContext(); if (!eglMakeCurrent(display,EGL_NO_SURFACE,EGL_NO_SURFACE,context)) { - qDebug() << "screen: eglMakeCurrent FAILED"; + qDebug("screen: eglMakeCurrent FAILED"); } glGenFramebuffers(1,&mFbo); |