From 4a5bcff7ecf2a1e0b2178b95f7f092ef3126dff9 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Fri, 30 Sep 2016 22:56:15 +0000 Subject: [PATCH] embracing the STL Signed-off-by: Ivailo Monev --- CMakeLists.txt | 25 +- mkspecs/mkspecs.cmake | 8 + mkspecs/tests/misc/stl.cpp | 150 -------- mkspecs/tests/tests.cmake | 27 -- .../javascriptcore/runtime/DateConstructor.cpp | 28 +- .../javascriptcore/runtime/DateInstance.cpp | 4 +- .../javascriptcore/runtime/DatePrototype.cpp | 14 +- .../runtime/JSGlobalObjectFunctions.cpp | 10 +- src/3rdparty/javascriptcore/runtime/JSImmediate.h | 2 +- src/3rdparty/javascriptcore/runtime/JSONObject.cpp | 4 - src/3rdparty/javascriptcore/runtime/JSValue.cpp | 6 +- src/3rdparty/javascriptcore/runtime/JSValue.h | 10 +- src/3rdparty/javascriptcore/runtime/MathObject.cpp | 20 +- .../javascriptcore/runtime/NumberPrototype.cpp | 10 +- .../javascriptcore/runtime/StringPrototype.cpp | 4 +- src/3rdparty/javascriptcore/runtime/UStringImpl.h | 8 +- src/3rdparty/javascriptcore/wtf/DateMath.cpp | 8 +- src/3rdparty/javascriptcore/wtf/MathExtras.h | 34 -- src/3rdparty/javascriptcore/wtf/Vector.h | 7 +- src/3rdparty/javascriptcore/wtf/dtoa.cpp | 4 +- src/core/CMakeLists.txt | 5 - src/core/animation/qvariantanimation.cpp | 2 +- src/core/arch/qatomic_bootstrap.h | 99 ----- src/core/arch/qatomic_generic.h | 235 ------------ src/core/arch/qatomic_unix.cpp | 121 ------ src/core/concurrent/qtconcurrentiteratekernel.h | 31 +- src/core/global/global.cmake | 1 - src/core/global/qconfig.h.cmake | 2 +- src/core/global/qfeatures.h | 3 - src/core/global/qglobal.h.cmake | 128 ++----- src/core/global/qnumeric.cpp | 152 ++++---- src/core/global/qnumeric.h | 25 +- src/core/global/qnumeric_p.h | 171 --------- src/core/io/qprocess_unix.cpp | 2 +- src/core/kernel/qabstracteventdispatcher.cpp | 16 +- src/core/kernel/qcore_unix_p.h | 2 +- src/core/kernel/qmetatype.h | 2 +- src/core/kernel/qobject.cpp | 37 +- src/core/kernel/qobject_p.h | 2 +- src/core/plugin/quuid.cpp | 2 +- src/core/qcorecommon_p.h | 6 + src/core/thread/qatomic.h | 422 +++++++++++++++------ src/core/thread/qbasicatomic.h | 186 --------- src/core/thread/qmutex_p.h | 2 - src/core/thread/qmutex_unix.cpp | 72 +--- src/core/thread/qwaitcondition_unix.cpp | 7 +- src/core/thread/thread.cmake | 2 - src/core/tools/qalgorithms.h | 224 +---------- src/core/tools/qbytearray.cpp | 6 +- src/core/tools/qbytearray.h | 23 +- src/core/tools/qcontiguouscache.h | 2 +- src/core/tools/qhash.cpp | 2 +- src/core/tools/qhash.h | 2 +- src/core/tools/qiterator.h | 30 -- src/core/tools/qlinkedlist.cpp | 2 +- src/core/tools/qlinkedlist.h | 6 +- src/core/tools/qlist.cpp | 2 +- src/core/tools/qlist.h | 6 +- src/core/tools/qlocale.cpp | 7 +- src/core/tools/qlocale_tools.cpp | 30 +- src/core/tools/qlocale_tools_p.h | 12 - src/core/tools/qmap.cpp | 2 +- src/core/tools/qmap.h | 10 +- src/core/tools/qscopedpointer.h | 3 - src/core/tools/qshareddata.h | 6 +- src/core/tools/qsharedpointer_impl.h | 6 +- src/core/tools/qstring.cpp | 4 +- src/core/tools/qstring.h | 22 +- src/core/tools/qstringbuilder.h | 6 - src/core/tools/qvector.cpp | 2 +- src/core/tools/qvector.h | 6 +- src/dbus/qdbusintegrator.cpp | 2 +- .../qml/qdeclarativeobjectscriptclass.cpp | 8 - src/gui/dialogs/qfiledialog.cpp | 17 - src/gui/dialogs/qfiledialog_embedded.ui | 340 ----------------- src/gui/dialogs/qfileinfogatherer.cpp | 13 +- src/gui/dialogs/qfileinfogatherer_p.h | 11 +- src/gui/dialogs/qfilesystemmodel.cpp | 2 +- src/gui/dialogs/qfilesystemmodel_p.h | 2 +- src/gui/egl/qegl.cpp | 8 +- src/gui/image/qbmphandler.cpp | 2 +- src/gui/image/qicon.cpp | 2 +- src/gui/image/qimage.cpp | 2 +- src/gui/image/qpixmap_x11.cpp | 8 +- src/gui/image/qpixmapcache.cpp | 4 - src/gui/image/qpixmapdata_p.h | 3 - src/gui/itemviews/qfileiconprovider_p.h | 5 - src/gui/kernel/qapplication.cpp | 43 +-- src/gui/kernel/qapplication_x11.cpp | 15 +- src/gui/kernel/qdnd_p.h | 128 ------- src/gui/kernel/qevent_p.h | 7 - src/gui/kernel/qguiplatformplugin.cpp | 31 +- src/gui/kernel/qkeymapper_x11.cpp | 2 +- src/gui/kernel/qt_gui_pch.h | 85 ----- src/gui/kernel/qwhatsthis.cpp | 4 +- src/gui/kernel/qwidget.cpp | 174 +-------- src/gui/kernel/qwidget_x11.cpp | 49 ++- src/gui/kernel/qx11info_x11.h | 1 + src/gui/painting/qbezier.cpp | 1 - src/gui/painting/qdrawhelper.cpp | 30 +- src/gui/painting/qpaintdevice.h | 5 - src/gui/painting/qpaintengine.cpp | 25 -- src/gui/painting/qpaintengine_x11.cpp | 1 - src/gui/painting/qpainter.cpp | 2 - src/gui/painting/qpathclipper.cpp | 13 +- src/gui/painting/qprintengine.h | 6 - src/gui/painting/qprinter.h | 15 - src/gui/painting/qregion.h | 4 +- src/gui/painting/qregion_x11.cpp | 2 +- src/gui/painting/qstroker_p.h | 1 - src/gui/painting/qtextureglyphcache.cpp | 1 - src/gui/styles/qcommonstyle.cpp | 94 ++--- src/gui/styles/qstylehelper.cpp | 27 -- src/gui/styles/qstylehelper_p.h | 1 - src/gui/styles/qwindowsstyle.cpp | 28 +- src/gui/text/qfontdatabase_x11.h | 17 - src/gui/text/qfontengine.cpp | 2 +- src/gui/text/qfontengine_p.h | 5 - src/gui/text/qtextcontrol.cpp | 4 +- src/gui/text/qtextengine.cpp | 181 --------- src/gui/widgets/qeffects.cpp | 8 - src/gui/widgets/qmenubar.cpp | 4 - src/gui/widgets/qplaintextedit.cpp | 3 - src/gui/widgets/qscrollbar.cpp | 6 - src/gui/widgets/qtextedit.cpp | 3 - src/gui/widgets/qwidgetresizehandler.cpp | 3 - src/network/access/qftp.cpp | 4 +- src/network/access/qhttp.cpp | 4 +- src/network/access/qnetworkaccessbackend.cpp | 4 +- src/network/access/qnetworkaccesshttpbackend.cpp | 6 +- src/network/access/qnetworkcookie.cpp | 8 +- src/network/bearer/qnetworkconfigmanager.cpp | 4 +- src/network/kernel/qhostinfo.cpp | 2 +- src/network/socket/qsocks5socketengine.cpp | 2 +- .../gl2paintengineex/qtextureglyphcache_gl.cpp | 2 +- .../gl2paintengineex/qtriangulatingstroker_p.h | 1 - src/opengl/qgl.cpp | 7 - src/opengl/qglcolormap.cpp | 2 +- src/opengl/qglcolormap.h | 2 +- src/shared/bootstrap.cmake | 10 - src/shared/qclass_lib_map.h | 4 +- src/test/qbenchmarkvalgrind.cpp | 14 +- src/test/qtest_global.h | 2 +- src/test/qtestlog.cpp | 2 +- src/tools/moc/moc.h | 1 - src/tools/moc/preprocessor.cpp | 1 - src/tools/uic/cpp/cppwriteinitialization.cpp | 13 - src/tools/uic/cpp/cppwriteinitialization.h | 19 - src/xmlpatterns/data/qschemanumeric_p.h | 4 +- 149 files changed, 773 insertions(+), 3344 deletions(-) delete mode 100644 mkspecs/tests/misc/stl.cpp delete mode 100644 src/core/arch/qatomic_bootstrap.h delete mode 100644 src/core/arch/qatomic_generic.h delete mode 100644 src/core/arch/qatomic_unix.cpp delete mode 100644 src/core/global/qnumeric_p.h delete mode 100644 src/core/thread/qbasicatomic.h delete mode 100644 src/gui/dialogs/qfiledialog_embedded.ui delete mode 100644 src/gui/kernel/qt_gui_pch.h diff --git a/CMakeLists.txt b/CMakeLists.txt index ef2abe1e1..5b488a68f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ # Editors notes: # # * To find all FIXME/TODO related to the CMake build system (and those -# inherited from the autotools build system) execute the following in the +# inherited from the QMake build system) execute the following in the # top-level directory of the source tree: # # find -name '*.cmake' -exec grep -E 'TODO|FIXME' {} + @@ -139,9 +139,10 @@ set(CPACK_GENERATOR "TXZ") set(CPACK_SOURCE_GENERATOR "TXZ") include(CPack) -# 9 minutes timeout for the tests, Travis timeouts on 10min and I do not want -# some tests to be skipped because of one test. Like the qpainter test - it -# does a lot of tests and can (and sometimes it does) take more then 10min. +# 9 minutes timeout for the tests, Travis timeouts on 10min if there is no +# output and I do not want some tests to be skipped because of one test. Like +# the qpainter test - it does a lot of tests and can (and sometimes it does) +# take more then 10min. set(CTEST_TEST_TIMEOUT 540) if(NOT CMAKE_VERSION VERSION_LESS "3.3.0") @@ -154,10 +155,11 @@ add_definitions( -DKATIE_DATE="${KATIE_DATE}" -DQT_USE_QSTRINGBUILDER -DQT_ASCII_CAST_WARNINGS - # maybe one day, use with caution! + # -DQT_STRICT_ITERATORS + # maybe one day, this forces it onto other projects which (most likely) + # means source code adjustments! # -DQT_NO_CAST_FROM_ASCII # -DQT_NO_CAST_TO_ASCII - # -DQT_STRICT_ITERATORS ) # this is how Qt4 does it @@ -422,9 +424,7 @@ if(PYTHONINTERP_FOUND) message(SEND_ERROR "${genmap_error}") endif() else() - message(WARNING - "\nUsing pre-generated classes map" - ) + message(WARNING "\nUsing pre-generated classes map") endif() # various sources use #include @@ -432,8 +432,11 @@ include_directories(${CMAKE_SOURCE_DIR}/src) if(ENABLE_TESTING) message(WARNING - "\nUnless it is intentionall you should not enable testing. You will have to unset " - "QT_PLUGIN_PATH if you have Qt4 installed on the system prior to running the tests." + "\nUnless it is intentionall you should not enable testing, deploying tests builds" + " is a bad idea.\n\n" + "Prior to runing the test you will have to unset the QT_PLUGIN_PATH environmental" + "variable if you have Qt4 installed on the system because the plugins are not " + "compatible and using them will cause undefined behaviour." ) enable_testing() add_definitions(-DQT_BUILD_INTERNAL) diff --git a/mkspecs/mkspecs.cmake b/mkspecs/mkspecs.cmake index 1afb6aa4e..25a69e13f 100644 --- a/mkspecs/mkspecs.cmake +++ b/mkspecs/mkspecs.cmake @@ -91,6 +91,14 @@ if("${KATIE_COMPILER}" MATCHES "(gcc|clang)") set(QT_VISIBILITY_AVAILABLE TRUE) endif() +# Set compiler standard to C++ 11 +if(NOT CMAKE_VERSION VERSION_LESS "3.1.0") + set(CMAKE_CXX_STANDARD_REQUIRED ON) + set(CMAKE_CXX_STANDARD 11) +elseif("${KATIE_COMPILER}" MATCHES "(gcc|clang)") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") +endif() + # TODO: make use of GNUInstallDirs set(QT_PREFIX_PATH "${CMAKE_INSTALL_PREFIX}" CACHE PATH "General installation prefix") set(QT_HEADERS_PATH "${QT_PREFIX_PATH}/include/katie" CACHE PATH "Headers installation path") diff --git a/mkspecs/tests/misc/stl.cpp b/mkspecs/tests/misc/stl.cpp deleted file mode 100644 index c02d81161..000000000 --- a/mkspecs/tests/misc/stl.cpp +++ /dev/null @@ -1,150 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the config.tests of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* Sample program for configure to test STL support on target -platforms. We are mainly concerned with being able to instantiate -templates for common STL container classes. -*/ - -#include -#include -#include -#include -#include - -// something mean to see if the compiler and C++ standard lib are good enough -template -class DummyClass -{ - // everything in std namespace ? - typedef std::bidirectional_iterator_tag i; - typedef std::ptrdiff_t d; - // typename implemented ? - typedef typename std::map::iterator MyIterator; -}; - -// extracted from QVector's strict iterator -template -class DummyIterator -{ - typedef DummyIterator iterator; -public: - T *i; - typedef std::random_access_iterator_tag iterator_category; - typedef std::ptrdiff_t difference_type; - typedef T value_type; - typedef T *pointer; - typedef T &reference; - - inline DummyIterator() : i(0) {} - inline DummyIterator(T *n) : i(n) {} - inline DummyIterator(const DummyIterator &o): i(o.i){} - inline T &operator*() const { return *i; } - inline T *operator->() const { return i; } - inline T &operator[](int j) const { return *(i + j); } - inline bool operator==(const DummyIterator &o) const { return i == o.i; } - inline bool operator!=(const DummyIterator &o) const { return i != o.i; } - inline bool operator<(const DummyIterator& other) const { return i < other.i; } - inline bool operator<=(const DummyIterator& other) const { return i <= other.i; } - inline bool operator>(const DummyIterator& other) const { return i > other.i; } - inline bool operator>=(const DummyIterator& other) const { return i >= other.i; } - inline DummyIterator &operator++() { ++i; return *this; } - inline DummyIterator operator++(int) { T *n = i; ++i; return n; } - inline DummyIterator &operator--() { i--; return *this; } - inline DummyIterator operator--(int) { T *n = i; i--; return n; } - inline DummyIterator &operator+=(int j) { i+=j; return *this; } - inline DummyIterator &operator-=(int j) { i-=j; return *this; } - inline DummyIterator operator+(int j) const { return DummyIterator(i+j); } - inline DummyIterator operator-(int j) const { return DummyIterator(i-j); } - inline int operator-(DummyIterator j) const { return i - j.i; } -}; - -int main() -{ - std::vector v1; - v1.push_back( 0 ); - v1.push_back( 1 ); - v1.push_back( 2 ); - v1.push_back( 3 ); - v1.push_back( 4 ); - int v1size = v1.size(); - v1size = 0; - int v1capacity = v1.capacity(); - v1capacity = 0; - - std::vector::iterator v1it = std::find( v1.begin(), v1.end(), 99 ); - bool v1notfound = (v1it == v1.end()); - v1notfound = false; - - v1it = std::find( v1.begin(), v1.end(), 3 ); - bool v1found = (v1it != v1.end()); - v1found = false; - - std::vector v2; - std::copy( v1.begin(), v1it, std::back_inserter( v2 ) ); - int v2size = v2.size(); - v2size = 0; - - std::map m1; - m1.insert( std::make_pair( 1, 2.0 ) ); - m1.insert( std::make_pair( 3, 2.0 ) ); - m1.insert( std::make_pair( 5, 2.0 ) ); - m1.insert( std::make_pair( 7, 2.0 ) ); - int m1size = m1.size(); - m1size = 0; - std::map::iterator m1it = m1.begin(); - for ( ; m1it != m1.end(); ++m1it ) { - int first = (*m1it).first; - first = 0; - double second = (*m1it).second; - second = 0.0; - } - std::map< int, double > m2( m1 ); - int m2size = m2.size(); - m2size = 0; - - DummyIterator it1, it2; - int n = std::distance(it1, it2); - std::advance(it1, 3); - - return 0; -} - diff --git a/mkspecs/tests/tests.cmake b/mkspecs/tests/tests.cmake index 4b43ccbd8..c39ecb35f 100644 --- a/mkspecs/tests/tests.cmake +++ b/mkspecs/tests/tests.cmake @@ -51,31 +51,4 @@ endif() ################################ MISC TESTS ################################ -macro(KATIE_MISC_TEST _test _define) - string(TOUPPER ${_test} uppertest) - try_compile( - _has_misc_feature - ${CMAKE_BINARY_DIR}/katie_tests/misc - ${KATIE_MKSPECS_DIR}/tests/misc/${_test}.cpp - OUTPUT_VARIABLE _misc_feature_log - ) - - file(WRITE ${CMAKE_BINARY_DIR}/katie_tests/misc/${_test}.log "${_misc_feature_log}") - - set(KATIE_${uppertest}_RESULT ${_has_misc_feature} CACHE BOOL "Host supports ${uppertest}") - if(KATIE_${uppertest}_RESULT) - add_definitions(-DQT_${_define}) - else() - add_definitions(-DQT_NO_${_define}) - endif() - - set(_cache_override) - if(NOT _has_misc_feature STREQUAL KATIE_${uppertest}_RESULT) - set(_cache_override " (cache override)") - endif() - message(STATUS "Host supports ${uppertest}: ${KATIE_${uppertest}_RESULT}${_cache_override}") -endmacro() - -katie_misc_test(stl STL) - # TODO: check if data relocations should be disabled before any target additions and define Q_NO_DATA_RELOCATION diff --git a/src/3rdparty/javascriptcore/runtime/DateConstructor.cpp b/src/3rdparty/javascriptcore/runtime/DateConstructor.cpp index 9c09b722b..1c1490627 100644 --- a/src/3rdparty/javascriptcore/runtime/DateConstructor.cpp +++ b/src/3rdparty/javascriptcore/runtime/DateConstructor.cpp @@ -85,13 +85,13 @@ JSObject* constructDate(ExecState* exec, const ArgList& args) value = primitive.toNumber(exec); } } else { - if (isnan(args.at(0).toNumber(exec)) - || isnan(args.at(1).toNumber(exec)) - || (numArgs >= 3 && isnan(args.at(2).toNumber(exec))) - || (numArgs >= 4 && isnan(args.at(3).toNumber(exec))) - || (numArgs >= 5 && isnan(args.at(4).toNumber(exec))) - || (numArgs >= 6 && isnan(args.at(5).toNumber(exec))) - || (numArgs >= 7 && isnan(args.at(6).toNumber(exec)))) + if (std::isnan(args.at(0).toNumber(exec)) + || std::isnan(args.at(1).toNumber(exec)) + || (numArgs >= 3 && std::isnan(args.at(2).toNumber(exec))) + || (numArgs >= 4 && std::isnan(args.at(3).toNumber(exec))) + || (numArgs >= 5 && std::isnan(args.at(4).toNumber(exec))) + || (numArgs >= 6 && std::isnan(args.at(5).toNumber(exec))) + || (numArgs >= 7 && std::isnan(args.at(6).toNumber(exec)))) value = NaN; else { GregorianDateTime t; @@ -153,13 +153,13 @@ static JSValue JSC_HOST_CALL dateNow(ExecState* exec, JSObject*, JSValue, const static JSValue JSC_HOST_CALL dateUTC(ExecState* exec, JSObject*, JSValue, const ArgList& args) { int n = args.size(); - if (isnan(args.at(0).toNumber(exec)) - || isnan(args.at(1).toNumber(exec)) - || (n >= 3 && isnan(args.at(2).toNumber(exec))) - || (n >= 4 && isnan(args.at(3).toNumber(exec))) - || (n >= 5 && isnan(args.at(4).toNumber(exec))) - || (n >= 6 && isnan(args.at(5).toNumber(exec))) - || (n >= 7 && isnan(args.at(6).toNumber(exec)))) + if (std::isnan(args.at(0).toNumber(exec)) + || std::isnan(args.at(1).toNumber(exec)) + || (n >= 3 && std::isnan(args.at(2).toNumber(exec))) + || (n >= 4 && std::isnan(args.at(3).toNumber(exec))) + || (n >= 5 && std::isnan(args.at(4).toNumber(exec))) + || (n >= 6 && std::isnan(args.at(5).toNumber(exec))) + || (n >= 7 && std::isnan(args.at(6).toNumber(exec)))) return jsNaN(exec); GregorianDateTime t; diff --git a/src/3rdparty/javascriptcore/runtime/DateInstance.cpp b/src/3rdparty/javascriptcore/runtime/DateInstance.cpp index 77a92be64..9a7a2e057 100644 --- a/src/3rdparty/javascriptcore/runtime/DateInstance.cpp +++ b/src/3rdparty/javascriptcore/runtime/DateInstance.cpp @@ -49,7 +49,7 @@ DateInstance::DateInstance(ExecState* exec, double time) const GregorianDateTime* DateInstance::calculateGregorianDateTime(ExecState* exec) const { double milli = internalNumber(); - if (isnan(milli)) + if (std::isnan(milli)) return 0; if (!m_data) @@ -65,7 +65,7 @@ const GregorianDateTime* DateInstance::calculateGregorianDateTime(ExecState* exe const GregorianDateTime* DateInstance::calculateGregorianDateTimeUTC(ExecState* exec) const { double milli = internalNumber(); - if (isnan(milli)) + if (std::isnan(milli)) return 0; if (!m_data) diff --git a/src/3rdparty/javascriptcore/runtime/DatePrototype.cpp b/src/3rdparty/javascriptcore/runtime/DatePrototype.cpp index 915346587..ec2560e35 100644 --- a/src/3rdparty/javascriptcore/runtime/DatePrototype.cpp +++ b/src/3rdparty/javascriptcore/runtime/DatePrototype.cpp @@ -216,11 +216,7 @@ static bool fillStructuresUsingTimeArgs(ExecState* exec, const ArgList& args, in // milliseconds if (idx < numArgs) { double millis = args.at(idx).toNumber(exec); -#if defined(__GLIBCXX__) && (__GLIBCXX__ >= 20070724) && defined(__GXX_EXPERIMENTAL_CXX0X__) ok = std::isfinite(millis); -#else - ok = isfinite(millis); -#endif milliseconds += millis; } else milliseconds += *ms; @@ -657,7 +653,7 @@ JSValue JSC_HOST_CALL dateProtoFuncGetMilliSeconds(ExecState* exec, JSObject*, J DateInstance* thisDateObj = asDateInstance(thisValue); double milli = thisDateObj->internalNumber(); - if (isnan(milli)) + if (std::isnan(milli)) return jsNaN(exec); double secs = floor(milli / msPerSecond); @@ -672,7 +668,7 @@ JSValue JSC_HOST_CALL dateProtoFuncGetUTCMilliseconds(ExecState* exec, JSObject* DateInstance* thisDateObj = asDateInstance(thisValue); double milli = thisDateObj->internalNumber(); - if (isnan(milli)) + if (std::isnan(milli)) return jsNaN(exec); double secs = floor(milli / msPerSecond); @@ -714,7 +710,7 @@ static JSValue setNewValueFromTimeArgs(ExecState* exec, JSValue thisValue, const DateInstance* thisDateObj = asDateInstance(thisValue); double milli = thisDateObj->internalNumber(); - if (args.isEmpty() || isnan(milli)) { + if (args.isEmpty() || std::isnan(milli)) { JSValue result = jsNaN(exec); thisDateObj->setInternalValue(result); return result; @@ -758,7 +754,7 @@ static JSValue setNewValueFromDateArgs(ExecState* exec, JSValue thisValue, const double ms = 0; GregorianDateTime gregorianDateTime; - if (numArgsToUse == 3 && isnan(milli)) + if (numArgsToUse == 3 && std::isnan(milli)) msToGregorianDateTime(exec, 0, true, gregorianDateTime); else { ms = milli - floor(milli / msPerSecond) * msPerSecond; @@ -881,7 +877,7 @@ JSValue JSC_HOST_CALL dateProtoFuncSetYear(ExecState* exec, JSObject*, JSValue t double ms = 0; GregorianDateTime gregorianDateTime; - if (isnan(milli)) + if (std::isnan(milli)) // Based on ECMA 262 B.2.5 (setYear) // the time must be reset to +0 if it is NaN. msToGregorianDateTime(exec, 0, true, gregorianDateTime); diff --git a/src/3rdparty/javascriptcore/runtime/JSGlobalObjectFunctions.cpp b/src/3rdparty/javascriptcore/runtime/JSGlobalObjectFunctions.cpp index 6b87faaa1..4e0c0a1a6 100644 --- a/src/3rdparty/javascriptcore/runtime/JSGlobalObjectFunctions.cpp +++ b/src/3rdparty/javascriptcore/runtime/JSGlobalObjectFunctions.cpp @@ -309,13 +309,9 @@ JSValue JSC_HOST_CALL globalFuncParseInt(ExecState* exec, JSObject*, JSValue, co if (value.isDouble()) { double d = value.asDouble(); -#if defined(__GLIBCXX__) && (__GLIBCXX__ >= 20070724) && defined(__GXX_EXPERIMENTAL_CXX0X__) if (std::isfinite(d)) -#else - if (isfinite(d)) -#endif return jsNumber(exec, (d > 0) ? floor(d) : ceil(d)); - if (isnan(d) || isinf(d)) + if (std::isnan(d) || std::isinf(d)) return jsNaN(exec); return jsNumber(exec, 0); } @@ -330,13 +326,13 @@ JSValue JSC_HOST_CALL globalFuncParseFloat(ExecState* exec, JSObject*, JSValue, JSValue JSC_HOST_CALL globalFuncIsNaN(ExecState* exec, JSObject*, JSValue, const ArgList& args) { - return jsBoolean(isnan(args.at(0).toNumber(exec))); + return jsBoolean(std::isnan(args.at(0).toNumber(exec))); } JSValue JSC_HOST_CALL globalFuncIsFinite(ExecState* exec, JSObject*, JSValue, const ArgList& args) { double n = args.at(0).toNumber(exec); - return jsBoolean(!isnan(n) && !isinf(n)); + return jsBoolean(!std::isnan(n) && !std::isinf(n)); } JSValue JSC_HOST_CALL globalFuncDecodeURI(ExecState* exec, JSObject*, JSValue, const ArgList& args) diff --git a/src/3rdparty/javascriptcore/runtime/JSImmediate.h b/src/3rdparty/javascriptcore/runtime/JSImmediate.h index 15aa93d72..a093cc2eb 100644 --- a/src/3rdparty/javascriptcore/runtime/JSImmediate.h +++ b/src/3rdparty/javascriptcore/runtime/JSImmediate.h @@ -486,7 +486,7 @@ namespace JSC { const int intVal = static_cast(d); // Check for data loss from conversion to int. - if (intVal != d || (!intVal && signbit(d))) + if (intVal != d || (!intVal && std::signbit(d))) return fromNumberOutsideIntegerRange(d); return from(intVal); diff --git a/src/3rdparty/javascriptcore/runtime/JSONObject.cpp b/src/3rdparty/javascriptcore/runtime/JSONObject.cpp index beff847c5..af4dfcc70 100644 --- a/src/3rdparty/javascriptcore/runtime/JSONObject.cpp +++ b/src/3rdparty/javascriptcore/runtime/JSONObject.cpp @@ -399,11 +399,7 @@ Stringifier::StringifyResult Stringifier::appendStringifiedValue(StringBuilder& double numericValue; if (value.getNumber(numericValue)) { -#if defined(__GLIBCXX__) && (__GLIBCXX__ >= 20070724) && defined(__GXX_EXPERIMENTAL_CXX0X__) if (!std::isfinite(numericValue)) -#else - if (!isfinite(numericValue)) -#endif builder.append("null"); else builder.append(UString::from(numericValue)); diff --git a/src/3rdparty/javascriptcore/runtime/JSValue.cpp b/src/3rdparty/javascriptcore/runtime/JSValue.cpp index 9b245ec8d..72d8fd0b4 100644 --- a/src/3rdparty/javascriptcore/runtime/JSValue.cpp +++ b/src/3rdparty/javascriptcore/runtime/JSValue.cpp @@ -43,7 +43,7 @@ double JSValue::toInteger(ExecState* exec) const if (isInt32()) return asInt32(); double d = toNumber(exec); - return isnan(d) ? 0.0 : trunc(d); + return std::isnan(d) ? 0.0 : trunc(d); } double JSValue::toIntegerPreserveNaN(ExecState* exec) const @@ -141,7 +141,7 @@ int32_t toInt32SlowCase(double d, bool& ok) if (d >= -D32 / 2 && d < D32 / 2) return static_cast(d); - if (isnan(d) || isinf(d)) { + if (std::isnan(d) || std::isinf(d)) { ok = false; return 0; } @@ -161,7 +161,7 @@ uint32_t toUInt32SlowCase(double d, bool& ok) if (d >= 0.0 && d < D32) return static_cast(d); - if (isnan(d) || isinf(d)) { + if (std::isnan(d) || std::isinf(d)) { ok = false; return 0; } diff --git a/src/3rdparty/javascriptcore/runtime/JSValue.h b/src/3rdparty/javascriptcore/runtime/JSValue.h index d384cc2b3..6e01d9826 100644 --- a/src/3rdparty/javascriptcore/runtime/JSValue.h +++ b/src/3rdparty/javascriptcore/runtime/JSValue.h @@ -25,7 +25,7 @@ #include "CallData.h" #include "ConstructData.h" -#include +#include #include // for size_t #include #include @@ -606,11 +606,7 @@ namespace JSC { inline JSValue::JSValue(ExecState* exec, double d) { const int32_t asInt32 = static_cast(d); -#if defined(__GLIBCXX__) && (__GLIBCXX__ >= 20070724) && defined(__GXX_EXPERIMENTAL_CXX0X__) if (asInt32 != d || (!asInt32 && std::signbit(d))) { // true for -0.0 -#else - if (asInt32 != d || (!asInt32 && signbit(d))) { // true for -0.0 -#endif u.asDouble = d; return; } @@ -691,11 +687,7 @@ namespace JSC { inline JSValue::JSValue(JSGlobalData* globalData, double d) { const int32_t asInt32 = static_cast(d); -#if defined(__GLIBCXX__) && (__GLIBCXX__ >= 20070724) && defined(__GXX_EXPERIMENTAL_CXX0X__) if (asInt32 != d || (!asInt32 && std::signbit(d))) { // true for -0.0 -#else - if (asInt32 != d || (!asInt32 && signbit(d))) { // true for -0.0 -#endif u.asDouble = d; return; } diff --git a/src/3rdparty/javascriptcore/runtime/MathObject.cpp b/src/3rdparty/javascriptcore/runtime/MathObject.cpp index 524d29121..2cec97083 100644 --- a/src/3rdparty/javascriptcore/runtime/MathObject.cpp +++ b/src/3rdparty/javascriptcore/runtime/MathObject.cpp @@ -166,15 +166,11 @@ JSValue JSC_HOST_CALL mathProtoFuncMax(ExecState* exec, JSObject*, JSValue, cons double result = -Inf; for (unsigned k = 0; k < argsCount; ++k) { double val = args.at(k).toNumber(exec); - if (isnan(val)) { + if (std::isnan(val)) { result = NaN; break; } -#if defined(__GLIBCXX__) && (__GLIBCXX__ >= 20070724) && defined(__GXX_EXPERIMENTAL_CXX0X__) if (val > result || (val == 0 && result == 0 && !std::signbit(val))) -#else - if (val > result || (val == 0 && result == 0 && !signbit(val))) -#endif result = val; } return jsNumber(exec, result); @@ -186,15 +182,11 @@ JSValue JSC_HOST_CALL mathProtoFuncMin(ExecState* exec, JSObject*, JSValue, cons double result = +Inf; for (unsigned k = 0; k < argsCount; ++k) { double val = args.at(k).toNumber(exec); - if (isnan(val)) { + if (std::isnan(val)) { result = NaN; break; } -#if defined(__GLIBCXX__) && (__GLIBCXX__ >= 20070724) && defined(__GXX_EXPERIMENTAL_CXX0X__) if (val < result || (val == 0 && result == 0 && std::signbit(val))) -#else - if (val < result || (val == 0 && result == 0 && signbit(val))) -#endif result = val; } return jsNumber(exec, result); @@ -207,9 +199,9 @@ JSValue JSC_HOST_CALL mathProtoFuncPow(ExecState* exec, JSObject*, JSValue, cons double arg = args.at(0).toNumber(exec); double arg2 = args.at(1).toNumber(exec); - if (isnan(arg2)) + if (std::isnan(arg2)) return jsNaN(exec); - if (isinf(arg2) && fabs(arg) == 1) + if (std::isinf(arg2) && fabs(arg) == 1) return jsNaN(exec); return jsNumber(exec, pow(arg, arg2)); } @@ -222,11 +214,7 @@ JSValue JSC_HOST_CALL mathProtoFuncRandom(ExecState* exec, JSObject*, JSValue, c JSValue JSC_HOST_CALL mathProtoFuncRound(ExecState* exec, JSObject*, JSValue, const ArgList& args) { double arg = args.at(0).toNumber(exec); -#if defined(__GLIBCXX__) && (__GLIBCXX__ >= 20070724) && defined(__GXX_EXPERIMENTAL_CXX0X__) if (std::signbit(arg) && arg >= -0.5) -#else - if (signbit(arg) && arg >= -0.5) -#endif return jsNumber(exec, -0.0); double integer = ceil(arg); return jsNumber(exec, integer - (integer - arg > 0.5)); diff --git a/src/3rdparty/javascriptcore/runtime/NumberPrototype.cpp b/src/3rdparty/javascriptcore/runtime/NumberPrototype.cpp index bfca4d141..02f96498c 100644 --- a/src/3rdparty/javascriptcore/runtime/NumberPrototype.cpp +++ b/src/3rdparty/javascriptcore/runtime/NumberPrototype.cpp @@ -157,7 +157,7 @@ JSValue JSC_HOST_CALL numberProtoFuncToString(ExecState* exec, JSObject*, JSValu char s[2048 + 3]; const char* lastCharInString = s + sizeof(s) - 1; double x = v.uncheckedGetNumber(); - if (isnan(x) || isinf(x)) + if (std::isnan(x) || std::isinf(x)) return jsString(exec, UString::from(x)); bool isNegative = x < 0.0; @@ -233,7 +233,7 @@ JSValue JSC_HOST_CALL numberProtoFuncToFixed(ExecState* exec, JSObject*, JSValue int f = static_cast(df); double x = v.uncheckedGetNumber(); - if (isnan(x)) + if (std::isnan(x)) return jsNontrivialString(exec, "NaN"); UString s; @@ -319,7 +319,7 @@ JSValue JSC_HOST_CALL numberProtoFuncToExponential(ExecState* exec, JSObject*, J double x = v.uncheckedGetNumber(); - if (isnan(x) || isinf(x)) + if (std::isnan(x) || std::isinf(x)) return jsString(exec, UString::from(x)); JSValue fractionalDigitsValue = args.at(0); @@ -345,7 +345,7 @@ JSValue JSC_HOST_CALL numberProtoFuncToExponential(ExecState* exec, JSObject*, J decimalAdjust = static_cast(logx); } - if (isnan(x)) + if (std::isnan(x)) return jsNontrivialString(exec, "NaN"); if (x == -0.0) // (-0.0).toExponential() should print as 0 instead of -0 @@ -391,7 +391,7 @@ JSValue JSC_HOST_CALL numberProtoFuncToPrecision(ExecState* exec, JSObject*, JSV double doublePrecision = args.at(0).toIntegerPreserveNaN(exec); double x = v.uncheckedGetNumber(); - if (args.at(0).isUndefined() || isnan(x) || isinf(x)) + if (args.at(0).isUndefined() || std::isnan(x) || std::isinf(x)) return jsString(exec, v.toString(exec)); UString s; diff --git a/src/3rdparty/javascriptcore/runtime/StringPrototype.cpp b/src/3rdparty/javascriptcore/runtime/StringPrototype.cpp index fa48cde2c..b544d1fed 100644 --- a/src/3rdparty/javascriptcore/runtime/StringPrototype.cpp +++ b/src/3rdparty/javascriptcore/runtime/StringPrototype.cpp @@ -675,9 +675,9 @@ JSValue JSC_HOST_CALL stringProtoFuncSubstring(ExecState* exec, JSObject*, JSVal double start = a0.toNumber(exec); double end = a1.toNumber(exec); - if (isnan(start)) + if (std::isnan(start)) start = 0; - if (isnan(end)) + if (std::isnan(end)) end = 0; if (start < 0) start = 0; diff --git a/src/3rdparty/javascriptcore/runtime/UStringImpl.h b/src/3rdparty/javascriptcore/runtime/UStringImpl.h index 8beb07f78..1bbbeeb53 100644 --- a/src/3rdparty/javascriptcore/runtime/UStringImpl.h +++ b/src/3rdparty/javascriptcore/runtime/UStringImpl.h @@ -71,28 +71,28 @@ public: return adoptRef(new UStringImpl(buffer, length, sharedBuffer)); } - static PassRefPtr createUninitialized(unsigned length, UChar*& output) + static PassRefPtr createUninitialized(unsigned int length, UChar*& output) { if (!length) { output = 0; return &empty(); } - if (length > ((std::numeric_limits::max() - sizeof(UStringImpl)) / sizeof(UChar))) + if (length > ((std::numeric_limits::max() - sizeof(UStringImpl)) / sizeof(UChar))) CRASH(); UStringImpl* resultImpl = static_cast(fastMalloc(sizeof(UChar) * length + sizeof(UStringImpl))); output = reinterpret_cast(resultImpl + 1); return adoptRef(new(resultImpl) UStringImpl(output, length, BufferInternal)); } - static PassRefPtr tryCreateUninitialized(unsigned length, UChar*& output) + static PassRefPtr tryCreateUninitialized(unsigned int length, UChar*& output) { if (!length) { output = 0; return &empty(); } - if (length > ((std::numeric_limits::max() - sizeof(UStringImpl)) / sizeof(UChar))) + if (length > ((std::numeric_limits::max() - sizeof(UStringImpl)) / sizeof(UChar))) return 0; UStringImpl* resultImpl = static_cast(tryFastMalloc(sizeof(UChar) * length + sizeof(UStringImpl))); if (!resultImpl) diff --git a/src/3rdparty/javascriptcore/wtf/DateMath.cpp b/src/3rdparty/javascriptcore/wtf/DateMath.cpp index ed6ef7b21..8c4f2e2fd 100644 --- a/src/3rdparty/javascriptcore/wtf/DateMath.cpp +++ b/src/3rdparty/javascriptcore/wtf/DateMath.cpp @@ -838,7 +838,7 @@ double parseDateFromNullTerminatedCharacters(const char* dateString) bool haveTZ; int offset; double ms = parseDateFromNullTerminatedCharacters(dateString, haveTZ, offset); - if (isnan(ms)) + if (std::isnan(ms)) return NaN; // fall back to local timezone @@ -850,11 +850,7 @@ double parseDateFromNullTerminatedCharacters(const char* dateString) double timeClip(double t) { -#if defined(__GLIBCXX__) && (__GLIBCXX__ >= 20070724) && defined(__GXX_EXPERIMENTAL_CXX0X__) if (!std::isfinite(t)) -#else - if (!isfinite(t)) -#endif return NaN; if (fabs(t) > maxECMAScriptTime) return NaN; @@ -966,7 +962,7 @@ double parseDateFromNullTerminatedCharacters(ExecState* exec, const char* dateSt bool haveTZ; int offset; double ms = WTF::parseDateFromNullTerminatedCharacters(dateString, haveTZ, offset); - if (isnan(ms)) + if (std::isnan(ms)) return NaN; // fall back to local timezone diff --git a/src/3rdparty/javascriptcore/wtf/MathExtras.h b/src/3rdparty/javascriptcore/wtf/MathExtras.h index f586f1d41..d0da62487 100644 --- a/src/3rdparty/javascriptcore/wtf/MathExtras.h +++ b/src/3rdparty/javascriptcore/wtf/MathExtras.h @@ -30,15 +30,6 @@ #include #include -#if OS(SOLARIS) -#include -#endif - -#if OS(OPENBSD) -#include -#include -#endif - #ifndef M_PI const double piDouble = 3.14159265358979323846; const float piFloat = 3.14159265358979323846f; @@ -55,31 +46,6 @@ const double piOverFourDouble = M_PI_4; const float piOverFourFloat = static_cast(M_PI_4); #endif -#if OS(SOLARIS) - -#ifndef isfinite -inline bool isfinite(double x) { return finite(x) && !isnand(x); } -#endif -#ifndef isinf -inline bool isinf(double x) { return !finite(x) && !isnand(x); } -#endif -#ifndef signbit -inline bool signbit(double x) { return x < 0.0; } // FIXME: Wrong for negative 0. -#endif - -#endif - -#if OS(OPENBSD) - -#ifndef isfinite -inline bool isfinite(double x) { return finite(x); } -#endif -#ifndef signbit -inline bool signbit(double x) { struct ieee_double *p = (struct ieee_double *)&x; return p->dbl_sign; } -#endif - -#endif - inline double deg2rad(double d) { return d * piDouble / 180.0; } inline double rad2deg(double r) { return r * 180.0 / piDouble; } inline double deg2grad(double d) { return d * 400.0 / 360.0; } diff --git a/src/3rdparty/javascriptcore/wtf/Vector.h b/src/3rdparty/javascriptcore/wtf/Vector.h index 36d5584c8..5e4bcb287 100644 --- a/src/3rdparty/javascriptcore/wtf/Vector.h +++ b/src/3rdparty/javascriptcore/wtf/Vector.h @@ -36,17 +36,14 @@ namespace WTF { using std::max; // WTF_ALIGN_OF / WTF_ALIGNED - #if COMPILER(GCC) || COMPILER(MINGW) || COMPILER(RVCT) || COMPILER(WINSCW) + #if COMPILER(GCC) #define WTF_ALIGN_OF(type) __alignof__(type) #define WTF_ALIGNED(variable_type, variable, n) variable_type variable __attribute__((__aligned__(n))) - #elif COMPILER(MSVC) - #define WTF_ALIGN_OF(type) __alignof(type) - #define WTF_ALIGNED(variable_type, variable, n) __declspec(align(n)) variable_type variable #else #define WTF_ALIGN_OF(type) 0 #endif - #if COMPILER(GCC) && !COMPILER(INTEL) && (((__GNUC__ * 100) + __GNUC_MINOR__) >= 303) + #if COMPILER(GCC) && !COMPILER(INTEL) typedef char __attribute__((__may_alias__)) AlignedBufferChar; #else typedef char AlignedBufferChar; diff --git a/src/3rdparty/javascriptcore/wtf/dtoa.cpp b/src/3rdparty/javascriptcore/wtf/dtoa.cpp index e73cdf521..3d3e50075 100644 --- a/src/3rdparty/javascriptcore/wtf/dtoa.cpp +++ b/src/3rdparty/javascriptcore/wtf/dtoa.cpp @@ -774,7 +774,7 @@ static ALWAYS_INLINE void diff(BigInt& c, const BigInt& aRef, const BigInt& bRef static double ulp(U *x) { - register int32_t L; + int32_t L; U u; L = (word0(x) & Exp_mask) - (P - 1) * Exp_msk1; @@ -2379,7 +2379,7 @@ void doubleToStringInJavaScriptFormat(double d, DtoaBuffer buffer, unsigned* res Q_ASSERT(buffer); // avoid ever printing -NaN, in JS conceptually there is only one NaN value - if (isnan(d)) { + if (std::isnan(d)) { append(buffer, "NaN", 3); if (resultLength) *resultLength = 3; diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 29be18942..28ab3e54c 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -152,7 +152,6 @@ set(CORE_PUBLIC_HEADERS QStateMachine QVariantComparisonHelper QMetaObject - QBasicAtomicPointer QPauseAnimation QMapData QByteRef @@ -178,7 +177,6 @@ set(CORE_PUBLIC_HEADERS QCharRef QReturnArgument QMetaObjectAccessor - QBasicAtomicInt QConcatenable QLocale QMetaType @@ -260,7 +258,6 @@ set(CORE_PUBLIC_HEADERS ) include(animation/animation.cmake) -include(arch/arch.cmake) include(codecs/codecs.cmake) include(concurrent/concurrent.cmake) include(global/global.cmake) @@ -280,7 +277,6 @@ include_directories( ${CMAKE_BINARY_DIR}/include/QtCore ${CMAKE_BINARY_DIR}/privateinclude/QtCore ${CMAKE_CURRENT_SOURCE_DIR}/animation - ${CMAKE_CURRENT_SOURCE_DIR}/arch ${CMAKE_CURRENT_SOURCE_DIR}/codecs ${CMAKE_CURRENT_SOURCE_DIR}/concurrent ${CMAKE_CURRENT_SOURCE_DIR}/global @@ -293,7 +289,6 @@ include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/tools ${CMAKE_CURRENT_SOURCE_DIR}/xml ${CMAKE_CURRENT_BINARY_DIR}/animation - ${CMAKE_CURRENT_BINARY_DIR}/arch ${CMAKE_CURRENT_BINARY_DIR}/codecs ${CMAKE_CURRENT_BINARY_DIR}/concurrent ${CMAKE_CURRENT_BINARY_DIR}/global diff --git a/src/core/animation/qvariantanimation.cpp b/src/core/animation/qvariantanimation.cpp index 38ef2469e..429b583fc 100644 --- a/src/core/animation/qvariantanimation.cpp +++ b/src/core/animation/qvariantanimation.cpp @@ -293,7 +293,7 @@ void QVariantAnimationPrivate::setCurrentValueForProgress(const qreal progress) localProgress); qSwap(currentValue, ret); q->updateCurrentValue(currentValue); - static QBasicAtomicInt changedSignalIndex = Q_BASIC_ATOMIC_INITIALIZER(0); + static QAtomicInt changedSignalIndex = QAtomicInt(0); if (!changedSignalIndex) { //we keep the mask so that we emit valueChanged only when needed (for performance reasons) changedSignalIndex.testAndSetRelaxed(0, signalIndex("valueChanged(QVariant)")); diff --git a/src/core/arch/qatomic_bootstrap.h b/src/core/arch/qatomic_bootstrap.h deleted file mode 100644 index 471a72f66..000000000 --- a/src/core/arch/qatomic_bootstrap.h +++ /dev/null @@ -1,99 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QATOMIC_BOOTSTRAP_H -#define QATOMIC_BOOTSTRAP_H - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -inline bool QBasicAtomicInt::ref() -{ - return ++_q_value != 0; -} - -inline bool QBasicAtomicInt::deref() -{ - return --_q_value != 0; -} - -inline bool QBasicAtomicInt::testAndSetOrdered(int expectedValue, int newValue) -{ - if (_q_value == expectedValue) { - _q_value = newValue; - return true; - } - return false; -} - -inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue) -{ - return testAndSetOrdered(expectedValue, newValue); -} - -inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue) -{ - return testAndSetOrdered(expectedValue, newValue); -} - -inline int QBasicAtomicInt::fetchAndAddRelaxed(int valueToAdd) -{ - int returnValue = _q_value; - _q_value += valueToAdd; - return returnValue; -} - -template -Q_INLINE_TEMPLATE bool QBasicAtomicPointer::testAndSetOrdered(T *expectedValue, T *newValue) -{ - if (_q_value == expectedValue) { - _q_value = newValue; - return true; - } - return false; -} - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QATOMIC_BOOTSTRAP_H diff --git a/src/core/arch/qatomic_generic.h b/src/core/arch/qatomic_generic.h deleted file mode 100644 index f0cfb67d7..000000000 --- a/src/core/arch/qatomic_generic.h +++ /dev/null @@ -1,235 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QATOMIC_GENERIC_H -#define QATOMIC_GENERIC_H - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -#define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_NOT_NATIVE -#define Q_ATOMIC_INT_TEST_AND_SET_IS_NOT_NATIVE -#define Q_ATOMIC_INT_FETCH_AND_STORE_IS_NOT_NATIVE -#define Q_ATOMIC_INT_FETCH_AND_ADD_IS_NOT_NATIVE -#define Q_ATOMIC_POINTER_TEST_AND_SET_IS_NOT_NATIVE -#define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_NOT_NATIVE -#define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_NOT_NATIVE - -Q_CORE_EXPORT bool QBasicAtomicInt_testAndSetOrdered(volatile int *, int, int); -Q_CORE_EXPORT int QBasicAtomicInt_fetchAndStoreOrdered(volatile int *, int); -Q_CORE_EXPORT int QBasicAtomicInt_fetchAndAddOrdered(volatile int *, int); - -Q_CORE_EXPORT bool QBasicAtomicPointer_testAndSetOrdered(void * volatile *, void *, void *); -Q_CORE_EXPORT void *QBasicAtomicPointer_fetchAndStoreOrdered(void * volatile *, void *); -Q_CORE_EXPORT void *QBasicAtomicPointer_fetchAndAddOrdered(void * volatile *, qptrdiff); - -// Reference counting - -inline bool QBasicAtomicInt::ref() -{ - return QBasicAtomicInt_fetchAndAddOrdered(&_q_value, 1) != -1; -} - -inline bool QBasicAtomicInt::deref() -{ - return QBasicAtomicInt_fetchAndAddOrdered(&_q_value, -1) != 1; -} - -// Test and set for integers - -inline bool QBasicAtomicInt::testAndSetOrdered(int expectedValue, int newValue) -{ - return QBasicAtomicInt_testAndSetOrdered(&_q_value, expectedValue, newValue); -} - -inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue) -{ - return testAndSetOrdered(expectedValue, newValue); -} - -inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue) -{ - return testAndSetOrdered(expectedValue, newValue); -} - -inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue) -{ - return testAndSetOrdered(expectedValue, newValue); -} - -// Fetch and store for integers - -inline int QBasicAtomicInt::fetchAndStoreOrdered(int newValue) -{ - return QBasicAtomicInt_fetchAndStoreOrdered(&_q_value, newValue); -} - -inline int QBasicAtomicInt::fetchAndStoreRelaxed(int newValue) -{ - return fetchAndStoreOrdered(newValue); -} - -inline int QBasicAtomicInt::fetchAndStoreAcquire(int newValue) -{ - return fetchAndStoreOrdered(newValue); -} - -inline int QBasicAtomicInt::fetchAndStoreRelease(int newValue) -{ - return fetchAndStoreOrdered(newValue); -} - -// Fetch and add for integers - -inline int QBasicAtomicInt::fetchAndAddOrdered(int valueToAdd) -{ - return QBasicAtomicInt_fetchAndAddOrdered(&_q_value, valueToAdd); -} - -inline int QBasicAtomicInt::fetchAndAddRelaxed(int valueToAdd) -{ - return fetchAndAddOrdered(valueToAdd); -} - -inline int QBasicAtomicInt::fetchAndAddAcquire(int valueToAdd) -{ - return fetchAndAddOrdered(valueToAdd); -} - -inline int QBasicAtomicInt::fetchAndAddRelease(int valueToAdd) -{ - return fetchAndAddOrdered(valueToAdd); -} - -// Test and set for pointers - -template -Q_INLINE_TEMPLATE bool QBasicAtomicPointer::testAndSetOrdered(T *expectedValue, T *newValue) -{ - union { T * volatile * typed; void * volatile * voidp; } pointer; - pointer.typed = &_q_value; - return QBasicAtomicPointer_testAndSetOrdered(pointer.voidp, expectedValue, newValue); -} - -template -Q_INLINE_TEMPLATE bool QBasicAtomicPointer::testAndSetRelaxed(T *expectedValue, T *newValue) -{ - return testAndSetOrdered(expectedValue, newValue); -} - -template -Q_INLINE_TEMPLATE bool QBasicAtomicPointer::testAndSetAcquire(T *expectedValue, T *newValue) -{ - return testAndSetOrdered(expectedValue, newValue); -} - -template -Q_INLINE_TEMPLATE bool QBasicAtomicPointer::testAndSetRelease(T *expectedValue, T *newValue) -{ - return testAndSetOrdered(expectedValue, newValue); -} - -// Fetch and store for pointers - -template -Q_INLINE_TEMPLATE T *QBasicAtomicPointer::fetchAndStoreOrdered(T *newValue) -{ - union { T * volatile * typed; void * volatile * voidp; } pointer; - union { T *typed; void *voidp; } returnValue; - pointer.typed = &_q_value; - returnValue.voidp = QBasicAtomicPointer_fetchAndStoreOrdered(pointer.voidp, newValue); - return returnValue.typed; -} - -template -Q_INLINE_TEMPLATE T *QBasicAtomicPointer::fetchAndStoreRelaxed(T *newValue) -{ - return fetchAndStoreOrdered(newValue); -} - -template -Q_INLINE_TEMPLATE T *QBasicAtomicPointer::fetchAndStoreAcquire(T *newValue) -{ - return fetchAndStoreOrdered(newValue); -} - -template -Q_INLINE_TEMPLATE T *QBasicAtomicPointer::fetchAndStoreRelease(T *newValue) -{ - return fetchAndStoreOrdered(newValue); -} - -// Fetch and add for pointers - -template -Q_INLINE_TEMPLATE T *QBasicAtomicPointer::fetchAndAddOrdered(qptrdiff valueToAdd) -{ - union { T * volatile *typed; void * volatile *voidp; } pointer; - union { T *typed; void *voidp; } returnValue; - pointer.typed = &_q_value; - returnValue.voidp = QBasicAtomicPointer_fetchAndAddOrdered(pointer.voidp, valueToAdd * sizeof(T)); - return returnValue.typed; -} - -template -Q_INLINE_TEMPLATE T *QBasicAtomicPointer::fetchAndAddRelaxed(qptrdiff valueToAdd) -{ - return fetchAndAddOrdered(valueToAdd); -} - -template -Q_INLINE_TEMPLATE T *QBasicAtomicPointer::fetchAndAddAcquire(qptrdiff valueToAdd) -{ - return fetchAndAddOrdered(valueToAdd); -} - -template -Q_INLINE_TEMPLATE T *QBasicAtomicPointer::fetchAndAddRelease(qptrdiff valueToAdd) -{ - return fetchAndAddOrdered(valueToAdd); -} - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QATOMIC_GENERIC_H diff --git a/src/core/arch/qatomic_unix.cpp b/src/core/arch/qatomic_unix.cpp deleted file mode 100644 index f52d41f25..000000000 --- a/src/core/arch/qatomic_unix.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - - -#include "qplatformdefs.h" - -#include - -QT_BEGIN_NAMESPACE -static pthread_mutex_t qAtomicMutex = PTHREAD_MUTEX_INITIALIZER; - -Q_CORE_EXPORT -bool QBasicAtomicInt_testAndSetOrdered(volatile int *_q_value, int expectedValue, int newValue) -{ - bool returnValue = false; - pthread_mutex_lock(&qAtomicMutex); - if (*_q_value == expectedValue) { - *_q_value = newValue; - returnValue = true; - } - pthread_mutex_unlock(&qAtomicMutex); - return returnValue; -} - -Q_CORE_EXPORT -int QBasicAtomicInt_fetchAndStoreOrdered(volatile int *_q_value, int newValue) -{ - int returnValue; - pthread_mutex_lock(&qAtomicMutex); - returnValue = *_q_value; - *_q_value = newValue; - pthread_mutex_unlock(&qAtomicMutex); - return returnValue; -} - -Q_CORE_EXPORT -int QBasicAtomicInt_fetchAndAddOrdered(volatile int *_q_value, int valueToAdd) -{ - int returnValue; - pthread_mutex_lock(&qAtomicMutex); - returnValue = *_q_value; - *_q_value += valueToAdd; - pthread_mutex_unlock(&qAtomicMutex); - return returnValue; -} - -Q_CORE_EXPORT -bool QBasicAtomicPointer_testAndSetOrdered(void * volatile *_q_value, - void *expectedValue, - void *newValue) -{ - bool returnValue = false; - pthread_mutex_lock(&qAtomicMutex); - if (*_q_value == expectedValue) { - *_q_value = newValue; - returnValue = true; - } - pthread_mutex_unlock(&qAtomicMutex); - return returnValue; -} - -Q_CORE_EXPORT -void *QBasicAtomicPointer_fetchAndStoreOrdered(void * volatile *_q_value, void *newValue) -{ - void *returnValue; - pthread_mutex_lock(&qAtomicMutex); - returnValue = *_q_value; - *_q_value = newValue; - pthread_mutex_unlock(&qAtomicMutex); - return returnValue; -} - -Q_CORE_EXPORT -void *QBasicAtomicPointer_fetchAndAddOrdered(void * volatile *_q_value, qptrdiff valueToAdd) -{ - void *returnValue; - pthread_mutex_lock(&qAtomicMutex); - returnValue = *_q_value; - *_q_value = reinterpret_cast(returnValue) + valueToAdd; - pthread_mutex_unlock(&qAtomicMutex); - return returnValue; -} -QT_END_NAMESPACE diff --git a/src/core/concurrent/qtconcurrentiteratekernel.h b/src/core/concurrent/qtconcurrentiteratekernel.h index e44f919c7..72991c6fd 100644 --- a/src/core/concurrent/qtconcurrentiteratekernel.h +++ b/src/core/concurrent/qtconcurrentiteratekernel.h @@ -50,9 +50,7 @@ #include #include -#ifndef QT_NO_STL -# include -#endif +#include QT_BEGIN_HEADER QT_BEGIN_NAMESPACE @@ -61,16 +59,7 @@ QT_BEGIN_NAMESPACE namespace QtConcurrent { -#ifndef QT_NO_STL using std::advance; -#else - template - void advance(It &it, T value) - { - it+=value; - } -#endif - /* The BlockSizeManager class manages how many iterations a thread should reserve and process at a time. This is done by measuring the time spent @@ -148,7 +137,6 @@ public: inline void * getPointer() { return 0; } }; -#ifndef QT_NO_STL inline bool selectIteration(std::bidirectional_iterator_tag) { return false; // while @@ -163,14 +151,6 @@ inline bool selectIteration(std::random_access_iterator_tag) { return true; // for } -#else -// no stl support, always use while iteration -template -inline bool selectIteration(T) -{ - return false; // while -} -#endif template class IterateKernel : public ThreadEngine @@ -179,20 +159,11 @@ public: typedef T ResultType; IterateKernel(Iterator _begin, Iterator _end) -#if defined (QT_NO_STL) - : begin(_begin), end(_end), current(_begin), currentIndex(0), - forIteration(false), progressReportingEnabled(true) -#else : begin(_begin), end(_end), current(_begin), currentIndex(0), forIteration(selectIteration(typename std::iterator_traits::iterator_category())), progressReportingEnabled(true) -#endif { -#if defined (QT_NO_STL) - iterationCount = 0; -#else iterationCount = forIteration ? std::distance(_begin, _end) : 0; -#endif } virtual ~IterateKernel() { } diff --git a/src/core/global/global.cmake b/src/core/global/global.cmake index 7f198c992..8ac2ad2f8 100644 --- a/src/core/global/global.cmake +++ b/src/core/global/global.cmake @@ -3,7 +3,6 @@ set(CORE_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/global/qnamespace.h ${CMAKE_CURRENT_SOURCE_DIR}/global/qendian.h ${CMAKE_CURRENT_SOURCE_DIR}/global/qnumeric.h - ${CMAKE_CURRENT_SOURCE_DIR}/global/qnumeric_p.h ${CMAKE_CURRENT_SOURCE_DIR}/global/qfeatures.h ${CMAKE_CURRENT_SOURCE_DIR}/global/qlibraryinfo.h ) diff --git a/src/core/global/qconfig.h.cmake b/src/core/global/qconfig.h.cmake index d0adbfa85..95a4de92b 100644 --- a/src/core/global/qconfig.h.cmake +++ b/src/core/global/qconfig.h.cmake @@ -98,7 +98,7 @@ /* Data structures */ #cmakedefine QT_NO_QUUID_STRING -#cmakedefine QT_NO_STL +#cmakedefine QT_NO_STL_WCHAR #cmakedefine QT_NO_TEXTDATE #cmakedefine QT_NO_DATESTRING diff --git a/src/core/global/qfeatures.h b/src/core/global/qfeatures.h index e7ec44957..0ee22c179 100644 --- a/src/core/global/qfeatures.h +++ b/src/core/global/qfeatures.h @@ -223,9 +223,6 @@ // Status Tip //#define QT_NO_STATUSTIP -// Standard Template Library -//#define QT_NO_STL - // QMotifStyle //#define QT_NO_STYLE_MOTIF diff --git a/src/core/global/qglobal.h.cmake b/src/core/global/qglobal.h.cmake index d59805498..df54b7d8d 100644 --- a/src/core/global/qglobal.h.cmake +++ b/src/core/global/qglobal.h.cmake @@ -139,9 +139,7 @@ #ifdef __cplusplus -#ifndef QT_NO_STL #include -#endif #ifndef QT_NAMESPACE /* user namespace */ @@ -386,34 +384,11 @@ namespace QT_NAMESPACE {} # define __has_extension __has_feature # endif # endif -# ifdef __APPLE__ -# define Q_NO_DEPRECATED_CONSTRUCTORS -# endif -# if __GNUC__ == 2 && __GNUC_MINOR__ <= 7 -# define Q_FULL_TEMPLATE_INSTANTIATION -# endif -/* GCC 2.95 knows "using" but does not support it correctly */ -# if __GNUC__ == 2 && __GNUC_MINOR__ <= 95 -# define Q_NO_USING_KEYWORD -# define QT_NO_STL_WCHAR -# endif -# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) -# define Q_ALIGNOF(type) __alignof__(type) -# define Q_TYPEOF(expr) __typeof__(expr) -# define Q_DECL_ALIGN(n) __attribute__((__aligned__(n))) -# endif -# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) -# define Q_LIKELY(expr) __builtin_expect(!!(expr), true) -# define Q_UNLIKELY(expr) __builtin_expect(!!(expr), false) -# endif -/* GCC 3.1 and GCC 3.2 wrongly define _SB_CTYPE_MACROS on HP-UX */ -# if defined(Q_OS_HPUX) && __GNUC__ == 3 && __GNUC_MINOR__ >= 1 -# define Q_WRONG_SB_CTYPE_MACROS -# endif -/* GCC <= 3.3 cannot handle template friends */ -# if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ <= 3) -# define Q_NO_TEMPLATE_FRIENDS -# endif +# define Q_ALIGNOF(type) __alignof__(type) +# define Q_TYPEOF(expr) __typeof__(expr) +# define Q_DECL_ALIGN(n) __attribute__((__aligned__(n))) +# define Q_LIKELY(expr) __builtin_expect(!!(expr), true) +# define Q_UNLIKELY(expr) __builtin_expect(!!(expr), false) # if (defined(Q_CC_GNU) || defined(Q_CC_INTEL)) && !defined(QT_MOC_CPP) # define Q_PACKED __attribute__ ((__packed__)) # define Q_NO_PACKED_REFERENCE @@ -753,31 +728,23 @@ namespace QT_NAMESPACE {} #if defined(Q_CC_GNU) && !defined(Q_CC_INTEL) && !defined(Q_CC_CLANG) # if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L -# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 403 - /* C++0x features supported in GCC 4.3: */ -# define Q_COMPILER_RVALUE_REFS -# define Q_COMPILER_DECLTYPE -# endif -# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 - /* C++0x features supported in GCC 4.4: */ -# define Q_COMPILER_VARIADIC_TEMPLATES -# define Q_COMPILER_AUTO_FUNCTION -# define Q_COMPILER_AUTO_TYPE -# define Q_COMPILER_EXTERN_TEMPLATES -# define Q_COMPILER_DEFAULT_DELETE_MEMBERS -# define Q_COMPILER_CLASS_ENUM -# define Q_COMPILER_INITIALIZER_LISTS -# endif -# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 405 - /* C++0x features supported in GCC 4.5: */ -# define Q_COMPILER_LAMBDA -# define Q_COMPILER_UNICODE_STRINGS -# endif -# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 - /* C++0x features supported in GCC 4.6: */ -# define Q_COMPILER_CONSTEXPR -# define Q_COMPILER_NULLPTR -# endif + /* C++0x features supported in GCC 4.3: */ +# define Q_COMPILER_RVALUE_REFS +# define Q_COMPILER_DECLTYPE + /* C++0x features supported in GCC 4.4: */ +# define Q_COMPILER_VARIADIC_TEMPLATES +# define Q_COMPILER_AUTO_FUNCTION +# define Q_COMPILER_AUTO_TYPE +# define Q_COMPILER_EXTERN_TEMPLATES +# define Q_COMPILER_DEFAULT_DELETE_MEMBERS +# define Q_COMPILER_CLASS_ENUM +# define Q_COMPILER_INITIALIZER_LISTS +# /* C++0x features supported in GCC 4.5: */ +# define Q_COMPILER_LAMBDA +# define Q_COMPILER_UNICODE_STRINGS +# /* C++0x features supported in GCC 4.6: */ +# define Q_COMPILER_CONSTEXPR +# define Q_COMPILER_NULLPTR # endif #endif @@ -822,7 +789,7 @@ namespace QT_NAMESPACE {} #endif #ifndef Q_REQUIRED_RESULT -# if defined(Q_CC_GNU) && !defined(Q_CC_INTEL) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) +# if defined(Q_CC_GNU) && !defined(Q_CC_INTEL) # define Q_REQUIRED_RESULT __attribute__ ((warn_unused_result)) # else # define Q_REQUIRED_RESULT @@ -938,7 +905,7 @@ redefine to built-in booleans to make autotests work properly */ */ #if defined(Q_MOC_RUN) # define Q_DECL_DEPRECATED Q_DECL_DEPRECATED -#elif defined(Q_CC_GNU) && !defined(Q_CC_INTEL) && (__GNUC__ - 0 > 3 || (__GNUC__ - 0 == 3 && __GNUC_MINOR__ - 0 >= 2)) +#elif defined(Q_CC_GNU) && !defined(Q_CC_INTEL) # define Q_DECL_DEPRECATED __attribute__ ((__deprecated__)) #else # define Q_DECL_DEPRECATED @@ -981,24 +948,15 @@ redefine to built-in booleans to make autotests work properly */ #ifdef QT_ASCII_CAST_WARNINGS # define QT_ASCII_CAST_WARN Q_DECL_DEPRECATED -# if defined(Q_CC_GNU) && __GNUC__ < 4 - /* gcc < 4 doesn't like Q_DECL_DEPRECATED in front of constructors */ -# define QT_ASCII_CAST_WARN_CONSTRUCTOR -# else -# define QT_ASCII_CAST_WARN_CONSTRUCTOR Q_DECL_CONSTRUCTOR_DEPRECATED -# endif +# define QT_ASCII_CAST_WARN_CONSTRUCTOR Q_DECL_CONSTRUCTOR_DEPRECATED #else # define QT_ASCII_CAST_WARN # define QT_ASCII_CAST_WARN_CONSTRUCTOR #endif #if defined(__i386__) -# if defined(Q_CC_GNU) -#if !defined(Q_CC_INTEL) && ((100*(__GNUC__ - 0) + 10*(__GNUC_MINOR__ - 0) + __GNUC_PATCHLEVEL__) >= 332) +# if defined(Q_CC_GNU) && !defined(Q_CC_INTEL) # define QT_FASTCALL __attribute__((regparm(3))) -#else -# define QT_FASTCALL -#endif # else # define QT_FASTCALL # endif @@ -1386,14 +1344,14 @@ public: #else // forward declaration, since qatomic.h needs qglobal.h -template class QBasicAtomicPointer; +template class QAtomicPointer; // POD for Q_GLOBAL_STATIC template class QGlobalStatic { public: - QBasicAtomicPointer pointer; + QAtomicPointer pointer; bool destroyed; }; @@ -1417,7 +1375,7 @@ public: #define Q_GLOBAL_STATIC_INIT(TYPE, NAME) \ static QGlobalStatic this_ ## NAME \ - = { Q_BASIC_ATOMIC_INITIALIZER(0), false } + = { QAtomicPointer(0), false } #define Q_GLOBAL_STATIC(TYPE, NAME) \ static TYPE *NAME() \ @@ -1617,13 +1575,7 @@ Q_DECLARE_TYPEINFO_BODY(TYPE, FLAGS) template inline void qSwap(T &value1, T &value2) { -#ifdef QT_NO_STL - const T t = value1; - value1 = value2; - value2 = t; -#else std::swap(value1, value2); -#endif } /* @@ -1635,23 +1587,16 @@ inline void qSwap(T &value1, T &value2) types must declare a 'bool isDetached(void) const;' member for this to work. */ -#ifdef QT_NO_STL -#define Q_DECLARE_SHARED_STL(TYPE) -#else -#define Q_DECLARE_SHARED_STL(TYPE) \ +#define Q_DECLARE_SHARED(TYPE) \ +template <> inline bool qIsDetached(TYPE &t) { return t.isDetached(); } \ +template <> inline void qSwap(TYPE &value1, TYPE &value2) \ +{ qSwap(value1.data_ptr(), value2.data_ptr()); } \ QT_END_NAMESPACE \ namespace std { \ template<> inline void swap(QT_PREPEND_NAMESPACE(TYPE) &value1, QT_PREPEND_NAMESPACE(TYPE) &value2) \ { swap(value1.data_ptr(), value2.data_ptr()); } \ } \ QT_BEGIN_NAMESPACE -#endif - -#define Q_DECLARE_SHARED(TYPE) \ -template <> inline bool qIsDetached(TYPE &t) { return t.isDetached(); } \ -template <> inline void qSwap(TYPE &value1, TYPE &value2) \ -{ qSwap(value1.data_ptr(), value2.data_ptr()); } \ -Q_DECLARE_SHARED_STL(TYPE) /* QTypeInfo primitive specializations @@ -1960,13 +1905,6 @@ Q_CORE_EXPORT int qrand(); # define QT_NO_QFUTURE #endif -// gcc 3 version has problems with some of the -// map/filter overloads. -#if defined(Q_CC_GNU) && (__GNUC__ < 4) -# define QT_NO_CONCURRENT_MAP -# define QT_NO_CONCURRENT_FILTER -#endif - #if defined (__ELF__) # if defined (Q_OS_LINUX) || defined (Q_OS_SOLARIS) || defined (Q_OS_FREEBSD) || defined (Q_OS_OPENBSD) || defined (Q_OS_IRIX) # define Q_OF_ELF diff --git a/src/core/global/qnumeric.cpp b/src/core/global/qnumeric.cpp index 6ea49ddcd..f71e5c7ee 100644 --- a/src/core/global/qnumeric.cpp +++ b/src/core/global/qnumeric.cpp @@ -40,115 +40,131 @@ ****************************************************************************/ #include "qnumeric.h" -#include "qnumeric_p.h" QT_BEGIN_NAMESPACE -#if defined(QT_NO_STL) +#if !defined(Q_CC_MIPS) + /*! - Returns true if the double \a {d} is equivalent to infinity. + Returns the bit pattern for an infinite number as a double. */ -Q_CORE_EXPORT bool qIsInf(double d) +static const union { unsigned char c[8]; double d; } qt_be_inf_bytes = { { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 } }; +static const union { unsigned char c[8]; double d; } qt_le_inf_bytes = { { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f } }; +static const union { unsigned char c[8]; double d; } qt_armfpa_inf_bytes = { { 0, 0, 0xf0, 0x7f, 0, 0, 0, 0 } }; +Q_CORE_EXPORT double qInf() { - uchar *ch = (uchar *)&d; #ifdef QT_ARMFPA - return (ch[3] & 0x7f) == 0x7f && ch[2] == 0xf0; + return qt_armfpa_inf_bytes.d; #else - if (QSysInfo::ByteOrder == QSysInfo::BigEndian) { - return (ch[0] & 0x7f) == 0x7f && ch[1] == 0xf0; - } else { - return (ch[7] & 0x7f) == 0x7f && ch[6] == 0xf0; - } + return (QSysInfo::ByteOrder == QSysInfo::BigEndian + ? qt_be_inf_bytes.d + : qt_le_inf_bytes.d); #endif } /*! - Returns true if the double \a {d} is not a number (NaN). + Returns the bit pattern of a signalling NaN as a double. */ -Q_CORE_EXPORT bool qIsNaN(double d) +static const union { unsigned char c[8]; double d; } qt_be_snan_bytes = { { 0x7f, 0xf8, 0, 0, 0, 0, 0, 0 } }; +static const union { unsigned char c[8]; double d; } qt_le_snan_bytes = { { 0, 0, 0, 0, 0, 0, 0xf8, 0x7f } }; +static const union { unsigned char c[8]; double d; } qt_armfpa_snan_bytes = { { 0, 0, 0xf8, 0x7f, 0, 0, 0, 0 } }; +Q_CORE_EXPORT double qSNaN() { - uchar *ch = (uchar *)&d; #ifdef QT_ARMFPA - return (ch[3] & 0x7f) == 0x7f && ch[2] > 0xf0; + return qt_armfpa_snan_bytes.d; #else - if (QSysInfo::ByteOrder == QSysInfo::BigEndian) { - return (ch[0] & 0x7f) == 0x7f && ch[1] > 0xf0; - } else { - return (ch[7] & 0x7f) == 0x7f && ch[6] > 0xf0; - } + return (QSysInfo::ByteOrder == QSysInfo::BigEndian + ? qt_be_snan_bytes.d + : qt_le_snan_bytes.d); #endif } /*! - Returns true if the double \a {d} is a finite number. + Returns the bit pattern of a quiet NaN as a double. */ -Q_CORE_EXPORT bool qIsFinite(double d) +static const union { unsigned char c[8]; double d; } qt_be_qnan_bytes = { { 0xff, 0xf8, 0, 0, 0, 0, 0, 0 } }; +static const union { unsigned char c[8]; double d; } qt_le_qnan_bytes = { { 0, 0, 0, 0, 0, 0, 0xf8, 0xff } }; +static const union { unsigned char c[8]; double d; } qt_armfpa_qnan_bytes = { { 0, 0, 0xf8, 0xff, 0, 0, 0, 0 } }; +Q_CORE_EXPORT double qQNaN() { - uchar *ch = (uchar *)&d; #ifdef QT_ARMFPA - return (ch[3] & 0x7f) != 0x7f || (ch[2] & 0xf0) != 0xf0; + return qt_armfpa_qnan_bytes.d; #else - if (QSysInfo::ByteOrder == QSysInfo::BigEndian) { - return (ch[0] & 0x7f) != 0x7f || (ch[1] & 0xf0) != 0xf0; - } else { - return (ch[7] & 0x7f) != 0x7f || (ch[6] & 0xf0) != 0xf0; - } + return (QSysInfo::ByteOrder == QSysInfo::BigEndian + ? qt_be_qnan_bytes.d + : qt_le_qnan_bytes.d); #endif } -/*! - Returns true if the float \a {f} is equivalent to infinity. -*/ -Q_CORE_EXPORT bool qIsInf(float f) -{ - uchar *ch = (uchar *)&f; - if (QSysInfo::ByteOrder == QSysInfo::BigEndian) { - return (ch[0] & 0x7f) == 0x7f && ch[1] == 0x80; - } else { - return (ch[3] & 0x7f) == 0x7f && ch[2] == 0x80; - } -} +#else // Q_CC_MIPS -/*! - Returns true if the float \a {f} is not a number (NaN). -*/ -Q_CORE_EXPORT bool qIsNaN(float f) -{ - uchar *ch = (uchar *)&f; - if (QSysInfo::ByteOrder == QSysInfo::BigEndian) { - return (ch[0] & 0x7f) == 0x7f && ch[1] > 0x80; - } else { - return (ch[3] & 0x7f) == 0x7f && ch[2] > 0x80; - } -} /*! - Returns true if the float \a {f} is a finite number. + Returns the bit pattern for an infinite number as a double. */ -Q_CORE_EXPORT bool qIsFinite(float f) +static const unsigned char qt_be_inf_bytes[] = { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 }; +static const unsigned char qt_le_inf_bytes[] = { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f }; +static const unsigned char qt_armfpa_inf_bytes[] = { 0, 0, 0xf0, 0x7f, 0, 0, 0, 0 }; +Q_CORE_EXPORT double qInf() { - uchar *ch = (uchar *)&f; - if (QSysInfo::ByteOrder == QSysInfo::BigEndian) { - return (ch[0] & 0x7f) != 0x7f || (ch[1] & 0x80) != 0x80; - } else { - return (ch[3] & 0x7f) != 0x7f || (ch[2] & 0x80) != 0x80; - } + const unsigned char *bytes; +#ifdef QT_ARMFPA + bytes = qt_armfpa_inf_bytes; +#else + bytes = (QSysInfo::ByteOrder == QSysInfo::BigEndian + ? qt_be_inf_bytes + : qt_le_inf_bytes); +#endif + + union { unsigned char c[8]; double d; } returnValue; + memcpy(returnValue.c, bytes, sizeof(returnValue.c)); + return returnValue.d; } -#endif // QT_NO_STL /*! Returns the bit pattern of a signalling NaN as a double. */ -Q_CORE_EXPORT double qSNaN() { return qt_snan(); } +static const unsigned char qt_be_snan_bytes[] = { 0x7f, 0xf8, 0, 0, 0, 0, 0, 0 }; +static const unsigned char qt_le_snan_bytes[] = { 0, 0, 0, 0, 0, 0, 0xf8, 0x7f }; +static const unsigned char qt_armfpa_snan_bytes[] = { 0, 0, 0xf8, 0x7f, 0, 0, 0, 0 }; +Q_CORE_EXPORT double qSNaN() +{ + const unsigned char *bytes; +#ifdef QT_ARMFPA + bytes = qt_armfpa_snan_bytes; +#else + bytes = (QSysInfo::ByteOrder == QSysInfo::BigEndian + ? qt_be_snan_bytes + : qt_le_snan_bytes); +#endif + + union { unsigned char c[8]; double d; } returnValue; + memcpy(returnValue.c, bytes, sizeof(returnValue.c)); + return returnValue.d; +} /*! Returns the bit pattern of a quiet NaN as a double. */ -Q_CORE_EXPORT double qQNaN() { return qt_qnan(); } +static const unsigned char qt_be_qnan_bytes[] = { 0xff, 0xf8, 0, 0, 0, 0, 0, 0 }; +static const unsigned char qt_le_qnan_bytes[] = { 0, 0, 0, 0, 0, 0, 0xf8, 0xff }; +static const unsigned char qt_armfpa_qnan_bytes[] = { 0, 0, 0xf8, 0xff, 0, 0, 0, 0 }; +Q_CORE_EXPORT double qQNaN() +{ + const unsigned char *bytes; +#ifdef QT_ARMFPA + bytes = qt_armfpa_qnan_bytes; +#else + bytes = (QSysInfo::ByteOrder == QSysInfo::BigEndian + ? qt_be_qnan_bytes + : qt_le_qnan_bytes); +#endif -/*! - Returns the bit pattern for an infinite number as a double. -*/ -Q_CORE_EXPORT double qInf() { return qt_inf(); } + union { unsigned char c[8]; double d; } returnValue; + memcpy(returnValue.c, bytes, sizeof(returnValue.c)); + return returnValue.d; +} + +#endif // Q_CC_MIPS QT_END_NAMESPACE diff --git a/src/core/global/qnumeric.h b/src/core/global/qnumeric.h index eb156a07a..34338d4e6 100644 --- a/src/core/global/qnumeric.h +++ b/src/core/global/qnumeric.h @@ -44,29 +44,18 @@ #include -#if !defined(QT_NO_STL) -#include -#endif +#include QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -#if !defined(QT_NO_STL) -Q_CORE_EXPORT_INLINE bool qIsInf(double d) { return isinf(d); } -Q_CORE_EXPORT_INLINE bool qIsNaN(double d) { return isnan(d); } -Q_CORE_EXPORT_INLINE bool qIsFinite(double d) { return isfinite(d); } -Q_CORE_EXPORT_INLINE bool qIsInf(float f) { return isinf(f); } -Q_CORE_EXPORT_INLINE bool qIsNaN(float f) { return isnan(f); } -Q_CORE_EXPORT_INLINE bool qIsFinite(float f) { return isfinite(f); } -#else -Q_CORE_EXPORT bool qIsInf(double d); -Q_CORE_EXPORT bool qIsNaN(double d); -Q_CORE_EXPORT bool qIsFinite(double d); -Q_CORE_EXPORT bool qIsInf(float f); -Q_CORE_EXPORT bool qIsNaN(float f); -Q_CORE_EXPORT bool qIsFinite(float f); -#endif +inline bool qIsInf(double d) { return std::isinf(d); } +inline bool qIsNaN(double d) { return std::isnan(d); } +inline bool qIsFinite(double d) { return std::isfinite(d); } +inline bool qIsInf(float f) { return std::isinf(f); } +inline bool qIsNaN(float f) { return std::isnan(f); } +inline bool qIsFinite(float f) { return std::isfinite(f); } Q_CORE_EXPORT double qSNaN(); Q_CORE_EXPORT double qQNaN(); diff --git a/src/core/global/qnumeric_p.h b/src/core/global/qnumeric_p.h deleted file mode 100644 index 273477d07..000000000 --- a/src/core/global/qnumeric_p.h +++ /dev/null @@ -1,171 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QNUMERIC_P_H -#define QNUMERIC_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "QtCore/qglobal.h" - -QT_BEGIN_NAMESPACE - -#if !defined(Q_CC_MIPS) - -static const union { unsigned char c[8]; double d; } qt_be_inf_bytes = { { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 } }; -static const union { unsigned char c[8]; double d; } qt_le_inf_bytes = { { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f } }; -static const union { unsigned char c[8]; double d; } qt_armfpa_inf_bytes = { { 0, 0, 0xf0, 0x7f, 0, 0, 0, 0 } }; -static inline double qt_inf() -{ -#ifdef QT_ARMFPA - return qt_armfpa_inf_bytes.d; -#else - return (QSysInfo::ByteOrder == QSysInfo::BigEndian - ? qt_be_inf_bytes.d - : qt_le_inf_bytes.d); -#endif -} - -// Signaling NAN -static const union { unsigned char c[8]; double d; } qt_be_snan_bytes = { { 0x7f, 0xf8, 0, 0, 0, 0, 0, 0 } }; -static const union { unsigned char c[8]; double d; } qt_le_snan_bytes = { { 0, 0, 0, 0, 0, 0, 0xf8, 0x7f } }; -static const union { unsigned char c[8]; double d; } qt_armfpa_snan_bytes = { { 0, 0, 0xf8, 0x7f, 0, 0, 0, 0 } }; -static inline double qt_snan() -{ -#ifdef QT_ARMFPA - return qt_armfpa_snan_bytes.d; -#else - return (QSysInfo::ByteOrder == QSysInfo::BigEndian - ? qt_be_snan_bytes.d - : qt_le_snan_bytes.d); -#endif -} - -// Quiet NAN -static const union { unsigned char c[8]; double d; } qt_be_qnan_bytes = { { 0xff, 0xf8, 0, 0, 0, 0, 0, 0 } }; -static const union { unsigned char c[8]; double d; } qt_le_qnan_bytes = { { 0, 0, 0, 0, 0, 0, 0xf8, 0xff } }; -static const union { unsigned char c[8]; double d; } qt_armfpa_qnan_bytes = { { 0, 0, 0xf8, 0xff, 0, 0, 0, 0 } }; -static inline double qt_qnan() -{ -#ifdef QT_ARMFPA - return qt_armfpa_qnan_bytes.d; -#else - return (QSysInfo::ByteOrder == QSysInfo::BigEndian - ? qt_be_qnan_bytes.d - : qt_le_qnan_bytes.d); -#endif -} - -#else // Q_CC_MIPS - -static const unsigned char qt_be_inf_bytes[] = { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 }; -static const unsigned char qt_le_inf_bytes[] = { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f }; -static const unsigned char qt_armfpa_inf_bytes[] = { 0, 0, 0xf0, 0x7f, 0, 0, 0, 0 }; -static inline double qt_inf() -{ - const unsigned char *bytes; -#ifdef QT_ARMFPA - bytes = qt_armfpa_inf_bytes; -#else - bytes = (QSysInfo::ByteOrder == QSysInfo::BigEndian - ? qt_be_inf_bytes - : qt_le_inf_bytes); -#endif - - union { unsigned char c[8]; double d; } returnValue; - memcpy(returnValue.c, bytes, sizeof(returnValue.c)); - return returnValue.d; -} - -// Signaling NAN -static const unsigned char qt_be_snan_bytes[] = { 0x7f, 0xf8, 0, 0, 0, 0, 0, 0 }; -static const unsigned char qt_le_snan_bytes[] = { 0, 0, 0, 0, 0, 0, 0xf8, 0x7f }; -static const unsigned char qt_armfpa_snan_bytes[] = { 0, 0, 0xf8, 0x7f, 0, 0, 0, 0 }; -static inline double qt_snan() -{ - const unsigned char *bytes; -#ifdef QT_ARMFPA - bytes = qt_armfpa_snan_bytes; -#else - bytes = (QSysInfo::ByteOrder == QSysInfo::BigEndian - ? qt_be_snan_bytes - : qt_le_snan_bytes); -#endif - - union { unsigned char c[8]; double d; } returnValue; - memcpy(returnValue.c, bytes, sizeof(returnValue.c)); - return returnValue.d; -} - -// Quiet NAN -static const unsigned char qt_be_qnan_bytes[] = { 0xff, 0xf8, 0, 0, 0, 0, 0, 0 }; -static const unsigned char qt_le_qnan_bytes[] = { 0, 0, 0, 0, 0, 0, 0xf8, 0xff }; -static const unsigned char qt_armfpa_qnan_bytes[] = { 0, 0, 0xf8, 0xff, 0, 0, 0, 0 }; -static inline double qt_qnan() -{ - const unsigned char *bytes; -#ifdef QT_ARMFPA - bytes = qt_armfpa_qnan_bytes; -#else - bytes = (QSysInfo::ByteOrder == QSysInfo::BigEndian - ? qt_be_qnan_bytes - : qt_le_qnan_bytes); -#endif - - union { unsigned char c[8]; double d; } returnValue; - memcpy(returnValue.c, bytes, sizeof(returnValue.c)); - return returnValue.d; -} - -#endif // Q_CC_MIPS - -QT_END_NAMESPACE - -#endif // QNUMERIC_P_H diff --git a/src/core/io/qprocess_unix.cpp b/src/core/io/qprocess_unix.cpp index 5563d09aa..702f57092 100644 --- a/src/core/io/qprocess_unix.cpp +++ b/src/core/io/qprocess_unix.cpp @@ -306,7 +306,7 @@ void QProcessManager::catchDeadChildren() } } -static QBasicAtomicInt idCounter = Q_BASIC_ATOMIC_INITIALIZER(1); +static QAtomicInt idCounter = QAtomicInt(1); void QProcessManager::add(pid_t pid, QProcess *process) { diff --git a/src/core/kernel/qabstracteventdispatcher.cpp b/src/core/kernel/qabstracteventdispatcher.cpp index 04e14b139..4fb6e7798 100644 --- a/src/core/kernel/qabstracteventdispatcher.cpp +++ b/src/core/kernel/qabstracteventdispatcher.cpp @@ -88,13 +88,13 @@ static const int BucketOffset[] = { FourthBucketOffset, FifthBucketOffset, SixthBucketOffset }; -static QBasicAtomicPointer timerIds[] = - { Q_BASIC_ATOMIC_INITIALIZER(FirstBucket), - Q_BASIC_ATOMIC_INITIALIZER(0), - Q_BASIC_ATOMIC_INITIALIZER(0), - Q_BASIC_ATOMIC_INITIALIZER(0), - Q_BASIC_ATOMIC_INITIALIZER(0), - Q_BASIC_ATOMIC_INITIALIZER(0) }; +static QAtomicPointer timerIds[] = + { QAtomicPointer(FirstBucket), + QAtomicPointer(0), + QAtomicPointer(0), + QAtomicPointer(0), + QAtomicPointer(0), + QAtomicPointer(0) }; static void timerIdsDestructorFunction() { @@ -104,7 +104,7 @@ static void timerIdsDestructorFunction() } Q_DESTRUCTOR_FUNCTION(timerIdsDestructorFunction) -static QBasicAtomicInt nextFreeTimerId = Q_BASIC_ATOMIC_INITIALIZER(1); +static QAtomicInt nextFreeTimerId = QAtomicInt(1); // avoid the ABA-problem by using 7 of the top 8 bits of the timerId as a serial number static inline int prepareNewValueWithSerialNumber(int oldId, int newId) diff --git a/src/core/kernel/qcore_unix_p.h b/src/core/kernel/qcore_unix_p.h index 9c7c25744..4493a0ec8 100644 --- a/src/core/kernel/qcore_unix_p.h +++ b/src/core/kernel/qcore_unix_p.h @@ -149,7 +149,7 @@ inline void qt_ignore_sigpipe() { #ifndef Q_NO_POSIX_SIGNALS // Set to ignore SIGPIPE once only. - static QBasicAtomicInt atom = Q_BASIC_ATOMIC_INITIALIZER(0); + static QAtomicInt atom = QAtomicInt(0); if (!atom) { // More than one thread could turn off SIGPIPE at the same time // But that's acceptable because they all would be doing the same diff --git a/src/core/kernel/qmetatype.h b/src/core/kernel/qmetatype.h index dc6841391..c46d4b362 100644 --- a/src/core/kernel/qmetatype.h +++ b/src/core/kernel/qmetatype.h @@ -256,7 +256,7 @@ inline int qRegisterMetaTypeStreamOperators() enum { Defined = 1 }; \ static int qt_metatype_id() \ { \ - static QBasicAtomicInt metatype_id = Q_BASIC_ATOMIC_INITIALIZER(0); \ + static QAtomicInt metatype_id = QAtomicInt(0); \ if (!metatype_id) \ metatype_id = qRegisterMetaType< TYPE >(#TYPE, \ reinterpret_cast< TYPE *>(quintptr(-1))); \ diff --git a/src/core/kernel/qobject.cpp b/src/core/kernel/qobject.cpp index 722189884..555132c99 100644 --- a/src/core/kernel/qobject.cpp +++ b/src/core/kernel/qobject.cpp @@ -94,8 +94,8 @@ static int *queuedConnectionTypes(const QList &typeNames) return types; } -static QBasicAtomicPointer signalSlotMutexes = Q_BASIC_ATOMIC_INITIALIZER(0); -static QBasicAtomicInt objectCount = Q_BASIC_ATOMIC_INITIALIZER(0); +static QAtomicPointer signalSlotMutexes = QAtomicPointer(0); +static QAtomicInt objectCount = QAtomicInt(0); /** \internal * mutex to be locked when accessing the connectionlists or the senders list @@ -111,19 +111,6 @@ static inline QMutex *signalSlotLock(const QObject *o) return signalSlotMutexes->get(o); } -extern "C" Q_CORE_EXPORT void qt_addObject(QObject *) -{ - objectCount.ref(); -} - -extern "C" Q_CORE_EXPORT void qt_removeObject(QObject *) -{ - if(!objectCount.deref()) { - QMutexPool *old = signalSlotMutexes.fetchAndStoreAcquire(0); - delete old; - } -} - void (*QAbstractDeclarativeData::destroyed)(QAbstractDeclarativeData *, QObject *) = 0; void (*QAbstractDeclarativeData::parentChanged)(QAbstractDeclarativeData *, QObject *, QObject *) = 0; void (*QAbstractDeclarativeData::objectNameChanged)(QAbstractDeclarativeData *, QObject *) = 0; @@ -167,11 +154,14 @@ QObjectPrivate::~QObjectPrivate() if (threadData) threadData->deref(); - delete static_cast(metaObject); + QAbstractDynamicMetaObject* mobject = static_cast(metaObject); + if (mobject) + delete mobject; #ifndef QT_NO_USERDATA - if (extraData) + if (extraData) { qDeleteAll(extraData->userData); - delete extraData; + delete extraData; + } #endif } @@ -610,7 +600,7 @@ QObject::QObject(QObject *parent) QT_RETHROW; } } - qt_addObject(this); + objectCount.ref(); } @@ -641,7 +631,7 @@ QObject::QObject(QObjectPrivate &dd, QObject *parent) QT_RETHROW; } } - qt_addObject(this); + objectCount.ref(); } /*! @@ -774,7 +764,10 @@ QObject::~QObject() if (!d->children.isEmpty()) d->deleteChildren(); - qt_removeObject(this); + if(!objectCount.deref()) { + QMutexPool *old = signalSlotMutexes.fetchAndStoreAcquire(0); + delete old; + } if (d->parent) // remove it from parent object d->setParent_helper(0); @@ -2737,7 +2730,7 @@ bool QMetaObjectPrivate::connect(const QObject *sender, int signal_index, c->method_relative = method_index; c->method_offset = method_offset; c->connectionType = type; - c->argumentTypes = types; + c->argumentTypes = QAtomicPointer(types); c->nextConnectionList = 0; c->callFunction = callFunction; diff --git a/src/core/kernel/qobject_p.h b/src/core/kernel/qobject_p.h index 4803f7f83..37f489a77 100644 --- a/src/core/kernel/qobject_p.h +++ b/src/core/kernel/qobject_p.h @@ -118,7 +118,7 @@ public: //senders linked list Connection *next; Connection **prev; - QBasicAtomicPointer argumentTypes; + QAtomicPointer argumentTypes; ushort method_offset; ushort method_relative; ushort connectionType : 3; // 0 == auto, 1 == direct, 2 == queued, 4 == blocking diff --git a/src/core/plugin/quuid.cpp b/src/core/plugin/quuid.cpp index a37b5a57e..15988da8a 100644 --- a/src/core/plugin/quuid.cpp +++ b/src/core/plugin/quuid.cpp @@ -833,7 +833,7 @@ QUuid QUuid::createUuid() static QThreadStorage uuidseed; if (!uuidseed.hasLocalData()) { int *pseed = new int; - static QBasicAtomicInt serial = Q_BASIC_ATOMIC_INITIALIZER(2); + static QAtomicInt serial = QAtomicInt(2); qsrand(*pseed = QDateTime::currentDateTime().toTime_t() + quintptr(&pseed) + serial.fetchAndAddRelaxed(1)); diff --git a/src/core/qcorecommon_p.h b/src/core/qcorecommon_p.h index 3906baec7..6fb1ad774 100644 --- a/src/core/qcorecommon_p.h +++ b/src/core/qcorecommon_p.h @@ -25,4 +25,10 @@ namespace { } #endif +static void report_error(int code, const char *where, const char *what) +{ + if (code != 0) + qWarning("%s: %s failure: %s", where, what, qPrintable(qt_error_string(code))); +} + #endif // QCORECOMMON_P_H diff --git a/src/core/thread/qatomic.h b/src/core/thread/qatomic.h index 92dd33764..a467f0688 100644 --- a/src/core/thread/qatomic.h +++ b/src/core/thread/qatomic.h @@ -1,118 +1,314 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +/*********************************************************************** +* +* Copyright (c) 2012-2016 Barbara Geller +* Copyright (c) 2012-2016 Ansel Sermersheim +* Copyright (c) 2012-2014 Digia Plc and/or its subsidiary(-ies). +* Copyright (c) 2008-2012 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* +* This file is part of CopperSpice. +* +* CopperSpice is free software: you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public License +* version 2.1 as published by the Free Software Foundation. +* +* CopperSpice is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with CopperSpice. If not, see +* . +* +***********************************************************************/ #ifndef QATOMIC_H #define QATOMIC_H -#include +#include "QtCore/qglobal.h" -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE +#include +#include -// High-level atomic integer operations -class Q_CORE_EXPORT QAtomicInt : public QBasicAtomicInt -{ -public: - inline QAtomicInt(int value = 0) - { -#ifdef QT_ARCH_PARISC - this->_q_lock[0] = this->_q_lock[1] = this->_q_lock[2] = this->_q_lock[3] = -1; +#ifndef ATOMIC_INT_LOCK_FREE +#define ATOMIC_INT_LOCK_FREE 0 #endif - _q_value = value; - } - inline QAtomicInt(const QAtomicInt &other) - { -#ifdef QT_ARCH_PARISC - this->_q_lock[0] = this->_q_lock[1] = this->_q_lock[2] = this->_q_lock[3] = -1; + +#ifndef ATOMIC_POINTER_LOCK_FREE +#define ATOMIC_POINTER_LOCK_FREE 0 #endif - _q_value = other._q_value; - } - inline QAtomicInt &operator=(int value) - { - (void) QBasicAtomicInt::operator=(value); - return *this; - } +QT_BEGIN_NAMESPACE +QT_BEGIN_HEADER + +class QAtomicInt +{ + public: + + inline QAtomicInt() : m_data(0) { + } + + inline QAtomicInt(int value) : m_data(value) { + } + + inline QAtomicInt(const QAtomicInt &other) { + int data = other.load(); + store(data); + } + + inline QAtomicInt &operator=(const QAtomicInt &other) { + int data = other.load(); + store(data); + + return *this; + } + + inline QAtomicInt &operator=(int data) { + store(data); + return *this; + } + + int load() const { + return m_data.load(); + } + + int loadAcquire() { + return m_data.load(std::memory_order_acquire); + } + + void store(int newValue) { + m_data.store(newValue); + } + + void storeRelease(int newValue) { + m_data.store(newValue, std::memory_order_release); + } + + // + static bool isReferenceCountingNative() { + return ATOMIC_INT_LOCK_FREE == 2; + } + + static bool isReferenceCountingWaitFree() { + return ATOMIC_INT_LOCK_FREE == 2; + } + + bool ref() { + int newValue = ++m_data; + return newValue != 0; + } + + bool deref() { + int newValue = --m_data; + return newValue != 0; + } + + // + static bool isTestAndSetNative() { + return ATOMIC_INT_LOCK_FREE == 2; + } + + static bool isTestAndSetWaitFree() { + return ATOMIC_INT_LOCK_FREE == 2; + } + + bool testAndSetRelaxed(int expectedValue, int newValue) { + return m_data.compare_exchange_strong(expectedValue, newValue, std::memory_order_relaxed); + } + + bool testAndSetAcquire(int expectedValue, int newValue) { + return m_data.compare_exchange_strong(expectedValue, newValue, std::memory_order_acquire); + } + + bool testAndSetRelease(int expectedValue, int newValue) { + return m_data.compare_exchange_strong(expectedValue, newValue, std::memory_order_release); + } + + bool testAndSetOrdered(int expectedValue, int newValue) { + return m_data.compare_exchange_strong(expectedValue, newValue, std::memory_order_seq_cst); + } + + // + static bool isFetchAndStoreNative() { + return ATOMIC_INT_LOCK_FREE == 2; + } + + static bool isFetchAndStoreWaitFree() { + return ATOMIC_INT_LOCK_FREE == 2; + } + + int fetchAndStoreRelaxed(int newValue) { + return m_data.exchange(newValue, std::memory_order_relaxed); + } + + int fetchAndStoreAcquire(int newValue) { + return m_data.exchange(newValue, std::memory_order_acquire); + } + + int fetchAndStoreRelease(int newValue) { + return m_data.exchange(newValue, std::memory_order_release); + } + + int fetchAndStoreOrdered(int newValue) { + return m_data.exchange(newValue, std::memory_order_seq_cst); + } + + // + static bool isFetchAndAddNative() { + return ATOMIC_INT_LOCK_FREE == 2; + } + + static bool isFetchAndAddWaitFree() { + return ATOMIC_INT_LOCK_FREE == 2; + } + + int fetchAndAddRelaxed(int valueToAdd) { + return m_data.fetch_add(valueToAdd, std::memory_order_relaxed); + } + + int fetchAndAddAcquire(int valueToAdd) { + return m_data.fetch_add(valueToAdd, std::memory_order_acquire); + } - inline QAtomicInt &operator=(const QAtomicInt &other) - { - (void) QBasicAtomicInt::operator=(other); - return *this; - } + int fetchAndAddRelease(int valueToAdd) { + return m_data.fetch_add(valueToAdd, std::memory_order_release); + } + int fetchAndAddOrdered(int valueToAdd) { + return m_data.fetch_add(valueToAdd, std::memory_order_seq_cst); + } + + inline operator int() const + { return load(); } + + private: + std::atomic m_data; }; -// High-level atomic pointer operations + template -class QAtomicPointer : public QBasicAtomicPointer +class QAtomicPointer { -public: - inline QAtomicPointer(T *value = 0) - { -#ifdef QT_ARCH_PARISC - this->_q_lock[0] = this->_q_lock[1] = this->_q_lock[2] = this->_q_lock[3] = -1; -#endif - QBasicAtomicPointer::_q_value = value; - } - inline QAtomicPointer(const QAtomicPointer &other) - { -#ifdef QT_ARCH_PARISC - this->_q_lock[0] = this->_q_lock[1] = this->_q_lock[2] = this->_q_lock[3] = -1; -#endif - QBasicAtomicPointer::_q_value = other._q_value; - } + public: + QAtomicPointer(T *value = 0) : m_data(value) { + } + + QAtomicPointer(const QAtomicPointer &other) { + T *data = other.load(); + store(data); + } + + QAtomicPointer &operator=(const QAtomicPointer &other) { + T *data = other.load(); + store(data); + + return *this; + } + + QAtomicPointer &operator=(T *data) { + store(data); + return *this; + } + + T *load() const { + return m_data.load(); + } + + T *loadAcquire() { + return m_data.load(std::memory_order_acquire); + } + + void store(T *newValue) { + m_data.store(newValue); + } + + void storeRelease(T *newValue) { + m_data.store(newValue, std::memory_order_release); + } + + // + static bool isTestAndSetNative() { + return ATOMIC_POINTER_LOCK_FREE == 2; + } + + static bool isTestAndSetWaitFree() { + return ATOMIC_POINTER_LOCK_FREE == 2; + } + + bool testAndSetRelaxed(T *expectedValue, T *newValue) { + return m_data.compare_exchange_strong(expectedValue, newValue, std::memory_order_relaxed); + } + + bool testAndSetAcquire(T *expectedValue, T *newValue) { + return m_data.compare_exchange_strong(expectedValue, newValue, std::memory_order_acquire); + } - inline QAtomicPointer &operator=(T *value) - { - (void) QBasicAtomicPointer::operator=(value); - return *this; - } + bool testAndSetRelease(T *expectedValue, T *newValue) { + return m_data.compare_exchange_strong(expectedValue, newValue, std::memory_order_release); + } - inline QAtomicPointer &operator=(const QAtomicPointer &other) - { - (void) QBasicAtomicPointer::operator=(other); - return *this; - } + bool testAndSetOrdered(T *expectedValue, T *newValue) { + return m_data.compare_exchange_strong(expectedValue, newValue, std::memory_order_seq_cst); + } + + // + static bool isFetchAndStoreNative() { + return ATOMIC_POINTER_LOCK_FREE == 2; + } + static bool isFetchAndStoreWaitFree() { + return ATOMIC_POINTER_LOCK_FREE == 2; + } + + T *fetchAndStoreRelaxed(T *newValue) { + return m_data.exchange(newValue, std::memory_order_relaxed); + } + + T *fetchAndStoreAcquire(T *newValue) { + return m_data.exchange(newValue, std::memory_order_acquire); + } + + T *fetchAndStoreRelease(T *newValue) { + return m_data.exchange(newValue, std::memory_order_release); + } + + T *fetchAndStoreOrdered(T *newValue) { + return m_data.exchange(newValue, std::memory_order_seq_cst); + } + + // + static bool isFetchAndAddNative() { + return ATOMIC_POINTER_LOCK_FREE == 2; + } + + static bool isFetchAndAddWaitFree() { + return ATOMIC_POINTER_LOCK_FREE == 2; + } + + T *fetchAndAddRelaxed(std::ptrdiff_t valueToAdd) { + return m_data.fetch_add(valueToAdd, std::memory_order_relaxed); + } + + T *fetchAndAddAcquire(std::ptrdiff_t valueToAdd) { + return m_data.fetch_add(valueToAdd, std::memory_order_acquire); + } + + T *fetchAndAddRelease(std::ptrdiff_t valueToAdd){ + return m_data.fetch_add(valueToAdd, std::memory_order_release); + } + + T *fetchAndAddOrdered(std::ptrdiff_t valueToAdd){ + return m_data.fetch_add(valueToAdd, std::memory_order_seq_cst); + } + + inline operator T *() const + { return load(); } + inline T *operator->() const + { return load(); } + + private: + std::atomic m_data; }; /*! @@ -124,12 +320,16 @@ public: template inline void qAtomicAssign(T *&d, T *x) { - if (d == x) - return; - x->ref.ref(); - if (!d->ref.deref()) - delete d; - d = x; + if (d == x) { + return; + } + + x->ref.ref(); + if (! d->ref.deref()) { + delete d; + } + + d = x; } /*! @@ -143,12 +343,16 @@ inline void qAtomicAssign(T *&d, T *x) template inline void qAtomicDetach(T *&d) { - if (d->ref == 1) - return; - T *x = d; - d = new T(*d); - if (!x->ref.deref()) - delete x; + if (d->ref.load() == 1) { + return; + } + + T *x = d; + d = new T(*d); + + if (! x->ref.deref()) { + delete x; + } } QT_END_NAMESPACE diff --git a/src/core/thread/qbasicatomic.h b/src/core/thread/qbasicatomic.h deleted file mode 100644 index 3e894dc7a..000000000 --- a/src/core/thread/qbasicatomic.h +++ /dev/null @@ -1,186 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QBASICATOMIC_H -#define QBASICATOMIC_H - -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -class Q_CORE_EXPORT QBasicAtomicInt -{ -public: -#ifdef QT_ARCH_PARISC - int _q_lock[4]; -#endif - volatile int _q_value; - - // Non-atomic API - inline bool operator==(int value) const - { - return _q_value == value; - } - - inline bool operator!=(int value) const - { - return _q_value != value; - } - - inline bool operator!() const - { - return _q_value == 0; - } - - inline operator int() const - { - return _q_value; - } - - inline QBasicAtomicInt &operator=(int value) - { -#ifdef QT_ARCH_PARISC - this->_q_lock[0] = this->_q_lock[1] = this->_q_lock[2] = this->_q_lock[3] = -1; -#endif - _q_value = value; - return *this; - } - - // Atomic API, implemented in qatomic_generic.h - bool ref(); - bool deref(); - - bool testAndSetRelaxed(int expectedValue, int newValue); - bool testAndSetAcquire(int expectedValue, int newValue); - bool testAndSetRelease(int expectedValue, int newValue); - bool testAndSetOrdered(int expectedValue, int newValue); - - int fetchAndStoreRelaxed(int newValue); - int fetchAndStoreAcquire(int newValue); - int fetchAndStoreRelease(int newValue); - int fetchAndStoreOrdered(int newValue); - - int fetchAndAddRelaxed(int valueToAdd); - int fetchAndAddAcquire(int valueToAdd); - int fetchAndAddRelease(int valueToAdd); - int fetchAndAddOrdered(int valueToAdd); -}; - -template -class QBasicAtomicPointer -{ -public: -#ifdef QT_ARCH_PARISC - int _q_lock[4]; -#endif - T * volatile _q_value; - - // Non-atomic API - inline bool operator==(T *value) const - { - return _q_value == value; - } - - inline bool operator!=(T *value) const - { - return !operator==(value); - } - - inline bool operator!() const - { - return operator==(0); - } - - inline operator T *() const - { - return _q_value; - } - - inline T *operator->() const - { - return _q_value; - } - - inline QBasicAtomicPointer &operator=(T *value) - { -#ifdef QT_ARCH_PARISC - this->_q_lock[0] = this->_q_lock[1] = this->_q_lock[2] = this->_q_lock[3] = -1; -#endif - _q_value = value; - return *this; - } - - // Atomic API, implemented in qatomic_generic.h - bool testAndSetRelaxed(T *expectedValue, T *newValue); - bool testAndSetAcquire(T *expectedValue, T *newValue); - bool testAndSetRelease(T *expectedValue, T *newValue); - bool testAndSetOrdered(T *expectedValue, T *newValue); - - T *fetchAndStoreRelaxed(T *newValue); - T *fetchAndStoreAcquire(T *newValue); - T *fetchAndStoreRelease(T *newValue); - T *fetchAndStoreOrdered(T *newValue); - - T *fetchAndAddRelaxed(qptrdiff valueToAdd); - T *fetchAndAddAcquire(qptrdiff valueToAdd); - T *fetchAndAddRelease(qptrdiff valueToAdd); - T *fetchAndAddOrdered(qptrdiff valueToAdd); -}; - -#ifdef QT_ARCH_PARISC -# define Q_BASIC_ATOMIC_INITIALIZER(a) {{-1,-1,-1,-1},(a)} -#else -# define Q_BASIC_ATOMIC_INITIALIZER(a) { (a) } -#endif - -QT_END_NAMESPACE - -#if defined(QT_BOOTSTRAPPED) -# include -#else -# include "QtCore/qatomic_generic.h" -#endif - -QT_END_HEADER - -#endif // QBASIC_ATOMIC diff --git a/src/core/thread/qmutex_p.h b/src/core/thread/qmutex_p.h index 803541024..0eed5f5bd 100644 --- a/src/core/thread/qmutex_p.h +++ b/src/core/thread/qmutex_p.h @@ -76,11 +76,9 @@ public: const uint recursive : 1; QAtomicInt contenders; -#if !defined(Q_OS_LINUX) || defined(QT_LINUXBASE) volatile bool wakeup; pthread_mutex_t mutex; pthread_cond_t cond; -#endif }; QT_END_NAMESPACE diff --git a/src/core/thread/qmutex_unix.cpp b/src/core/thread/qmutex_unix.cpp index 13c689547..726013955 100644 --- a/src/core/thread/qmutex_unix.cpp +++ b/src/core/thread/qmutex_unix.cpp @@ -46,6 +46,7 @@ #ifndef QT_NO_THREAD #include "qatomic.h" #include "qmutex_p.h" +#include "qcorecommon_p.h" #include @@ -53,93 +54,24 @@ #undef wakeup #endif -#if defined(Q_OS_MAC) -# include -# include -#elif defined(Q_OS_LINUX) && !defined(QT_LINUXBASE) -# include -# include -# include -# include -#endif - QT_BEGIN_NAMESPACE -#if !defined(Q_OS_LINUX) || defined(QT_LINUXBASE) -static void report_error(int code, const char *where, const char *what) -{ - if (code != 0) - qWarning("%s: %s failure: %s", where, what, qPrintable(qt_error_string(code))); -} -#endif - - QMutexPrivate::QMutexPrivate(QMutex::RecursionMode mode) : maximumSpinTime(MaximumSpinTimeThreshold), averageWaitTime(0), owner(0), count(0), recursive(mode == QMutex::Recursive) { -#if !defined(Q_OS_LINUX) || defined(QT_LINUXBASE) wakeup = false; report_error(pthread_mutex_init(&mutex, NULL), "QMutex", "mutex init"); report_error(pthread_cond_init(&cond, NULL), "QMutex", "cv init"); -#endif } QMutexPrivate::~QMutexPrivate() { -#if !defined(Q_OS_LINUX) || defined(QT_LINUXBASE) report_error(pthread_cond_destroy(&cond), "QMutex", "cv destroy"); report_error(pthread_mutex_destroy(&mutex), "QMutex", "mutex destroy"); -#endif -} - -#if defined(Q_OS_LINUX) && !defined(QT_LINUXBASE) - -static inline int _q_futex(volatile int *addr, int op, int val, const struct timespec *timeout, int *addr2, int val2) -{ - return syscall(SYS_futex, addr, op, val, timeout, addr2, val2); } bool QMutexPrivate::wait(int timeout) { - struct timespec ts, *pts = 0; - QElapsedTimer timer; - if (timeout >= 0) { - ts.tv_nsec = ((timeout % 1000) * 1000) * 1000; - ts.tv_sec = (timeout / 1000); - pts = &ts; - timer.start(); - } - while (contenders.fetchAndStoreAcquire(2) > 0) { - int r = _q_futex(&contenders._q_value, FUTEX_WAIT, 2, pts, 0, 0); - if (r != 0 && errno == ETIMEDOUT) - return false; - - if (pts) { - // recalculate the timeout - qint64 xtimeout = timeout * 1000 * 1000; - xtimeout -= timer.nsecsElapsed(); - if (xtimeout < 0) { - // timer expired after we returned - return false; - } - - ts.tv_sec = xtimeout / Q_INT64_C(1000) / 1000 / 1000; - ts.tv_nsec = xtimeout % (Q_INT64_C(1000) * 1000 * 1000); - } - } - return true; -} - -void QMutexPrivate::wakeUp() -{ - (void) contenders.fetchAndStoreRelease(0); - (void) _q_futex(&contenders._q_value, FUTEX_WAKE, 1, 0, 0, 0); -} - -#else // !Q_OS_LINUX || QT_LINUXBASE - -bool QMutexPrivate::wait(int timeout) -{ if (contenders.fetchAndAddAcquire(1) == 0) { // lock acquired without waiting return true; @@ -183,8 +115,6 @@ void QMutexPrivate::wakeUp() report_error(pthread_mutex_unlock(&mutex), "QMutex::unlock", "mutex unlock"); } -#endif // !Q_OS_LINUX || QT_LINUXBASE - QT_END_NAMESPACE #endif // QT_NO_THREAD diff --git a/src/core/thread/qwaitcondition_unix.cpp b/src/core/thread/qwaitcondition_unix.cpp index c202dc5f2..4b47a71b5 100644 --- a/src/core/thread/qwaitcondition_unix.cpp +++ b/src/core/thread/qwaitcondition_unix.cpp @@ -48,6 +48,7 @@ #include "qmutex_p.h" #include "qreadwritelock_p.h" +#include "qcorecommon_p.h" #include @@ -55,12 +56,6 @@ QT_BEGIN_NAMESPACE -static void report_error(int code, const char *where, const char *what) -{ - if (code != 0) - qWarning("%s: %s failure: %s", where, what, qPrintable(qt_error_string(code))); -} - class QWaitConditionPrivate { public: pthread_mutex_t mutex; diff --git a/src/core/thread/thread.cmake b/src/core/thread/thread.cmake index a79e83902..fddc5ec71 100644 --- a/src/core/thread/thread.cmake +++ b/src/core/thread/thread.cmake @@ -13,8 +13,6 @@ set(CORE_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/thread/qorderedmutexlocker_p.h ${CMAKE_CURRENT_SOURCE_DIR}/thread/qreadwritelock_p.h ${CMAKE_CURRENT_SOURCE_DIR}/thread/qthread_p.h - - ${CMAKE_CURRENT_SOURCE_DIR}/thread/qbasicatomic.h ) set(CORE_SOURCES diff --git a/src/core/tools/qalgorithms.h b/src/core/tools/qalgorithms.h index b9c2ebd6a..029367ef8 100644 --- a/src/core/tools/qalgorithms.h +++ b/src/core/tools/qalgorithms.h @@ -55,20 +55,6 @@ QT_BEGIN_NAMESPACE namespace QAlgorithmsPrivate { template -Q_OUTOFLINE_TEMPLATE void qSortHelper(RandomAccessIterator start, RandomAccessIterator end, const T &t, LessThan lessThan); -template -inline void qSortHelper(RandomAccessIterator begin, RandomAccessIterator end, const T &dummy); - -template -Q_OUTOFLINE_TEMPLATE void qStableSortHelper(RandomAccessIterator start, RandomAccessIterator end, const T &t, LessThan lessThan); -template -inline void qStableSortHelper(RandomAccessIterator, RandomAccessIterator, const T &); - -template -Q_OUTOFLINE_TEMPLATE RandomAccessIterator qLowerBoundHelper(RandomAccessIterator begin, RandomAccessIterator end, const T &value, LessThan lessThan); -template -Q_OUTOFLINE_TEMPLATE RandomAccessIterator qUpperBoundHelper(RandomAccessIterator begin, RandomAccessIterator end, const T &value, LessThan lessThan); -template Q_OUTOFLINE_TEMPLATE RandomAccessIterator qBinaryFindHelper(RandomAccessIterator begin, RandomAccessIterator end, const T &value, LessThan lessThan); } @@ -76,71 +62,37 @@ Q_OUTOFLINE_TEMPLATE RandomAccessIterator qBinaryFindHelper(RandomAccessIterator template inline OutputIterator qCopy(InputIterator begin, InputIterator end, OutputIterator dest) { -#ifndef QT_NO_STL return std::copy(begin, end, dest); -#else - while (begin != end) - *dest++ = *begin++; - return dest; -#endif } template inline BiIterator2 qCopyBackward(BiIterator1 begin, BiIterator1 end, BiIterator2 dest) { -#ifndef QT_NO_STL return std::copy_backward(begin, end, dest); -#else - while (begin != end) - *--dest = *--end; - return dest; -#endif } template inline bool qEqual(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2) { -#ifndef QT_NO_STL return std::equal(first1, last1, first2); -#else - for (; first1 != last1; ++first1, ++first2) - if (!(*first1 == *first2)) - return false; - return true; -#endif } template inline void qFill(ForwardIterator first, ForwardIterator last, const T &val) { -#ifndef QT_NO_STL return std::fill(first, last, val); -#else - for (; first != last; ++first) - *first = val; -#endif } template inline void qFill(Container &container, const T &val) { -#ifndef QT_NO_STL return std::fill_n(container, val); -#else - qFill(container.begin(), container.end(), val); -#endif } template inline InputIterator qFind(InputIterator first, InputIterator last, const T &val) { -#ifndef QT_NO_STL return std::find(first, last, val); -#else - while (first != last && !(*first == val)) - ++first; - return first; -#endif } template @@ -152,13 +104,7 @@ inline typename Container::const_iterator qFind(const Container &container, cons template inline void qCount(InputIterator first, InputIterator last, const T &value, Size &n) { -#ifndef QT_NO_STL return std::count(first, last, n); -#else - for (; first != last; ++first) - if (*first == value) - ++n; -#endif } template @@ -191,14 +137,14 @@ template inline void qSort(RandomAccessIterator start, RandomAccessIterator end) { if (start != end) - QAlgorithmsPrivate::qSortHelper(start, end, *start); + std::sort(start, end); } template inline void qSort(RandomAccessIterator start, RandomAccessIterator end, LessThan lessThan) { if (start != end) - QAlgorithmsPrivate::qSortHelper(start, end, *start, lessThan); + std::sort(start, end, lessThan); } template @@ -209,21 +155,21 @@ inline void qSort(Container &c) c.detach(); #endif if (!c.empty()) - QAlgorithmsPrivate::qSortHelper(c.begin(), c.end(), *c.begin()); + std::sort(c.begin(), c.end()); } template inline void qStableSort(RandomAccessIterator start, RandomAccessIterator end) { if (start != end) - QAlgorithmsPrivate::qStableSortHelper(start, end, *start); + std::stable_sort(start, end); } template inline void qStableSort(RandomAccessIterator start, RandomAccessIterator end, LessThan lessThan) { if (start != end) - QAlgorithmsPrivate::qStableSortHelper(start, end, *start, lessThan); + std::stable_sort(start, end, lessThan); } template @@ -234,7 +180,7 @@ inline void qStableSort(Container &c) c.detach(); #endif if (!c.empty()) - QAlgorithmsPrivate::qStableSortHelper(c.begin(), c.end(), *c.begin()); + std::stable_sort(c.begin(), c.end()); } template @@ -261,15 +207,15 @@ Q_OUTOFLINE_TEMPLATE RandomAccessIterator qLowerBound(RandomAccessIterator begin } template -Q_OUTOFLINE_TEMPLATE RandomAccessIterator qLowerBound(RandomAccessIterator begin, RandomAccessIterator end, const T &value, LessThan lessThan) +inline RandomAccessIterator qLowerBound(RandomAccessIterator begin, RandomAccessIterator end, const T &value, LessThan lessThan) { - return QAlgorithmsPrivate::qLowerBoundHelper(begin, end, value, lessThan); + return std::lower_bound(begin, end, value, lessThan); } template -Q_OUTOFLINE_TEMPLATE typename Container::const_iterator qLowerBound(const Container &container, const T &value) +inline typename Container::const_iterator qLowerBound(const Container &container, const T &value) { - return QAlgorithmsPrivate::qLowerBoundHelper(container.constBegin(), container.constEnd(), value, qLess()); + return std::lower_bound(container.constBegin(), container.constEnd(), value, qLess()); } template @@ -294,15 +240,15 @@ Q_OUTOFLINE_TEMPLATE RandomAccessIterator qUpperBound(RandomAccessIterator begin } template -Q_OUTOFLINE_TEMPLATE RandomAccessIterator qUpperBound(RandomAccessIterator begin, RandomAccessIterator end, const T &value, LessThan lessThan) +inline RandomAccessIterator qUpperBound(RandomAccessIterator begin, RandomAccessIterator end, const T &value, LessThan lessThan) { - return QAlgorithmsPrivate::qUpperBoundHelper(begin, end, value, lessThan); + return std::upper_bound(begin, end, value, lessThan); } template -Q_OUTOFLINE_TEMPLATE typename Container::const_iterator qUpperBound(const Container &container, const T &value) +inline typename Container::const_iterator qUpperBound(const Container &container, const T &value) { - return QAlgorithmsPrivate::qUpperBoundHelper(container.constBegin(), container.constEnd(), value, qLess()); + return std::upper_bound(container.constBegin(), container.constEnd(), value, qLess()); } template @@ -350,70 +296,6 @@ inline void qDeleteAll(const Container &c) */ namespace QAlgorithmsPrivate { -template -Q_OUTOFLINE_TEMPLATE void qSortHelper(RandomAccessIterator start, RandomAccessIterator end, const T &t, LessThan lessThan) -{ -#ifndef QT_NO_STL - Q_UNUSED(t); - std::sort(start, end, lessThan); -#else -top: - int span = int(end - start); - if (span < 2) - return; - - --end; - RandomAccessIterator low = start, high = end - 1; - RandomAccessIterator pivot = start + span / 2; - - if (lessThan(*end, *start)) - qSwap(*end, *start); - if (span == 2) - return; - - if (lessThan(*pivot, *start)) - qSwap(*pivot, *start); - if (lessThan(*end, *pivot)) - qSwap(*end, *pivot); - if (span == 3) - return; - - qSwap(*pivot, *end); - - while (low < high) { - while (low < high && lessThan(*low, *end)) - ++low; - - while (high > low && lessThan(*end, *high)) - --high; - - if (low < high) { - qSwap(*low, *high); - ++low; - --high; - } else { - break; - } - } - - if (lessThan(*low, *end)) - ++low; - - qSwap(*end, *low); - qSortHelper(start, low, t, lessThan); - - start = low + 1; - ++end; - goto top; -#endif -} - -template -inline void qSortHelper(RandomAccessIterator begin, RandomAccessIterator end, const T &dummy) -{ - qSortHelper(begin, end, dummy, qLess()); -} - template Q_OUTOFLINE_TEMPLATE void qReverse(RandomAccessIterator begin, RandomAccessIterator end) { @@ -466,85 +348,9 @@ Q_OUTOFLINE_TEMPLATE void qMerge(RandomAccessIterator begin, RandomAccessIterato } template -#ifndef QT_NO_STL -Q_OUTOFLINE_TEMPLATE void qStableSortHelper(RandomAccessIterator begin, RandomAccessIterator end, const T & , LessThan lessThan) -#else -Q_OUTOFLINE_TEMPLATE void qStableSortHelper(RandomAccessIterator begin, RandomAccessIterator end, const T &t, LessThan lessThan) -#endif -{ -#ifndef QT_NO_STL - std::stable_sort(begin, end, lessThan); -#else - const int span = end - begin; - if (span < 2) - return; - - const RandomAccessIterator middle = begin + span / 2; - qStableSortHelper(begin, middle, t, lessThan); - qStableSortHelper(middle, end, t, lessThan); - qMerge(begin, middle, end, t, lessThan); -#endif -} - -template -inline void qStableSortHelper(RandomAccessIterator begin, RandomAccessIterator end, const T &dummy) -{ - qStableSortHelper(begin, end, dummy, qLess()); -} - -template -Q_OUTOFLINE_TEMPLATE RandomAccessIterator qLowerBoundHelper(RandomAccessIterator begin, RandomAccessIterator end, const T &value, LessThan lessThan) -{ -#ifndef QT_NO_STL - return std::lower_bound(begin, end, value, lessThan); -#else - RandomAccessIterator middle; - int n = int(end - begin); - int half; - - while (n > 0) { - half = n >> 1; - middle = begin + half; - if (lessThan(*middle, value)) { - begin = middle + 1; - n -= half + 1; - } else { - n = half; - } - } - return begin; -#endif -} - - -template -Q_OUTOFLINE_TEMPLATE RandomAccessIterator qUpperBoundHelper(RandomAccessIterator begin, RandomAccessIterator end, const T &value, LessThan lessThan) -{ -#ifndef QT_NO_STL - return std::upper_bound(begin, end, value, lessThan); -#else - RandomAccessIterator middle; - int n = end - begin; - int half; - - while (n > 0) { - half = n >> 1; - middle = begin + half; - if (lessThan(value, *middle)) { - n = half; - } else { - begin = middle + 1; - n -= half + 1; - } - } - return begin; -#endif -} - -template Q_OUTOFLINE_TEMPLATE RandomAccessIterator qBinaryFindHelper(RandomAccessIterator begin, RandomAccessIterator end, const T &value, LessThan lessThan) { - RandomAccessIterator it = qLowerBoundHelper(begin, end, value, lessThan); + RandomAccessIterator it = qLowerBound(begin, end, value, lessThan); if (it == end || lessThan(value, *it)) return end; diff --git a/src/core/tools/qbytearray.cpp b/src/core/tools/qbytearray.cpp index b3e409366..42c821159 100644 --- a/src/core/tools/qbytearray.cpp +++ b/src/core/tools/qbytearray.cpp @@ -589,9 +589,9 @@ QByteArray qUncompress(const uchar* data, int nbytes) } #endif -QByteArray::Data QByteArray::shared_null = {Q_BASIC_ATOMIC_INITIALIZER(1), - 0, 0, shared_null.array, {0} }; -QByteArray::Data QByteArray::shared_empty = { Q_BASIC_ATOMIC_INITIALIZER(1), +QByteArray::Data QByteArray::shared_null = { QAtomicInt(1), + 0, 0, shared_null.array, {0} }; +QByteArray::Data QByteArray::shared_empty = { QAtomicInt(1), 0, 0, shared_empty.array, {0} }; /*! diff --git a/src/core/tools/qbytearray.h b/src/core/tools/qbytearray.h index 789503502..18bdf489b 100644 --- a/src/core/tools/qbytearray.h +++ b/src/core/tools/qbytearray.h @@ -47,27 +47,12 @@ #include #include - -#ifndef QT_NO_STL -# include -#endif +#include #ifdef truncate #error qbytearray.h must be included before any header file that defines truncate #endif -#if defined(Q_CC_GNU) && (__GNUC__ == 4 && __GNUC_MINOR__ == 0) -//There is a bug in GCC 4.0 that tries to instantiate template of annonymous enum -# ifdef QT_USE_FAST_OPERATOR_PLUS -# undef QT_USE_FAST_OPERATOR_PLUS -# endif -# ifdef QT_USE_QSTRINGBUILDER -# undef QT_USE_QSTRINGBUILDER -# endif - -#endif - - QT_BEGIN_HEADER QT_BEGIN_NAMESPACE @@ -126,7 +111,7 @@ class Q_CORE_EXPORT QByteArray { private: struct Data { - QBasicAtomicInt ref; + QAtomicInt ref; int alloc, size; char *data; char array[1]; @@ -327,10 +312,8 @@ public: void push_front(const char *c); void push_front(const QByteArray &a); -#ifndef QT_NO_STL static inline QByteArray fromStdString(const std::string &s); inline std::string toStdString() const; -#endif inline int count() const { return d->size; } int length() const { return d->size; } @@ -532,13 +515,11 @@ inline QByteArray &QByteArray::setNum(uint n, int base) inline QByteArray &QByteArray::setNum(float n, char f, int prec) { return setNum(double(n),f,prec); } -#ifndef QT_NO_STL inline std::string QByteArray::toStdString() const { return std::string(constData(), length()); } inline QByteArray QByteArray::fromStdString(const std::string &s) { return QByteArray(s.data(), int(s.size())); } -#endif #if !defined(QT_NO_DATASTREAM) || defined(QT_BOOTSTRAPPED) Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QByteArray &); diff --git a/src/core/tools/qcontiguouscache.h b/src/core/tools/qcontiguouscache.h index e174d80ad..6c878537e 100644 --- a/src/core/tools/qcontiguouscache.h +++ b/src/core/tools/qcontiguouscache.h @@ -55,7 +55,7 @@ QT_BEGIN_NAMESPACE struct Q_CORE_EXPORT QContiguousCacheData { - QBasicAtomicInt ref; + QAtomicInt ref; int alloc; int count; int start; diff --git a/src/core/tools/qhash.cpp b/src/core/tools/qhash.cpp index f652f763d..1fdb82316 100644 --- a/src/core/tools/qhash.cpp +++ b/src/core/tools/qhash.cpp @@ -166,7 +166,7 @@ static int countBits(int hint) const int MinNumBits = 4; QHashData QHashData::shared_null = { - 0, 0, Q_BASIC_ATOMIC_INITIALIZER(1), 0, 0, MinNumBits, 0, 0, true + 0, 0, QAtomicInt(1), 0, 0, MinNumBits, 0, 0, true }; QHashData *QHashData::detach_helper(void (*node_duplicate)(Node *, void *), diff --git a/src/core/tools/qhash.h b/src/core/tools/qhash.h index ba22b5a12..5be1098a6 100644 --- a/src/core/tools/qhash.h +++ b/src/core/tools/qhash.h @@ -106,7 +106,7 @@ struct Q_CORE_EXPORT QHashData Node *fakeNext; Node **buckets; - QBasicAtomicInt ref; + QAtomicInt ref; int size; int nodeSize; short userNumBits; diff --git a/src/core/tools/qiterator.h b/src/core/tools/qiterator.h index 3daa362c4..babd9a06c 100644 --- a/src/core/tools/qiterator.h +++ b/src/core/tools/qiterator.h @@ -46,36 +46,6 @@ QT_BEGIN_HEADER -#ifdef QT_NO_STL -# include // No-op, indirectly include additional configuration headers. -# if defined(_LIBCPP_VERSION) -// libc++ may declare these structs in an inline namespace. Forward-declare -// these iterators in the same namespace so that we do not shadow the original -// declarations. - -// Tell clang not to warn about the use of inline namespaces when not building -// in C++11 mode. -# if defined(Q_CC_CLANG) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wc++11-extensions" -# endif - -_LIBCPP_BEGIN_NAMESPACE_STD - struct bidirectional_iterator_tag; - struct random_access_iterator_tag; -_LIBCPP_END_NAMESPACE_STD - -# if defined(Q_CC_CLANG) -# pragma GCC diagnostic pop -# endif -# else -namespace std { - struct bidirectional_iterator_tag; - struct random_access_iterator_tag; -} -# endif -#endif - QT_BEGIN_NAMESPACE diff --git a/src/core/tools/qlinkedlist.cpp b/src/core/tools/qlinkedlist.cpp index cadc5e4b1..133cfc360 100644 --- a/src/core/tools/qlinkedlist.cpp +++ b/src/core/tools/qlinkedlist.cpp @@ -45,7 +45,7 @@ QT_BEGIN_NAMESPACE QLinkedListData QLinkedListData::shared_null = { &QLinkedListData::shared_null, &QLinkedListData::shared_null, - Q_BASIC_ATOMIC_INITIALIZER(1), 0, true + QAtomicInt(1), 0, true }; /*! \class QLinkedList diff --git a/src/core/tools/qlinkedlist.h b/src/core/tools/qlinkedlist.h index b43de23f2..91e96ab31 100644 --- a/src/core/tools/qlinkedlist.h +++ b/src/core/tools/qlinkedlist.h @@ -45,10 +45,8 @@ #include #include -#ifndef QT_NO_STL #include #include -#endif QT_BEGIN_HEADER @@ -58,7 +56,7 @@ QT_BEGIN_NAMESPACE struct Q_CORE_EXPORT QLinkedListData { QLinkedListData *n, *p; - QBasicAtomicInt ref; + QAtomicInt ref; int size; uint sharable : 1; @@ -219,12 +217,10 @@ public: typedef const value_type &const_reference; typedef qptrdiff difference_type; -#ifndef QT_NO_STL static inline QLinkedList fromStdList(const std::list &list) { QLinkedList tmp; qCopy(list.begin(), list.end(), std::back_inserter(tmp)); return tmp; } inline std::list toStdList() const { std::list tmp; qCopy(constBegin(), constEnd(), std::back_inserter(tmp)); return tmp; } -#endif // comfort diff --git a/src/core/tools/qlist.cpp b/src/core/tools/qlist.cpp index 13bedae60..19f8d6024 100644 --- a/src/core/tools/qlist.cpp +++ b/src/core/tools/qlist.cpp @@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE the number of elements in the list. */ -QListData::Data QListData::shared_null = { Q_BASIC_ATOMIC_INITIALIZER(1), 0, 0, 0, true, { 0 } }; +QListData::Data QListData::shared_null = { QAtomicInt(1), 0, 0, 0, true, { 0 } }; static int grow(int size) { diff --git a/src/core/tools/qlist.h b/src/core/tools/qlist.h index 83060e139..2e5dcfe49 100644 --- a/src/core/tools/qlist.h +++ b/src/core/tools/qlist.h @@ -46,10 +46,8 @@ #include #include -#ifndef QT_NO_STL #include #include -#endif #ifdef Q_COMPILER_INITIALIZER_LISTS #include #include @@ -69,7 +67,7 @@ template class QSet; struct Q_CORE_EXPORT QListData { struct Data { - QBasicAtomicInt ref; + QAtomicInt ref; int alloc, begin, end; uint sharable : 1; void *array[1]; @@ -324,12 +322,10 @@ public: static QList fromVector(const QVector &vector); static QList fromSet(const QSet &set); -#ifndef QT_NO_STL static inline QList fromStdList(const std::list &list) { QList tmp; qCopy(list.begin(), list.end(), std::back_inserter(tmp)); return tmp; } inline std::list toStdList() const { std::list tmp; qCopy(constBegin(), constEnd(), std::back_inserter(tmp)); return tmp; } -#endif private: Node *detach_helper_grow(int i, int n); diff --git a/src/core/tools/qlocale.cpp b/src/core/tools/qlocale.cpp index 916f96a79..a01409be8 100644 --- a/src/core/tools/qlocale.cpp +++ b/src/core/tools/qlocale.cpp @@ -60,7 +60,6 @@ #include "qvariant.h" #include "qstringbuilder.h" #include "qnumeric.h" -#include "qnumeric_p.h" QT_BEGIN_NAMESPACE @@ -2973,13 +2972,13 @@ double QLocalePrivate::bytearrayToDouble(const char *num, bool *ok, bool *overfl } if (qstrcmp(num, "nan") == 0) - return qt_snan(); + return qSNaN(); if (qstrcmp(num, "+inf") == 0 || qstrcmp(num, "inf") == 0) - return qt_inf(); + return qInf(); if (qstrcmp(num, "-inf") == 0) - return -qt_inf(); + return -qInf(); bool _ok; const char *endptr; diff --git a/src/core/tools/qlocale_tools.cpp b/src/core/tools/qlocale_tools.cpp index 3af33d89b..985987102 100644 --- a/src/core/tools/qlocale_tools.cpp +++ b/src/core/tools/qlocale_tools.cpp @@ -68,8 +68,8 @@ QT_BEGIN_NAMESPACE #ifndef QT_QLOCALE_USES_FCVT -static char *_qdtoa( NEEDS_VOLATILE double d, int mode, int ndigits, int *decpt, - int *sign, char **rve, char **digits_str); +static char *_qdtoa( double d, int mode, int ndigits, int *decpt, + int *sign, char **rve, char **digits_str); #endif QString qulltoa(qulonglong l, int base, const QChar _zero) @@ -597,9 +597,9 @@ QT_END_INCLUDE_NAMESPACE #error Exactly one of IEEE_BIG_OR_LITTLE_ENDIAN, VAX, or IBM should be defined. #endif -static inline ULong _getWord0(const NEEDS_VOLATILE double x) +static inline ULong _getWord0(const double x) { - const NEEDS_VOLATILE uchar *ptr = reinterpret_cast(&x); + const uchar *ptr = reinterpret_cast(&x); if (QSysInfo::ByteOrder == QSysInfo::BigEndian) { return (ptr[0]<<24) + (ptr[1]<<16) + (ptr[2]<<8) + ptr[3]; } else { @@ -607,9 +607,9 @@ static inline ULong _getWord0(const NEEDS_VOLATILE double x) } } -static inline void _setWord0(NEEDS_VOLATILE double *x, ULong l) +static inline void _setWord0(double *x, ULong l) { - NEEDS_VOLATILE uchar *ptr = reinterpret_cast(x); + uchar *ptr = reinterpret_cast(x); if (QSysInfo::ByteOrder == QSysInfo::BigEndian) { ptr[0] = uchar(l>>24); ptr[1] = uchar(l>>16); @@ -623,18 +623,18 @@ static inline void _setWord0(NEEDS_VOLATILE double *x, ULong l) } } -static inline ULong _getWord1(const NEEDS_VOLATILE double x) +static inline ULong _getWord1(const double x) { - const NEEDS_VOLATILE uchar *ptr = reinterpret_cast(&x); + const uchar *ptr = reinterpret_cast(&x); if (QSysInfo::ByteOrder == QSysInfo::BigEndian) { return (ptr[4]<<24) + (ptr[5]<<16) + (ptr[6]<<8) + ptr[7]; } else { return (ptr[3]<<24) + (ptr[2]<<16) + (ptr[1]<<8) + ptr[0]; } } -static inline void _setWord1(NEEDS_VOLATILE double *x, ULong l) +static inline void _setWord1(double *x, ULong l) { - NEEDS_VOLATILE uchar *ptr = reinterpret_cast(x); + uchar *ptr = reinterpret_cast(x); if (QSysInfo::ByteOrder == QSysInfo::BigEndian) { ptr[4] = uchar(l>>24); ptr[5] = uchar(l>>16); @@ -648,7 +648,7 @@ static inline void _setWord1(NEEDS_VOLATILE double *x, ULong l) } } -static inline ULong getWord0(const NEEDS_VOLATILE double x) +static inline ULong getWord0(const double x) { #ifdef QT_ARMFPA return _getWord1(x); @@ -657,7 +657,7 @@ static inline ULong getWord0(const NEEDS_VOLATILE double x) #endif } -static inline void setWord0(NEEDS_VOLATILE double *x, ULong l) +static inline void setWord0(double *x, ULong l) { #ifdef QT_ARMFPA _setWord1(x, l); @@ -666,7 +666,7 @@ static inline void setWord0(NEEDS_VOLATILE double *x, ULong l) #endif } -static inline ULong getWord1(const NEEDS_VOLATILE double x) +static inline ULong getWord1(const double x) { #ifdef QT_ARMFPA return _getWord0(x); @@ -675,7 +675,7 @@ static inline ULong getWord1(const NEEDS_VOLATILE double x) #endif } -static inline void setWord1(NEEDS_VOLATILE double *x, ULong l) +static inline void setWord1(double *x, ULong l) { #ifdef QT_ARMFPA _setWord0(x, l); @@ -2265,7 +2265,7 @@ Q_CORE_EXPORT char *qdtoa ( double d, int mode, int ndigits, int *decpt, int *si return s; } -static char *_qdtoa( NEEDS_VOLATILE double d, int mode, int ndigits, int *decpt, int *sign, char **rve, char **resultp) +static char *_qdtoa( double d, int mode, int ndigits, int *decpt, int *sign, char **rve, char **resultp) { /* Arguments ndigits, decpt, sign are similar to those diff --git a/src/core/tools/qlocale_tools_p.h b/src/core/tools/qlocale_tools_p.h index 5f7f8fa7f..5fa1f0c73 100644 --- a/src/core/tools/qlocale_tools_p.h +++ b/src/core/tools/qlocale_tools_p.h @@ -56,18 +56,6 @@ #include "qlocale_p.h" #include "qstring.h" -#if !defined(QT_QLOCALE_NEEDS_VOLATILE) -# if defined(Q_CC_GNU) && __GNUC__ == 4 -# define QT_QLOCALE_NEEDS_VOLATILE -# endif -#endif - -#if defined(QT_QLOCALE_NEEDS_VOLATILE) -# define NEEDS_VOLATILE volatile -#else -# define NEEDS_VOLATILE -#endif - QT_BEGIN_NAMESPACE QString qulltoa(qulonglong l, int base, const QChar _zero); diff --git a/src/core/tools/qmap.cpp b/src/core/tools/qmap.cpp index d36de8a19..9ff3a316e 100644 --- a/src/core/tools/qmap.cpp +++ b/src/core/tools/qmap.cpp @@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE QMapData QMapData::shared_null = { &shared_null, { &shared_null, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - Q_BASIC_ATOMIC_INITIALIZER(1), 0, 0, 0, false, true + QAtomicInt(1), 0, 0, 0, false, true }; QMapData *QMapData::createData() diff --git a/src/core/tools/qmap.h b/src/core/tools/qmap.h index f3ebb8568..1c510a74a 100644 --- a/src/core/tools/qmap.h +++ b/src/core/tools/qmap.h @@ -46,10 +46,7 @@ #include #include -#ifndef QT_NO_STL #include -#endif - #include QT_BEGIN_HEADER @@ -67,7 +64,7 @@ struct Q_CORE_EXPORT QMapData QMapData *backward; QMapData *forward[QMapData::LastLevel + 1]; - QBasicAtomicInt ref; + QAtomicInt ref; int topLevel; int size; uint randomBits; @@ -178,10 +175,8 @@ public: { qSwap(d, other.d); return *this; } #endif inline void swap(QMap &other) { qSwap(d, other.d); } -#ifndef QT_NO_STL explicit QMap(const typename std::map &other); std::map toStdMap() const; -#endif bool operator==(const QMap &other) const; inline bool operator!=(const QMap &other) const { return !(*this == other); } @@ -882,7 +877,6 @@ Q_OUTOFLINE_TEMPLATE bool QMap::operator==(const QMap &other) co return true; } -#ifndef QT_NO_STL template Q_OUTOFLINE_TEMPLATE QMap::QMap(const std::map &other) { @@ -908,8 +902,6 @@ Q_OUTOFLINE_TEMPLATE std::map QMap::toStdMap() const return map; } -#endif // QT_NO_STL - template class QMultiMap : public QMap { diff --git a/src/core/tools/qscopedpointer.h b/src/core/tools/qscopedpointer.h index 60275c179..a323e3364 100644 --- a/src/core/tools/qscopedpointer.h +++ b/src/core/tools/qscopedpointer.h @@ -178,7 +178,6 @@ template Q_INLINE_TEMPLATE void qSwap(QScopedPointer &p1, QScopedPointer &p2) { p1.swap(p2); } -#ifndef QT_NO_STL QT_END_NAMESPACE namespace std { template @@ -186,8 +185,6 @@ namespace std { { p1.swap(p2); } } QT_BEGIN_NAMESPACE -#endif - namespace QtPrivate { diff --git a/src/core/tools/qshareddata.h b/src/core/tools/qshareddata.h index c36df1e35..334bad2e1 100644 --- a/src/core/tools/qshareddata.h +++ b/src/core/tools/qshareddata.h @@ -263,8 +263,8 @@ template Q_INLINE_TEMPLATE void qSwap(QExplicitlySharedDataPointer &p1, QExplicitlySharedDataPointer &p2) { p1.swap(p2); } -#ifndef QT_NO_STL QT_END_NAMESPACE + namespace std { template Q_INLINE_TEMPLATE void swap(QT_PREPEND_NAMESPACE(QSharedDataPointer) &p1, QT_PREPEND_NAMESPACE(QSharedDataPointer) &p2) @@ -274,10 +274,6 @@ namespace std { Q_INLINE_TEMPLATE void swap(QT_PREPEND_NAMESPACE(QExplicitlySharedDataPointer) &p1, QT_PREPEND_NAMESPACE(QExplicitlySharedDataPointer) &p2) { p1.swap(p2); } } -QT_BEGIN_NAMESPACE -#endif - -QT_END_NAMESPACE QT_END_HEADER diff --git a/src/core/tools/qsharedpointer_impl.h b/src/core/tools/qsharedpointer_impl.h index dbdd34540..5a7e05228 100644 --- a/src/core/tools/qsharedpointer_impl.h +++ b/src/core/tools/qsharedpointer_impl.h @@ -156,8 +156,8 @@ namespace QtSharedPointer { // the ExternalRefCountData object. struct ExternalRefCountData { - QBasicAtomicInt weakref; - QBasicAtomicInt strongref; + QAtomicInt weakref; + QAtomicInt strongref; inline ExternalRefCountData() { @@ -740,7 +740,6 @@ inline void qSwap(QSharedPointer &p1, QSharedPointer &p2) p1.swap(p2); } -#ifndef QT_NO_STL QT_END_NAMESPACE namespace std { template @@ -748,7 +747,6 @@ namespace std { { p1.swap(p2); } } QT_BEGIN_NAMESPACE -#endif namespace QtSharedPointer { // helper functions: diff --git a/src/core/tools/qstring.cpp b/src/core/tools/qstring.cpp index 6dac44d3d..460b36f52 100644 --- a/src/core/tools/qstring.cpp +++ b/src/core/tools/qstring.cpp @@ -723,9 +723,9 @@ const QString::Null QString::null = { }; \sa split() */ -QString::Data QString::shared_null = { Q_BASIC_ATOMIC_INITIALIZER(1), +QString::Data QString::shared_null = { QAtomicInt(1), 0, 0, shared_null.array, 0, {0} }; -QString::Data QString::shared_empty = { Q_BASIC_ATOMIC_INITIALIZER(1), +QString::Data QString::shared_empty = { QAtomicInt(1), 0, 0, shared_empty.array, 0, {0} }; int QString::grow(int size) diff --git a/src/core/tools/qstring.h b/src/core/tools/qstring.h index 4b3a707a0..880572c59 100644 --- a/src/core/tools/qstring.h +++ b/src/core/tools/qstring.h @@ -47,15 +47,11 @@ #include #include -#ifndef QT_NO_STL -# include - -# ifndef QT_NO_STL_WCHAR +#include +#ifndef QT_NO_STL_WCHAR // workaround for some headers not typedef'ing std::wstring typedef std::basic_string QStdWString; -# endif // QT_NO_STL_WCHAR - -#endif // QT_NO_STL +#endif // QT_NO_STL_WCHAR #include @@ -473,14 +469,12 @@ public: inline void push_front(QChar c) { prepend(c); } inline void push_front(const QString &s) { prepend(s); } -#ifndef QT_NO_STL static inline QString fromStdString(const std::string &s); inline std::string toStdString() const; -# ifndef QT_NO_STL_WCHAR +#ifndef QT_NO_STL_WCHAR static inline QString fromStdWString(const QStdWString &s); inline QStdWString toStdWString() const; -# endif // QT_NO_STL_WCHAR -#endif +#endif // QT_NO_STL_WCHAR // compatibility struct Null { }; @@ -506,7 +500,7 @@ private: #endif struct Data { - QBasicAtomicInt ref; + QAtomicInt ref; int alloc, size; ushort *data; ushort capacity : 1; @@ -908,14 +902,13 @@ inline QT_ASCII_CAST_WARN const QString operator+(const QString &s, const QByteA # endif // QT_NO_CAST_FROM_ASCII #endif // QT_USE_QSTRINGBUILDER -#ifndef QT_NO_STL inline std::string QString::toStdString() const { return toAscii().toStdString(); } inline QString QString::fromStdString(const std::string &s) { return fromAscii(s.data(), int(s.size())); } -# ifndef QT_NO_STL_WCHAR +#ifndef QT_NO_STL_WCHAR inline QStdWString QString::toStdWString() const { QStdWString str; @@ -924,7 +917,6 @@ inline QStdWString QString::toStdWString() const } inline QString QString::fromStdWString(const QStdWString &s) { return fromWCharArray(s.data(), int(s.size())); } -# endif #endif diff --git a/src/core/tools/qstringbuilder.h b/src/core/tools/qstringbuilder.h index b398457c3..07d8a3336 100644 --- a/src/core/tools/qstringbuilder.h +++ b/src/core/tools/qstringbuilder.h @@ -45,12 +45,6 @@ #include #include -#if defined(Q_CC_GNU) && !defined(Q_CC_INTEL) -# if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ == 0) -# include -# endif -#endif - #include QT_BEGIN_HEADER diff --git a/src/core/tools/qvector.cpp b/src/core/tools/qvector.cpp index 72fd4667e..ac860d4be 100644 --- a/src/core/tools/qvector.cpp +++ b/src/core/tools/qvector.cpp @@ -45,7 +45,7 @@ QT_BEGIN_NAMESPACE -QVectorData QVectorData::shared_null = { Q_BASIC_ATOMIC_INITIALIZER(1), 0, 0, true, false }; +QVectorData QVectorData::shared_null = { QAtomicInt(1), 0, 0, true, false }; QVectorData *QVectorData::allocate(int size) { diff --git a/src/core/tools/qvector.h b/src/core/tools/qvector.h index 07613a0bd..bd9d6f11c 100644 --- a/src/core/tools/qvector.h +++ b/src/core/tools/qvector.h @@ -44,9 +44,7 @@ #include -#ifndef QT_NO_STL #include -#endif QT_BEGIN_HEADER @@ -54,7 +52,7 @@ QT_BEGIN_NAMESPACE struct Q_CORE_EXPORT QVectorData { - QBasicAtomicInt ref; + QAtomicInt ref; int alloc; int size; uint sharable : 1; @@ -281,12 +279,10 @@ public: static QVector fromList(const QList &list); -#ifndef QT_NO_STL static inline QVector fromStdVector(const std::vector &vector) { QVector tmp; tmp.reserve(int(vector.size())); qCopy(vector.begin(), vector.end(), std::back_inserter(tmp)); return tmp; } inline std::vector toStdVector() const { std::vector tmp; tmp.reserve(size()); qCopy(constBegin(), constEnd(), std::back_inserter(tmp)); return tmp; } -#endif private: friend class QRegion; // Optimization for QRegion::rects() diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index 16aa8b28f..2d61a751f 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -70,7 +70,7 @@ QT_BEGIN_NAMESPACE -static QBasicAtomicInt isDebugging = Q_BASIC_ATOMIC_INITIALIZER(-1); +static QAtomicInt isDebugging = QAtomicInt(-1); #define qDBusDebug if (::isDebugging == 0); else qDebug static const QString orgFreedesktopDBusString = QLatin1String(DBUS_SERVICE_DBUS); diff --git a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp index 4074d7a41..e1f4ffd20 100644 --- a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp +++ b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp @@ -55,14 +55,6 @@ #include #include -#if defined(__GNUC__) -# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 405 -// The code in this file does not violate strict aliasing, but GCC thinks it does -// so turn off the warnings for us to have a clean build -# pragma GCC diagnostic ignored "-Wstrict-aliasing" -# endif -#endif - QT_BEGIN_NAMESPACE struct ObjectData : public QScriptDeclarativeClass::Object { diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp index 624ca5d11..424f71e05 100644 --- a/src/gui/dialogs/qfiledialog.cpp +++ b/src/gui/dialogs/qfiledialog.cpp @@ -59,18 +59,7 @@ #include #include #include -#if !defined(Q_WS_WINCE) #include "ui_qfiledialog.h" -#else -#define Q_EMBEDDED_SMALLSCREEN -#include "ui_qfiledialog_embedded.h" -#if defined(Q_OS_WINCE) -extern bool qt_priv_ptr_valid; -#endif -#if defined(Q_OS_UNIX) -#include -#endif -#endif QT_BEGIN_NAMESPACE @@ -2160,12 +2149,6 @@ void QFileDialogPrivate::init(const QString &directory, const QString &nameFilte q->restoreState(settings.value(QLatin1String("filedialog")).toByteArray()); #endif -#if defined(Q_EMBEDDED_SMALLSCREEN) - qFileDialogUi->lookInLabel->setVisible(false); - qFileDialogUi->fileNameLabel->setVisible(false); - qFileDialogUi->fileTypeLabel->setVisible(false); - qFileDialogUi->sidebar->hide(); -#endif // Default case if (!nameFilter.isEmpty()) q->setNameFilter(nameFilter); diff --git a/src/gui/dialogs/qfiledialog_embedded.ui b/src/gui/dialogs/qfiledialog_embedded.ui deleted file mode 100644 index 75eded168..000000000 --- a/src/gui/dialogs/qfiledialog_embedded.ui +++ /dev/null @@ -1,340 +0,0 @@ - - ********************************************************************* -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** $QT_END_LICENSE$ -** -********************************************************************* - QFileDialog - - - - 0 - 0 - 240 - 320 - - - - true - - - - - - - 1 - 0 - - - - - - - - - - Back - - - - - - - Forward - - - - - - - Parent Directory - - - - - - - Create New Folder - - - - - - - List View - - - - - - - Detail View - - - - - - - - - - 0 - 0 - - - - Qt::Horizontal - - - - - QFrame::NoFrame - - - QFrame::Raised - - - - 0 - - - 0 - - - - - 0 - - - - - 0 - 0 - 108 - 164 - - - - - 0 - - - 0 - - - - - - - - - - 0 - 0 - 100 - 30 - - - - - 0 - - - 0 - - - - - - - - - - - - - - - - - - - 1 - 0 - - - - - - - - Qt::Vertical - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - 0 - 0 - - - - - - - - - - false - - - - 0 - 0 - - - - - 0 - 0 - - - - - 0 - 0 - - - - - - - - false - - - - 0 - 0 - - - - - 0 - 0 - - - - Files of type: - - - - - - - false - - - - 0 - 0 - - - - - 0 - 0 - - - - Look in: - - - - - - - - QFileDialogTreeView - QTreeView -
qfiledialog_p.h
-
- - QFileDialogListView - QListView -
qfiledialog_p.h
-
- - QSidebar - QListWidget -
qsidebar_p.h
-
- - QFileDialogLineEdit - QLineEdit -
qfiledialog_p.h
-
- - QFileDialogComboBox - QComboBox -
qfiledialog_p.h
-
-
- - lookInCombo - backButton - forwardButton - toParentButton - newFolderButton - listModeButton - detailModeButton - sidebar - listView - fileNameEdit - fileTypeCombo - buttonBox - treeView - - - -
diff --git a/src/gui/dialogs/qfileinfogatherer.cpp b/src/gui/dialogs/qfileinfogatherer.cpp index 16f87fcdd..d19c69e5f 100644 --- a/src/gui/dialogs/qfileinfogatherer.cpp +++ b/src/gui/dialogs/qfileinfogatherer.cpp @@ -249,7 +249,7 @@ QExtendedInformation QFileInfoGatherer::getInfo(const QFileInfo &fileInfo) const #endif #endif - if (m_resolveSymlinks && info.isSymLink(/* ignoreNtfsSymLinks = */ true)) { + if (m_resolveSymlinks && info.isSymLink()) { QFileInfo resolvedInfo(fileInfo.readLink()); resolvedInfo = resolvedInfo.canonicalFilePath(); if (resolvedInfo.exists()) { @@ -261,16 +261,7 @@ QExtendedInformation QFileInfoGatherer::getInfo(const QFileInfo &fileInfo) const QString QFileInfoGatherer::translateDriveName(const QFileInfo &drive) const { - QString driveName = drive.absoluteFilePath(); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) - if (driveName.startsWith(QLatin1Char('/'))) // UNC host - return drive.fileName(); -#endif -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) - if (driveName.endsWith(QLatin1Char('/'))) - driveName.chop(1); -#endif - return driveName; + return drive.absoluteFilePath(); } /* diff --git a/src/gui/dialogs/qfileinfogatherer_p.h b/src/gui/dialogs/qfileinfogatherer_p.h index 5c3a19e8f..b9e3eae3a 100644 --- a/src/gui/dialogs/qfileinfogatherer_p.h +++ b/src/gui/dialogs/qfileinfogatherer_p.h @@ -108,15 +108,8 @@ public: return QExtendedInformation::System; } - bool isSymLink(bool ignoreNtfsSymLinks = false) const + bool isSymLink() const { -#ifdef Q_WS_WIN - if (ignoreNtfsSymLinks) { - return !mFileInfo.suffix().compare(QLatin1String("lnk"), Qt::CaseInsensitive); - } -#else - Q_UNUSED(ignoreNtfsSymLinks); -#endif return mFileInfo.isSymLink(); } @@ -202,10 +195,8 @@ private: bool m_resolveSymlinks; QFileIconProvider *m_iconProvider; QFileIconProvider defaultProvider; -#ifndef Q_OS_WIN uint userId; uint groupId; -#endif }; #endif // QT_NO_FILESYSTEMMODEL diff --git a/src/gui/dialogs/qfilesystemmodel.cpp b/src/gui/dialogs/qfilesystemmodel.cpp index 3f01d848a..381d1be21 100644 --- a/src/gui/dialogs/qfilesystemmodel.cpp +++ b/src/gui/dialogs/qfilesystemmodel.cpp @@ -802,7 +802,7 @@ QString QFileSystemModelPrivate::name(const QModelIndex &index) const return QString(); QFileSystemNode *dirNode = node(index); if (fileInfoGatherer.resolveSymlinks() && !resolvedSymLinks.isEmpty() && - dirNode->isSymLink(/* ignoreNtfsSymLinks = */ true)) { + dirNode->isSymLink()) { QString fullPath = QDir::fromNativeSeparators(filePath(index)); if (resolvedSymLinks.contains(fullPath)) return resolvedSymLinks[fullPath]; diff --git a/src/gui/dialogs/qfilesystemmodel_p.h b/src/gui/dialogs/qfilesystemmodel_p.h index d3dcaa33e..815415f05 100644 --- a/src/gui/dialogs/qfilesystemmodel_p.h +++ b/src/gui/dialogs/qfilesystemmodel_p.h @@ -115,7 +115,7 @@ public: inline bool isFile() const { if (info) return info->isFile(); return true; } inline bool isSystem() const { if (info) return info->isSystem(); return true; } inline bool isHidden() const { if (info) return info->isHidden(); return false; } - inline bool isSymLink(bool ignoreNtfsSymLinks = false) const { return info && info->isSymLink(ignoreNtfsSymLinks); } + inline bool isSymLink() const { return info && info->isSymLink(); } inline bool caseSensitive() const { if (info) return info->isCaseSensitive(); return false; } inline QIcon icon() const { if (info) return info->icon; return QIcon(); } diff --git a/src/gui/egl/qegl.cpp b/src/gui/egl/qegl.cpp index cf6882a2b..148466d51 100644 --- a/src/gui/egl/qegl.cpp +++ b/src/gui/egl/qegl.cpp @@ -72,12 +72,12 @@ public: static bool displayOpened() { return displayOpen; } private: - static QBasicAtomicInt contexts; - static QBasicAtomicInt displayOpen; + static QAtomicInt contexts; + static QAtomicInt displayOpen; }; -QBasicAtomicInt QEglContextTracker::contexts = Q_BASIC_ATOMIC_INITIALIZER(0); -QBasicAtomicInt QEglContextTracker::displayOpen = Q_BASIC_ATOMIC_INITIALIZER(0); +QAtomicInt QEglContextTracker::contexts = QAtomicInt(0); +QAtomicInt QEglContextTracker::displayOpen = QAtomicInt(0); // Current GL and VG contexts. These are used to determine if // we can avoid an eglMakeCurrent() after a call to lazyDoneCurrent(). diff --git a/src/gui/image/qbmphandler.cpp b/src/gui/image/qbmphandler.cpp index cdfd11764..4e2aaded9 100644 --- a/src/gui/image/qbmphandler.cpp +++ b/src/gui/image/qbmphandler.cpp @@ -639,7 +639,7 @@ bool qt_write_dib(QDataStream &s, QImage image) uchar *buf = new uchar[bpl_bmp]; uchar *b, *end; - register uchar *p; + uchar *p; memset(buf, 0, bpl_bmp); for (y=image.height()-1; y>=0; y--) { // write the image bits diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp index 2571a4038..211e48709 100644 --- a/src/gui/image/qicon.cpp +++ b/src/gui/image/qicon.cpp @@ -105,7 +105,7 @@ QT_BEGIN_NAMESPACE \value On Display the pixmap when the widget is in an "on" state */ -static QBasicAtomicInt serialNumCounter = Q_BASIC_ATOMIC_INITIALIZER(1); +static QAtomicInt serialNumCounter = QAtomicInt(1); static void qt_cleanup_icon_cache(); typedef QCache IconCache; diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 0da700b09..cc852d93b 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -108,7 +108,7 @@ static QImage rotated90(const QImage &src); static QImage rotated180(const QImage &src); static QImage rotated270(const QImage &src); -QBasicAtomicInt qimage_serial_number = Q_BASIC_ATOMIC_INITIALIZER(1); +QAtomicInt qimage_serial_number = QAtomicInt(1); QImageData::QImageData() : ref(0), width(0), height(0), depth(0), nbytes(0), data(0), diff --git a/src/gui/image/qpixmap_x11.cpp b/src/gui/image/qpixmap_x11.cpp index 028e2e0ee..7cdc6ce31 100644 --- a/src/gui/image/qpixmap_x11.cpp +++ b/src/gui/image/qpixmap_x11.cpp @@ -308,7 +308,7 @@ static int defaultScreen = -1; QPixmap member functions *****************************************************************************/ -QBasicAtomicInt qt_pixmap_serial = Q_BASIC_ATOMIC_INITIALIZER(0); +QAtomicInt qt_pixmap_serial = QAtomicInt(0); int Q_GUI_EXPORT qt_x11_preferred_pixmap_depth = 0; QX11PixmapData::QX11PixmapData(PixelType type) @@ -1749,7 +1749,7 @@ QImage QX11PixmapData::toImage(const QXImageWrapper &xiWrapper, const QRect &rec image.setColor(0, qRgb(255,255,255)); image.setColor(1, qRgb(0,0,0)); } else if (!trucol) { // pixmap with colormap - register uchar *p; + uchar *p; uchar *end; uchar use[256]; // pixel-in-use table uchar pix[256]; // pixel translation table @@ -2150,8 +2150,8 @@ QPixmap QPixmap::grabWindow(WId window, int x, int y, int w, int h) QX11PixmapData *data = new QX11PixmapData(QPixmapData::PixmapType); - void qt_x11_getX11InfoForWindow(QX11Info * xinfo, const XWindowAttributes &a); - qt_x11_getX11InfoForWindow(&data->xinfo,window_attr); + extern void qt_x11_getX11InfoForWindow(QX11Info *xinfo, const void *a); + qt_x11_getX11InfoForWindow(&data->xinfo, static_cast(&window_attr)); data->resize(w, h); diff --git a/src/gui/image/qpixmapcache.cpp b/src/gui/image/qpixmapcache.cpp index 8befbface..dd090bf2b 100644 --- a/src/gui/image/qpixmapcache.cpp +++ b/src/gui/image/qpixmapcache.cpp @@ -91,11 +91,7 @@ QT_BEGIN_NAMESPACE \sa QCache, QPixmap */ -#if defined(Q_WS_WINCE) -static int cache_limit = 2048; // 2048 KB cache limit for embedded -#else static int cache_limit = 10240; // 10 MB cache limit for desktop -#endif /*! \class QPixmapCache::Key diff --git a/src/gui/image/qpixmapdata_p.h b/src/gui/image/qpixmapdata_p.h index 1ee8cb6bb..ff42a6ec1 100644 --- a/src/gui/image/qpixmapdata_p.h +++ b/src/gui/image/qpixmapdata_p.h @@ -153,9 +153,6 @@ private: # define QT_XFORM_TYPE_MSBFIRST 0 # define QT_XFORM_TYPE_LSBFIRST 1 -# if defined(Q_WS_WIN) -# define QT_XFORM_TYPE_WINDOWSPIXMAP 2 -# endif extern bool qt_xForm_helper(const QTransform&, int, int, int, uchar*, int, int, int, const uchar*, int, int, int); QT_END_NAMESPACE diff --git a/src/gui/itemviews/qfileiconprovider_p.h b/src/gui/itemviews/qfileiconprovider_p.h index d2f57afd5..4faa9b35e 100644 --- a/src/gui/itemviews/qfileiconprovider_p.h +++ b/src/gui/itemviews/qfileiconprovider_p.h @@ -59,11 +59,6 @@ public: QFileIconProviderPrivate(); void setUseCustomDirectoryIcons(bool enable); QIcon getIcon(QStyle::StandardPixmap name) const; -#ifdef Q_WS_WIN - QIcon getWinIcon(const QFileInfo &fi) const; -#elif defined(Q_WS_MAC) - QIcon getMacIcon(const QFileInfo &fi) const; -#endif QFileIconProvider * q_ptr; const QString homePath; diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 73d41d48f..23e86331e 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -932,7 +932,7 @@ QApplication::~QApplication() QWidgetSet *mySet = QWidgetPrivate::allWidgets; QWidgetPrivate::allWidgets = 0; for (QWidgetSet::ConstIterator it = mySet->constBegin(); it != mySet->constEnd(); ++it) { - register QWidget *w = *it; + QWidget *w = *it; if (!w->parent()) // window w->destroy(true, true); } @@ -1306,8 +1306,7 @@ void QApplication::setStyle(QStyle *style) // clean up the old style if (QApplicationPrivate::app_style) { if (QApplicationPrivate::is_app_running && !QApplicationPrivate::is_app_closing) { - for (QWidgetList::ConstIterator it = all.constBegin(); it != all.constEnd(); ++it) { - register QWidget *w = *it; + foreach (QWidget *w, all) { if (!(w->windowType() == Qt::Desktop) && // except desktop w->testAttribute(Qt::WA_WState_Polished)) { // has been polished QApplicationPrivate::app_style->unpolish(w); @@ -1347,24 +1346,22 @@ void QApplication::setStyle(QStyle *style) // re-polish existing widgets if necessary if (QApplicationPrivate::is_app_running && !QApplicationPrivate::is_app_closing) { - for (QWidgetList::ConstIterator it1 = all.constBegin(); it1 != all.constEnd(); ++it1) { - register QWidget *w = *it1; - if (w->windowType() != Qt::Desktop && w->testAttribute(Qt::WA_WState_Polished)) { - if (w->style() == QApplicationPrivate::app_style) - QApplicationPrivate::app_style->polish(w); // repolish + foreach (QWidget *it1, all) { + if (it1->windowType() != Qt::Desktop && it1->testAttribute(Qt::WA_WState_Polished)) { + if (it1->style() == QApplicationPrivate::app_style) + QApplicationPrivate::app_style->polish(it1); // repolish #ifndef QT_NO_STYLE_STYLESHEET else - w->setStyleSheet(w->styleSheet()); // touch + it1->setStyleSheet(it1->styleSheet()); // touch #endif } } - for (QWidgetList::ConstIterator it2 = all.constBegin(); it2 != all.constEnd(); ++it2) { - register QWidget *w = *it2; - if (w->windowType() != Qt::Desktop && !w->testAttribute(Qt::WA_SetStyle)) { + foreach (QWidget *it2, all) { + if (it2->windowType() != Qt::Desktop && !it2->testAttribute(Qt::WA_SetStyle)) { QEvent e(QEvent::StyleChange); - QApplication::sendEvent(w, &e); - w->update(); + QApplication::sendEvent(it2, &e); + it2->update(); } } } @@ -1564,9 +1561,7 @@ void QApplicationPrivate::setPalette_helper(const QPalette &palette, const char* QEvent e(QEvent::ApplicationPaletteChange); QApplication::sendEvent(QApplication::instance(), &e); - QWidgetList wids = QApplication::allWidgets(); - for (QWidgetList::ConstIterator it = wids.constBegin(); it != wids.constEnd(); ++it) { - register QWidget *w = *it; + foreach (QWidget *w, QApplication::allWidgets()) { if (all || (!className && w->isWindow()) || w->inherits(className)) // matching class QApplication::sendEvent(w, &e); } @@ -1743,9 +1738,7 @@ void QApplication::setFont(const QFont &font, const char *className) QEvent e(QEvent::ApplicationFontChange); QApplication::sendEvent(QApplication::instance(), &e); - QWidgetList wids = QApplication::allWidgets(); - for (QWidgetList::ConstIterator it = wids.constBegin(); it != wids.constEnd(); ++it) { - register QWidget *w = *it; + foreach (QWidget *w, QApplication::allWidgets()) { if (all || (!className && w->isWindow()) || w->inherits(className)) // matching class sendEvent(w, &e); } @@ -1805,9 +1798,7 @@ void QApplication::setWindowIcon(const QIcon &icon) *QApplicationPrivate::app_icon = icon; if (QApplicationPrivate::is_app_running && !QApplicationPrivate::is_app_closing) { QEvent e(QEvent::ApplicationWindowIconChange); - QWidgetList all = QApplication::allWidgets(); - for (QWidgetList::ConstIterator it = all.constBegin(); it != all.constEnd(); ++it) { - register QWidget *w = *it; + foreach (QWidget *w, QApplication::allWidgets()) { if (w->isWindow()) sendEvent(w, &e); } @@ -1829,10 +1820,8 @@ void QApplication::setWindowIcon(const QIcon &icon) QWidgetList QApplication::topLevelWidgets() { QWidgetList list; - QWidgetList all = allWidgets(); - for (QWidgetList::ConstIterator it = all.constBegin(); it != all.constEnd(); ++it) { - QWidget *w = *it; + foreach (QWidget *w, QApplication::allWidgets()) { if (w->isWindow() && w->windowType() != Qt::Desktop) list.append(w); } @@ -3651,7 +3640,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e) && mouse->type() == QEvent::MouseMove && mouse->buttons() == 0) { // but still send them through all application event filters (normally done by notify_helper) for (int i = 0; i < d->eventFilters.size(); ++i) { - register QObject *obj = d->eventFilters.at(i); + QObject *obj = d->eventFilters.at(i); if (!obj) continue; if (obj->d_func()->threadData != w->d_func()->threadData) { diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp index 74e0a4df1..96ae010f6 100644 --- a/src/gui/kernel/qapplication_x11.cpp +++ b/src/gui/kernel/qapplication_x11.cpp @@ -2772,10 +2772,9 @@ void QApplication::setOverrideCursor(const QCursor &cursor) qApp->d_func()->cursor_list.prepend(cursor); QWidgetList all = allWidgets(); - for (QWidgetList::ConstIterator it = all.constBegin(); it != all.constEnd(); ++it) { - register QWidget *w = *it; - if ((w->testAttribute(Qt::WA_SetCursor) || w->isWindow()) && (w->windowType() != Qt::Desktop)) - qt_x11_enforce_cursor(w); + foreach (QWidget *it, all) { + if ((it->testAttribute(Qt::WA_SetCursor) || it->isWindow()) && (it->windowType() != Qt::Desktop)) + qt_x11_enforce_cursor(it); } XFlush(X11->display); // make X execute it NOW } @@ -2787,11 +2786,9 @@ void QApplication::restoreOverrideCursor() qApp->d_func()->cursor_list.removeFirst(); if (QWidgetPrivate::mapper != 0 && !closingDown()) { - QWidgetList all = allWidgets(); - for (QWidgetList::ConstIterator it = all.constBegin(); it != all.constEnd(); ++it) { - register QWidget *w = *it; - if ((w->testAttribute(Qt::WA_SetCursor) || w->isWindow()) && (w->windowType() != Qt::Desktop)) - qt_x11_enforce_cursor(w); + foreach (QWidget *it, allWidgets()) { + if ((it->testAttribute(Qt::WA_SetCursor) || it->isWindow()) && (it->windowType() != Qt::Desktop)) + qt_x11_enforce_cursor(it); } XFlush(X11->display); } diff --git a/src/gui/kernel/qdnd_p.h b/src/gui/kernel/qdnd_p.h index 381e60e58..9d260ddfe 100644 --- a/src/gui/kernel/qdnd_p.h +++ b/src/gui/kernel/qdnd_p.h @@ -92,73 +92,6 @@ protected: virtual QVariant retrieveData_sys(const QString &mimeType, QVariant::Type type) const = 0; }; -#ifdef Q_WS_WIN -class QOleDataObject : public IDataObject -{ -public: - explicit QOleDataObject(QMimeData *mimeData); - virtual ~QOleDataObject(); - - void releaseQt(); - const QMimeData *mimeData() const; - DWORD reportedPerformedEffect() const; - - // IUnknown methods - STDMETHOD(QueryInterface)(REFIID riid, void FAR* FAR* ppvObj); - STDMETHOD_(ULONG,AddRef)(void); - STDMETHOD_(ULONG,Release)(void); - - // IDataObject methods - STDMETHOD(GetData)(LPFORMATETC pformatetcIn, LPSTGMEDIUM pmedium); - STDMETHOD(GetDataHere)(LPFORMATETC pformatetc, LPSTGMEDIUM pmedium); - STDMETHOD(QueryGetData)(LPFORMATETC pformatetc); - STDMETHOD(GetCanonicalFormatEtc)(LPFORMATETC pformatetc, LPFORMATETC pformatetcOut); - STDMETHOD(SetData)(LPFORMATETC pformatetc, STGMEDIUM FAR * pmedium, - BOOL fRelease); - STDMETHOD(EnumFormatEtc)(DWORD dwDirection, LPENUMFORMATETC FAR* ppenumFormatEtc); - STDMETHOD(DAdvise)(FORMATETC FAR* pFormatetc, DWORD advf, - LPADVISESINK pAdvSink, DWORD FAR* pdwConnection); - STDMETHOD(DUnadvise)(DWORD dwConnection); - STDMETHOD(EnumDAdvise)(LPENUMSTATDATA FAR* ppenumAdvise); - -private: - ULONG m_refs; - QPointer data; - int CF_PERFORMEDDROPEFFECT; - DWORD performedEffect; -}; - -class QOleEnumFmtEtc : public IEnumFORMATETC -{ -public: - explicit QOleEnumFmtEtc(const QVector &fmtetcs); - explicit QOleEnumFmtEtc(const QVector &lpfmtetcs); - virtual ~QOleEnumFmtEtc(); - - bool isNull() const; - - // IUnknown methods - STDMETHOD(QueryInterface)(REFIID riid, void FAR* FAR* ppvObj); - STDMETHOD_(ULONG,AddRef)(void); - STDMETHOD_(ULONG,Release)(void); - - // IEnumFORMATETC methods - STDMETHOD(Next)(ULONG celt, LPFORMATETC rgelt, ULONG FAR* pceltFetched); - STDMETHOD(Skip)(ULONG celt); - STDMETHOD(Reset)(void); - STDMETHOD(Clone)(LPENUMFORMATETC FAR* newEnum); - -private: - bool copyFormatEtc(LPFORMATETC dest, LPFORMATETC src) const; - - ULONG m_dwRefs; - ULONG m_nIndex; - QVector m_lpfmtetcs; - bool m_isNull; -}; - -#endif - #endif //QT_NO_DRAGANDDROP && QT_NO_CLIPBOARD #ifndef QT_NO_DRAGANDDROP @@ -188,11 +121,6 @@ protected: bool hasFormat_sys(const QString &mimeType) const; QStringList formats_sys() const; QVariant retrieveData_sys(const QString &mimeType, QVariant::Type type) const; - -#if defined(Q_WS_WIN) -public: - LPDATAOBJECT currentDataObject; -#endif }; class QDragManager: public QObject { @@ -205,9 +133,6 @@ class QDragManager: public QObject { friend class QDragMoveEvent; friend class QDropEvent; friend class QApplication; -#ifdef Q_WS_MAC - friend class QWidgetPrivate; //dnd is implemented here -#endif bool eventFilter(QObject *, QEvent *); void timerEvent(QTimerEvent*); @@ -259,59 +184,6 @@ private: Q_DISABLE_COPY(QDragManager) }; - -#if defined(Q_WS_WIN) - -class QOleDropTarget : public IDropTarget -{ -public: - QOleDropTarget(QWidget* w); - virtual ~QOleDropTarget() {} - - void releaseQt(); - - // IUnknown methods - STDMETHOD(QueryInterface)(REFIID riid, void FAR* FAR* ppvObj); - STDMETHOD_(ULONG, AddRef)(void); - STDMETHOD_(ULONG, Release)(void); - - // IDropTarget methods - STDMETHOD(DragEnter)(LPDATAOBJECT pDataObj, DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect); - STDMETHOD(DragOver)(DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect); - STDMETHOD(DragLeave)(); - STDMETHOD(Drop)(LPDATAOBJECT pDataObj, DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect); - -private: - ULONG m_refs; - QWidget* widget; - QPointer currentWidget; - QRect answerRect; - QPoint lastPoint; - DWORD chosenEffect; - DWORD lastKeyState; - - void sendDragEnterEvent(QWidget *to, DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect); -}; - -#endif - -#if defined (Q_WS_MAC) -class QCocoaDropData : public QInternalMimeData -{ - Q_OBJECT -public: - QCocoaDropData(CFStringRef pasteboard); - ~QCocoaDropData(); - -protected: - bool hasFormat_sys(const QString &mimeType) const; - QStringList formats_sys() const; - QVariant retrieveData_sys(const QString &mimeType, QVariant::Type type) const; -public: - CFStringRef dropPasteboard; -}; -#endif - #endif // !QT_NO_DRAGANDDROP diff --git a/src/gui/kernel/qevent_p.h b/src/gui/kernel/qevent_p.h index 847f08bf7..d93c13ad0 100644 --- a/src/gui/kernel/qevent_p.h +++ b/src/gui/kernel/qevent_p.h @@ -119,9 +119,6 @@ public: QNativeGestureEvent() : QEvent(QEvent::NativeGesture), gestureType(None), percentage(0) -#ifdef Q_WS_WIN - , sequenceId(0), argument(0) -#endif { } @@ -129,10 +126,6 @@ public: float percentage; QPoint position; float angle; -#ifdef Q_WS_WIN - ulong sequenceId; - quint64 argument; -#endif }; class QGestureEventPrivate diff --git a/src/gui/kernel/qguiplatformplugin.cpp b/src/gui/kernel/qguiplatformplugin.cpp index 391286c30..52a348c04 100644 --- a/src/gui/kernel/qguiplatformplugin.cpp +++ b/src/gui/kernel/qguiplatformplugin.cpp @@ -50,14 +50,6 @@ #include "qplatformdefs.h" #include "qicon.h" -#ifdef Q_WS_WINCE -#include "qguifunctions_wince.h" -extern bool qt_wince_is_smartphone(); //qguifunctions_wince.cpp -extern bool qt_wince_is_mobile(); //qguifunctions_wince.cpp -extern bool qt_wince_is_pocket_pc(); //qguifunctions_wince.cpp -#endif - - #if defined(Q_WS_X11) #include #include @@ -130,26 +122,10 @@ QGuiPlatformPlugin::~QGuiPlatformPlugin() {} /* return the string key to be used by default the application */ QString QGuiPlatformPlugin::styleName() { -#if defined(Q_WS_WIN) && defined(Q_WS_WINCE) - if (qt_wince_is_smartphone() || qt_wince_is_pocket_pc()) - return QLatin1String("WindowsMobile"); - else - return QLatin1String("WindowsCE"); -#elif defined(Q_WS_WIN) - if ((QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA - && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))) - return QLatin1String("WindowsVista"); - else if ((QSysInfo::WindowsVersion >= QSysInfo::WV_XP - && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))) - return QLatin1String("WindowsXP"); - else - return QLatin1String("Windows"); // default styles for Windows -#elif defined(Q_WS_X11) && defined(Q_OS_SOLARIS) +#if defined(Q_WS_X11) && defined(Q_OS_SOLARIS) return QLatin1String("CDE"); // default style for X11 on Solaris #elif defined(Q_WS_X11) && defined(Q_OS_IRIX) return QLatin1String("SGI"); // default style for X11 on IRIX -#elif defined(Q_WS_MAC) - return QLatin1String("Macintosh"); // default style for all Mac's #elif defined(Q_WS_X11) QString stylename; switch(X11->desktopEnvironment) { @@ -246,11 +222,6 @@ QStringList QGuiPlatformPlugin::iconThemeSearchPaths() paths.prepend(homeDir.path()); #endif -#if defined(Q_WS_WIN) - paths.append(qApp->applicationDirPath() + QLatin1String("/icons")); -#elif defined(Q_WS_MAC) - paths.append(qApp->applicationDirPath() + QLatin1String("/../Resources/icons")); -#endif return paths; } diff --git a/src/gui/kernel/qkeymapper_x11.cpp b/src/gui/kernel/qkeymapper_x11.cpp index 29e0f602a..d859df4ea 100644 --- a/src/gui/kernel/qkeymapper_x11.cpp +++ b/src/gui/kernel/qkeymapper_x11.cpp @@ -184,7 +184,7 @@ qt_XTranslateKey(register QXCoreDesc *dpy, KeySym *keysym_return) { int per; - register KeySym *syms; + KeySym *syms; KeySym sym, lsym, usym; if (! dpy->keysyms) diff --git a/src/gui/kernel/qt_gui_pch.h b/src/gui/kernel/qt_gui_pch.h deleted file mode 100644 index c8eb6308a..000000000 --- a/src/gui/kernel/qt_gui_pch.h +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - * This is a precompiled header file for use in Xcode / Mac GCC / - * GCC >= 3.4 / VC to greatly speed the building of Qt. It may also be - * of use to people developing their own project, but it is probably - * better to define your own header. Use of this header is currently - * UNSUPPORTED. - */ - -// from corelib/global/qt_pch.h -#if defined __cplusplus -#include - - -#ifdef Q_WS_WIN -# define _POSIX_ -# include -# undef _POSIX_ -#endif - -#include -#include -#include // All moc genereated code has this include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#endif diff --git a/src/gui/kernel/qwhatsthis.cpp b/src/gui/kernel/qwhatsthis.cpp index 6e20742a9..0cd806117 100644 --- a/src/gui/kernel/qwhatsthis.cpp +++ b/src/gui/kernel/qwhatsthis.cpp @@ -367,9 +367,7 @@ class QWhatsThisPrivate : public QObject void QWhatsThisPrivate::notifyToplevels(QEvent *e) { - QWidgetList toplevels = QApplication::topLevelWidgets(); - for (int i = 0; i < toplevels.count(); ++i) { - register QWidget *w = toplevels.at(i); + foreach (QWidget *w, QApplication::topLevelWidgets()) { QApplication::sendEvent(w, e); } } diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 021257b44..5c55cda2a 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -5841,11 +5841,7 @@ void QWidget::setFocus(Qt::FocusReason reason) while (f->d_func()->extra && f->d_func()->extra->focus_proxy) f = f->d_func()->extra->focus_proxy; - if (QApplication::focusWidget() == f -#if defined(Q_WS_WIN) - && GetFocus() == f->internalWinId() -#endif - ) + if (QApplication::focusWidget() == f) return; #ifndef QT_NO_GRAPHICSVIEW @@ -5970,16 +5966,9 @@ void QWidget::clearFocus() if (hasFocus()) { // Update proxy state QApplicationPrivate::setFocusWidget(0, Qt::OtherFocusReason); -#if defined(Q_WS_WIN) - if (!(windowType() == Qt::Popup) && GetFocus() == internalWinId()) - SetFocus(0); - else -#endif - { #ifndef QT_NO_ACCESSIBILITY - QAccessible::updateAccessibility(this, 0, QAccessible::Focus); + QAccessible::updateAccessibility(this, 0, QAccessible::Focus); #endif - } } } @@ -6132,14 +6121,7 @@ bool QWidget::isActiveWindow() const return true; } } -#if defined(Q_WS_WIN32) - HWND active = GetActiveWindow(); - if (!tlw->testAttribute(Qt::WA_WState_Created)) - return false; - return active == tlw->internalWinId() || ::IsChild(active, tlw->internalWinId()); -#else return false; -#endif } /*! @@ -6548,24 +6530,7 @@ bool QWidget::restoreGeometry(const QByteArray &geometry) // set geomerty before setting the window state to make // sure the window is maximized to the right screen. Qt::WindowStates ws = windowState(); -#ifndef Q_WS_WIN setGeometry(restoredNormalGeometry); -#else - if (ws & Qt::WindowFullScreen) { - // Full screen is not a real window state on Windows. - move(availableGeometry.topLeft()); - } else if (ws & Qt::WindowMaximized) { - // Setting a geometry on an already maximized window causes this to be - // restored into a broken, half-maximized state, non-resizable state (QTBUG-4397). - // Move the window in normal state if needed. - if (restoredScreenNumber != desktop->screenNumber(this)) { - setWindowState(Qt::WindowNoState); - setGeometry(restoredNormalGeometry); - } - } else { - setGeometry(restoredNormalGeometry); - } -#endif // Q_WS_WIN if (maximized) ws |= Qt::WindowMaximized; if (fullScreen) @@ -6955,14 +6920,6 @@ void QWidgetPrivate::show_helper() Q_UNUSED(isEmbedded); #endif - // On Windows, show the popup now so that our own focus handling - // stores the correct old focus widget even if it's stolen in the - // showevent -#if defined(Q_WS_WIN) || defined(Q_WS_MAC) - if (!isEmbedded && q->windowType() == Qt::Popup) - qApp->d_func()->openPopup(q); -#endif - // send the show event before showing the window QShowEvent showEvent; QApplication::sendEvent(q, &showEvent); @@ -6975,10 +6932,8 @@ void QWidgetPrivate::show_helper() show_sys(); -#if !defined(Q_WS_WIN) && !defined(Q_WS_MAC) if (!isEmbedded && q->windowType() == Qt::Popup) qApp->d_func()->openPopup(q); -#endif #ifndef QT_NO_ACCESSIBILITY if (q->windowType() != Qt::ToolTip) // Tooltips are read aloud twice in MS narrator. @@ -7034,12 +6989,6 @@ void QWidgetPrivate::hide_helper() if (!isEmbedded && q->isModal() && q->isWindow()) QApplicationPrivate::leaveModal(q); -#if defined(Q_WS_WIN) - if (q->isWindow() && !(q->windowType() == Qt::Popup) && q->parentWidget() - && !q->parentWidget()->isHidden() && q->isActiveWindow()) - q->parentWidget()->activateWindow(); // Activate parent -#endif - q->setAttribute(Qt::WA_Mapped, false); hide_sys(); @@ -7057,7 +7006,7 @@ void QWidgetPrivate::hide_helper() // next bit tries to move the focus if the focus widget is now // hidden. if (wasVisible) { -#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined(Q_WS_MAC) +#if defined(Q_WS_X11) qApp->d_func()->sendSyntheticEnterLeave(q); #endif @@ -7183,7 +7132,7 @@ void QWidget::setVisible(bool visible) d->show_helper(); -#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined(Q_WS_MAC) +#if defined(Q_WS_X11) qApp->d_func()->sendSyntheticEnterLeave(this); #endif } @@ -7193,16 +7142,6 @@ void QWidget::setVisible(bool visible) } else { // hide if (testAttribute(Qt::WA_WState_ExplicitShowHide) && testAttribute(Qt::WA_WState_Hidden)) return; -#if defined(Q_WS_WIN) - // reset WS_DISABLED style in a Blocked window - if(isWindow() && testAttribute(Qt::WA_WState_Created) - && QApplicationPrivate::isBlockedByModal(this)) - { - LONG dwStyle = GetWindowLong(winId(), GWL_STYLE); - dwStyle &= ~WS_DISABLED; - SetWindowLong(winId(), GWL_STYLE, dwStyle); - } -#endif if (QApplicationPrivate::hidden_focus_widget == this) QApplicationPrivate::hidden_focus_widget = 0; @@ -7633,26 +7572,6 @@ bool QWidget::isAncestorOf(const QWidget *child) const return false; } -#if defined(Q_WS_WIN) -inline void setDisabledStyle(QWidget *w, bool setStyle) -{ - // set/reset WS_DISABLED style. - if(w && w->isWindow() && w->isVisible() && w->isEnabled()) { - LONG dwStyle = GetWindowLong(w->winId(), GWL_STYLE); - LONG newStyle = dwStyle; - if (setStyle) - newStyle |= WS_DISABLED; - else - newStyle &= ~WS_DISABLED; - if (newStyle != dwStyle) { - SetWindowLong(w->winId(), GWL_STYLE, newStyle); - // we might need to repaint in some situations (eg. menu) - w->repaint(); - } - } -} -#endif - /***************************************************************************** QWidget event handling *****************************************************************************/ @@ -8028,9 +7947,6 @@ bool QWidget::event(QEvent *event) QApplication::sendEvent(o, event); } } -#if defined(Q_WS_WIN) - setDisabledStyle(this, (event->type() == QEvent::WindowBlocked)); -#endif } break; #ifndef QT_NO_TOOLTIP @@ -8078,7 +7994,7 @@ bool QWidget::event(QEvent *event) case QEvent::EmbeddingControl: d->topData()->frameStrut.setCoords(0 ,0, 0, 0); data->fstrut_dirty = false; -#if defined(Q_WS_WIN) || defined(Q_WS_X11) +#if defined(Q_WS_X11) d->topData()->embedded = 1; #endif break; @@ -8929,31 +8845,7 @@ bool QWidget::macEvent(EventHandlerCallRef, EventRef) } #endif -#if defined(Q_WS_WIN) -/*! - This special event handler can be reimplemented in a subclass to - receive native Windows events which are passed in the \a message - parameter. - - In your reimplementation of this function, if you want to stop the - event being handled by Qt, return true and set \a result to the value - that the window procedure should return. If you return false, this - native event is passed back to Qt, which translates the event into - a Qt event and sends it to the widget. - - \warning This function is not portable. - - \sa QApplication::winEventFilter() -*/ -bool QWidget::winEvent(MSG *message, long *result) -{ - Q_UNUSED(message); - Q_UNUSED(result); - return false; -} - -#endif #if defined(Q_WS_X11) /*! @@ -9280,8 +9172,7 @@ QWidget *QWidgetPrivate::childAtRecursiveHelper(const QPoint &p, bool ignoreChil } // Map the point 'p' from parent coordinates to child coordinates. - QPoint childPoint = p; - childPoint -= child->data->crect.topLeft(); + const QPoint childPoint = p - child->data->crect.topLeft(); // Check if the point hits the child. if (!child->d_func()->pointInsideRectAndMask(childPoint)) @@ -9529,7 +9420,7 @@ void QWidget::setParent(QWidget *parent, Qt::WindowFlags f) // (f & Qt::MSWindowsOwnDC) clause (which is set on QGLWidgets on all // platforms). if (newParent -#if defined(Q_WS_WIN) || defined(QT_OPENGL_ES) +#if defined(QT_OPENGL_ES) || (f & Qt::MSWindowsOwnDC) #endif ) { @@ -9880,15 +9771,6 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on) Q_ASSERT_X(sizeof(d->high_attributes)*8 >= (Qt::WA_AttributeCount - sizeof(uint)*8), "QWidget::setAttribute(WidgetAttribute, bool)", "QWidgetPrivate::high_attributes[] too small to contain all attributes in WidgetAttribute"); -#ifdef Q_WS_WIN - // ### Don't use PaintOnScreen+paintEngine() to do native painting in 5.0 - if (attribute == Qt::WA_PaintOnScreen && on && !inherits("QGLWidget")) { - // see qwidget_win.cpp, ::paintEngine for details - paintEngine(); - if (d->noPaintOnScreen) - return; - } -#endif setAttribute_internal(attribute, on, data, d); @@ -10015,7 +9897,7 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on) } case Qt::WA_PaintOnScreen: d->updateIsOpaque(); -#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined(Q_WS_MAC) +#if defined(Q_WS_X11) // Recreate the widget if it's already created as an alien widget and // WA_PaintOnScreen is enabled. Paint on screen widgets must have win id. // So must their children. @@ -10121,10 +10003,6 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on) } break; case Qt::WA_AcceptTouchEvents: -#if defined(Q_WS_WIN) || defined(Q_WS_MAC) - if (on) - d->registerTouchWindow(); -#endif break; case Qt::WA_LockPortraitOrientation: case Qt::WA_LockLandscapeOrientation: @@ -10516,39 +10394,6 @@ void QWidget::updateMicroFocus() #endif } - -#if defined (Q_WS_WIN) -/*! - Returns the window system handle of the widget, for low-level - access. Using this function is not portable. - - An HDC acquired with getDC() has to be released with releaseDC(). - - \warning Using this function is not portable. -*/ -HDC QWidget::getDC() const -{ - Q_D(const QWidget); - if (d->hd) - return (HDC) d->hd; - return GetDC(winId()); -} - -/*! - Releases the HDC \a hdc acquired by a previous call to getDC(). - - \warning Using this function is not portable. -*/ -void QWidget::releaseDC(HDC hdc) const -{ - Q_D(const QWidget); - // If its the widgets own dc, it will be released elsewhere. If - // its a different HDC we release it and issue a warning if it - // fails. - if (hdc != d->hd && !ReleaseDC(winId(), hdc)) - qErrnoWarning("QWidget::releaseDC(): failed to release HDC"); -} -#else /*! Returns the window system handle of the widget, for low-level access. Using this function is not portable. @@ -10563,7 +10408,6 @@ Qt::HANDLE QWidget::handle() const (void)winId(); // enforce native window return d->hd; } -#endif /*! @@ -11143,10 +10987,8 @@ QRect QWidgetPrivate::frameStrut() const } if (data.fstrut_dirty -#ifndef Q_WS_WIN // ### Fix properly for 4.3 && q->isVisible() -#endif && q->testAttribute(Qt::WA_WState_Created)) const_cast(this)->updateFrameStrut(); diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp index b313f9993..5c4d4dd93 100644 --- a/src/gui/kernel/qwidget_x11.cpp +++ b/src/gui/kernel/qwidget_x11.cpp @@ -577,25 +577,7 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO else q->setAttribute(Qt::WA_WState_Visible); - QX11InfoData* xd = xinfo.getX11Data(true); - // find which screen the window is on... - xd->screen = QX11Info::appScreen(); // by default, use the default :) - int i; - for (i = 0; i < ScreenCount(X11->display); i++) { - if (RootWindow(X11->display, i) == a.root) { - xd->screen = i; - break; - } - } - - xd->depth = a.depth; - xd->cells = DisplayCells(X11->display, xd->screen); - xd->visual = a.visual; - xd->defaultVisual = (XVisualIDFromVisual((Visual *) a.visual) == - XVisualIDFromVisual((Visual *) QX11Info::appVisual(scr))); - xd->colormap = a.colormap; - xd->defaultColormap = (a.colormap == QX11Info::appColormap(scr)); - xinfo.setX11Data(xd); + qt_x11_getX11InfoForWindow(&xinfo, static_cast(&a)); } else if (desktop) { // desktop widget #ifdef QWIDGET_EXTRA_DEBUG @@ -1060,7 +1042,7 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows) setAttribute(Qt::WA_WState_Created, false); QObjectList childList = children(); for (int i = 0; i < childList.size(); ++i) { // destroy all widget children - register QObject *obj = childList.at(i); + QObject *obj = childList.at(i); if (obj->isWidgetType()) static_cast(obj)->destroy(destroySubWindows, destroySubWindows); @@ -2753,7 +2735,7 @@ void QWidgetPrivate::scroll_sys(int dx, int dy, const QRect &r) if (!valid_rect && !children.isEmpty()) { // scroll children QPoint pd(dx, dy); for (int i = 0; i < children.size(); ++i) { // move all children - register QObject *object = children.at(i); + QObject *object = children.at(i); if (object->isWidgetType()) { QWidget *w = static_cast(object); if (!w->isWindow()) @@ -3045,6 +3027,7 @@ XRenderColor QX11Data::preMultiply(const QColor &c) color.blue = (B | B << 8) * color.alpha / 0x10000; return color; } + Picture QX11Data::getSolidFill(int screen, const QColor &c) { if (!X11->use_xrender) @@ -3084,6 +3067,30 @@ Picture QX11Data::getSolidFill(int screen, const QColor &c) } #endif +void qt_x11_getX11InfoForWindow(QX11Info *xinfo, const void *att) +{ + QX11InfoData* xd = xinfo->getX11Data(true); + const XWindowAttributes *a = static_cast(att); + // find which screen the window is on... + xd->screen = QX11Info::appScreen(); // by default, use the default :) + int i; + for (i = 0; i < ScreenCount(X11->display); i++) { + if (RootWindow(X11->display, i) == a->root) { + xd->screen = i; + break; + } + } + + xd->depth = a->depth; + xd->cells = DisplayCells(X11->display, xd->screen); + xd->visual = a->visual; + xd->defaultVisual = (XVisualIDFromVisual((Visual *) a->visual) == + XVisualIDFromVisual((Visual *) QX11Info::appVisual(xinfo->screen()))); + xd->colormap = a->colormap; + xd->defaultColormap = (a->colormap == QX11Info::appColormap(xinfo->screen())); + xinfo->setX11Data(xd); +} + void QWidgetPrivate::updateX11AcceptFocus() { Q_Q(QWidget); diff --git a/src/gui/kernel/qx11info_x11.h b/src/gui/kernel/qx11info_x11.h index b6e87d713..329a96315 100644 --- a/src/gui/kernel/qx11info_x11.h +++ b/src/gui/kernel/qx11info_x11.h @@ -110,6 +110,7 @@ protected: friend void qt_init(QApplicationPrivate *priv, int, Display *display, Qt::HANDLE visual, Qt::HANDLE colormap); friend void qt_cleanup(); + friend void qt_x11_getX11InfoForWindow(QX11Info *xinfo, const void *att); }; QT_END_NAMESPACE diff --git a/src/gui/painting/qbezier.cpp b/src/gui/painting/qbezier.cpp index 53a9024ae..f932ffe11 100644 --- a/src/gui/painting/qbezier.cpp +++ b/src/gui/painting/qbezier.cpp @@ -48,7 +48,6 @@ #include #include -#include #include QT_BEGIN_NAMESPACE diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 1eeaaeb54..1b4b1cd8f 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -6019,12 +6019,7 @@ static inline void rgbBlendPixel(quint32 *dst, int coverage, int sr, int sg, int int dg = qGreen(*dst); int db = qBlue(*dst); - if (da != 255 -#if defined (Q_WS_WIN) - // Work around GDI messing up alpha channel - && qRed(*dst) <= da && qBlue(*dst) <= da && qGreen(*dst) <= da -#endif - ) { + if (da != 255) { int a = qGray(coverage); sr = qt_div_255(qt_pow_rgb_invgamma[sr] * a); @@ -6409,39 +6404,18 @@ DrawHelper qDrawHelper[QImage::NImageFormats] = void qInitDrawhelperAsm() { - qreal smoothing = qreal(1.7); - -#ifdef Q_WS_MAC - // decided by testing a few things on an iMac, should probably get this from the - // system... - smoothing = qreal(2.0); -#endif - -#ifdef Q_WS_WIN - extern qreal qt_fontsmoothing_gamma; // qapplication_win.cpp - smoothing = qt_fontsmoothing_gamma; -#endif - #ifdef Q_WS_X11 - Q_UNUSED(smoothing); for (int i=0; i<256; ++i) { qt_pow_rgb_gamma[i] = uchar(i); qt_pow_rgb_invgamma[i] = uchar(i); } #else + const qreal smoothing = qreal(1.7); for (int i=0; i<256; ++i) { qt_pow_rgb_gamma[i] = uchar(qRound(qPow(i / qreal(255.0), smoothing) * 255)); qt_pow_rgb_invgamma[i] = uchar(qRound(qPow(i / qreal(255.), 1 / smoothing) * 255)); } #endif - -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) - const qreal gray_gamma = 2.31; - for (int i=0; i<256; ++i) - qt_pow_gamma[i] = uint(qRound(qPow(i / qreal(255.), gray_gamma) * 2047)); - for (int i=0; i<2048; ++i) - qt_pow_invgamma[i] = uchar(qRound(qPow(i / qreal(2047.0), 1 / gray_gamma) * 255)); -#endif } QT_END_NAMESPACE diff --git a/src/gui/painting/qpaintdevice.h b/src/gui/painting/qpaintdevice.h index 06b53116d..276845dbd 100644 --- a/src/gui/painting/qpaintdevice.h +++ b/src/gui/painting/qpaintdevice.h @@ -75,11 +75,6 @@ public: { return painters != 0; } virtual QPaintEngine *paintEngine() const = 0; -#ifdef Q_WS_WIN - virtual HDC getDC() const; - virtual void releaseDC(HDC hdc) const; -#endif - int width() const { return metric(PdmWidth); } int height() const { return metric(PdmHeight); } int widthMM() const { return metric(PdmWidthMM); } diff --git a/src/gui/painting/qpaintengine.cpp b/src/gui/painting/qpaintengine.cpp index 03359baf7..485520499 100644 --- a/src/gui/painting/qpaintengine.cpp +++ b/src/gui/painting/qpaintengine.cpp @@ -885,31 +885,6 @@ QPaintDevice *QPaintEngine::paintDevice() const return d_func()->pdev; } -#ifdef Q_WS_WIN -/*! - \internal - - Empty default implementation. -*/ - -HDC QPaintEngine::getDC() const -{ - return 0; -} - - -/*! - \internal - - Empty default implementation. -*/ - -void QPaintEngine::releaseDC(HDC) const -{ -} - -#endif - /*! \internal diff --git a/src/gui/painting/qpaintengine_x11.cpp b/src/gui/painting/qpaintengine_x11.cpp index 9b211f434..e4a7b87e4 100644 --- a/src/gui/painting/qpaintengine_x11.cpp +++ b/src/gui/painting/qpaintengine_x11.cpp @@ -72,7 +72,6 @@ #include "qpaintengine_x11_p.h" #include -#include #include #ifndef QT_NO_XRENDER diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 3b34003f3..fcc86d50c 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -117,9 +117,7 @@ static bool qt_painter_thread_test(int devType, const char *what, bool extraCond case QInternal::Printer: case QInternal::Picture: // can be drawn onto these devices safely from any thread -#ifndef Q_WS_WIN if (extraCondition) -#endif break; default: #ifdef Q_WS_X11 diff --git a/src/gui/painting/qpathclipper.cpp b/src/gui/painting/qpathclipper.cpp index f8f65e3a4..eb6a27722 100644 --- a/src/gui/painting/qpathclipper.cpp +++ b/src/gui/painting/qpathclipper.cpp @@ -42,8 +42,9 @@ #include "qpathclipper_p.h" #include -#include #include +#include +#include /** The algorithm is as follows: @@ -61,8 +62,6 @@ 9. Convert the resulting winged edge structure to a painter path. */ -#include - QT_BEGIN_NAMESPACE static inline bool fuzzyIsNull(qreal d) @@ -280,10 +279,10 @@ SegmentTree::SegmentTree(QPathSegments &segments) : m_segments(segments), m_intersections(0) { - m_bounds.x1 = qt_inf(); - m_bounds.y1 = qt_inf(); - m_bounds.x2 = -qt_inf(); - m_bounds.y2 = -qt_inf(); + m_bounds.x1 = qInf(); + m_bounds.y1 = qInf(); + m_bounds.x2 = -qInf(); + m_bounds.y2 = -qInf(); m_index.resize(m_segments.segments()); diff --git a/src/gui/painting/qprintengine.h b/src/gui/painting/qprintengine.h index 242592723..a98fa222c 100644 --- a/src/gui/painting/qprintengine.h +++ b/src/gui/painting/qprintengine.h @@ -101,12 +101,6 @@ public: virtual int metric(QPaintDevice::PaintDeviceMetric) const = 0; virtual QPrinter::PrinterState printerState() const = 0; - -#ifdef Q_WS_WIN - virtual HDC getPrinterDC() const { return 0; } - virtual void releasePrinterDC(HDC) const { } -#endif - }; #endif // QT_NO_PRINTER diff --git a/src/gui/painting/qprinter.h b/src/gui/painting/qprinter.h index df19f56cd..1c8f1a87c 100644 --- a/src/gui/painting/qprinter.h +++ b/src/gui/painting/qprinter.h @@ -196,9 +196,6 @@ public: QList supportedResolutions() const; -#ifdef Q_WS_WIN - QList supportedPaperSources() const; -#endif void setFontEmbeddingEnabled(bool enable); bool fontEmbeddingEnabled() const; @@ -206,20 +203,13 @@ public: void setDoubleSidedPrinting(bool enable); bool doubleSidedPrinting() const; -#ifdef Q_WS_WIN - void setWinPageSize(int winPageSize); - int winPageSize() const; -#endif - QRect paperRect() const; QRect pageRect() const; QRectF paperRect(Unit) const; QRectF pageRect(Unit) const; -#if !defined(Q_WS_WIN) QString printerSelectionOption() const; void setPrinterSelectionOption(const QString &); -#endif bool newPage(); bool abort(); @@ -229,11 +219,6 @@ public: QPaintEngine *paintEngine() const; QPrintEngine *printEngine() const; -#ifdef Q_WS_WIN - HDC getDC() const; - void releaseDC(HDC hdc) const; -#endif - void setFromTo(int fromPage, int toPage); int fromPage() const; int toPage() const; diff --git a/src/gui/painting/qregion.h b/src/gui/painting/qregion.h index 5fc90a278..1021d072a 100644 --- a/src/gui/painting/qregion.h +++ b/src/gui/painting/qregion.h @@ -158,12 +158,10 @@ private: void exec(const QByteArray &ba, int ver = 0, QDataStream::ByteOrder byteOrder = QDataStream::BigEndian); #endif struct QRegionData { - QBasicAtomicInt ref; + QAtomicInt ref; #if defined(Q_WS_X11) Region rgn; void *xrectangles; -#endif -#if defined(Q_WS_X11) QRegionPrivate *qt_rgn; #endif }; diff --git a/src/gui/painting/qregion_x11.cpp b/src/gui/painting/qregion_x11.cpp index f6b9e23cf..5bf8663c0 100644 --- a/src/gui/painting/qregion_x11.cpp +++ b/src/gui/painting/qregion_x11.cpp @@ -45,7 +45,7 @@ QT_BEGIN_NAMESPACE -QRegion::QRegionData QRegion::shared_empty = {Q_BASIC_ATOMIC_INITIALIZER(1), 0, 0, 0}; +QRegion::QRegionData QRegion::shared_empty = { QAtomicInt(1), 0, 0, 0}; void QRegion::updateX11Region() const { diff --git a/src/gui/painting/qstroker_p.h b/src/gui/painting/qstroker_p.h index 22bc78e4d..3857e67b4 100644 --- a/src/gui/painting/qstroker_p.h +++ b/src/gui/painting/qstroker_p.h @@ -55,7 +55,6 @@ #include "QtGui/qpainterpath.h" #include "qdatabuffer_p.h" -#include "qnumeric_p.h" QT_BEGIN_NAMESPACE diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp index b4b77c7c8..e9c370fd3 100644 --- a/src/gui/painting/qtextureglyphcache.cpp +++ b/src/gui/painting/qtextureglyphcache.cpp @@ -41,7 +41,6 @@ #include #include "qtextureglyphcache_p.h" -#include "qnumeric_p.h" #include "qfontengine_ft_p.h" QT_BEGIN_NAMESPACE diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp index 36e666a88..705fe49b6 100644 --- a/src/gui/styles/qcommonstyle.cpp +++ b/src/gui/styles/qcommonstyle.cpp @@ -4201,13 +4201,13 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid ret = 0; break; case PM_DialogButtonsSeparator: - ret = int(QStyleHelper::dpiScaled(5.)); + ret = 5; break; case PM_DialogButtonsButtonWidth: - ret = int(QStyleHelper::dpiScaled(70.)); + ret = 70; break; case PM_DialogButtonsButtonHeight: - ret = int(QStyleHelper::dpiScaled(30.)); + ret = 30; break; case PM_TitleBarHeight: { if (const QStyleOptionTitleBar *tb = qstyleoption_cast(opt)) { @@ -4215,26 +4215,26 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid ret = qMax(widget ? widget->fontMetrics().height() : opt->fontMetrics.height(), 16); #ifndef QT_NO_DOCKWIDGET } else if (qobject_cast(widget)) { - ret = qMax(widget->fontMetrics().height(), int(QStyleHelper::dpiScaled(13))); + ret = qMax(widget->fontMetrics().height(), 13); #endif } else { ret = qMax(widget ? widget->fontMetrics().height() : opt->fontMetrics.height(), 18); } } else { - ret = int(QStyleHelper::dpiScaled(18.)); + ret = 18; } break; } case PM_ScrollBarSliderMin: - ret = int(QStyleHelper::dpiScaled(9.)); + ret = 9; break; case PM_ButtonMargin: - ret = int(QStyleHelper::dpiScaled(6.)); + ret = 6; break; case PM_DockWidgetTitleBarButtonMargin: - ret = int(QStyleHelper::dpiScaled(2.)); + ret = 2; break; case PM_ButtonDefaultIndicator: @@ -4242,7 +4242,7 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid break; case PM_MenuButtonIndicator: - ret = int(QStyleHelper::dpiScaled(12.)); + ret = 12; break; case PM_ButtonShiftHorizontal: @@ -4261,11 +4261,11 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid break; case PM_MdiSubWindowFrameWidth: - ret = int(QStyleHelper::dpiScaled(4.)); + ret = 4; break; case PM_MdiSubWindowMinimizedWidth: - ret = int(QStyleHelper::dpiScaled(196.)); + ret = 196; break; #ifndef QT_NO_SCROLLBAR @@ -4276,7 +4276,7 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid : QApplication::globalStrut().width(); ret = qMax(16, s); } else { - ret = int(QStyleHelper::dpiScaled(16.)); + ret = 16; } break; #endif @@ -4286,7 +4286,7 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid #ifndef QT_NO_SLIDER case PM_SliderThickness: - ret = int(QStyleHelper::dpiScaled(16.)); + ret = 16; break; case PM_SliderTickmarkOffset: @@ -4320,11 +4320,11 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid #endif // QT_NO_SLIDER #ifndef QT_NO_DOCKWIDGET case PM_DockWidgetSeparatorExtent: - ret = int(QStyleHelper::dpiScaled(6.)); + ret = 6; break; case PM_DockWidgetHandleExtent: - ret = int(QStyleHelper::dpiScaled(8.)); + ret = 8; break; case PM_DockWidgetTitleMargin: ret = 0; @@ -4353,19 +4353,19 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid break; case PM_ToolBarItemSpacing: - ret = int(QStyleHelper::dpiScaled(4.)); + ret = 4; break; case PM_ToolBarHandleExtent: - ret = int(QStyleHelper::dpiScaled(8.)); + ret = 8; break; case PM_ToolBarSeparatorExtent: - ret = int(QStyleHelper::dpiScaled(6.)); + ret = 6; break; case PM_ToolBarExtensionExtent: - ret = int(QStyleHelper::dpiScaled(12.)); + ret = 12; break; #endif // QT_NO_TOOLBAR @@ -4375,7 +4375,7 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid break; case PM_TabBarTabHSpace: - ret = int(QStyleHelper::dpiScaled(24.)); + ret = 24; break; case PM_TabBarTabShiftHorizontal: @@ -4404,27 +4404,18 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid break; case PM_IndicatorWidth: - ret = int(QStyleHelper::dpiScaled(13.)); - break; - case PM_IndicatorHeight: - ret = int(QStyleHelper::dpiScaled(13.)); + ret = 13; break; case PM_ExclusiveIndicatorWidth: - ret = int(QStyleHelper::dpiScaled(12.)); - break; - case PM_ExclusiveIndicatorHeight: - ret = int(QStyleHelper::dpiScaled(12.)); + ret = 12; break; case PM_MenuTearoffHeight: - ret = int(QStyleHelper::dpiScaled(10.)); - break; - case PM_MenuScrollerHeight: - ret = int(QStyleHelper::dpiScaled(10.)); + ret = 10; break; case PM_MenuDesktopFrameWidth: @@ -4433,17 +4424,16 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid ret = 0; break; - case PM_HeaderMargin: - ret = int(QStyleHelper::dpiScaled(4.)); - break; + case PM_HeaderMarkSize: - ret = int(QStyleHelper::dpiScaled(32.)); + ret = 32; break; + case PM_HeaderMargin: case PM_HeaderGripMargin: - ret = int(QStyleHelper::dpiScaled(4.)); + ret = 4; break; case PM_TabBarScrollButtonWidth: - ret = int(QStyleHelper::dpiScaled(16.)); + ret = 16; break; case PM_LayoutLeftMargin: case PM_LayoutTopMargin: @@ -4465,19 +4455,19 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid break; case PM_DefaultTopLevelMargin: - ret = int(QStyleHelper::dpiScaled(11.)); + ret = 11; break; case PM_DefaultChildMargin: - ret = int(QStyleHelper::dpiScaled(9.)); + ret = 9; break; case PM_DefaultLayoutSpacing: - ret = int(QStyleHelper::dpiScaled(6.)); + ret = 6; break; case PM_ToolBarIconSize: ret = qt_guiPlatformPlugin()->platformHint(QGuiPlatformPlugin::PH_ToolBarIconSize); if (!ret) - ret = int(QStyleHelper::dpiScaled(24.)); + ret = 24; break; case PM_TabBarIconSize: @@ -4487,38 +4477,34 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid case PM_ButtonIconSize: case PM_SmallIconSize: - ret = int(QStyleHelper::dpiScaled(16.)); + ret = 16; break; case PM_IconViewIconSize: ret = proxy()->pixelMetric(PM_LargeIconSize, opt, widget); break; case PM_LargeIconSize: - ret = int(QStyleHelper::dpiScaled(32.)); + ret = 32; break; case PM_ToolTipLabelFrameWidth: + case PM_TextCursorWidth: + case PM_TabBar_ScrollButtonOverlap: ret = 1; break; case PM_CheckBoxLabelSpacing: case PM_RadioButtonLabelSpacing: - ret = int(QStyleHelper::dpiScaled(6.)); + ret = 6; break; case PM_SizeGripSize: - ret = int(QStyleHelper::dpiScaled(13.)); + ret = 13; break; case PM_MessageBoxIconSize: - ret = int(QStyleHelper::dpiScaled(32.)); - break; - case PM_TextCursorWidth: - ret = 1; - break; - case PM_TabBar_ScrollButtonOverlap: - ret = 1; + ret = 32; break; case PM_TabCloseIndicatorWidth: case PM_TabCloseIndicatorHeight: - ret = int(QStyleHelper::dpiScaled(16.)); + ret = 16; break; case PM_ScrollView_ScrollBarSpacing: ret = 2 * proxy()->pixelMetric(PM_DefaultFrameWidth, opt, widget); diff --git a/src/gui/styles/qstylehelper.cpp b/src/gui/styles/qstylehelper.cpp index 85ed8108f..a9ee7f65a 100644 --- a/src/gui/styles/qstylehelper.cpp +++ b/src/gui/styles/qstylehelper.cpp @@ -46,13 +46,6 @@ #include #include #include - -#if defined(Q_WS_WIN) -#include "qt_windows.h" -#elif defined(Q_WS_MAC) -#include -#endif - #include "qstylehelper_p.h" #include @@ -80,26 +73,6 @@ QString uniqueName(const QString &key, const QStyleOption *option, const QSize & return tmp; } -qreal dpiScaled(qreal value) -{ - static qreal scale = -1; - if (scale < 0) { - scale = 1.0; -#if defined(Q_WS_WIN) - { - HDC hdcScreen = GetDC(0); - int dpi = GetDeviceCaps(hdcScreen, LOGPIXELSX); - ReleaseDC(0, hdcScreen); - scale = dpi/96.0; - } -#elif defined(Q_WS_MAC) - scale = qt_mac_get_scalefactor(); -#endif - } - return value * scale; -} - - #ifndef QT_NO_DIAL int calcBigLineSize(int radius) diff --git a/src/gui/styles/qstylehelper_p.h b/src/gui/styles/qstylehelper_p.h index 2ed6b7a4e..65223fb24 100644 --- a/src/gui/styles/qstylehelper_p.h +++ b/src/gui/styles/qstylehelper_p.h @@ -69,7 +69,6 @@ class QStyleOption; namespace QStyleHelper { QString uniqueName(const QString &key, const QStyleOption *option, const QSize &size); - qreal dpiScaled(qreal value); #ifndef QT_NO_DIAL qreal angle(const QPointF &p1, const QPointF &p2); QPolygonF calcLines(const QStyleOptionSlider *dial); diff --git a/src/gui/styles/qwindowsstyle.cpp b/src/gui/styles/qwindowsstyle.cpp index 96214ef0b..9c491a55a 100644 --- a/src/gui/styles/qwindowsstyle.cpp +++ b/src/gui/styles/qwindowsstyle.cpp @@ -405,7 +405,7 @@ int QWindowsStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, const QW #ifndef QT_NO_SLIDER case PM_SliderLength: - ret = int(QStyleHelper::dpiScaled(11.)); + ret = 11; break; // Returns the number of pixels to use for the business part of the @@ -453,11 +453,11 @@ int QWindowsStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, const QW break; case PM_SmallIconSize: - ret = int(QStyleHelper::dpiScaled(16.)); + ret = 16; break; case PM_LargeIconSize: - ret = int(QStyleHelper::dpiScaled(32.)); + ret = 32; break; case PM_IconViewIconSize: @@ -465,24 +465,12 @@ int QWindowsStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, const QW break; case PM_DockWidgetTitleMargin: - ret = int(QStyleHelper::dpiScaled(2.)); + ret = 2; break; case PM_DockWidgetTitleBarButtonMargin: - ret = int(QStyleHelper::dpiScaled(4.)); - break; -#if defined(Q_WS_WIN) - case PM_DockWidgetFrameWidth: -#if defined(Q_OS_WINCE) - ret = GetSystemMetrics(SM_CXDLGFRAME); -#else - ret = GetSystemMetrics(SM_CXFRAME); -#endif - break; -#else case PM_DockWidgetFrameWidth: ret = 4; break; -#endif // Q_WS_WIN break; #endif // QT_NO_MENU @@ -544,7 +532,7 @@ int QWindowsStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, const QW ret = 0; break; case PM_ToolBarHandleExtent: - ret = int(QStyleHelper::dpiScaled(10.)); + ret = 10; break; default: ret = QCommonStyle::pixelMetric(pm, opt, widget); @@ -3025,15 +3013,13 @@ QSize QWindowsStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, int defwidth = 0; if (btn->features & QStyleOptionButton::AutoDefaultButton) defwidth = 2 * proxy()->pixelMetric(PM_ButtonDefaultIndicator, btn, widget); - int minwidth = int(QStyleHelper::dpiScaled(75.)); - int minheight = int(QStyleHelper::dpiScaled(23.)); + const int minwidth = 75; + const int minheight = 23; -#ifndef QT_QWS_SMALL_PUSHBUTTON if (w < minwidth + defwidth && !btn->text.isEmpty()) w = minwidth + defwidth; if (h < minheight + defwidth) h = minheight + defwidth; -#endif sz = QSize(w, h); } break; diff --git a/src/gui/text/qfontdatabase_x11.h b/src/gui/text/qfontdatabase_x11.h index 7dfff7f09..c7927f387 100644 --- a/src/gui/text/qfontdatabase_x11.h +++ b/src/gui/text/qfontdatabase_x11.h @@ -1913,18 +1913,6 @@ QFontEngine *QFontDatabase::loadXlfd(int script, const QFontDef &request, int fo return fe; } -#if (defined(QT_ARCH_ARM) || defined(QT_ARCH_ARMV6)) && defined(Q_CC_GNU) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 3) -#define NEEDS_GCC_BUG_WORKAROUND -#endif - -#ifdef NEEDS_GCC_BUG_WORKAROUND -static inline void gccBugWorkaround(const QFontDef &req) -{ - char buffer[8]; - snprintf(buffer, 8, "%f", req.pixelSize); -} -#endif - /*! \internal Loads a QFontEngine for the specified \a script that matches the QFontDef \e request member variable. @@ -1940,11 +1928,6 @@ void QFontDatabase::load(const QFontPrivate *d, int script) if (req.pixelSize < 1) req.pixelSize = 1; -#ifdef NEEDS_GCC_BUG_WORKAROUND - // req.pixelSize ends up with a bogus value unless this workaround is called - gccBugWorkaround(req); -#endif - if (req.weight == 0) req.weight = QFont::Normal; if (req.stretch == 0) diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index 884c4c60a..cb76d62dc 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -758,7 +758,7 @@ QFontEngineGlyphCache *QFontEngine::glyphCache(void *key, QFontEngineGlyphCache: return 0; } -#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined(Q_WS_MAC) +#if defined(Q_WS_X11) static inline QFixed kerning(int left, int right, const QFontEngine::KernPair *pairs, int numPairs) { uint left_right = (left << 16) + right; diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h index 41e41d967..1f5759cca 100644 --- a/src/gui/text/qfontengine_p.h +++ b/src/gui/text/qfontengine_p.h @@ -376,9 +376,4 @@ public: QT_END_NAMESPACE -#ifdef Q_WS_WIN -# include "qfontengine_win_p.h" -#endif - - #endif // QFONTENGINE_P_H diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp index fb2a915e9..37ee4e92b 100644 --- a/src/gui/text/qtextcontrol.cpp +++ b/src/gui/text/qtextcontrol.cpp @@ -94,7 +94,7 @@ QT_BEGIN_NAMESPACE #ifndef QT_NO_CONTEXTMENU -#if defined(Q_WS_WIN) || defined(Q_WS_X11) +#if defined(Q_WS_X11) extern bool qt_use_rtl_extensions; #endif #endif @@ -2169,7 +2169,7 @@ QMenu *QTextControl::createStandardContextMenu(const QPointF &pos, QWidget *pare } #endif -#if defined(Q_WS_WIN) || defined(Q_WS_X11) +#if defined(Q_WS_X11) if ((d->interactionFlags & Qt::TextEditable) && qt_use_rtl_extensions) { #else if (d->interactionFlags & Qt::TextEditable) { diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 395d7eb18..2b3826fd9 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -952,187 +952,6 @@ static inline bool hasCaseChange(const QScriptItem &si) si.analysis.flags == QScriptAnalysis::Lowercase; } -#if defined(Q_WS_WINCE) //TODO -// set the glyph attributes heuristically. Assumes a 1 to 1 relationship between chars and glyphs -// and no reordering. -// also computes logClusters heuristically -static void heuristicSetGlyphAttributes(const QChar *uc, int length, QGlyphLayout *glyphs, unsigned short *logClusters, int num_glyphs) -{ - // ### zeroWidth and justification are missing here!!!!! - - Q_UNUSED(num_glyphs); - Q_ASSERT(num_glyphs <= length); - -// qDebug("QScriptEngine::heuristicSetGlyphAttributes, num_glyphs=%d", item->num_glyphs); - - int glyph_pos = 0; - for (int i = 0; i < length; i++) { - if (uc[i].isHighSurrogate() && i < length-1 && uc[i+1].isLowSurrogate()) { - logClusters[i] = glyph_pos; - logClusters[++i] = glyph_pos; - } else { - logClusters[i] = glyph_pos; - } - ++glyph_pos; - } - - // first char in a run is never (treated as) a mark - int cStart = 0; - - const bool symbolFont = false; // #### - glyphs->attributes[0].mark = false; - glyphs->attributes[0].clusterStart = true; - glyphs->attributes[0].dontPrint = (!symbolFont && uc[0].unicode() == 0x00ad) || qIsControlChar(uc[0].unicode()); - - int pos = 0; - int lastCat = QChar::category(uc[0].unicode()); - for (int i = 1; i < length; ++i) { - if (logClusters[i] == pos) - // same glyph - continue; - ++pos; - while (pos < logClusters[i]) { - glyphs[pos].attributes = glyphs[pos-1].attributes; - ++pos; - } - // hide soft-hyphens by default - if ((!symbolFont && uc[i].unicode() == 0x00ad) || qIsControlChar(uc[i].unicode())) - glyphs->attributes[pos].dontPrint = true; - const QUnicodeTables::Properties *prop = QUnicodeTables::properties(uc[i].unicode()); - int cat = prop->category; - if (cat != QChar::Mark_NonSpacing) { - glyphs->attributes[pos].mark = false; - glyphs->attributes[pos].clusterStart = true; - glyphs->attributes[pos].combiningClass = 0; - cStart = logClusters[i]; - } else { - int cmb = prop->combiningClass; - - if (cmb == 0) { - // Fix 0 combining classes - if ((uc[pos].unicode() & 0xff00) == 0x0e00) { - // thai or lao - unsigned char col = uc[pos].cell(); - if (col == 0x31 || - col == 0x34 || - col == 0x35 || - col == 0x36 || - col == 0x37 || - col == 0x47 || - col == 0x4c || - col == 0x4d || - col == 0x4e) { - cmb = QChar::Combining_AboveRight; - } else if (col == 0xb1 || - col == 0xb4 || - col == 0xb5 || - col == 0xb6 || - col == 0xb7 || - col == 0xbb || - col == 0xcc || - col == 0xcd) { - cmb = QChar::Combining_Above; - } else if (col == 0xbc) { - cmb = QChar::Combining_Below; - } - } - } - - glyphs->attributes[pos].mark = true; - glyphs->attributes[pos].clusterStart = false; - glyphs->attributes[pos].combiningClass = cmb; - logClusters[i] = cStart; - glyphs->advances_x[pos] = 0; - glyphs->advances_y[pos] = 0; - } - - // one gets an inter character justification point if the current char is not a non spacing mark. - // as then the current char belongs to the last one and one gets a space justification point - // after the space char. - if (lastCat == QChar::Separator_Space) - glyphs->attributes[pos-1].justification = HB_Space; - else if (cat != QChar::Mark_NonSpacing) - glyphs->attributes[pos-1].justification = HB_Character; - else - glyphs->attributes[pos-1].justification = HB_NoJustification; - - lastCat = cat; - } - pos = logClusters[length-1]; - if (lastCat == QChar::Separator_Space) - glyphs->attributes[pos].justification = HB_Space; - else - glyphs->attributes[pos].justification = HB_Character; -} - -void QTextEngine::shapeTextWithCE(int item) const -{ - QScriptItem &si = layoutData->items[item]; - si.glyph_data_offset = layoutData->used; - - QFontEngine *fe = fontEngine(si, &si.ascent, &si.descent, &si.leading); - - QTextEngine::ShaperFlags flags; - if (si.analysis.bidiLevel % 2) - flags |= RightToLeft; - if (option.useDesignMetrics()) - flags |= DesignMetrics; - - // pre-initialize char attributes - if (! attributes()) - return; - - const int len = length(item); - int num_glyphs = length(item); - const QChar *str = layoutData->string.unicode() + si.position; - ushort upperCased[256]; - if (hasCaseChange(si)) { - ushort *uc = upperCased; - if (len > 256) - uc = new ushort[len]; - for (int i = 0; i < len; ++i) { - if(si.analysis.flags == QScriptAnalysis::Lowercase) - uc[i] = str[i].toLower().unicode(); - else - uc[i] = str[i].toUpper().unicode(); - } - str = reinterpret_cast(uc); - } - - while (true) { - if (! ensureSpace(num_glyphs)) { - // If str is converted to uppercase/lowercase form with a new buffer, - // we need to delete that buffer before return for error - const ushort *uc = reinterpret_cast(str); - if (hasCaseChange(si) && uc != upperCased) - delete [] uc; - return; - } - num_glyphs = layoutData->glyphLayout.numGlyphs - layoutData->used; - - QGlyphLayout g = availableGlyphs(&si); - unsigned short *log_clusters = logClusters(&si); - - if (fe->stringToCMap(str, - len, - &g, - &num_glyphs, - flags)) { - heuristicSetGlyphAttributes(str, len, &g, log_clusters, num_glyphs); - break; - } - } - - si.num_glyphs = num_glyphs; - - layoutData->used += si.num_glyphs; - - const ushort *uc = reinterpret_cast(str); - if (hasCaseChange(si) && uc != upperCased) - delete [] uc; -} -#endif - static inline void moveGlyphData(const QGlyphLayout &destination, const QGlyphLayout &source, int num) { if (num > 0 && destination.glyphs != source.glyphs) { diff --git a/src/gui/widgets/qeffects.cpp b/src/gui/widgets/qeffects.cpp index af6b21de3..d2c87a915 100644 --- a/src/gui/widgets/qeffects.cpp +++ b/src/gui/widgets/qeffects.cpp @@ -101,9 +101,7 @@ static QAlphaWidget* q_blend = 0; QAlphaWidget::QAlphaWidget(QWidget* w, Qt::WindowFlags f) : QWidget(QApplication::desktop()->screen(QApplication::desktop()->screenNumber(w)), f) { -#ifndef Q_WS_WIN setEnabled(false); -#endif setAttribute(Qt::WA_NoSystemBackground, true); widget = w; alpha = 0; @@ -353,9 +351,7 @@ static QRollEffect* q_roll = 0; QRollEffect::QRollEffect(QWidget* w, Qt::WindowFlags f, DirFlags orient) : QWidget(0, f), orientation(orient) { -#ifndef Q_WS_WIN setEnabled(false); -#endif widget = w; Q_ASSERT(widget); @@ -508,10 +504,6 @@ void QRollEffect::scroll() qApp->removeEventFilter(this); if (widget) { if (!showWidget) { -#ifdef Q_WS_WIN - setEnabled(true); - setFocus(); -#endif widget->hide(); } else { //Since we are faking the visibility of the widget diff --git a/src/gui/widgets/qmenubar.cpp b/src/gui/widgets/qmenubar.cpp index fb1969da7..e0ed9b32b 100644 --- a/src/gui/widgets/qmenubar.cpp +++ b/src/gui/widgets/qmenubar.cpp @@ -1063,10 +1063,6 @@ void QMenuBar::mousePressEvent(QMouseEvent *e) d->activeMenu = 0; menu->hide(); } -#ifdef Q_WS_WIN - if((d->closePopupMode = style()->styleHint(QStyle::SH_MenuBar_DismissOnSecondClick))) - update(d->actionRect(action)); -#endif } else { d->setCurrentAction(action, true); } diff --git a/src/gui/widgets/qplaintextedit.cpp b/src/gui/widgets/qplaintextedit.cpp index b92542d31..280c00b25 100644 --- a/src/gui/widgets/qplaintextedit.cpp +++ b/src/gui/widgets/qplaintextedit.cpp @@ -807,9 +807,6 @@ void QPlainTextEditPrivate::init(const QString &txt) viewport->setCursor(Qt::IBeamCursor); #endif originalOffsetY = 0; -#ifdef Q_WS_WIN - setSingleFingerPanEnabled(true); -#endif } void QPlainTextEditPrivate::_q_repaintContents(const QRectF &contentsRect) diff --git a/src/gui/widgets/qscrollbar.cpp b/src/gui/widgets/qscrollbar.cpp index e77336b61..a0180dca2 100644 --- a/src/gui/widgets/qscrollbar.cpp +++ b/src/gui/widgets/qscrollbar.cpp @@ -385,12 +385,6 @@ void QScrollBarPrivate::init() q->setSizePolicy(sp); q->setAttribute(Qt::WA_WState_OwnSizePolicy, false); q->setAttribute(Qt::WA_OpaquePaintEvent); - -#if !defined(QT_NO_CONTEXTMENU) && defined(Q_WS_WINCE) - if (!q->style()->styleHint(QStyle::SH_ScrollBar_ContextMenu, 0, q)) { - q->setContextMenuPolicy(Qt::PreventContextMenu); - } -#endif } #ifndef QT_NO_CONTEXTMENU diff --git a/src/gui/widgets/qtextedit.cpp b/src/gui/widgets/qtextedit.cpp index f7f5e515a..7d8d6353f 100644 --- a/src/gui/widgets/qtextedit.cpp +++ b/src/gui/widgets/qtextedit.cpp @@ -184,9 +184,6 @@ void QTextEditPrivate::init(const QString &html) #ifndef QT_NO_CURSOR viewport->setCursor(Qt::IBeamCursor); #endif -#ifdef Q_WS_WIN - setSingleFingerPanEnabled(true); -#endif } void QTextEditPrivate::_q_repaintContents(const QRectF &contentsRect) diff --git a/src/gui/widgets/qwidgetresizehandler.cpp b/src/gui/widgets/qwidgetresizehandler.cpp index a84c48d73..71d22475a 100644 --- a/src/gui/widgets/qwidgetresizehandler.cpp +++ b/src/gui/widgets/qwidgetresizehandler.cpp @@ -48,9 +48,6 @@ #include "qcursor.h" #include "qsizegrip.h" #include "qevent.h" -#if defined(Q_WS_WIN) -#include "qt_windows.h" -#endif #include "qdebug.h" #include "qlayoutengine_p.h" diff --git a/src/network/access/qftp.cpp b/src/network/access/qftp.cpp index 9101b12fe..326a7a5e6 100644 --- a/src/network/access/qftp.cpp +++ b/src/network/access/qftp.cpp @@ -249,10 +249,10 @@ public: } data; bool is_ba; - static QBasicAtomicInt idCounter; + static QAtomicInt idCounter; }; -QBasicAtomicInt QFtpCommand::idCounter = Q_BASIC_ATOMIC_INITIALIZER(1); +QAtomicInt QFtpCommand::idCounter = QAtomicInt(1); QFtpCommand::QFtpCommand(QFtp::Command cmd, QStringList raw, const QByteArray &ba) : command(cmd), rawCmds(raw), is_ba(true) diff --git a/src/network/access/qhttp.cpp b/src/network/access/qhttp.cpp index 251b9c005..fce7dc109 100644 --- a/src/network/access/qhttp.cpp +++ b/src/network/access/qhttp.cpp @@ -88,7 +88,7 @@ public: bool finished; private: - static QBasicAtomicInt idCounter; + static QAtomicInt idCounter; }; class QHttpPrivate : public QObjectPrivate @@ -180,7 +180,7 @@ public: QTimer post100ContinueTimer; }; -QBasicAtomicInt QHttpRequest::idCounter = Q_BASIC_ATOMIC_INITIALIZER(1); +QAtomicInt QHttpRequest::idCounter = QAtomicInt(1); bool QHttpRequest::hasRequestHeader() { diff --git a/src/network/access/qnetworkaccessbackend.cpp b/src/network/access/qnetworkaccessbackend.cpp index 6c93e7bd6..fcb1456a2 100644 --- a/src/network/access/qnetworkaccessbackend.cpp +++ b/src/network/access/qnetworkaccessbackend.cpp @@ -72,10 +72,10 @@ public: QMutex mutex; //this is used to avoid (re)constructing factory data from destructors of other global classes - static QBasicAtomicInt valid; + static QAtomicInt valid; }; Q_GLOBAL_STATIC(QNetworkAccessBackendFactoryData, factoryData) -QBasicAtomicInt QNetworkAccessBackendFactoryData::valid = Q_BASIC_ATOMIC_INITIALIZER(0); +QAtomicInt QNetworkAccessBackendFactoryData::valid = QAtomicInt(0); QNetworkAccessBackendFactory::QNetworkAccessBackendFactory() { diff --git a/src/network/access/qnetworkaccesshttpbackend.cpp b/src/network/access/qnetworkaccesshttpbackend.cpp index ed29647dd..050363ece 100644 --- a/src/network/access/qnetworkaccesshttpbackend.cpp +++ b/src/network/access/qnetworkaccesshttpbackend.cpp @@ -65,7 +65,7 @@ QT_BEGIN_NAMESPACE class QNetworkProxy; -static inline bool isSeparator(register char c) +static inline bool isSeparator(char c) { static const char separators[] = "()<>@,;:\\\"/[]?={}"; return isLWS(c) || strchr(separators, c) != 0; @@ -121,7 +121,7 @@ static QHash parseHttpOptionHeader(const QByteArray &hea // quoted-pair = "\" CHAR ++pos; while (pos < header.length()) { - register char c = header.at(pos); + char c = header.at(pos); if (c == '"') { // end of quoted text break; @@ -139,7 +139,7 @@ static QHash parseHttpOptionHeader(const QByteArray &hea } else { // case: token while (pos < header.length()) { - register char c = header.at(pos); + const char c = header.at(pos); if (isSeparator(c)) break; value += c; diff --git a/src/network/access/qnetworkcookie.cpp b/src/network/access/qnetworkcookie.cpp index 900142fea..7c5ce1fd5 100644 --- a/src/network/access/qnetworkcookie.cpp +++ b/src/network/access/qnetworkcookie.cpp @@ -371,7 +371,7 @@ static QPair nextField(const QByteArray &text, int &posi // parse the first part, before the equal sign for (i = position; i < length; ++i) { - register char c = text.at(i); + const char c = text.at(i); if (c == ';' || c == '=') break; } @@ -401,7 +401,7 @@ static QPair nextField(const QByteArray &text, int &posi second += '"'; ++i; while (i < length) { - register char c = text.at(i); + char c = text.at(i); if (c == '"') { // end of quoted text if (isNameValue) @@ -422,7 +422,7 @@ static QPair nextField(const QByteArray &text, int &posi } for ( ; i < length; ++i) { - register char c = text.at(i); + const char c = text.at(i); if (c == ';') break; } @@ -431,7 +431,7 @@ static QPair nextField(const QByteArray &text, int &posi // no quote, we found format (2) position = i; for ( ; i < length; ++i) { - register char c = text.at(i); + const char c = text.at(i); // for name value pairs, we want to parse until reaching the next ';' // and not break when reaching a space char if (c == ';' || ((isNameValue && (c == '\n' || c == '\r')) || (!isNameValue && isLWS(c)))) diff --git a/src/network/bearer/qnetworkconfigmanager.cpp b/src/network/bearer/qnetworkconfigmanager.cpp index f8c76aad6..3a498c026 100644 --- a/src/network/bearer/qnetworkconfigmanager.cpp +++ b/src/network/bearer/qnetworkconfigmanager.cpp @@ -54,9 +54,9 @@ QT_BEGIN_NAMESPACE -static QBasicAtomicPointer connManager_ptr; +static QAtomicPointer connManager_ptr; Q_GLOBAL_STATIC(QMutex, connManager_mutex) -static QBasicAtomicInt appShutdown; +static QAtomicInt appShutdown; static void connManager_cleanup() { diff --git a/src/network/kernel/qhostinfo.cpp b/src/network/kernel/qhostinfo.cpp index f79da735b..420c83b38 100644 --- a/src/network/kernel/qhostinfo.cpp +++ b/src/network/kernel/qhostinfo.cpp @@ -115,7 +115,7 @@ Q_GLOBAL_STATIC(QHostInfoLookupManager, theHostInfoLookupManager) \sa QAbstractSocket, {http://www.rfc-editor.org/rfc/rfc3492.txt}{RFC 3492} */ -static QBasicAtomicInt theIdCounter = Q_BASIC_ATOMIC_INITIALIZER(1); +static QAtomicInt theIdCounter = QAtomicInt(1); /*! Looks up the IP address(es) associated with host name \a name, and diff --git a/src/network/socket/qsocks5socketengine.cpp b/src/network/socket/qsocks5socketengine.cpp index 112014e63..9bad5b3bf 100644 --- a/src/network/socket/qsocks5socketengine.cpp +++ b/src/network/socket/qsocks5socketengine.cpp @@ -988,7 +988,7 @@ QSocks5SocketEngine::~QSocks5SocketEngine() delete d->bindData; } -static QBasicAtomicInt descriptorCounter = Q_BASIC_ATOMIC_INITIALIZER(1); +static QAtomicInt descriptorCounter = QAtomicInt(1); bool QSocks5SocketEngine::initialize(QAbstractSocket::SocketType type, QAbstractSocket::NetworkLayerProtocol protocol) { diff --git a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp index a4fa51550..62fb97146 100644 --- a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp +++ b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp @@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE -QBasicAtomicInt qgltextureglyphcache_serial_number = Q_BASIC_ATOMIC_INITIALIZER(1); +QAtomicInt qgltextureglyphcache_serial_number = QAtomicInt(1); QGLTextureGlyphCache::QGLTextureGlyphCache(const QGLContext *context, QFontEngineGlyphCache::Type type, const QTransform &matrix) : QImageTextureGlyphCache(type, matrix), QGLContextGroupResourceBase() diff --git a/src/opengl/gl2paintengineex/qtriangulatingstroker_p.h b/src/opengl/gl2paintengineex/qtriangulatingstroker_p.h index 964de6f3b..81308258f 100644 --- a/src/opengl/gl2paintengineex/qtriangulatingstroker_p.h +++ b/src/opengl/gl2paintengineex/qtriangulatingstroker_p.h @@ -46,7 +46,6 @@ #include #include #include -#include #include #include #include diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index efc50625a..2823cee66 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -332,10 +332,6 @@ void QGL::setPreferredPaintEngine(QPaintEngine::Type engineType) static inline void transform_point(GLdouble out[4], const GLdouble m[16], const GLdouble in[4]) { -#if defined(Q_CC_GNU) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Warray-bounds" -#endif #define M(row,col) m[col*4+row] out[0] = M(0, 0) * in[0] + M(0, 1) * in[1] + M(0, 2) * in[2] + M(0, 3) * in[3]; @@ -346,9 +342,6 @@ static inline void transform_point(GLdouble out[4], const GLdouble m[16], const out[3] = M(3, 0) * in[0] + M(3, 1) * in[1] + M(3, 2) * in[2] + M(3, 3) * in[3]; #undef M -#if defined(Q_CC_GNU) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406) -# pragma GCC diagnostic pop -#endif } static inline GLint qgluProject(GLdouble objx, GLdouble objy, GLdouble objz, diff --git a/src/opengl/qglcolormap.cpp b/src/opengl/qglcolormap.cpp index 8cb7c39ee..0b0f2d195 100644 --- a/src/opengl/qglcolormap.cpp +++ b/src/opengl/qglcolormap.cpp @@ -94,7 +94,7 @@ QT_BEGIN_NAMESPACE -QGLColormap::QGLColormapData QGLColormap::shared_null = { Q_BASIC_ATOMIC_INITIALIZER(1), 0, 0 }; +QGLColormap::QGLColormapData QGLColormap::shared_null = { QAtomicInt(1), 0, 0 }; /*! Construct a QGLColormap. diff --git a/src/opengl/qglcolormap.h b/src/opengl/qglcolormap.h index 8ae457f06..23dc298c4 100644 --- a/src/opengl/qglcolormap.h +++ b/src/opengl/qglcolormap.h @@ -77,7 +77,7 @@ protected: private: struct QGLColormapData { - QBasicAtomicInt ref; + QAtomicInt ref; QVector *cells; Qt::HANDLE cmapHandle; }; diff --git a/src/shared/bootstrap.cmake b/src/shared/bootstrap.cmake index b2fa6e6dc..6d0f9bb9e 100644 --- a/src/shared/bootstrap.cmake +++ b/src/shared/bootstrap.cmake @@ -10,7 +10,6 @@ set(BOOTSTRAP_DEFINITIONS -DQT_NO_GEOM_VARIANT -DQT_NO_LIBRARY -DQT_NO_QOBJECT - -DQT_NO_STL -DQT_NO_SYSTEMLOCALE -DQT_NO_TEXTSTREAM -DQT_NO_THREAD @@ -26,11 +25,6 @@ set(BOOTSTRAP_INCLUDES ${CMAKE_BINARY_DIR}/privateinclude ${CMAKE_BINARY_DIR}/include/QtCore ${CMAKE_BINARY_DIR}/privateinclude/QtCore - ${CMAKE_BINARY_DIR}/include/QtXml - ${CMAKE_BINARY_DIR}/privateinclude/QtXml - ${CMAKE_SOURCE_DIR}/src/xml - ${CMAKE_SOURCE_DIR}/src/xml/dom - ${CMAKE_SOURCE_DIR}/src/xml/sax ${CMAKE_SOURCE_DIR}/src/core/arch ${CMAKE_SOURCE_DIR}/src/core/global ${CMAKE_SOURCE_DIR}/src/core/kernel @@ -80,10 +74,6 @@ set(BOOTSTRAP_SOURCES ${CMAKE_SOURCE_DIR}/src/core/tools/qstringlist.cpp ${CMAKE_SOURCE_DIR}/src/core/tools/qvector.cpp ${CMAKE_SOURCE_DIR}/src/core/tools/qvsnprintf.cpp - ${CMAKE_SOURCE_DIR}/src/core/xml/qxmlutils.cpp - ${CMAKE_SOURCE_DIR}/src/core/xml/qxmlstream.cpp - ${CMAKE_SOURCE_DIR}/src/xml/dom/qdom.cpp - ${CMAKE_SOURCE_DIR}/src/xml/sax/qxml.cpp ${CMAKE_SOURCE_DIR}/src/core/io/qfilesystemengine_unix.cpp ${CMAKE_SOURCE_DIR}/src/core/io/qfilesystemiterator_unix.cpp ${CMAKE_SOURCE_DIR}/src/core/io/qfsfileengine_unix.cpp diff --git a/src/shared/qclass_lib_map.h b/src/shared/qclass_lib_map.h index dd4667016..cdb98f027 100644 --- a/src/shared/qclass_lib_map.h +++ b/src/shared/qclass_lib_map.h @@ -101,8 +101,6 @@ static const ClassInfoEntry qclass_lib_map[] = { { "QTextBoundaryFinder", "QtCore/qtextboundaryfinder.h"}, { "QTimeLine", "QtCore/qtimeline.h"}, { "QVectorData", "QtCore/qvector.h"}, - { "QAtomicInt", "QtCore/qatomic.h"}, - { "QBasicAtomicInt", "QtCore/qbasicatomic.h"}, { "QMutex", "QtCore/qmutex.h"}, { "QMutexLocker", "QtCore/qmutex.h"}, { "QReadWriteLock", "QtCore/qreadwritelock.h"}, @@ -763,6 +761,6 @@ static const ClassInfoEntry qclass_lib_map[] = { { "QSslKey", "QtNetwork/qsslkey.h"}, { "QSslSocket", "QtNetwork/qsslsocket.h"}, }; -static const int qclass_lib_count = 757; +static const int qclass_lib_count = 755; #endif diff --git a/src/test/qbenchmarkvalgrind.cpp b/src/test/qbenchmarkvalgrind.cpp index a29001bac..063bb880a 100644 --- a/src/test/qbenchmarkvalgrind.cpp +++ b/src/test/qbenchmarkvalgrind.cpp @@ -219,12 +219,6 @@ bool QBenchmarkValgrindUtils::runCallgrindSubProcess(const QStringList &origAppA return finishedOk; } -#if defined(Q_CC_GNU) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406) -// the callgrind macros below generate warnings -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wunused-but-set-variable" -#endif - void QBenchmarkCallgrindMeasurer::start() { CALLGRIND_ZERO_STATS; @@ -233,15 +227,9 @@ void QBenchmarkCallgrindMeasurer::start() qint64 QBenchmarkCallgrindMeasurer::checkpoint() { CALLGRIND_DUMP_STATS; - const qint64 result = QBenchmarkValgrindUtils::extractLastResult(); - return result; + return QBenchmarkValgrindUtils::extractLastResult(); } -#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406) -// the callgrind macros above generate warnings -# pragma GCC diagnostic pop -#endif - qint64 QBenchmarkCallgrindMeasurer::stop() { return checkpoint(); diff --git a/src/test/qtest_global.h b/src/test/qtest_global.h index 3c7010545..3fda1da8a 100644 --- a/src/test/qtest_global.h +++ b/src/test/qtest_global.h @@ -48,7 +48,7 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -#if defined (Q_CC_SUN) || defined (Q_CC_XLC) || (defined (Q_CC_GNU) && (__GNUC__ - 0 < 3)) +#if defined (Q_CC_SUN) || defined (Q_CC_XLC) # define QTEST_NO_SPECIALIZATIONS #endif diff --git a/src/test/qtestlog.cpp b/src/test/qtestlog.cpp index 6dc1f22fc..08ca79a88 100644 --- a/src/test/qtestlog.cpp +++ b/src/test/qtestlog.cpp @@ -120,7 +120,7 @@ namespace QTest { static void messageHandler(QtMsgType type, const char *msg) { - static QBasicAtomicInt counter = Q_BASIC_ATOMIC_INITIALIZER(QTest::maxWarnings); + static QAtomicInt counter = QAtomicInt(QTest::maxWarnings); if (!msg || !QTest::testLogger) { // if this goes wrong, something is seriously broken. diff --git a/src/tools/moc/moc.h b/src/tools/moc/moc.h index 8d86fab58..d7895aae9 100644 --- a/src/tools/moc/moc.h +++ b/src/tools/moc/moc.h @@ -43,7 +43,6 @@ #define MOC_H #include "parser.h" -#include #include #include #include diff --git a/src/tools/moc/preprocessor.cpp b/src/tools/moc/preprocessor.cpp index 290bc216c..3a4be9ddf 100644 --- a/src/tools/moc/preprocessor.cpp +++ b/src/tools/moc/preprocessor.cpp @@ -41,7 +41,6 @@ #include "preprocessor.h" #include "utils.h" -#include #include #include #include diff --git a/src/tools/uic/cpp/cppwriteinitialization.cpp b/src/tools/uic/cpp/cppwriteinitialization.cpp index 37e49e1f8..84caa7cb6 100644 --- a/src/tools/uic/cpp/cppwriteinitialization.cpp +++ b/src/tools/uic/cpp/cppwriteinitialization.cpp @@ -311,13 +311,6 @@ int IconHandle::compare(const IconHandle &rhs) const return 0; } - -#if defined(Q_OS_MAC) && defined(Q_CC_GNU) && (__GNUC__ == 3 && __GNUC_MINOR__ == 3) -inline uint qHash(const SizePolicyHandle &handle) { return qHash(handle.m_domSizePolicy); } -inline uint qHash(const FontHandle &handle) { return qHash(handle.m_domFont); } -inline uint qHash(const IconHandle &handle) { return qHash(handle.m_domIcon); } -#endif - SizePolicyHandle::SizePolicyHandle(const DomSizePolicy *domSizePolicy) : m_domSizePolicy(domSizePolicy) { @@ -418,17 +411,11 @@ void WriteInitialization::LayoutDefaultHandler::writeProperty(int p, const QStri // the default value, layout properties were always written const bool useLayoutFunctionPre43 = !suppressDefault && (m_state[p] == (HasDefaultFunction|HasDefaultValue)) && value == m_defaultValues[p]; if (!useLayoutFunctionPre43) { - bool ifndefMac = (!(m_state[p] & (HasDefaultFunction|HasDefaultValue)) - && value == defaultStyleValue); - if (ifndefMac) - str << "#ifndef Q_OS_MAC\n"; if (p == Margin) { // Use setContentsMargins for numeric values writeContentsMargins(indent, objectName, value, str); } else { writeSetter(indent, objectName, setter, value, str); } - if (ifndefMac) - str << "#endif\n"; return; } } diff --git a/src/tools/uic/cpp/cppwriteinitialization.h b/src/tools/uic/cpp/cppwriteinitialization.h index eae5ea971..8ee880687 100644 --- a/src/tools/uic/cpp/cppwriteinitialization.h +++ b/src/tools/uic/cpp/cppwriteinitialization.h @@ -68,9 +68,6 @@ namespace CPP { int compare(const FontHandle &) const; private: const DomFont *m_domFont; -#if defined(Q_OS_MAC) && defined(Q_CC_GNU) && (__GNUC__ == 3 && __GNUC_MINOR__ == 3) - friend uint qHash(const FontHandle &); -#endif }; inline bool operator ==(const FontHandle &f1, const FontHandle &f2) { return f1.compare(f2) == 0; } inline bool operator <(const FontHandle &f1, const FontHandle &f2) { return f1.compare(f2) < 0; } @@ -82,9 +79,6 @@ namespace CPP { int compare(const IconHandle &) const; private: const DomResourceIcon *m_domIcon; -#if defined(Q_OS_MAC) && defined(Q_CC_GNU) && (__GNUC__ == 3 && __GNUC_MINOR__ == 3) - friend uint qHash(const IconHandle &); -#endif }; inline bool operator ==(const IconHandle &i1, const IconHandle &i2) { return i1.compare(i2) == 0; } inline bool operator <(const IconHandle &i1, const IconHandle &i2) { return i1.compare(i2) < 0; } @@ -96,16 +90,9 @@ namespace CPP { int compare(const SizePolicyHandle &) const; private: const DomSizePolicy *m_domSizePolicy; -#if defined(Q_OS_MAC) && defined(Q_CC_GNU) && (__GNUC__ == 3 && __GNUC_MINOR__ == 3) - friend uint qHash(const SizePolicyHandle &); -#endif }; inline bool operator ==(const SizePolicyHandle &f1, const SizePolicyHandle &f2) { return f1.compare(f2) == 0; } -#if !(defined(Q_OS_MAC) && defined(Q_CC_GNU) && (__GNUC__ == 3 && __GNUC_MINOR__ == 3)) inline bool operator <(const SizePolicyHandle &f1, const SizePolicyHandle &f2) { return f1.compare(f2) < 0; } -#endif - - struct WriteInitialization : public TreeWalker { @@ -293,15 +280,9 @@ private: ColorBrushHash m_colorBrushHash; // Map from font properties to font variable name for reuse // Map from size policy to variable for reuse -#if defined(Q_OS_MAC) && defined(Q_CC_GNU) && (__GNUC__ == 3 && __GNUC_MINOR__ == 3) - typedef QHash FontPropertiesNameMap; - typedef QHash IconPropertiesNameMap; - typedef QHash SizePolicyNameMap; -#else typedef QMap FontPropertiesNameMap; typedef QMap IconPropertiesNameMap; typedef QMap SizePolicyNameMap; -#endif FontPropertiesNameMap m_fontPropertiesNameMap; IconPropertiesNameMap m_iconPropertiesNameMap; SizePolicyNameMap m_sizePolicyNameMap; diff --git a/src/xmlpatterns/data/qschemanumeric_p.h b/src/xmlpatterns/data/qschemanumeric_p.h index 9fa580682..fe08eaa31 100644 --- a/src/xmlpatterns/data/qschemanumeric_p.h +++ b/src/xmlpatterns/data/qschemanumeric_p.h @@ -61,9 +61,7 @@ QT_BEGIN_NAMESPACE /** * @file - * @short Contains class Numeric. This file was originally called qnumeric_p.h, - * but various build systems cannot handle that that name happens to be - * identical to another one, the one in QtCore. + * @short Contains class Numeric. */ namespace QPatternist -- 2.11.0