[freetype2] Avoid multiple evaluation in FT_PEEK_* macros

Upstream Clang PR https://github.com/llvm/llvm-project/pull/180955
extended `-Wunsequenced` to diagnose multiple unsequenced reads of the
same `volatile`-qualified scalar object (C11 5.1.2.3p2, 6.5p2).

In `src/sfnt/ttcmap.c`, `tt_face_build_cmaps` passes `FT_Byte* volatile`
pointers (`p` and `cmap`, marked `volatile` for `ft_setjmp`) to
`TT_NEXT_USHORT`, `TT_NEXT_ULONG`, and `TT_PEEK_USHORT`. Because the
underlying `FT_PEEK_*` macros in `include/freetype/internal/ftstream.h`
expand their pointer argument 2-4 times across unsequenced bitwise `|`,
this triggers `-Werror,-Wunsequenced`.

Back the `FT_PEEK_*` macros with `static inline` helper functions taking
`const void*` so the caller's pointer expression is evaluated once at
the call boundary before combining the bytes.

Bug: 585509660
Change-Id: I733a4cc155041f18f8268a4d2829a621218b503c
Reviewed-on: https://fuchsia-review.googlesource.com/c/third_party/freetype2/+/1985085
Reviewed-by: Jonny Wang <jonnywang@google.com>
Lint: android-build-ayeaye@system.gserviceaccount.com <android-build-ayeaye@system.gserviceaccount.com>
1 file changed