Le mardi 4 mars 2014, 06:27:37 Carlos Montiers a écrit : > Hello. I check the tiny c project with cppcheck, and i found this next: > > tiny_impdef.c line 228 > p = tcc_realloc(p, n0 = n0 ? n0 * 2 : 256); > maybe should be: > p = tcc_realloc(p, n0 ? n0 * 2 : 256);
If you check the source you'll see that it's probably made on purpose since this is part of a loop and thus n0 will be used again later. Agreed, the n0 = n0 ? n0 * 2 : 256 could be done outside realloc but there is no problem here. > > x86_64-gen.c line 504 > assert((v >= TREG_XMM0) || (v <= TREG_XMM7)); > maybe should be: > assert((v >= TREG_XMM0) && (v <= TREG_XMM7)); Looks weird indeed. It seems the problem was introduced in 1caee8ab. Fixed. > > tccgen.c line 2272 > if (t & (VT_DEFSIGN | VT_UNSIGNED)) > maybe should be: > if (t & VT_UNSIGNED) No problem here, I don't see why it complains. > > tccgen.c line 165 > s = *ps; > maybe should be: > //s = *ps; because is assigned in next line Oups, my fault. I guess it's some leftover from statement I added to do a patch. Fixed. > > tccpp.c line 2917 > assign address of local variable to a function parameter (i not understand > this), but for case We change the value of a function parameter and the tool complains because function parameters are passed by value and this assignment will be lost. However here the parameter is reused later so the value is not lost. False warning. > > tccpp.c line 279 > sprintf(p, "%Lu", cv->ull); > maybe should be: //the mask is unsigned long but the value is unsigned long > long > sprintf(p, "%llu", cv->ull); > or > sprintf(p, "%Lu", (unsigned long)cv->ull); Fixed. > > c67-gen.c lines 1904 and 1905 are unncesseary because are the same > condition that lines 1902 and 1903 Fixed. Strange, because it seems it was written directly like this. > > tcc.c line 82 > int ret = spawnvp(P_NOWAIT, prog, (char *const*)argv); > maybe should be: //because spawnvp spect (const char * const *) > int ret = spawnvp(P_NOWAIT, prog, (const char * const *)argv); I prefer to leave it untouched as I don't see where it finds this signature for spawnvp. I found the prototype in win32/include/process.h but it's only char * const [] (the const seems redundant since an array cannot be modified). Thanks for your report. Cheers Thomas _______________________________________________ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel