Skip to content

SL-19647: Eliminate LLSDArray entirely.#204

Merged
nat-goodspeed merged 2 commits intomainfrom
zap-LLSDArray
May 17, 2023
Merged

SL-19647: Eliminate LLSDArray entirely.#204
nat-goodspeed merged 2 commits intomainfrom
zap-LLSDArray

Conversation

@nat-goodspeed
Copy link
Contributor

No description provided.

It seems newer compilers have a different interpretation of exactly when to
engage LLSDArray's copy constructor. In particular, this assignment:

some_LLSD_map[key] = LLSDArray(...)(...)...;

used to convert the LLSDArray object directly to LLSD; now it first calls the
custom copy constructor, which embeds the intended array within an outer array
before assigning it into the containing map.

The newer llsd::array() function avoids that problem because what it returns
is already an LLSD object.

Taking inventory of LLSDArray assignments of that form turned up a number of
workarounds like LLSD(LLSDArray(...)). Replacing those with llsd::array() is
both simpler and more readable.

Tip of the hat to Chorazinallen for surfacing this issue!

(cherry picked from commit bb71815)
Newer C++ compilers have different semantics around LLSDArray's special copy
constructor, which was essential to proper LLSD nesting. In short, we can no
longer trust LLSDArray to behave correctly. Now that we have variadic
functions, get rid of LLSDArray and replace every reference with llsd::array().
Copy link
Contributor

@simon-linden simon-linden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have used these changes in the puppetry branch and it seems good. It's definitely nice to clean up the old calls

@nat-goodspeed nat-goodspeed merged commit 55e2d48 into main May 17, 2023
@nat-goodspeed nat-goodspeed deleted the zap-LLSDArray branch May 17, 2023 13:55
@github-actions github-actions bot locked and limited conversation to collaborators May 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants