libtiff: Merge branch 'unity_clang_fixes' into 'master'

From 9d62554d0719c0516bb79a9c6a9fcae82fd44658 Mon Sep 17 00:00:00 2001
From: Even Rouault <[EMAIL REDACTED]>
Date: Thu, 23 Nov 2023 16:40:01 +0100
Subject: [PATCH] Fixes to avoid CLang warnings on unity builds

---
 libtiff/tif_jpeg.c  | 11 +++++++++++
 libtiff/tif_ojpeg.c | 10 +++++++++-
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/libtiff/tif_jpeg.c b/libtiff/tif_jpeg.c
index 250144f2..bcab8dd0 100644
--- a/libtiff/tif_jpeg.c
+++ b/libtiff/tif_jpeg.c
@@ -182,9 +182,20 @@ typedef unsigned char boolean;
 #define LONGJMP(jbuf, code) longjmp(jbuf, code)
 #define JMP_BUF jmp_buf
 
+#ifndef TIFF_jpeg_destination_mgr_defined
+#define TIFF_jpeg_destination_mgr_defined
 typedef struct jpeg_destination_mgr jpeg_destination_mgr;
+#endif
+
+#ifndef TIFF_jpeg_source_mgr_defined
+#define TIFF_jpeg_source_mgr_defined
 typedef struct jpeg_source_mgr jpeg_source_mgr;
+#endif
+
+#ifndef TIFF_jpeg_error_mgr_defined
+#define TIFF_jpeg_error_mgr_defined
 typedef struct jpeg_error_mgr jpeg_error_mgr;
+#endif
 
 /*
  * State block for each open TIFF file using
diff --git a/libtiff/tif_ojpeg.c b/libtiff/tif_ojpeg.c
index ea572091..ec0da992 100644
--- a/libtiff/tif_ojpeg.c
+++ b/libtiff/tif_ojpeg.c
@@ -234,10 +234,18 @@ typedef unsigned char boolean;
 #include "jerror.h"
 #include "jpeglib.h"
 
+#ifndef TIFF_jpeg_source_mgr_defined
+#define TIFF_jpeg_source_mgr_defined
+typedef struct jpeg_source_mgr jpeg_source_mgr;
+#endif
+
+#ifndef TIFF_jpeg_error_mgr_defined
+#define TIFF_jpeg_error_mgr_defined
 typedef struct jpeg_error_mgr jpeg_error_mgr;
+#endif
+
 typedef struct jpeg_common_struct jpeg_common_struct;
 typedef struct jpeg_decompress_struct jpeg_decompress_struct;
-typedef struct jpeg_source_mgr jpeg_source_mgr;
 
 typedef enum
 {