diff options
author | Even Rouault <even.rouault@spatialys.com> | 2022-12-11 13:13:35 +0000 |
---|---|---|
committer | Even Rouault <even.rouault@spatialys.com> | 2022-12-11 13:13:35 +0000 |
commit | 3da0dddadbdf18410d077707d8fa3835b5e79ed0 (patch) | |
tree | 33396c1324534faa9e286d6b287b00fd5ec2fb29 | |
parent | 07042f194109f3b4c81280496449ea9f5e474b2c (diff) | |
parent | 23b315d10f907495aa7ec6e7b2f9d822ab6598fb (diff) | |
download | libtiff-git-3da0dddadbdf18410d077707d8fa3835b5e79ed0.tar.gz |
Merge branch 'do_not_format_tiffvers_h' into 'master'
Revert formatting of tiffvers.h and add TIFFLIB_MAJOR_VERSION, TIFFLIB_MINOR_VERSION, TIFFLIB_MICRO_VERSION defines
See merge request libtiff/libtiff!434
-rw-r--r-- | .pre-commit-config.yaml | 6 | ||||
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | RELEASE-DATE | 2 | ||||
-rw-r--r-- | libtiff/tiffvers.h | 27 | ||||
-rw-r--r-- | libtiff/tiffvers.h.in | 21 | ||||
-rw-r--r-- | test/test_open_options.c | 25 |
6 files changed, 76 insertions, 7 deletions
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 27aba544..dbad088d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,7 +3,11 @@ repos: rev: 'v15.0.4' hooks: - id: clang-format + # tif_fax3sm.c is a generated file + # tiffvers.h as well, and its formatting is sensitive for + # FindTIFF.cmake to detect the version number exclude: > (?x)^( - libtiff/tif_fax3sm.c + libtiff/tif_fax3sm.c| + libtiff/tiffvers.h ) diff --git a/Makefile.am b/Makefile.am index 254ab7d9..2f07eec7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -65,7 +65,7 @@ SUBDIRS = port libtiff tools build contrib test doc release: (rm -f $(top_srcdir)/RELEASE-DATE && echo $(LIBTIFF_RELEASE_DATE) > $(top_srcdir)/RELEASE-DATE) (rm -f $(top_srcdir)/VERSION && echo $(LIBTIFF_VERSION) > $(top_srcdir)/VERSION) - (rm -f $(top_srcdir)/libtiff/tiffvers.h && sed 's,LIBTIFF_VERSION,$(LIBTIFF_VERSION),;s,LIBTIFF_RELEASE_DATE,$(LIBTIFF_RELEASE_DATE),' $(top_srcdir)/libtiff/tiffvers.h.in > $(top_srcdir)/libtiff/tiffvers.h) + (rm -f $(top_srcdir)/libtiff/tiffvers.h && sed 's,LIBTIFF_VERSION,$(LIBTIFF_VERSION),;s,LIBTIFF_RELEASE_DATE,$(LIBTIFF_RELEASE_DATE),;s,LIBTIFF_MAJOR_VERSION,$(LIBTIFF_MAJOR_VERSION),;s,LIBTIFF_MINOR_VERSION,$(LIBTIFF_MINOR_VERSION),;s,LIBTIFF_MICRO_VERSION,$(LIBTIFF_MICRO_VERSION),' $(top_srcdir)/libtiff/tiffvers.h.in > $(top_srcdir)/libtiff/tiffvers.h) pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libtiff-4.pc diff --git a/RELEASE-DATE b/RELEASE-DATE index 6f787fd2..039ae27f 100644 --- a/RELEASE-DATE +++ b/RELEASE-DATE @@ -1 +1 @@ -20221209 +20221210 diff --git a/libtiff/tiffvers.h b/libtiff/tiffvers.h index ad21a413..c90b5c1c 100644 --- a/libtiff/tiffvers.h +++ b/libtiff/tiffvers.h @@ -1,6 +1,9 @@ -#define TIFFLIB_VERSION_STR \ - "LIBTIFF, Version 4.5.0\nCopyright (c) 1988-1996 Sam Leffler\nCopyright " \ - "(c) 1991-1996 Silicon Graphics, Inc." +/* clang-format off */ + +/* clang-format disabled because FindTIFF.cmake is very sensitive to the + * formatting of below line being a single line. + */ +#define TIFFLIB_VERSION_STR "LIBTIFF, Version 4.5.0\nCopyright (c) 1988-1996 Sam Leffler\nCopyright (c) 1991-1996 Silicon Graphics, Inc." /* * This define can be used in code that requires * compilation-related definitions specific to a @@ -8,4 +11,20 @@ * version checking should be done based on the * string returned by TIFFGetVersion. */ -#define TIFFLIB_VERSION 20221209 +#define TIFFLIB_VERSION 20221210 + +/* The following defines have been added in 4.5.0 */ +#define TIFFLIB_MAJOR_VERSION 4 +#define TIFFLIB_MINOR_VERSION 5 +#define TIFFLIB_MICRO_VERSION 0 + +/* Macro added in 4.5.0. Returns TRUE if the current libtiff version is + * greater or equal to major.minor.micro + */ +#define TIFFLIB_AT_LEAST(major, minor, micro) \ + (TIFFLIB_MAJOR_VERSION > (major) || \ + (TIFFLIB_MAJOR_VERSION == (major) && TIFFLIB_MINOR_VERSION > (minor)) || \ + (TIFFLIB_MAJOR_VERSION == (major) && TIFFLIB_MINOR_VERSION == (minor) && \ + TIFFLIB_MICRO_VERSION >= (micro))) + +/* clang-format on */ diff --git a/libtiff/tiffvers.h.in b/libtiff/tiffvers.h.in index 48ec0eb8..b98851c0 100644 --- a/libtiff/tiffvers.h.in +++ b/libtiff/tiffvers.h.in @@ -1,3 +1,8 @@ +/* clang-format off */ + +/* clang-format disabled because FindTIFF.cmake is very sensitive to the + * formatting of below line being a single line. + */ #define TIFFLIB_VERSION_STR "LIBTIFF, Version LIBTIFF_VERSION\nCopyright (c) 1988-1996 Sam Leffler\nCopyright (c) 1991-1996 Silicon Graphics, Inc." /* * This define can be used in code that requires @@ -7,3 +12,19 @@ * string returned by TIFFGetVersion. */ #define TIFFLIB_VERSION LIBTIFF_RELEASE_DATE + +/* The following defines have been added in 4.5.0 */ +#define TIFFLIB_MAJOR_VERSION LIBTIFF_MAJOR_VERSION +#define TIFFLIB_MINOR_VERSION LIBTIFF_MINOR_VERSION +#define TIFFLIB_MICRO_VERSION LIBTIFF_MICRO_VERSION + +/* Macro added in 4.5.0. Returns TRUE if the current libtiff version is + * greater or equal to major.minor.micro + */ +#define TIFFLIB_AT_LEAST(major, minor, micro) \ + (TIFFLIB_MAJOR_VERSION > (major) || \ + (TIFFLIB_MAJOR_VERSION == (major) && TIFFLIB_MINOR_VERSION > (minor)) || \ + (TIFFLIB_MAJOR_VERSION == (major) && TIFFLIB_MINOR_VERSION == (minor) && \ + TIFFLIB_MICRO_VERSION >= (micro))) + +/* clang-format on */ diff --git a/test/test_open_options.c b/test/test_open_options.c index aef99e89..136adb37 100644 --- a/test/test_open_options.c +++ b/test/test_open_options.c @@ -43,6 +43,31 @@ #define ERROR_STRING_SIZE 1024 +/* Test TIFFLIB_AT_LEAST() macro */ +#if !TIFFLIB_AT_LEAST(TIFFLIB_MAJOR_VERSION, TIFFLIB_MINOR_VERSION, \ + TIFFLIB_MICRO_VERSION) +#error "TIFFLIB_AT_LEAST broken" +#endif +#if !TIFFLIB_AT_LEAST(TIFFLIB_MAJOR_VERSION, TIFFLIB_MINOR_VERSION, 0) +#error "TIFFLIB_AT_LEAST broken" +#endif +#if !TIFFLIB_AT_LEAST(TIFFLIB_MAJOR_VERSION, 0, 0) +#error "TIFFLIB_AT_LEAST broken" +#endif +#if !TIFFLIB_AT_LEAST(TIFFLIB_MAJOR_VERSION - 1, 0, 0) +#error "TIFFLIB_AT_LEAST broken" +#endif +#if TIFFLIB_AT_LEAST(TIFFLIB_MAJOR_VERSION + 1, 0, 0) +#error "TIFFLIB_AT_LEAST broken" +#endif +#if TIFFLIB_AT_LEAST(TIFFLIB_MAJOR_VERSION, TIFFLIB_MINOR_VERSION + 1, 0) +#error "TIFFLIB_AT_LEAST broken" +#endif +#if TIFFLIB_AT_LEAST(TIFFLIB_MAJOR_VERSION, TIFFLIB_MINOR_VERSION, \ + TIFFLIB_MICRO_VERSION + 1) +#error "TIFFLIB_AT_LEAST broken" +#endif + typedef struct MyErrorHandlerUserDataStruct { char *buffer; |