clang reports warnings on c2str.c

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

clang reports warnings on c2str.c

Christian Jullien-3

Hi Grischka,

 

Clang reports the following warnings with your new c2str.c source file (found with RPi4 arm and other platforms using clang):

 

clang -o c2str.exe tests/misc/c2str.c && ./c2str.exe include/tccdefs.h tccdefs_.h

tests/misc/c2str.c:58:19: warning: passing 'unsigned char *' to parameter of

      type 'char *' converts between pointers to integer types with different

      sign [-Wpointer-sign]

        if (fgets(p, sizeof l - (p - l), fp)) {

                  ^

/usr/include/stdio.h:570:38: note: passing argument to parameter '__s' here

extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream)

                                     ^

tests/misc/c2str.c:59:24: warning: passing 'unsigned char *' to parameter of

      type 'const char *' converts between pointers to integer types with

      different sign [-Wpointer-sign]

            p = strchr(p, 0);

                       ^

/usr/include/string.h:225:34: note: passing argument to parameter '__s' here

extern char *strchr (const char *__s, int __c)

                                 ^

tests/misc/c2str.c:59:15: warning: assigning to 'unsigned char *' from 'char *'

      converts between pointers to integer types with different sign

      [-Wpointer-sign]

            p = strchr(p, 0);

              ^ ~~~~~~~~~~~~

tests/misc/c2str.c:87:68: warning: data argument not used by format string

      [-Wformat-extra-args]

                fprintf(op, " (converted, do not edit this file)", l);

                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ^

tests/misc/c2str.c:92:28: warning: passing 'unsigned char [1000]' to parameter

      of type 'const char *' converts between pointers to integer types with

      different sign [-Wpointer-sign]

                p = strchr(l, 0);

                           ^

/usr/include/string.h:225:34: note: passing argument to parameter '__s' here

extern char *strchr (const char *__s, int __c)

                                 ^

tests/misc/c2str.c:92:19: warning: assigning to 'unsigned char *' from 'char *'

      converts between pointers to integer types with different sign

      [-Wpointer-sign]

                p = strchr(l, 0);

                  ^ ~~~~~~~~~~~~

tests/misc/c2str.c:110:43: warning: passing 'unsigned char *' to parameter of

      type 'char *' converts between pointers to integer types with different

      sign [-Wpointer-sign]

                        q = strchr(strcpy(q, platform_macros[f + 1]), 0);

                                          ^

/usr/include/string.h:121:39: note: passing argument to parameter '__dest' here

extern char *strcpy (char *__restrict __dest, const char *__restrict __src)

                                      ^

tests/misc/c2str.c:110:27: warning: assigning to 'unsigned char *' from 'char *'

      converts between pointers to integer types with different sign

      [-Wpointer-sign]

                        q = strchr(strcpy(q, platform_macros[f + 1]), 0);

                          ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

8 warnings generated.


_______________________________________________
Tinycc-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel