1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Fix psabi warning emitted by GCC on ARM64

The type std::pair<Point<float>, float> inherits from an empty base on
C++17. Due to a bug in GCC 10.1 this would prevent the compiler from
treating it as a HFA type, and it would use a different register to pass
it, than it does in newer GCC versions. Because of this ABI change an
ABI warning is emitted by GCC today, hinting at this fact.

By using a custom struct that does not inherit from an empty base we are
avoiding emitting this warning.
This commit is contained in:
attila 2025-03-21 18:13:32 +01:00 committed by Attila Szarvas
parent 5f5a247f82
commit bd015f5c97
2 changed files with 14 additions and 7 deletions

View file

@ -661,7 +661,7 @@ void TextEditor::repaintText (Range<int> range)
const auto info = getCursorEdge (caretState.withPosition (range.getEnd()) const auto info = getCursorEdge (caretState.withPosition (range.getEnd())
.withPreferredEdge (Edge::leading)); .withPreferredEdge (Edge::leading));
y2 = (int) (info.first.y + lh * 2.0f); y2 = (int) (info.anchor.y + lh * 2.0f);
} }
const auto offset = getYOffset(); const auto offset = getYOffset();
@ -872,7 +872,7 @@ Range<int64> TextEditor::getLineRangeForIndex (int index)
+ lastParagraphItem.range.getStart(); + lastParagraphItem.range.getStart();
} }
std::pair<Point<float>, float> TextEditor::getTextSelectionEdge (int index, Edge edge) const TextEditor::CaretEdge TextEditor::getTextSelectionEdge (int index, Edge edge) const
{ {
jassert (0 <= index && index < getTotalNumChars()); jassert (0 <= index && index < getTotalNumChars());
const auto textRange = Range<int64>::withStartAndLength ((int64) index, 1); const auto textRange = Range<int64>::withStartAndLength ((int64) index, 1);
@ -1702,8 +1702,8 @@ TextEditor::Edge TextEditor::getEdgeTypeCloserToPosition (int indexInText, Point
{ {
const auto testCaret = caretState.withPosition (indexInText); const auto testCaret = caretState.withPosition (indexInText);
const auto leading = getCursorEdge (testCaret.withPreferredEdge (Edge::leading)).first.getDistanceFrom (pos); const auto leading = getCursorEdge (testCaret.withPreferredEdge (Edge::leading)).anchor.getDistanceFrom (pos);
const auto trailing = getCursorEdge (testCaret.withPreferredEdge (Edge::trailing)).first.getDistanceFrom (pos); const auto trailing = getCursorEdge (testCaret.withPreferredEdge (Edge::trailing)).anchor.getDistanceFrom (pos);
if (leading < trailing) if (leading < trailing)
return Edge::leading; return Edge::leading;
@ -2139,7 +2139,7 @@ bool TextEditor::isEmpty() const
return getTotalNumChars() == 0; return getTotalNumChars() == 0;
} }
std::pair<Point<float>, float> TextEditor::getCursorEdge (const CaretState& tempCaret) const TextEditor::CaretEdge TextEditor::getCursorEdge (const CaretState& tempCaret) const
{ {
const auto visualIndex = tempCaret.getVisualIndex(); const auto visualIndex = tempCaret.getVisualIndex();
jassert (0 <= visualIndex && visualIndex <= getTotalNumChars()); jassert (0 <= visualIndex && visualIndex <= getTotalNumChars());

View file

@ -906,8 +906,15 @@ private:
void insert (const String&, int insertIndex, const Font&, Colour, UndoManager*, int newCaretPos); void insert (const String&, int insertIndex, const Font&, Colour, UndoManager*, int newCaretPos);
void reinsert (const TextEditorStorageChunks& chunks); void reinsert (const TextEditorStorageChunks& chunks);
void remove (Range<int>, UndoManager*, int caretPositionToMoveTo, TextEditorStorageChunks* removedOut = nullptr); void remove (Range<int>, UndoManager*, int caretPositionToMoveTo, TextEditorStorageChunks* removedOut = nullptr);
std::pair<Point<float>, float> getTextSelectionEdge (int index, Edge edge) const;
std::pair<Point<float>, float> getCursorEdge (const CaretState& caret) const; struct CaretEdge
{
Point<float> anchor;
float height{};
};
CaretEdge getTextSelectionEdge (int index, Edge edge) const;
CaretEdge getCursorEdge (const CaretState& caret) const;
void updateCaretPosition(); void updateCaretPosition();
void updateValueFromText(); void updateValueFromText();
void textWasChangedByValue(); void textWasChangedByValue();