EdouardBERGE / rasm

RASM powerful Z80 assembler
132 stars 16 forks source link

Some clang warnings #4

Closed polluks closed 3 years ago

polluks commented 4 years ago
In file included from rasm.c:96:
./apultra.h:1201:19: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
      if (nResult < 0) return -1;
          ~~~~~~~ ^ ~
./apultra.h:1216:22: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
         if (nResult < 0) return -1;
             ~~~~~~~ ^ ~
./apultra.h:1246:25: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
            if (nResult < 0) return -1;
                ~~~~~~~ ^ ~
./apultra.h:1271:28: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
               if (nResult < 0) return -1;
                   ~~~~~~~ ^ ~
./apultra.h:1275:28: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
               if (nResult < 0) return -1;
                   ~~~~~~~ ^ ~
./apultra.h:1279:28: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
               if (nResult < 0) return -1;
                   ~~~~~~~ ^ ~
./apultra.h:1283:28: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
               if (nResult < 0) return -1;
                   ~~~~~~~ ^ ~
./apultra.h:1325:19: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
      if (nResult < 0) return -1;
          ~~~~~~~ ^ ~
./apultra.h:1339:22: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
         if (nResult < 0) return -1;
             ~~~~~~~ ^ ~
./apultra.h:1406:25: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
            if (nResult < 0) return -1;
                ~~~~~~~ ^ ~
./apultra.h:1452:28: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
               if (nResult < 0) return -1;
                   ~~~~~~~ ^ ~
./apultra.h:1456:28: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
               if (nResult < 0) return -1;
                   ~~~~~~~ ^ ~
./apultra.h:1460:28: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
               if (nResult < 0) return -1;
                   ~~~~~~~ ^ ~
./apultra.h:1464:28: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
               if (nResult < 0) return -1;
                   ~~~~~~~ ^ ~
rasm.c:2738:10: warning: passing 'unsigned char *' to parameter of type 'char *' converts between pointers to integer types with different sign
      [-Wpointer-sign]
        strncpy(&HobetaHeader[0],trdos_name,8);
                ^~~~~~~~~~~~~~~~
/gg/include/string.h:65:29: note: passing argument to parameter here
char    *strncpy __P((char *, const char *, size_t));
                            ^
rasm.c:13238:14: warning: passing 'unsigned char [4]' to parameter of type 'const char *' converts between pointers to integer types with different sign
      [-Wpointer-sign]
        if (strncmp(wav_header->ChunkID,"RIFF",4)) {
                    ^~~~~~~~~~~~~~~~~~~
/gg/include/string.h:64:35: note: passing argument to parameter here
int      strncmp __P((const char *, const char *, size_t));
                                  ^
rasm.c:13239:15: warning: passing 'unsigned char [4]' to parameter of type 'const char *' converts between pointers to integer types with different sign
      [-Wpointer-sign]
                if (strncmp(wav_header->ChunkID,"RIFX",4)) {
                            ^~~~~~~~~~~~~~~~~~~
/gg/include/string.h:64:35: note: passing argument to parameter here
int      strncmp __P((const char *, const char *, size_t));
                                  ^
rasm.c:13246:14: warning: passing 'unsigned char [4]' to parameter of type 'const char *' converts between pointers to integer types with different sign
      [-Wpointer-sign]
        if (strncmp(wav_header->Format,"WAVE",4)) {
                    ^~~~~~~~~~~~~~~~~~
/gg/include/string.h:64:35: note: passing argument to parameter here
int      strncmp __P((const char *, const char *, size_t));
                                  ^
rasm.c:13255:14: warning: passing 'unsigned char [4]' to parameter of type 'const char *' converts between pointers to integer types with different sign
      [-Wpointer-sign]
        if (strncmp(wav_header->SubChunk1ID,"fmt",3)) {
                    ^~~~~~~~~~~~~~~~~~~~~~~
/gg/include/string.h:64:35: note: passing argument to parameter here
int      strncmp __P((const char *, const char *, size_t));
                                  ^
rasm.c:13264:17: warning: passing 'unsigned char *' to parameter of type 'const char *' converts between pointers to integer types with different sign
      [-Wpointer-sign]
        while (strncmp(subchunk,"data",4)) {
                       ^~~~~~~~
/gg/include/string.h:64:35: note: passing argument to parameter here
int      strncmp __P((const char *, const char *, size_t));
                                  ^
rasm.c:14477:32: warning: passing 'char [17]' to parameter of type 'const unsigned char *' converts between pointers to integer types with different sign
      [-Wpointer-sign]
        InitAutomate(ae->AutomateHexa,AutomateHexaDefinition);
                                      ^~~~~~~~~~~~~~~~~~~~~~
rasm.c:1138:32: note: expanded from macro 'AutomateHexaDefinition'
#define AutomateHexaDefinition "0123456789ABCDEF"
                               ^~~~~~~~~~~~~~~~~~
rasm.c:1682:55: note: passing argument to parameter 'def' here
void InitAutomate(char *autotab, const unsigned char *def)
                                                      ^
rasm.c:14478:33: warning: passing 'char [12]' to parameter of type 'const unsigned char *' converts between pointers to integer types with different sign
      [-Wpointer-sign]
        InitAutomate(ae->AutomateDigit,AutomateDigitDefinition);
                                       ^~~~~~~~~~~~~~~~~~~~~~~
rasm.c:1137:33: note: expanded from macro 'AutomateDigitDefinition'
#define AutomateDigitDefinition ".0123456789"
                                ^~~~~~~~~~~~~
rasm.c:1682:55: note: passing argument to parameter 'def' here
void InitAutomate(char *autotab, const unsigned char *def)
                                                      ^
rasm.c:14479:38: warning: passing 'char [42]' to parameter of type 'const unsigned char *' converts between pointers to integer types with different sign
      [-Wpointer-sign]
        InitAutomate(ae->AutomateValidLabel,AutomateValidLabelDefinition);
                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
rasm.c:1136:38: note: expanded from macro 'AutomateValidLabelDefinition'
#define AutomateValidLabelDefinition "0123456789.ABCDEFGHIJKLMNOPQRSTUVWXYZ_@{}"
                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
rasm.c:1682:55: note: passing argument to parameter 'def' here
void InitAutomate(char *autotab, const unsigned char *def)
                                                      ^
rasm.c:14480:43: warning: passing 'char [30]' to parameter of type 'const unsigned char *' converts between pointers to integer types with different sign
      [-Wpointer-sign]
        InitAutomate(ae->AutomateValidLabelFirst,AutomateValidLabelFirstDefinition);
                                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
rasm.c:1135:43: note: expanded from macro 'AutomateValidLabelFirstDefinition'
#define AutomateValidLabelFirstDefinition ".ABCDEFGHIJKLMNOPQRSTUVWXYZ_@"
                                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
rasm.c:1682:55: note: passing argument to parameter 'def' here
void InitAutomate(char *autotab, const unsigned char *def)
                                                      ^
rasm.c:14481:55: warning: passing 'char [57]' to parameter of type 'const unsigned char *' converts between pointers to integer types with different sign
      [-Wpointer-sign]
        InitAutomate(ae->AutomateExpressionValidCharExtended,AutomateExpressionValidCharExtendedDefinition);
                                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
rasm.c:1132:55: note: expanded from macro 'AutomateExpressionValidCharExtendedDefinition'
#define AutomateExpressionValidCharExtendedDefinition "0123456789.ABCDEFGHIJKLMNOPQRSTUVWXYZ_{}@+-*/~^$#%<A7><=>|&"
                                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
rasm.c:1682:55: note: passing argument to parameter 'def' here
void InitAutomate(char *autotab, const unsigned char *def)
                                                      ^
rasm.c:14482:52: warning: passing 'char [44]' to parameter of type 'const unsigned char *' converts between pointers to integer types with different sign
      [-Wpointer-sign]
        InitAutomate(ae->AutomateExpressionValidCharFirst,AutomateExpressionValidCharFirstDefinition);
                                                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
rasm.c:1133:52: note: expanded from macro 'AutomateExpressionValidCharFirstDefinition'
#define AutomateExpressionValidCharFirstDefinition "#%0123456789.ABCDEFGHIJKLMNOPQRSTUVWXYZ_@${"
                                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
rasm.c:1682:55: note: passing argument to parameter 'def' here
void InitAutomate(char *autotab, const unsigned char *def)
                                                      ^
rasm.c:14483:47: warning: passing 'char [43]' to parameter of type 'const unsigned char *' converts between pointers to integer types with different sign
      [-Wpointer-sign]
        InitAutomate(ae->AutomateExpressionValidChar,AutomateExpressionValidCharDefinition);
                                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
rasm.c:1134:47: note: expanded from macro 'AutomateExpressionValidCharDefinition'
#define AutomateExpressionValidCharDefinition "0123456789.ABCDEFGHIJKLMNOPQRSTUVWXYZ_{}@$"
                                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
rasm.c:1682:55: note: passing argument to parameter 'def' here
void InitAutomate(char *autotab, const unsigned char *def)
                                                      ^
rasm.c:15358:36: warning: passing 'unsigned char *' to parameter of type 'char *' converts between pointers to integer types with different sign
      [-Wpointer-sign]
                                                FileWriteBinary(TMP_filename,ae->mem[i]+offset,endoffset-offset);
                                                                             ^~~~~~~~~~~~~~~~~
./minilib.h:895:42: note: passing argument to parameter 'data' here
int FileWriteBinary(char *filename,char *data,int n)
                                         ^
rasm.c:19103:41: warning: passing 'unsigned char *' to parameter of type 'char *' converts between pointers to integer types with different sign
      [-Wpointer-sign]
        FileWriteBinary("autotest_include.raw",opcode,idx);
                                               ^~~~~~
./minilib.h:895:42: note: passing argument to parameter 'data' here
int FileWriteBinary(char *filename,char *data,int n)
                                         ^
29 warnings generated.
EdouardBERGE commented 3 years ago

most of warnings should be ok now