Workaround GHS compiler bug

This temporary workaround allows to compile with GHS toolchain and
should be removed when GHS provides patch to fix the compiler issue.

Change-Id: I0d0eac8054e6ba2f448fed3d3c80a518e0d2af97
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
Kimmo Ollila 2017-03-26 17:38:16 +03:00
parent e8d03c5599
commit 15fe60cfda

View File

@ -534,7 +534,19 @@ QWidget *QLineEditPrivate::addAction(QAction *newAction, QAction *before, QLineE
#endif
}
// If there is a 'before' action, it takes preference
// There's a bug in GHS compiler that causes internal error on the following code.
// The affected GHS compiler versions are 2016.5.4 and 2017.1
// This temporary workaround allows to compile with GHS toolchain and should be
// removed when GHS provides a patch to fix the compiler issue.
#if defined(Q_CC_GHS)
const SideWidgetLocation loc = {position, -1};
const auto location = before ? findSideWidget(before) : loc;
#else
const auto location = before ? findSideWidget(before) : SideWidgetLocation{position, -1};
#endif
SideWidgetEntryList &list = location.position == QLineEdit::TrailingPosition ? trailingSideWidgets : leadingSideWidgets;
list.insert(location.isValid() ? list.begin() + location.index : list.end(),
SideWidgetEntry(w, newAction, flags));