Ticket #57751: patch-qt4-mac-cpp11-attempts.diff

File patch-qt4-mac-cpp11-attempts.diff, 16.7 KB (added by kencu (Ken), 5 years ago)

some patches in an attempt to enable building with clang-7.0

  • src/3rdparty/javascriptcore/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp

    diff --git src/3rdparty/javascriptcore/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp src/3rdparty/javascriptcore/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
    index b0a0877c..046b11c8 100644
    RegisterID* BytecodeGenerator::emitNextPropertyName(RegisterID* dst, RegisterID* 
    18351835RegisterID* BytecodeGenerator::emitCatch(RegisterID* targetRegister, Label* start, Label* end)
    18361836{
    18371837#if ENABLE(JIT)
    1838     HandlerInfo info = { start->bind(0, 0), end->bind(0, 0), instructions().size(), m_dynamicScopeDepth + m_baseScopeDepth, CodeLocationLabel() };
     1838    HandlerInfo info = {
     1839        static_cast<uint32_t>(start->bind(0, 0)),
     1840        static_cast<uint32_t>(end->bind(0, 0)),
     1841        static_cast<uint32_t>(instructions().size()),
     1842        static_cast<uint32_t>(m_dynamicScopeDepth + m_baseScopeDepth),
     1843        CodeLocationLabel()
     1844    };
    18391845#else
    1840     HandlerInfo info = { start->bind(0, 0), end->bind(0, 0), instructions().size(), m_dynamicScopeDepth + m_baseScopeDepth };
     1846    HandlerInfo info = {
     1847        static_cast<uint32_t>(start->bind(0, 0)),
     1848        static_cast<uint32_t>(end->bind(0, 0)),
     1849        static_cast<uint32_t>(instructions().size()),
     1850        static_cast<uint32_t>(m_dynamicScopeDepth + m_baseScopeDepth)
     1851    };
    18411852#endif
    18421853
    18431854    m_codeBlock->addExceptionHandler(info);
    void BytecodeGenerator::emitPushNewScope(RegisterID* dst, const Identifier& prop 
    18891900
    18901901void BytecodeGenerator::beginSwitch(RegisterID* scrutineeRegister, SwitchInfo::SwitchType type)
    18911902{
    1892     SwitchInfo info = { instructions().size(), type };
     1903    SwitchInfo info = { static_cast<uint32_t>(instructions().size()), type };
    18931904    switch (type) {
    18941905        case SwitchInfo::SwitchImmediate:
    18951906            emitOpcode(op_switch_imm);
  • src/3rdparty/javascriptcore/JavaScriptCore/bytecompiler/BytecodeGenerator.h

    diff --git src/3rdparty/javascriptcore/JavaScriptCore/bytecompiler/BytecodeGenerator.h src/3rdparty/javascriptcore/JavaScriptCore/bytecompiler/BytecodeGenerator.h
    index 8b6a4251..af74e60c 100644
    namespace JSC { 
    176176            // Node::emitCode assumes that dst, if provided, is either a local or a referenced temporary.
    177177            ASSERT(!dst || dst == ignoredResult() || !dst->isTemporary() || dst->refCount());
    178178            if (!m_codeBlock->numberOfLineInfos() || m_codeBlock->lastLineInfo().lineNumber != n->lineNo()) {
    179                 LineInfo info = { instructions().size(), n->lineNo() };
     179                LineInfo info = { static_cast<uint32_t>(instructions().size()), n->lineNo() };
    180180                m_codeBlock->addLineInfo(info);
    181181            }
    182182            if (m_emitNodeDepth >= s_maxEmitNodeDepth)
    namespace JSC { 
    195195        void emitNodeInConditionContext(ExpressionNode* n, Label* trueTarget, Label* falseTarget, bool fallThroughMeansTrue)
    196196        {
    197197            if (!m_codeBlock->numberOfLineInfos() || m_codeBlock->lastLineInfo().lineNumber != n->lineNo()) {
    198                 LineInfo info = { instructions().size(), n->lineNo() };
     198                LineInfo info = { static_cast<uint32_t>(instructions().size()), n->lineNo() };
    199199                m_codeBlock->addLineInfo(info);
    200200            }
    201201            if (m_emitNodeDepth >= s_maxEmitNodeDepth)
  • src/3rdparty/javascriptcore/JavaScriptCore/runtime/Identifier.cpp

    diff --git src/3rdparty/javascriptcore/JavaScriptCore/runtime/Identifier.cpp src/3rdparty/javascriptcore/JavaScriptCore/runtime/Identifier.cpp
    index 747c4ac8..0702c423 100644
    PassRefPtr<UString::Rep> Identifier::add(JSGlobalData* globalData, const UChar* 
    195195        UString::Rep::empty().hash();
    196196        return &UString::Rep::empty();
    197197    }
    198     UCharBuffer buf = {s, length};
     198    UCharBuffer buf = {s, static_cast<unsigned>(length)};
    199199    pair<HashSet<UString::Rep*>::iterator, bool> addResult = globalData->identifierTable->add<UCharBuffer, UCharBufferTranslator>(buf);
    200200
    201201    // If the string is newly-translated, then we need to adopt it.
  • src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSONObject.cpp

    diff --git src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSONObject.cpp src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSONObject.cpp
    index b089584e..daacbdbb 100644
    void Stringifier::appendQuotedString(StringBuilder& builder, const UString& valu 
    320320            default:
    321321                static const char hexDigits[] = "0123456789abcdef";
    322322                UChar ch = data[i];
    323                 UChar hex[] = { '\\', 'u', hexDigits[(ch >> 12) & 0xF], hexDigits[(ch >> 8) & 0xF], hexDigits[(ch >> 4) & 0xF], hexDigits[ch & 0xF] };
     323                UChar hex[] = { '\\', 'u',
     324                                static_cast<UChar>(hexDigits[(ch >> 12) & 0xF]),
     325                                static_cast<UChar>(hexDigits[(ch >> 8) & 0xF]),
     326                                static_cast<UChar>(hexDigits[(ch >> 4) & 0xF]),
     327                                static_cast<UChar>(hexDigits[ch & 0xF]) };
    324328                builder.append(hex, sizeof(hex) / sizeof(UChar));
    325329                break;
    326330        }
  • src/3rdparty/javascriptcore/JavaScriptCore/runtime/Structure.cpp

    diff --git src/3rdparty/javascriptcore/JavaScriptCore/runtime/Structure.cpp src/3rdparty/javascriptcore/JavaScriptCore/runtime/Structure.cpp
    index 499c53a7..ac4ab864 100644
    Structure::Structure(JSValue prototype, const TypeInfo& typeInfo) 
    156156Structure::~Structure()
    157157{
    158158    if (m_previous) {
    159         if (m_nameInPrevious)
    160             m_previous->table.remove(StructureTransitionTableHash::Key(RefPtr<UString::Rep>(m_nameInPrevious.get()), m_attributesInPrevious), m_specificValueInPrevious);
    161         else
     159        if (m_nameInPrevious) {
     160            unsigned attrInPrev = m_attributesInPrevious;
     161            m_previous->table.remove(StructureTransitionTableHash::Key(RefPtr<UString::Rep>(m_nameInPrevious.get()), attrInPrev), m_specificValueInPrevious);
     162        } else
    162163            m_previous->table.removeAnonymousSlotTransition(m_anonymousSlotsInPrevious);
    163164
    164165    }
  • src/3rdparty/javascriptcore/JavaScriptCore/runtime/Structure.h

    diff --git src/3rdparty/javascriptcore/JavaScriptCore/runtime/Structure.h src/3rdparty/javascriptcore/JavaScriptCore/runtime/Structure.h
    index 7571efc1..a8deb5ef 100644
    namespace JSC { 
    316316        Structure* existingTransition = singleTransition();
    317317        TransitionTable* transitionTable = new TransitionTable;
    318318        setTransitionTable(transitionTable);
    319         if (existingTransition)
    320             add(StructureTransitionTableHash::Key(RefPtr<UString::Rep>(existingTransition->m_nameInPrevious.get()), existingTransition->m_attributesInPrevious), existingTransition, existingTransition->m_specificValueInPrevious);
     319        if (existingTransition) {
     320            const unsigned attrsInPrev = existingTransition->m_attributesInPrevious;
     321            add(StructureTransitionTableHash::Key(RefPtr<UString::Rep>(existingTransition->m_nameInPrevious.get()), attrsInPrev), existingTransition, existingTransition->m_specificValueInPrevious);
     322        }
    321323    }
    322324} // namespace JSC
    323325
  • src/3rdparty/javascriptcore/JavaScriptCore/wtf/unicode/UTF8.cpp

    diff --git src/3rdparty/javascriptcore/JavaScriptCore/wtf/unicode/UTF8.cpp src/3rdparty/javascriptcore/JavaScriptCore/wtf/unicode/UTF8.cpp
    index 21d58563..cbfc528e 100644
    static bool isLegalUTF8(const unsigned char* source, int length) 
    229229// This table contains as many values as there might be trailing bytes
    230230// in a UTF-8 sequence.
    231231static const UChar32 offsetsFromUTF8[6] = { 0x00000000UL, 0x00003080UL, 0x000E2080UL,
    232             0x03C82080UL, 0xFA082080UL, 0x82082080UL };
     232            0x03C82080UL, static_cast<UChar32>(0xFA082080UL), static_cast<UChar32>(0x82082080UL) };
    233233
    234234ConversionResult convertUTF8ToUTF16(
    235235    const char** sourceStart, const char* sourceEnd,
  • src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexCompiler.cpp

    diff --git src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexCompiler.cpp src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexCompiler.cpp
    index 9cd3d123..c37bf518 100644
    const char* compileRegex(const UString& patternString, RegexPattern& pattern) 
    719719
    720720    constructor.setupOffsets();
    721721
    722     return false;
     722    return NULL;
    723723};
    724724
    725725
  • src/gui/kernel/qcocoaview_mac.mm

    diff --git src/gui/kernel/qcocoaview_mac.mm src/gui/kernel/qcocoaview_mac.mm
    index 34dc8156..81f67d5e 100644
    Qt::DropAction QDragManager::drag(QDrag *o) 
    13521352    // Save supported actions:
    13531353    [theView setSupportedActions: qt_mac_mapDropActions(dragPrivate()->possible_actions)];
    13541354    QPoint pointInView = [theView qt_qwidget]->mapFromGlobal(dndParams->globalPoint);
    1355     NSPoint imageLoc = {pointInView.x() - hotspot.x(), pointInView.y() + pix.height() - hotspot.y()};
     1355    NSPoint imageLoc = {static_cast<CGFloat>(pointInView.x() - hotspot.x()), static_cast<CGFloat>(pointInView.y() + pix.height() - hotspot.y())};
    13561356    NSSize mouseOffset = {0.0, 0.0};
    13571357    NSPasteboard *pboard = [NSPasteboard pasteboardWithName:NSDragPboard];
    13581358    dragPrivate()->executed_action = Qt::ActionMask;
  • src/gui/kernel/qcursor_mac.mm

    diff --git src/gui/kernel/qcursor_mac.mm src/gui/kernel/qcursor_mac.mm
    index 764bc382..91c2cedb 100644
    void QCursorData::initCursorFromBitmap() 
    369369    type = QCursorData::TYPE_ImageCursor;
    370370    curs.cp.my_cursor = true;
    371371    QPixmap bmCopy = QPixmap::fromImage(finalCursor);
    372     NSPoint hotSpot = { hx, hy };
     372    NSPoint hotSpot = { static_cast<CGFloat>(hx), static_cast<CGFloat>(hy) };
    373373    nsimage = static_cast<NSImage*>(qt_mac_create_nsimage(bmCopy));
    374374    curs.cp.nscursor = [[NSCursor alloc] initWithImage:nsimage hotSpot: hotSpot];
    375375    [nsimage release];
    void QCursorData::initCursorFromPixmap() 
    379379{
    380380    type = QCursorData::TYPE_ImageCursor;
    381381    curs.cp.my_cursor = true;
    382     NSPoint hotSpot = { hx, hy };
     382    NSPoint hotSpot = { static_cast<CGFloat>(hx), static_cast<CGFloat>(hy) };
    383383    NSImage *nsimage;
    384384    nsimage = static_cast<NSImage *>(qt_mac_create_nsimage(pixmap));
    385385    curs.cp.nscursor = [[NSCursor alloc] initWithImage:nsimage hotSpot: hotSpot];
  • src/gui/kernel/qt_cocoa_helpers_mac.mm

    diff --git src/gui/kernel/qt_cocoa_helpers_mac.mm src/gui/kernel/qt_cocoa_helpers_mac.mm
    index 761c8da5..cabf4c8d 100644
    void qt_dispatchTabletProximityEvent(void * /*NSEvent * */ tabletEvent) 
    462462{
    463463    NSEvent *proximityEvent = static_cast<NSEvent *>(tabletEvent);
    464464    // simply construct a Carbon proximity record and handle it all in one spot.
    465     TabletProximityRec carbonProximityRec = { [proximityEvent vendorID],
    466                                               [proximityEvent tabletID],
    467                                               [proximityEvent pointingDeviceID],
    468                                               [proximityEvent deviceID],
    469                                               [proximityEvent systemTabletID],
    470                                               [proximityEvent vendorPointingDeviceType],
    471                                               [proximityEvent pointingDeviceSerialNumber],
     465    TabletProximityRec carbonProximityRec = { static_cast<UInt16>([proximityEvent vendorID]),
     466                                              static_cast<UInt16>([proximityEvent tabletID]),
     467                                              static_cast<UInt16>([proximityEvent pointingDeviceID]),
     468                                              static_cast<UInt16>([proximityEvent deviceID]),
     469                                              static_cast<UInt16>([proximityEvent systemTabletID]),
     470                                              static_cast<UInt16>([proximityEvent vendorPointingDeviceType]),
     471                                              static_cast<UInt32>([proximityEvent pointingDeviceSerialNumber]),
    472472                                              [proximityEvent uniqueID],
    473                                               [proximityEvent capabilityMask],
    474                                               [proximityEvent pointingDeviceType],
    475                                               [proximityEvent isEnteringProximity] };
     473                                              static_cast<UInt32>([proximityEvent capabilityMask]),
     474                                              static_cast<UInt8>([proximityEvent pointingDeviceType]),
     475                                              static_cast<UInt8>([proximityEvent isEnteringProximity]) };
    476476    qt_dispatchTabletProximityEvent(carbonProximityRec);
    477477}
    478478#endif // QT_MAC_USE_COCOA
  • src/gui/styles/qmacstyle_mac.mm

    diff --git src/gui/styles/qmacstyle_mac.mm src/gui/styles/qmacstyle_mac.mm
    index 196d14bd..549a2d7e 100644
    void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter 
    34663466                    tti.version = qt_mac_hitheme_version;
    34673467                    tti.state = tds;
    34683468                    QColor textColor = btn->palette.buttonText().color();
    3469                     CGFloat colorComp[] = { textColor.redF(), textColor.greenF(),
    3470                                           textColor.blueF(), textColor.alphaF() };
     3469                    CGFloat colorComp[] = { static_cast<CGFloat>(textColor.redF()), static_cast<CGFloat>(textColor.greenF()),
     3470                                          static_cast<CGFloat>(textColor.blueF()), static_cast<CGFloat>(textColor.alphaF()) };
    34713471                    CGContextSetFillColorSpace(cg, QCoreGraphicsPaintEngine::macGenericColorSpace());
    34723472                    CGContextSetFillColor(cg, colorComp);
    34733473                    tti.fontID = themeId;
    void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter 
    37083708                tti.version = qt_mac_hitheme_version;
    37093709                tti.state = tds;
    37103710                QColor textColor = myTab.palette.windowText().color();
    3711                 CGFloat colorComp[] = { textColor.redF(), textColor.greenF(),
    3712                                         textColor.blueF(), textColor.alphaF() };
     3711                CGFloat colorComp[] = { static_cast<CGFloat>(textColor.redF()), static_cast<CGFloat>(textColor.greenF()),
     3712                                        static_cast<CGFloat>(textColor.blueF()), static_cast<CGFloat>(textColor.alphaF()) };
    37133713                CGContextSetFillColorSpace(cg, QCoreGraphicsPaintEngine::macGenericColorSpace());
    37143714                CGContextSetFillColor(cg, colorComp);
    37153715                switch (d->aquaSizeConstrain(opt, w)) {
    void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter 
    38983898                CGContextSetShouldAntialias(cg, true);
    38993899                CGContextSetShouldSmoothFonts(cg, true);
    39003900                QColor textColor = p->pen().color();
    3901                 CGFloat colorComp[] = { textColor.redF(), textColor.greenF(),
    3902                                       textColor.blueF(), textColor.alphaF() };
     3901                CGFloat colorComp[] = { static_cast<CGFloat>(textColor.redF()), static_cast<CGFloat>(textColor.greenF()),
     3902                                      static_cast<CGFloat>(textColor.blueF()), static_cast<CGFloat>(textColor.alphaF()) };
    39033903                CGContextSetFillColorSpace(cg, QCoreGraphicsPaintEngine::macGenericColorSpace());
    39043904                CGContextSetFillColor(cg, colorComp);
    39053905                HIThemeTextInfo tti;
    void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex 
    50345034                tti.version = qt_mac_hitheme_version;
    50355035                tti.state = tds;
    50365036                QColor textColor = groupBox->palette.windowText().color();
    5037                 CGFloat colorComp[] = { textColor.redF(), textColor.greenF(),
    5038                                       textColor.blueF(), textColor.alphaF() };
     5037                CGFloat colorComp[] = { static_cast<CGFloat>(textColor.redF()), static_cast<CGFloat>(textColor.greenF()),
     5038                                      static_cast<CGFloat>(textColor.blueF()), static_cast<CGFloat>(textColor.alphaF()) };
    50395039                CGContextSetFillColorSpace(cg, QCoreGraphicsPaintEngine::macGenericColorSpace());
    50405040                CGContextSetFillColor(cg, colorComp);
    50415041                tti.fontID = checkable ? kThemeSystemFont : kThemeSmallSystemFont;