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

Fix discarded-qualifiers Warning. #232

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

Conversation

MeinhardZhou
Copy link

  • unsupporeted_term should be const char*
  • linenoiseEditMore should be const char*, but linenoiseEditFeed() return char *, so add a local heap-allocate variable.

Warning:

../thirdparty/linenoise/linenoise.c:122:36: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
  122 | static char *unsupported_term[] = {"dumb","cons25","emacs",NULL};
      |                                    ^~~~~~
../thirdparty/linenoise/linenoise.c:122:43: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
  122 | static char *unsupported_term[] = {"dumb","cons25","emacs",NULL};
      |                                           ^~~~~~~~
../thirdparty/linenoise/linenoise.c:122:52: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
  122 |  char *unsupported_term[] = {"dumb","cons25","emacs",NULL};
      |                                              ^~~~~~~

../thirdparty/linenoise/linenoise.c:908:27: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
  908 | char *linenoiseEditMore = "If you see this, you are misusing the API: when linenoiseEditFeed() is called, if it returns linenoiseEditMore the user is yet editing the line. See the README file for more information.";
      |                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

1. unsupporeted_term should be const char*
2. linenoiseEditMore should be const char*, but linenoiseEditFeed()
   return char *, so add a local heap-allocate variable.

Signed-off-by: Meinhard Zhou <[email protected]>
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