Bug 707130 - -Wincompatible-pointer-types warning in base/fapi_ft.c
Summary: -Wincompatible-pointer-types warning in base/fapi_ft.c
Status: RESOLVED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: Build Process (show other bugs)
Version: 10.02.0
Hardware: PC All
: P2 normal
Assignee: Default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-09-14 03:27 UTC by Sam James
Modified: 2024-01-19 05:01 UTC (History)
1 user (show)

See Also:
Customer:
Word Size: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sam James 2023-09-14 03:27:43 UTC
Noticed this when building 10.02.0 but it's also there in 10.01.2 at least:
```
x86_64-pc-linux-gnu-gcc  -DHAVE_MKSTEMP -DHAVE_FILE64 -DHAVE_FSEEKO -DHAVE_MKSTEMP64 -DHAVE_FONTCONFIG -DHAVE_LIBIDN -DHAVE_SETLOCALE -DHAVE_SSE2 -DHAVE_DBUS -DHAVE_BSWAP32 -DHAVE_BYTESWAP_H -DHAVE_STRERROR -
DHAVE_ISNAN -DHAVE_ISINF  -DHAVE_PREAD_PWRITE=1 -DGS_RECURSIVE_MUTEXATTR=PTHREAD_MUTEX_RECURSIVE -O2 -DNDEBUG -Wall -Wstrict-prototypes -Wundef -Wmissing-declarations -Wmissing-prototypes -Wwrite-strings -fno
-strict-aliasing -Werror=declaration-after-statement -fno-builtin -fno-common -Werror=return-type -Wno-unused-local-typedefs -DHAVE_STDINT_H=1 -DHAVE_DIRENT_H=1 -DHAVE_SYS_DIR_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_S
YS_TIMES_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_LIBDL=1 -DGX_COLOR_INDEX_TYPE="unsigned long long" -D__USE_UNIX98=1  -DBUILD_PDF=1 -I./pdf -O2 -pipe -march=native -fdiagnostics-color=always -frecord-gcc-switches -Wre
turn-type -ggdb3 -DHAVE_RESTRICT=1  -DUSE_LIBPAPER  -fno-strict-aliasing -DHAVE_POPEN_PROTO=1    -I./obj -I./base -I./devices  -DWHICH_CMS="lcms2" -O2 -pipe -march=native -fdiagnostics-color=always -frecord-g
cc-switches -Wreturn-type -ggdb3 -DHAVE_RESTRICT=1  -DUSE_LIBPAPER -I/usr/include/freetype2 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include  -DSHARE_FT=1 -o ./obj/fapi_ft_1.o -c
./base/fapi_ft.c
./base/fapi_ft.c: In function ‘gs_fapi_ft_get_scaled_font’:
./base/fapi_ft.c:1283:61: warning: passing argument 2 of ‘a_font->retrieve_tt_font’ from incompatible pointer type [-Wincompatible-pointer-types]
 1283 |                     code = a_font->retrieve_tt_font(a_font, &own_font_data, &ms);
      |                                                             ^~~~~~~~~~~~~~
      |                                                             |
      |                                                             unsigned char **
./base/fapi_ft.c:1283:61: note: expected ‘void **’ but argument is of type ‘unsigned char **’
./base/fapi_ft.c:1283:77: warning: pointer targets in passing argument 3 of ‘a_font->retrieve_tt_font’ differ in signedness [-Wpointer-sign]
 1283 |                     code = a_font->retrieve_tt_font(a_font, &own_font_data, &ms);
      |                                                                             ^~~
      |                                                                             |
      |                                                                             unsigned int *
./base/fapi_ft.c:1283:77: note: expected ‘int *’ but argument is of type ‘unsigned int *’
```

Newer compiler versions are planning on making incompatible-pointer-types error out by default, so I figured it was worth reporting.

Thanks.
Comment 1 Chris Liddell (chrisl) 2023-09-14 09:03:21 UTC
I assume this should solve it:
https://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff;h=b7beb19ad06e


Frankly, I *strongly* disagree with that warning. The whole point of void pointer function parameters is that they are compatible with *every* type - hence why free() takes a void * parameter.

But whatever.....