stdstring.h icon indicating copy to clipboard operation
stdstring.h copied to clipboard

Warnings and Errors

Open pbtrung opened this issue 7 years ago • 0 comments

#define STDSTRING_IMPLEMENTATION
#include "stdstring.h"

int main(int argc, char *argv[]) {
}

Full log:

gcc main.c -I./ -O3 -lm -Wall -Wextra

In file included from main.c:2:0:                                                                                                                                                                      
stdstring.h:261:5: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]                                                                                                     
 ABI const char * const strapi() {                                                                                                                                                                     
     ^~~~~                                                                                                                                                                                             
In file included from main.c:2:0:                                                                                                                                                                      
stdstring.h: In function ‘strvsprintfcb’:                                                                                                                                                              
stdstring.h:948:52: warning: signed and unsigned type in conditional expression [-Wsign-compare]                                                                                                       
             pr = -dp + ((pr > (stbsp__int32)l) ? l : pr);                                                                                                                                             
                                                    ^                                                                                                                                                  
stdstring.h: In function ‘stbsp__count_clamp_callback’:                                                                                                                                                
stdstring.h:1622:51: warning: unused parameter ‘buf’ [-Wunused-parameter]                                                                                                                              
 static char * stbsp__count_clamp_callback( char * buf, void * user, int len )                                                                                                                         
                                                   ^~~                                                                                                                                                 
In file included from main.c:2:0:                                                                                                                                                                      
stdstring.h: In function ‘strhuman’:                                                                                                                                                                   
stdstring.h:2806:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]                                                                                              
     while( (i > base) && *prefixp++ ) {                                                                                                                                                               
               ^                                                                                                                                                                                       
In file included from main.c:2:0:                                                                                                                                                                      
stdstring.h: In function ‘strchop’:                                                                                                                                                                    
stdstring.h:3058:16: warning: operation on ‘tokens’ may be undefined [-Wsequence-point]                                                                                                                
         *tokens++ = (*tokens++ = (const char *)(uintptr_t)n) ? string : "";                                                                                                                           
          ~~~~~~^~                                                                                                                                                                                     
stdstring.h: In function ‘stropt’:                                                                                                                                                                     
stdstring.h:3121:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]                                                                                              
                 if( strlen(kv) >= size && !memcmp( kv, token, size ) ) {                                                                                                                              
                                ^~                                                                                                                                                                     
stdstring.h: In function ‘strnorm’:                                                                                                                                                                    
stdstring.h:3275:20: warning: passing argument 2 of ‘strjoin’ from incompatible pointer type [-Wincompatible-pointer-types]                                                                            
     strjoin(&with, words, "_");                                                                                                                                                                       
                    ^~~~~                                                                                                                                                                              
stdstring.h:3074:12: note: expected ‘const char **’ but argument is of type ‘char **’                                                                                                                  
 HEAP char* strjoin( char **string, const char *words[], const char *separator ) {                                                                                                                     
            ^~~~~~~                                                                                                                                                                                    
main.c: In function ‘main’:                                                                                                                                                                            
main.c:4:14: warning: unused parameter ‘argc’ [-Wunused-parameter]                                                                                                                                     
 int main(int argc, char *argv[]) {                                                                                                                                                                    
              ^~~~                                                                                                                                                                                     
main.c:4:26: warning: unused parameter ‘argv’ [-Wunused-parameter]                                                                                                                                     
 int main(int argc, char *argv[]) {
                          ^~~~
In file included from main.c:2:0:
stdstring.h: In function ‘strvsprintfcb’:
stdstring.h:1207:13: warning: this statement may fall through [-Wimplicit-fallthrough=]
          fl &= ~STBSP__LEADINGZERO; // 'p' only prints the pointer with zeros
             ^
stdstring.h:1210:7: note: here
       case 'X': // upper hex

In file included from main.c:2:0:
stdstring.h: In function ‘streval’:
stdstring.h:225:27: warning: ignoring return value of ‘realloc’, declared with attribute warn_unused_result [-Wunused-result]
    #define REALLOC(p, sz) realloc((p), (sz))
                           ^~~~~~~~~~~~~~~~~~
stdstring.h:228:27: note: in expansion of macro ‘REALLOC’
    #define FREE(p)        REALLOC(p, 0)
                           ^~~~~~~
stdstring.h:2213:9: note: in expansion of macro ‘FREE’
         FREE(ev.st);
         ^~~~
stdstring.h:225:27: warning: ignoring return value of ‘realloc’, declared with attribute warn_unused_result [-Wunused-result]
    #define REALLOC(p, sz) realloc((p), (sz))
                           ^~~~~~~~~~~~~~~~~~
stdstring.h:228:27: note: in expansion of macro ‘REALLOC’
    #define FREE(p)        REALLOC(p, 0)
                           ^~~~~~~
stdstring.h:2234:5: note: in expansion of macro ‘FREE’
     FREE(ev.st);
     ^~~~
stdstring.h: In function ‘strrepl’:
stdstring.h:225:27: warning: ignoring return value of ‘realloc’, declared with attribute warn_unused_result [-Wunused-result]
    #define REALLOC(p, sz) realloc((p), (sz))
                           ^~~~~~~~~~~~~~~~~~
stdstring.h:228:27: note: in expansion of macro ‘REALLOC’
    #define FREE(p)        REALLOC(p, 0)
                           ^~~~~~~
stdstring.h:3025:9: note: in expansion of macro ‘FREE’
         FREE( buf );
         ^~~~
stdstring.h: In function ‘strnorm’:
stdstring.h:225:27: warning: ignoring return value of ‘realloc’, declared with attribute warn_unused_result [-Wunused-result]
    #define REALLOC(p, sz) realloc((p), (sz))
                           ^~~~~~~~~~~~~~~~~~
stdstring.h:228:27: note: in expansion of macro ‘REALLOC’
    #define FREE(p)        REALLOC(p, 0)
                           ^~~~~~~
stdstring.h:3257:5: note: in expansion of macro ‘FREE’
     FREE( tokens );
     ^~~~
stdstring.h:225:27: warning: ignoring return value of ‘realloc’, declared with attribute warn_unused_result [-Wunused-result]
    #define REALLOC(p, sz) realloc((p), (sz))
                           ^~~~~~~~~~~~~~~~~~
stdstring.h:228:27: note: in expansion of macro ‘REALLOC’
    #define FREE(p)        REALLOC(p, 0)
                           ^~~~~~~
stdstring.h:3276:5: note: in expansion of macro ‘FREE’
     FREE(words);

In file included from main.c:2:0:
stdstring.h: In function ‘strutf8’:
stdstring.h:3566:49: warning: this statement may fall through [-Wimplicit-fallthrough=]
         case 6: utf[5] = 0x80 | (cp & 0x3f); cp = (cp >> 6) | 0x4000000;
                                              ~~~^~~~~~~~~~~~~~~~~~~~~~~
stdstring.h:3567:9: note: here
         case 5: utf[4] = 0x80 | (cp & 0x3f); cp = (cp >> 6) | 0x200000;
         ^~~~
stdstring.h:3567:49: warning: this statement may fall through [-Wimplicit-fallthrough=]
         case 5: utf[4] = 0x80 | (cp & 0x3f); cp = (cp >> 6) | 0x200000;
                                              ~~~^~~~~~~~~~~~~~~~~~~~~~
stdstring.h:3568:9: note: here
         case 4: utf[3] = 0x80 | (cp & 0x3f); cp = (cp >> 6) | 0x10000;
         ^~~~
stdstring.h:3568:49: warning: this statement may fall through [-Wimplicit-fallthrough=]
         case 4: utf[3] = 0x80 | (cp & 0x3f); cp = (cp >> 6) | 0x10000;
                                              ~~~^~~~~~~~~~~~~~~~~~~~~
stdstring.h:3569:9: note: here
         case 3: utf[2] = 0x80 | (cp & 0x3f); cp = (cp >> 6) | 0x800;
         ^~~~
stdstring.h:3569:49: warning: this statement may fall through [-Wimplicit-fallthrough=]
         case 3: utf[2] = 0x80 | (cp & 0x3f); cp = (cp >> 6) | 0x800;
                                              ~~~^~~~~~~~~~~~~~~~~~~
stdstring.h:3570:9: note: here
         case 2: utf[1] = 0x80 | (cp & 0x3f); cp = (cp >> 6) | 0xc0;
         ^~~~
stdstring.h:3570:49: warning: this statement may fall through [-Wimplicit-fallthrough=]
         case 2: utf[1] = 0x80 | (cp & 0x3f); cp = (cp >> 6) | 0xc0;
                                              ~~~^~~~~~~~~~~~~~~~~~
stdstring.h:3571:9: note: here
         case 1: utf[0] = cp; default:;
         ^~~~
/tmp/ccFm0RHF.o: In function `stropt':
main.c:(.text+0xb13c): undefined reference to `__argc'
main.c:(.text+0xb143): undefined reference to `__argv'
collect2: error: ld returned 1 exit status

gcc 7.3.0 on Arch Linux x86_64

pbtrung avatar Mar 02 '18 20:03 pbtrung