qt5base-lts/tests/manual/qt_poll/qt_poll.pro
Louai Al-Khanji f0a6d45cc8 qt_poll: split out into separate file and sanitize build
The qt_poll function calls recv to query whether fds marked by select
as readable should be marked POLLIN or POLLHUP in the pollfd structure.
On many platforms such as QNX this requires extra link-time libraries
which were not previously required by QtCore.

While the qt_poll function is intended as a fallback mechanism only for
those platforms which do not implement poll natively, the function was
compiled unconditionally whenever QT_BUILD_INTERNAL was defined, e.g.
in developer builds.

Additionally the function was included on those systems that define poll
in system headers so that configure determines build-time availability,
but do not define _POSIX_POLL > 0 or indicate POSIX:2008 compliance via
either the _POSIX_VERSION or _XOPEN_VERSION macros. On those systems a
sysconf query for _SC_POLL was performed to determine at runtime whether
to call the system poll or qt_poll.

Both of these cases are in fact counterproductive. In the first case the
sole consumer of the function is a single manual unit test. In the
second, to my knowledge no platform requires the runtime fallback.
Despite that, we were forcing an extra dylib in both cases.

Both cases are fixed by 1) moving the implementation into its own file
for the unit test to include and 2) dropping the dynamic fallback if
configure determines availability of poll at compile-time.

This also reverts commit 1377709711, which
added -lsocket for QtCore on QNX.

Change-Id: I2dd10695c5d4cac81b68d2c2558797f3cdabc153
Reviewed-by: James McDonnell <jmcdonnell@qnx.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-12-05 00:47:36 +00:00

8 lines
194 B
Prolog

CONFIG += testcase
TARGET = tst_qt_poll
QT = core-private network testlib
INCLUDEPATH += ../../../src/corelib/kernel
SOURCES += \
tst_qt_poll.cpp \
../../../src/corelib/kernel/qpoll.cpp