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

Ignore GCC warning about uninitialized variables. #67

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

slackner
Copy link

@slackner slackner commented Dec 8, 2022

@DuffsDevice First of all, really cool project! It just makes it so much easier to deal with UTF-8 data.

When compiling my code with tinyutf8 with gcc, I got the following error:

      In file included from ...:
      .../third-party/tiny-utf8/include/tinyutf8/tinyutf8.h: In member function 'tiny_utf8::basic_string<V, D, A> tiny_utf8::basic_string<ValueType, DataType, Allocator>::raw_substr(tiny_utf8::basic_string<ValueType, DataType, Allocator>::size_type, tiny_utf8::basic_string<ValueType, DataType, Allocator>::size_type) const [with ValueType = char32_t; DataType = char; Allocator = std::allocator<char>]':
      .../third-party/tiny-utf8/include/tinyutf8/tinyutf8.h:860:4: error: 'lut_width' may be used uninitialized in this function [-Werror=maybe-uninitialized]
        860 |    switch( lut_width ){
            |    ^~~~~~
      .../third-party/tiny-utf8/include/tinyutf8/tinyutf8.h:3643:16: note: 'lut_width' was declared here
       3643 |   width_type   lut_width; // Ignore uninitialized warning, see [5]
            |                ^~~~~~~~~
      cc1plus: all warnings being treated as errors

The GCC version I'm using is:

gcc --version
gcc (Debian 10.2.1-6) 10.2.1 20210110
Copyright (C) 2020 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.

After reviewing the code in question I think the warning is incorrect, so this merge request disables it.
What do you think?

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

Successfully merging this pull request may close these issues.

1 participant