Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xcode16 build fix #2585

Open
wants to merge 28 commits into
base: develop
Choose a base branch
from
Open

Xcode16 build fix #2585

wants to merge 28 commits into from

Commits on Sep 17, 2024

  1. Xcode16 build fix

    marchcat committed Sep 17, 2024
    Configuration menu
    Copy the full SHA
    576c558 View commit details
    Browse the repository at this point in the history

Commits on Sep 24, 2024

  1. Make LLPointer equality comparisons accept not-identical types.

    That is, both `LLPointer::operator==()` and `operator!=()` and the free function
    `operator==()` and `operator!=()` now accept pointer types other than the type
    of the subject `LLPointer`, letting the compiler apply implicit pointer
    conversions or diagnose an error.
    nat-goodspeed committed Sep 24, 2024
    Configuration menu
    Copy the full SHA
    705fd68 View commit details
    Browse the repository at this point in the history
  2. LLConstPointer<T> is the same as LLPointer<const T>.

    Instead of restating the whole class, requiring changes to be made in parallel
    (which has already failed), just make a template alias.
    nat-goodspeed committed Sep 24, 2024
    Configuration menu
    Copy the full SHA
    1a682de View commit details
    Browse the repository at this point in the history

Commits on Sep 25, 2024

  1. Use copy-and-swap idiom for LLPointer's assignment operators.

    This affords strong exception safety. Also, eliminating the conditional may
    improve speed.
    nat-goodspeed committed Sep 25, 2024
    Configuration menu
    Copy the full SHA
    98c829a View commit details
    Browse the repository at this point in the history
  2. Explain why apparently redundant LLPointer methods are necessary.

    Given templated constructors and assignment operators, it's tempting to remove
    specific constructors and assignment operators with the same LLPointer<Type>
    parameters. That turns out to be a mistake. Add comments to warn future
    maintainers.
    nat-goodspeed committed Sep 25, 2024
    Configuration menu
    Copy the full SHA
    5d7b3ab View commit details
    Browse the repository at this point in the history
  3. Merge pull request #2681 from secondlife/nat/xcode-16

    Generalize LLPointer's comparison operators to allow comparable LLPointer types.
    marchcat committed Sep 25, 2024
    Configuration menu
    Copy the full SHA
    4b2b94f View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    55df732 View commit details
    Browse the repository at this point in the history

Commits on Sep 26, 2024

  1. Adapt fsyspath for C++20 conventions.

    In C++20, `std::filesystem::u8path()` (that accepts a UTF-8 encoded
    `std::string` and returns a `std::filesystem::path`) is deprecated. Instead,
    to engage UTF-8 coding conversions, we're supposed to pass the `path`
    constructor a `std::u8string`, i.e. a `std::basic_string<char8_t>`. Since
    `char8_t` is a type distinct from both `char` and `unsigned char`, we must Do
    Something to pass a UTF-8 encoded `std::string` into `std::filesystem::path`.
    
    To avoid copying characters from a `std::string` into a temporary
    `std::u8string` and from there into the `std::filesystem::path`, make a
    `boost::transform_iterator` that accepts a `std::string_view::iterator` and
    adapts it to dereference `char8_t` characters. Make `fsyspath(std::string_view)`
    engage the base-class constructor accepting (iterator, iterator), adapting
    `string_view::begin()` and `end()` to deliver `char8_t` characters.
    
    Use the same tactic for `fsyspath::operator=(std::string_view)`, explicitly
    calling `std::filesystem::path::assign()` with the adapted iterators.
    
    To resolve ambiguities, provide both constructors and assignment operators
    accepting `(const std::string&)` and `(const char*)`, explicitly converting
    each to `std::string_view`.
    
    At the same time, `std::filesystem::path::u8string()` now returns
    `std::u8string` rather than `std::string`. Since `std::filesystem::path`
    delivers only that `std::u8string` rather than iterators into its internal
    representation, we can't avoid capturing it and copying to the returned
    `std::string`.
    
    Remove explicit `.u8string()` calls from a few existing `fsyspath` instances,
    now that `fsyspath` supports implicit conversion to `std::string`.
    nat-goodspeed committed Sep 26, 2024
    Configuration menu
    Copy the full SHA
    dc0c6d3 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    988a0fd View commit details
    Browse the repository at this point in the history
  3. #include <cmath> rather than "math.h" to avoid lerp() conflict.

    GCC on Linux complains that "math.h", which hoists all the standard library
    math functions into the global namespace for classic C compatibility, creates
    a conflict between `std::lerp()` and the `lerp()` function in llmath.h.
    (Perhaps we should just replace our `lerp()` definition with `using std::lerp;`)
    
    Anyway, bringing in <cmath> rather than "math.h" leaves standard library math
    functions in the `std` namespace, avoiding the conflict.
    nat-goodspeed committed Sep 26, 2024
    Configuration menu
    Copy the full SHA
    015ff3d View commit details
    Browse the repository at this point in the history
  4. Ditch our own (conflicting) definition of the lerp() function.

    Hoist `std::lerp()` into the global namespace instead.
    nat-goodspeed committed Sep 26, 2024
    Configuration menu
    Copy the full SHA
    6400284 View commit details
    Browse the repository at this point in the history
  5. Fix GCC ambiguous-reversed-operator errors for LLKeyData compares.

    `LLKeyData::operator==(const LLKeyData&)` and `operator!=(const LLKeyData&)`
    were not themselves `const` methods. In C++20, that can produce a fatal
    warning that if the compare operands were reversed, you'd get different
    results. Making them both `const` should fix it.
    
    While touching the method definitions, make `operator==()` more intuitive, and
    make `operator!=()` simply negate `operator==()` instead of restating it in
    reverse.
    nat-goodspeed committed Sep 26, 2024
    Configuration menu
    Copy the full SHA
    6ac59d1 View commit details
    Browse the repository at this point in the history
  6. Reinstate our lerp() function, avoid "math.h" header.

    For reasons that remain unclear, MSVC likes our lerp() function better than
    its own std::lerp() function: publishing the latter into the global namespace,
    instead of defining our own, produces fatal argument conversion warnings.
    
    "math.h" publishes all of <cmath> into the global namespace, which causes a
    GCC conflict between std::lerp() and our lerp() function. Including <cmath>
    instead leaves std::lerp() in the std namespace, eliminating the conflict.
    nat-goodspeed committed Sep 26, 2024
    Configuration menu
    Copy the full SHA
    d7f6b96 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    15dad13 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    452e074 View commit details
    Browse the repository at this point in the history
  9. Rename our lerp() to flerp(); call where MSVC balks at std::lerp().

    Now the lerp() in global namespace is std::lerp(), but it remains true that
    for some calls to std::lerp(), MSVC issues fatal argument conversion warnings.
    In those places, call flerp() (our historic lerp()) instead.
    nat-goodspeed committed Sep 26, 2024
    Configuration menu
    Copy the full SHA
    8a6da4d View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    b043ed4 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    fcfcca9 View commit details
    Browse the repository at this point in the history

Commits on Sep 27, 2024

  1. Configuration menu
    Copy the full SHA
    d3833b6 View commit details
    Browse the repository at this point in the history
  2. Migrate ~LLPointer()'s peculiar warning case to llpointer.cpp.

    This allows removing #include "llerror.h" from llpointer.h.
    Also remove #include "llmutex.h" as a heavy way to get
    <boost/functional/hash.hpp>.
    
    That requires adding #include "llmutex.h" to llimage.h, llnotifications.h,
    llwatchdog.cpp and llvolumemgr.cpp, which were inheriting it from llpointer.h.
    nat-goodspeed committed Sep 27, 2024
    Configuration menu
    Copy the full SHA
    a2b76b6 View commit details
    Browse the repository at this point in the history
  3. Automate memory management in JPEG2KEncode and JPEG2KDecode.

    Instead of using strdup() and free() to store comment_text in JPEG2KEncode,
    store a std::string. Similarly, instead of manually managing pointers to
    encoder, decoder, image, stream and codestream_info in JPEG2KDecode and
    JPEG2KEncode, use std::unique_ptr for each, specifying their respective
    deleter functions.
    nat-goodspeed committed Sep 27, 2024
    Configuration menu
    Copy the full SHA
    d39c862 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    c7cef95 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    51fb298 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    ecc2ada View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    5c9d60c View commit details
    Browse the repository at this point in the history
  8. Introduce owning_ptr<T>; use it for JPEG2KEncode and JPEG2KDecode.

    owning_ptr<T> adapts std::unique_ptr<T> to be a better drop-in replacement for
    a legacy class that formerly stored plain T* data members, and explicitly
    destroyed them using domain-specific destructor functions.
    
    Directly substituting std::unique_ptr into JPEG2KEncode and JPEG2KDecode was
    cumbersome because every such pointer declaration required a redundant
    template parameter describing the deleter function passed into its
    constructor. Moreover, it required lots of little syntax tweaks: changing
    every assignment to a reset() call, changing every reference to a get() call.
    
    Using owning_ptr<T> allows us to leave the code more or less as it was before,
    save that assignment and destruction automatically handle the previous
    referenced T instance.
    nat-goodspeed committed Sep 27, 2024
    Configuration menu
    Copy the full SHA
    1c78829 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    cf2f482 View commit details
    Browse the repository at this point in the history
  10. Merge pull request #2714 from secondlife/nat/xcode-16

    Clean up llpointer.h per previous discussions.
    nat-goodspeed committed Sep 27, 2024
    Configuration menu
    Copy the full SHA
    71e89d6 View commit details
    Browse the repository at this point in the history