Loading ...
Sorry, an error occurred while loading the content.

[patch] fixed clang compilation warnings

Expand Messages
  • Dominique PellĂ©
    Hi Attached patch fixes the following warnings given by the clang compiler: clang -g -O3 -Wall -Wextra -Wmissing-prototypes -Wunreachable-code
    Message 1 of 2 , Jun 19, 2013
    • 0 Attachment
      Hi

      Attached patch fixes the following warnings given
      by the clang compiler:

      clang -g -O3 -Wall -Wextra -Wmissing-prototypes -Wunreachable-code
      -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DUNIX -o xxd xxd.c
      xxd.c:725:30: warning: adding 'int' to a string does not append to the
      string [-Wstring-plus-int]
      (p % cols) ? ", " : ",\n "+2*!p, c) < 0)
      ~~~~~~~^~~~~
      xxd.c:725:30: note: use array indexing to silence this warning
      (p % cols) ? ", " : ",\n "+2*!p, c) < 0)
      ^
      & [ ]
      xxd.c:734:24: warning: adding 'int' to a string does not append to the
      string [-Wstring-plus-int]
      if (fputs("};\n" + 3 * (fp == stdin), fpo) == EOF)
      ~~~~~~~^~~~~~~~~~~~~~~~~~~
      xxd.c:734:24: note: use array indexing to silence this warning
      if (fputs("};\n" + 3 * (fp == stdin), fpo) == EOF)
      ^
      & [ ]


      clang also gives this warning:

      ./regexp_nfa.c:2814:13: warning: will never be executed [-Wunreachable-code]
      return -1;
      ^

      I did not fix it because removing the return statement
      may give a warning on other compilers.


      clang also warns about this:

      ex_eval.c:1716:50: warning: will never be executed [-Wunreachable-code]
      pending |= (THROW_ON_ERROR) ? CSTP_THROW : 0;
      ^
      I did not fix it either. It's nitpicky.

      Regards
      Dominique

      --
      --
      You received this message from the "vim_dev" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php

      ---
      You received this message because you are subscribed to the Google Groups "vim_dev" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • Bram Moolenaar
      ... Thanks, I ll include this patch. ... Indeed. I can change the for into a while . Checking for state not to be NULL is somewhat meaningfull. It
      Message 2 of 2 , Jun 21, 2013
      • 0 Attachment
        Dominique Pelle wrote:

        > Attached patch fixes the following warnings given
        > by the clang compiler:
        >
        > clang -g -O3 -Wall -Wextra -Wmissing-prototypes -Wunreachable-code
        > -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DUNIX -o xxd xxd.c
        > xxd.c:725:30: warning: adding 'int' to a string does not append to the
        > string [-Wstring-plus-int]
        > (p % cols) ? ", " : ",\n "+2*!p, c) < 0)
        > ~~~~~~~^~~~~
        > xxd.c:725:30: note: use array indexing to silence this warning
        > (p % cols) ? ", " : ",\n "+2*!p, c) < 0)
        > ^
        > & [ ]
        > xxd.c:734:24: warning: adding 'int' to a string does not append to the
        > string [-Wstring-plus-int]
        > if (fputs("};\n" + 3 * (fp == stdin), fpo) == EOF)
        > ~~~~~~~^~~~~~~~~~~~~~~~~~~
        > xxd.c:734:24: note: use array indexing to silence this warning
        > if (fputs("};\n" + 3 * (fp == stdin), fpo) == EOF)
        > ^
        > & [ ]

        Thanks, I'll include this patch.

        > clang also gives this warning:
        >
        > ./regexp_nfa.c:2814:13: warning: will never be executed [-Wunreachable-code]
        > return -1;
        > ^
        >
        > I did not fix it because removing the return statement
        > may give a warning on other compilers.

        Indeed. I can change the "for" into a "while". Checking for "state"
        not to be NULL is somewhat meaningfull. It should never happen, but
        it's good not to crash when it does happen.

        > clang also warns about this:
        >
        > ex_eval.c:1716:50: warning: will never be executed [-Wunreachable-code]
        > pending |= (THROW_ON_ERROR) ? CSTP_THROW : 0;
        > ^
        > I did not fix it either. It's nitpicky.

        Would have to be some ugly #ifdef. Is it possible to suppress the warning?

        --
        XML is a nice language for computers. Not for humans.

        /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
        /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
        \\\ an exciting new programming language -- http://www.Zimbu.org ///
        \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

        --
        --
        You received this message from the "vim_dev" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php

        ---
        You received this message because you are subscribed to the Google Groups "vim_dev" group.
        To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
        For more options, visit https://groups.google.com/groups/opt_out.
      Your message has been successfully submitted and would be delivered to recipients shortly.