2021.01.16 21:13 "[Tiff] C99, part 2", by Roger Leigh
Hi folks,
Following Even’s merge of part 1 a few days back, I’ve opened a merge request for part 2: !205 <https://gitlab.com/libtiff/libtiff/-/merge_requests/205>
This consolidates all the remaining changes proposed a couple of weeks back into a single change. The details are on the MR description, but I’ll copy them here too for reference:
This is part 2 of the C99 conversion work. Following discussion on the mailing list, this combines steps 2 and 3 of the original proposal. Rather than transitioning to using the C99 types via a temporary set of tiff_-prefixed types, this does the transition in a single step.
- Remove Autoconf and CMake type size checks. No checking is required, since we will use the C99 types unconditionally
- Check for and enable C99-mode for the compiler with both Autoconf and CMake
- Replace all use of int8..uint64 types with the standard int8_t..uint64_t types.
- Add legacy-types option to Autoconf and CMake, and TIFF_LEGACY_TYPES macro to the public headers. This can be used to build older software against the C99 interfaces. By default the legacy types are not available, but they can be made available globally at configure time (recommendation will be to avoid this for distributions), or on a per-package basis with -DTIFF_LEGACY_TYPES=1
- Use standard PRI format macros for formatting standard sized types
- tif_fax3 code using long updated to use int64_t, removing different special-cases for 32-bit and 64-bit platforms
The one bit I’m not convinced by is the “legacy-types” option at configure time. It adds additional complexity and variability to a libtiff installation which might cause more problems than it’s worth, especially when you can just compile with the “TIFF_LEGACY_TYPES” macro for the same effect. If there are no objections, I’d like to drop this part.
The change is quite large, but the vast majority of it is the renaming of the types with no code changes to speak of. The remainder is mostly the update of the Autoconf and CMake logic to enable C99 and remove the legacy type checks.
Any comments much appreciated either here, or on the merge request if it’s for comments on the specific changes.
Kind regards,
Roger