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

C++ Deprecation Warnings #94

Closed
TurtleP opened this issue Nov 15, 2022 · 12 comments
Closed

C++ Deprecation Warnings #94

TurtleP opened this issue Nov 15, 2022 · 12 comments

Comments

@TurtleP
Copy link

TurtleP commented Nov 15, 2022

Hey,

I'm working on a project using this, but I use C++20. I'm getting the following warning:

In file included from c:\msys64\opt\devkitpro\devkitarm\arm-none-eabi\include\c++\12.2.0\bits\stl_construct.h:61,
                 from c:\msys64\opt\devkitpro\devkitarm\arm-none-eabi\include\c++\12.2.0\bits\char_traits.h:46,
                 from c:\msys64\opt\devkitpro\devkitarm\arm-none-eabi\include\c++\12.2.0\string:40,
                 from c:\msys64\opt\devkitpro\devkitarm\arm-none-eabi\include\c++\12.2.0\bitset:47,
                 from G:/GitHub/Homebrew/lovepotion/include/common/type.hpp:3,
                 from G:/GitHub/Homebrew/lovepotion/include/common/luax.hpp:3,
                 from G:/GitHub/Homebrew/lovepotion/include/objects/font/wrap_font.hpp:3:
c:\msys64\opt\devkitpro\devkitarm\arm-none-eabi\include\c++\12.2.0\bits\stl_iterator_base_types.h:127:34: note: declared here
  127 |     struct _GLIBCXX17_DEPRECATED iterator
      |                                  ^~~~~~~~
In file included from G:/GitHub/Homebrew/lovepotion/libraries/utf8/utf8.h:32:
G:/GitHub/Homebrew/lovepotion/libraries/utf8/utf8/unchecked.h:179:40: warning: 'template<class _Category, class _Tp, class _Distance, class _Pointer, class _Reference> stru
ct std::iterator' is deprecated [-Wdeprecated-declarations]
  179 |           class iterator : public std::iterator <std::bidirectional_iterator_tag, uint32_t> {
      |                                        ^~~~~~~~
c:\msys64\opt\devkitpro\devkitarm\arm-none-eabi\include\c++\12.2.0\bits\stl_iterator_base_types.h:127:34: note: declared here
  127 |     struct _GLIBCXX17_DEPRECATED iterator
      |                                  ^~~~~~~~

If there's something I can do about fixing this, let me know, unless the library needs to be updated to work with C++20.

@Finkman
Copy link
Contributor

Finkman commented Nov 22, 2022

I guess it is fixed since 2b1521b.
You should try latest release version

@TurtleP
Copy link
Author

TurtleP commented Nov 24, 2022

Yeah, I am using the latest release version, 3.2.2. Although I'm not home at the moment to work on my code, so I can't double check right now if maybe it was some random cache issue because of CMake (I forgot to push the latest changes before leaving for the holiday, heh). I'll be back on Friday/Saturday and get back to you.

@TurtleP
Copy link
Author

TurtleP commented Dec 13, 2022

Sorry for the late reply. I double checked with a clean build and everything. It still produces the warning. It's not exactly a big deal, but it is annoying it keeps popping up.

@nemtrif
Copy link
Owner

nemtrif commented Dec 18, 2022

You definitely don't have the latest version. unchecked.h:179 that causes the problem in your code looks like:
class iterator : public std::iterator <std::bidirectional_iterator_tag, uint32_t> {
That code does not exist anymore. Here is that line in the current version: https://github.com/nemtrif/utfcpp/blob/master/source/utf8/unchecked.h#L179

And here is the current declaration of the iterator type:
https://github.com/nemtrif/utfcpp/blob/master/source/utf8/unchecked.h#L218

@TurtleP
Copy link
Author

TurtleP commented Dec 19, 2022

I mean, I downloaded the latest release and replaced the files. You can confirm that here. I have no idea what I can tell you otherwise.

@Finkman
Copy link
Contributor

Finkman commented Dec 19, 2022

So, you mixed up your on cocktail of the lib? In that case, the issue should be moved to the cocktail. It is definitely fixed here.

@TurtleP
Copy link
Author

TurtleP commented Dec 19, 2022

I'm not sure what you mean, honestly. I didn't modify the source code from the downloaded release.

@nemtrif
Copy link
Owner

nemtrif commented Dec 22, 2022

I just looked at https://github.com/nemtrif/utfcpp/archive/refs/tags/v3.2.2.zip and it is fine. What download exactly do you use?

@TurtleP
Copy link
Author

TurtleP commented Dec 23, 2022

I have downloaded that exact same zip file.

@nemtrif
Copy link
Owner

nemtrif commented Dec 23, 2022

Can you extract that file into a new directory, open file unchecked.h and look for the line that causes the warning:

class iterator : public std::iterator <std::bidirectional_iterator_tag, uint32_t> {

@TurtleP
Copy link
Author

TurtleP commented Dec 23, 2022

this is the class within unchecked.h:

        // The iterator class
        template <typename octet_iterator>
          class iterator : public std::iterator <std::bidirectional_iterator_tag, uint32_t> { 
            octet_iterator it;
            public:
            iterator () {}
            explicit iterator (const octet_iterator& octet_it): it(octet_it) {}
            // the default "big three" are OK
            octet_iterator base () const { return it; }
            uint32_t operator * () const
            {
                octet_iterator temp = it;
                return utf8::unchecked::next(temp);
            }
            bool operator == (const iterator& rhs) const 
            { 
                return (it == rhs.it);
            }
            bool operator != (const iterator& rhs) const
            {
                return !(operator == (rhs));
            }
            iterator& operator ++ () 
            {
                ::std::advance(it, utf8::internal::sequence_length(it));
                return *this;
            }
            iterator operator ++ (int)
            {
                iterator temp = *this;
                ::std::advance(it, utf8::internal::sequence_length(it));
                return temp;
            }  
            iterator& operator -- ()
            {
                utf8::unchecked::prior(it);
                return *this;
            }
            iterator operator -- (int)
            {
                iterator temp = *this;
                utf8::unchecked::prior(it);
                return temp;
            }
          }; // class iterator

and the #define version is UTF8_FOR_CPP_UNCHECKED_H_2675DCD0_9480_4c0c_B92A_CC14C027B731

@nemtrif
Copy link
Owner

nemtrif commented Dec 23, 2022

Long story short you have an old version of the code. I just looked at your repository and it is obvious. You don't even have all the files from recent releases: compare: https://github.com/lovebrew/lovepotion/tree/dev/3.0/libraries/utf8/utf8 to https://github.com/nemtrif/utfcpp/tree/master/source/utf8.

Or compare https://github.com/nemtrif/utfcpp/blob/master/source/utf8/core.h to https://github.com/lovebrew/lovepotion/blob/dev/3.0/libraries/utf8/utf8/core.h

You are obviously missing this part:

`// Determine the C++ standard version.
// If the user defines UTF_CPP_CPLUSPLUS, use that.
// Otherwise, trust the unreliable predefined macro __cplusplus

#if !defined UTF_CPP_CPLUSPLUS
#define UTF_CPP_CPLUSPLUS __cplusplus
#endif

#if UTF_CPP_CPLUSPLUS >= 201103L // C++ 11 or later
#define UTF_CPP_OVERRIDE override
#define UTF_CPP_NOEXCEPT noexcept
#else // C++ 98/03
#define UTF_CPP_OVERRIDE
#define UTF_CPP_NOEXCEPT throw()
#endif // C++ 11 or later
`

@nemtrif nemtrif closed this as completed Dec 25, 2022
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

3 participants