jivanpal / drat

Utility for performing data recovery and analysis of APFS partitions/containers.
GNU General Public License v3.0
163 stars 21 forks source link

Getting int-short assignment error #26

Closed TorosKae closed 2 years ago

TorosKae commented 2 years ago

Hi, after command make getting the next error

OBJECTS +++ include/drat/string/j.c +++ out/include/drat/string/j.o
gcc -std=c99 -D _GNU_SOURCE -Werror -Wall -Wextra -Wno-incompatible-pointer-types -Wno-multichar -Wno-unused-variable -Wno-unused-parameter -Wno-missing-field-initializers -I./include -I/usr/local/Cellar/argp-standalone/1.3/include/ -c "include/drat/string/j.c" -o "out/include/drat/string/j.o"
include/drat/string/j.c:53:55: error: format specifies type 'unsigned short' but
      the argument has type 'int' [-Werror,-Wformat]
  ...extended fields:  %"PRIu16"\n", has_xfields ? xfields->xf_num_exts : 0);
                       ~~~~~~~~      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make: *** [out/include/drat/string/j.o] Error 1

Why it could be? -GNU C Compiler (gcc) -GNU Make (make) -GNU Argp library () are installed. I have MacOs 10.15.7

jivanpal commented 2 years ago

Hi, thanks for reporting. This is due to the use of the ULL suffix in integer constants, which is not portable. This has been fixed in the global-arguments branch, which should be merged soon, by using the UINT64_C() macro instead, so I will close this.

jivanpal commented 2 years ago

Apologies, I thought this was the aforementioned issue which has already been fixed, but it appears specific to your build environment, as I cannot reproduce the issue on main. This should be fixed by changing 0 at the end of the problematic line to UINT16_C(0), including <stdint.h> for the macro. I have made this change in #27, please do git checkout port-test && make to see if this change works for you. Out of interest, to see where this incompatibility arises, what is your build environment (OS, hardware, etc.)?

TorosKae commented 2 years ago

Out of interest, to see where this incompatibility arises, what is your build environment (OS, hardware, etc.)?

Thanks for the reply! So I use MacOs 10.15.7 6-Core Intel Core i5 (3.7), 40Gb RAM, if it is really matter. A pulled port-test, run it again, but still have an exception

gcc -std=c99 -D _GNU_SOURCE -Werror -Wall -Wextra -Wno-incompatible-pointer-types -Wno-multichar -Wno-unused-variable -Wno-unused-parameter -Wno-missing-field-initializers -I./include -I/usr/local/Cellar/argp-standalone/1.3/include/ -c "include/drat/string/j.c" -o "out/include/drat/string/j.o"
include/drat/string/j.c:54:55: error: format specifies type 'unsigned short' but
      the argument has type 'int' [-Werror,-Wformat]
  ...fields:  %"PRIu16"\n", has_xfields ? xfields->xf_num_exts : UINT16_C(0));
              ~~~~~~~~      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make: *** [out/include/drat/string/j.o] Error 1
➜  drat git:(port-test) 

Hope did everything right

jivanpal commented 2 years ago

Hmm, not sure why it doesn't like that. I've altered the code again, try git pull && make and report back, thanks.

TorosKae commented 2 years ago

Seems working now, at least no errors. You can close the issue. Thank you so much)