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

Warning about cen::basic_vector3’ is deprecated when compiling empty project #138

Open
MatthewScholefield opened this issue Nov 26, 2023 · 2 comments

Comments

@MatthewScholefield
Copy link

Hello! I get the following warnings when I compile a plain project using centurion:

In file included from /.../build/_deps/centurion-src/src/centurion/common.hpp:28,
                 from /.../build/_deps/centurion-src/src/centurion.hpp:33,
                 from /.../source/main.cpp:1:
/.../build/_deps/centurion-src/src/centurion/common/math.hpp:66:35: warning: ‘template<class T> struct cen::basic_vector3’ is deprecated [-Wdeprecated-declarations]
   66 |   [[nodiscard]] explicit operator basic_vector3<U>() const noexcept
      |                                   ^~~~~~~~~~~~~
/.../build/_deps/centurion-src/src/centurion/common/math.hpp:50:8: note: declared here
   50 | struct basic_vector3;
      |        ^~~~~~~~~~~~~
/.../build/_deps/centurion-src/src/centurion/common/math.hpp: In member function ‘cen::basic_vector3<T>::operator cen::basic_vector3<U>() const’:
/.../build/_deps/centurion-src/src/centurion/common/math.hpp:68:40: warning: ‘template<class T> struct cen::basic_vector3’ is deprecated [-Wdeprecated-declarations]
   68 |     using target_value_type = typename basic_vector3<U>::value_type;
      |                                        ^~~~~~~~~~~~~
/.../build/_deps/centurion-src/src/centurion/common/math.hpp:50:8: note: declared here
   50 | struct basic_vector3;
      |        ^~~~~~~~~~~~~
/.../build/_deps/centurion-src/src/centurion/common/math.hpp:69:12: warning: ‘template<class T> struct cen::basic_vector3’ is deprecated [-Wdeprecated-declarations]
   69 |     return basic_vector3<U> {static_cast<target_value_type>(x),
      |            ^~~~~~~~~~~~~
/.../build/_deps/centurion-src/src/centurion/common/math.hpp:50:8: note: declared here
   50 | struct basic_vector3;
      |        ^~~~~~~~~~~~~
/.../build/_deps/centurion-src/src/centurion/common/math.hpp: At global scope:
/.../build/_deps/centurion-src/src/centurion/common/math.hpp:76:49: warning: ‘template<class T> struct cen::basic_vector3’ is deprecated [-Wdeprecated-declarations]
   76 | [[deprecated]] void serialize(Archive& archive, basic_vector3<T>& vector)
      |                                                 ^~~~~~~~~~~~~
/.../build/_deps/centurion-src/src/centurion/common/math.hpp:50:8: note: declared here
   50 | struct basic_vector3;
      |        ^~~~~~~~~~~~~
/.../build/_deps/centurion-src/src/centurion/common/math.hpp:82:59: warning: ‘template<class T> struct cen::basic_vector3’ is deprecated [-Wdeprecated-declarations]
   82 | [[nodiscard, deprecated]] constexpr auto operator==(const basic_vector3<T>& a,
      |                                                           ^~~~~~~~~~~~~
/.../build/_deps/centurion-src/src/centurion/common/math.hpp:50:8: note: declared here
   50 | struct basic_vector3;
      |        ^~~~~~~~~~~~~
/.../build/_deps/centurion-src/src/centurion/common/math.hpp:83:59: warning: ‘template<class T> struct cen::basic_vector3’ is deprecated [-Wdeprecated-declarations]
   83 |                                                     const basic_vector3<T>& b) noexcept -> bool
      |                                                           ^~~~~~~~~~~~~
/.../build/_deps/centurion-src/src/centurion/common/math.hpp:50:8: note: declared here
   50 | struct basic_vector3;
      |        ^~~~~~~~~~~~~
/.../build/_deps/centurion-src/src/centurion/common/math.hpp:89:59: warning: ‘template<class T> struct cen::basic_vector3’ is deprecated [-Wdeprecated-declarations]
   89 | [[nodiscard, deprecated]] constexpr auto operator!=(const basic_vector3<T>& a,
      |                                                           ^~~~~~~~~~~~~
/.../build/_deps/centurion-src/src/centurion/common/math.hpp:50:8: note: declared here
   50 | struct basic_vector3;
      |        ^~~~~~~~~~~~~
/.../build/_deps/centurion-src/src/centurion/common/math.hpp:90:59: warning: ‘template<class T> struct cen::basic_vector3’ is deprecated [-Wdeprecated-declarations]
   90 |                                                     const basic_vector3<T>& b) noexcept -> bool
      |                                                           ^~~~~~~~~~~~~
/.../build/_deps/centurion-src/src/centurion/common/math.hpp:50:8: note: declared here
   50 | struct basic_vector3;
      |        ^~~~~~~~~~~~~
/.../build/_deps/centurion-src/src/centurion/common/math.hpp:96:48: warning: ‘template<class T> struct cen::basic_vector3’ is deprecated [-Wdeprecated-declarations]
   96 | [[nodiscard, deprecated]] auto to_string(const basic_vector3<T>& vector) -> std::string
      |                                                ^~~~~~~~~~~~~
/.../build/_deps/centurion-src/src/centurion/common/math.hpp:50:8: note: declared here
   50 | struct basic_vector3;
      |        ^~~~~~~~~~~~~
/.../build/_deps/centurion-src/src/centurion/common/math.hpp:107:60: warning: ‘template<class T> struct cen::basic_vector3’ is deprecated [-Wdeprecated-declarations]
  107 | [[deprecated]] auto operator<<(std::ostream& stream, const basic_vector3<T>& vector)
      |                                                            ^~~~~~~~~~~~~
/.../build/_deps/centurion-src/src/centurion/common/math.hpp:50:8: note: declared here
   50 | struct basic_vector3;
      |        ^~~~~~~~~~~~~

Compiler info:

$ /usr/bin/c++ --version
c++ (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Compilation command (from CMake):

/usr/bin/c++  -I/.../build/_deps/centurion-src/src -I/usr/include/SDL2 -std=gnu++17 -MD -MT CMakeFiles/myproject.dir/source/main.cpp.o -MF CMakeFiles/myproject.dir/source/main.cpp.o.d -o CMakeFiles/myproject.dir/source/main.cpp.o -c /.../source/main.cpp

CMakeLists.txt:

cmake_minimum_required(VERSION 3.14)

project(myproject)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)

include(FetchContent)
FetchContent_Declare(
  centurion
  GIT_REPOSITORY https://github.com/albin-johansson/centurion.git
  GIT_TAG        v7.3.0
)
FetchContent_MakeAvailable(centurion)
find_package(SDL2 REQUIRED)
include_directories(${centurion_SOURCE_DIR}/src ${SDL2_INCLUDE_DIRS})

add_executable(myproject source/main.cpp)
target_link_libraries(myproject ${SDL2_LIBRARIES})
@albin-johansson
Copy link
Owner

Hi, this is the expected behavior. The deprecated type is simply used in some APIs.

@MatthewScholefield
Copy link
Author

👍

Would you be open to using:

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
...
#pragma GCC diagnostic pop

around the uses of basic_vector3 in math.hpp? I tested placing it between lines 64 and 112 and as long as the ivec3 / fvec3 / basic_vector3 definitions are outside the #pragma, the deprecation warning still occurs when the struct is referenced, but it suppresses the deprecation that occurs on import.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants