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

WIP: Fixing the compiler warnings for GCC 11 #647

Closed
wants to merge 2 commits into from

Conversation

planetmaker
Copy link

This PR is supposed to be amended by further commits targeting further warnings as by issue #646

Fix: [linux] Silence warnings about deprecated use of std::auto_ptr. Use std::unique_ptr for GCC > 4.4

@kaetemi
Copy link
Member

kaetemi commented Sep 19, 2021

Any reason why NL_ISO_CPP0X_AVAILABLE didn't get defined?
This should be caught earlier by #elif defined(NL_ISO_CPP0X_AVAILABLE)

@kaetemi
Copy link
Member

kaetemi commented Sep 19, 2021

#if defined(_HAS_CPP0X) || defined(__GXX_EXPERIMENTAL_CXX0X__) || (defined(NL_COMP_VC_VERSION) && NL_COMP_VC_VERSION >= 110)
#	define NL_ISO_CPP0X_AVAILABLE
#endif

@kaetemi
Copy link
Member

kaetemi commented Sep 19, 2021

Maybe that CPP0X check needs || (defined(__GNUC__) && (GCC_VERSION >= 40400) && (__cplusplus >= 201103L)) added.

@planetmaker
Copy link
Author

Additional comment: The commit with change from auto_ptr to unique_ptr needs further amendment or an additional commit: the test suite uses auto_ptr and it is not a simple replace task there.

@planetmaker
Copy link
Author

The problem for auto_ptr replacement is the test suite library, cpptest which seems to still be stuck with auto_ptr:

In Datei, eingebunden von /home/planetmaker/ryzom/dev/ryzomcore/nel/tools/nel_unit_test/nel_unit_test.cpp:30:
/home/planetmaker/ryzom/dev/ryzomcore/nel/tools/nel_unit_test/ut_misc.h: In Konstruktor »CUTMisc::CUTMisc()«:
/home/planetmaker/ryzom/dev/ryzomcore/nel/tools/nel_unit_test/ut_misc.h:41:26: Warnung: »template<class> class std::auto_ptr« ist veraltet: use 'std::unique_ptr' instead [-Wdeprecated-declarations]
   41 |                 add(std::auto_ptr<Test::Suite>(new CUTMiscCoTask));
      |                          ^~~~~~~~
In Datei, eingebunden von /usr/include/c++/11/memory:76,
                 von /usr/include/cpptest-suite.h:33,
                 von /usr/include/cpptest.h:34,
                 von /home/planetmaker/ryzom/dev/ryzomcore/nel/tools/nel_unit_test/nel_unit_test.cpp:20:
/usr/include/c++/11/bits/unique_ptr.h:57:28: Anmerkung: hier deklariert
   57 |   template<typename> class auto_ptr;
      |             

And this becomes an error when I replace all occurances of auto_ptr in ryzom's source with unique_ptr as cpptest uses auto_ptr:

In Datei, eingebunden von /usr/include/cpptest.h:34,
                 von /home/planetmaker/ryzom/dev/ryzomcore/nel/tools/nel_unit_test/nel_unit_test.cpp:20:
/usr/include/cpptest-suite.h:58:47: Anmerkung:   Argument 1 von »void Test::Suite::add(std::auto_ptr<Test::Suite>)« wird initialisiert
   58 |                 void add(std::auto_ptr<Suite> suite);
      |                          ~~~~~~~~~~~~~~~~~~~~~^~~~~
In Datei, eingebunden von /home/planetmaker/ryzom/dev/ryzomcore/nel/tools/nel_unit_test/nel_unit_test.cpp:30:
/home/planetmaker/ryzom/dev/ryzomcore/nel/tools/nel_unit_test/ut_misc.h:46:26: Fehler: »std::unique_ptr<Test::Suite>« kann nicht nach »std::auto_ptr<Test::Suite>« umgewandelt werden
   46 |                 add(std::unique_ptr<Test::Suite>(new CUTMiscDynLibLoad));
      |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                          |
      |                          std::unique_ptr<Test::Suite>

Quelle : cpptest-1.1.2-18.fc34.src.rpm

Not sure how to solve this issue. Ultimately it looks to me like cpptest is somewhat unmaintained and should be replaced by something else (that'd be outside of the scope of this patch). Alternatively I can - for now - insert pragmas into the unit test files which silences this GCC warning about auto_ptr usage during their compilation. Thoughts?

@kaetemi
Copy link
Member

kaetemi commented Sep 20, 2021 via email

@planetmaker
Copy link
Author

planetmaker commented Sep 20, 2021

can we drop support for GCC 4.x or GCC < 4.8.1? Then we will have complete C++11 support without tedious checks. GCC 4.8.1 was released in 2014, thus 7 years ago.

planetmaker added 2 commits September 20, 2021 16:21
…_ptr. The cpptest library seems stuck in old code and there is no easy way to change this other than replacing cpptest with something not using deprecated code
@kaetemi
Copy link
Member

kaetemi commented Sep 29, 2021

can we drop support for GCC 4.x or GCC < 4.8.1? Then we will have complete C++11 support without tedious checks. GCC 4.8.1 was released in 2014, thus 7 years ago.

Still need VS2008 support until we confirm the plugins work correctly on the latest 3ds Max.

@kaetemi
Copy link
Member

kaetemi commented Nov 19, 2021

Can you reapply this on the latest core4 branch? The auto_ptr should already be fixed now.

@planetmaker
Copy link
Author

Yes, I will. This issue is not forgotten :)

@kaetemi
Copy link
Member

kaetemi commented Jun 6, 2022

I'll close this since it no longer applies to the current version.

@kaetemi kaetemi closed this Jun 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants