SSBMTonberry / tileson

A modern and helpful cross-platform json-parser for C++, used for parsing Tiled maps.
BSD 2-Clause "Simplified" License
193 stars 30 forks source link

compiler warnings with Apple Clang 13.0.0 #83

Closed dmlary closed 1 year ago

dmlary commented 1 year ago

I'm working up fixes for these, but here's the list of compiler warnings with Apple Clang 13.0.0. I'd like to fix these as the code I'm including tileson into has warnings as errors during compilation.

Compiler info:

flecs-magnum> /usr/local/opt/ccache/libexec/c++ --version
Apple clang version 13.0.0 (clang-1300.0.29.30)
Target: x86_64-apple-darwin20.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

Warnings from head of master branch (6572decc519ff64a674e8445a7f82d3933e689a0).

/usr/local/opt/ccache/libexec/c++ -DGRAPHICS_API_OPENGL_33 -DPLATFORM_DESKTOP -DSPDLOG_COMPILED_LIB -I/Users/dmlary/src/flecs-magnum/build/_deps/spdlog-src/include -I/Users/dmlary/src/flecs-magnum/build/_deps/raylib-src/src -I/Users/dmlary/src/flecs-magnum/build/_deps/raylib-src/src/external/glfw/include -I/Users/dmlary/src/flecs-magnum/build/_deps/imgui-src -I/Users/dmlary/src/flecs-magnum/build/_deps/tileson-src -I/Users/dmlary/src/flecs-magnum/build/_deps/raylib-tileson-src/src/../include -I/Users/dmlary/src/flecs-magnum/build/_deps/flecs-src/include -g -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk -mmacosx-version-min=11.7 -Wall -Wextra -Werror -ffile-prefix-map=/Users/dmlary/src/flecs-magnum/= -std=gnu++20 -MD -MT src/CMakeFiles/game.dir/main.cpp.o -MF src/CMakeFiles/game.dir/main.cpp.o.d -o src/CMakeFiles/game.dir/main.cpp.o -c /Users/dmlary/src/flecs-magnum/src/main.cpp
In file included from /Users/dmlary/src/flecs-magnum/src/main.cpp:5:
/Users/dmlary/src/flecs-magnum/build/_deps/tileson-src/tileson.hpp:1309:68: error: unused parameter 'path' [-Werror,-Wunused-parameter]
    std::string Base64Decompressor::decompressFile(const fs::path &path)
                                                                   ^
/Users/dmlary/src/flecs-magnum/build/_deps/tileson-src/tileson.hpp:1319:60: error: unused parameter 'data' [-Werror,-Wunused-parameter]
    std::string Base64Decompressor::decompress(const void *data, size_t size)
                                                           ^
/Users/dmlary/src/flecs-magnum/build/_deps/tileson-src/tileson.hpp:1319:73: error: unused parameter 'size' [-Werror,-Wunused-parameter]
    std::string Base64Decompressor::decompress(const void *data, size_t size)
                                                                        ^
/Users/dmlary/src/flecs-magnum/build/_deps/tileson-src/tileson.hpp:3352:96: error: field 'm_value' will be initialized after field 'm_type' [-Werror,-Wreorder-ctor]
tson::Property::Property(std::string name, std::any value, Type type) : m_name { move(name) }, m_value { move(value) }, m_type {type}
                                                                                               ^
/Users/dmlary/src/flecs-magnum/build/_deps/tileson-src/tileson.hpp:4691:19: error: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'const int' [-Werror,-Wsign-compare]
            if (x == mapSize.x)
                ~ ^  ~~~~~~~~~
/Users/dmlary/src/flecs-magnum/build/_deps/tileson-src/tileson.hpp:6739:73: error: '/*' within block comment [-Werror,-Wcomment]
            //int                                    m_version{};       /*! 'version': The JSON format version - Removed in Tileson v1.3.0*/
                                                                        ^
/Users/dmlary/src/flecs-magnum/build/_deps/tileson-src/tileson.hpp:6870:85: error: unused parameter 'item' [-Werror,-Wunused-parameter]
        std::for_each(tilesets.begin(), tilesets.end(), [&](std::unique_ptr<IJson> &item)
                                                                                    ^
/Users/dmlary/src/flecs-magnum/build/_deps/tileson-src/tileson.hpp:8244:20: error: moving a temporary object prevents copy elision [-Werror,-Wpessimizing-move]
            return std::move(parseJson());
                   ^
/Users/dmlary/src/flecs-magnum/build/_deps/tileson-src/tileson.hpp:8244:20: note: remove std::move call here
            return std::move(parseJson());
                   ^~~~~~~~~~           ~
/Users/dmlary/src/flecs-magnum/build/_deps/tileson-src/tileson.hpp:8248:16: error: moving a temporary object prevents copy elision [-Werror,-Wpessimizing-move]
        return std::move(parseJson());
               ^
/Users/dmlary/src/flecs-magnum/build/_deps/tileson-src/tileson.hpp:8248:16: note: remove std::move call here
        return std::move(parseJson());
               ^~~~~~~~~~           ~
/Users/dmlary/src/flecs-magnum/build/_deps/tileson-src/tileson.hpp:8280:12: error: moving a temporary object prevents copy elision [-Werror,-Wpessimizing-move]
    return std::move(parseJson());
           ^
/Users/dmlary/src/flecs-magnum/build/_deps/tileson-src/tileson.hpp:8280:12: note: remove std::move call here
    return std::move(parseJson());
           ^~~~~~~~~~           ~
/Users/dmlary/src/flecs-magnum/build/_deps/tileson-src/tileson.hpp:8293:16: error: moving a local object in a return statement prevents copy elision [-Werror,-Wpessimizing-move]
        return std::move(map);
               ^
/Users/dmlary/src/flecs-magnum/build/_deps/tileson-src/tileson.hpp:8293:16: note: remove std::move call here
        return std::move(map);
               ^~~~~~~~~~   ~
/Users/dmlary/src/flecs-magnum/build/_deps/tileson-src/tileson.hpp:2812:19: error: private field 'm_endptr' is not used [-Werror,-Wunused-private-field]
            char *m_endptr;
                  ^
12 errors generated.