From acdae5c56b7daefe421c99815cdf3126b0efe6f3 Mon Sep 17 00:00:00 2001
From: Michele Calgaro <michele.calgaro@yahoo.it>
Date: Tue, 6 Jan 2026 12:37:54 +0900
Subject: Drop support for Watcom compiler, which is not c++17 compliant

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
---
 common/lzodefs.h | 53 ++++-------------------------------------
 common/minilzo.c | 72 ++++----------------------------------------------------
 2 files changed, 8 insertions(+), 117 deletions(-)

diff --git a/common/lzodefs.h b/common/lzodefs.h
index 3b9a62e..e0ad8e9 100644
--- a/common/lzodefs.h
+++ b/common/lzodefs.h
@@ -64,11 +64,6 @@
 #    pragma warn(disable: 2216)
 #  endif
 #endif
-#if 0 && defined(__WATCOMC__)
-#  if (__WATCOMC__ >= 1050) && (__WATCOMC__ < 1060)
-#    pragma warning 203 9
-#  endif
-#endif
 #if !(LZO_CFG_NO_DISABLE_WCRTNONSTDC)
 #ifndef _CRT_NONSTDC_NO_DEPRECATE
 #define _CRT_NONSTDC_NO_DEPRECATE 1
@@ -221,9 +216,6 @@
 #  define LZO_BROKEN_SIZEOF 1
 #endif
 #endif
-#if defined(__WATCOMC__) && (__WATCOMC__ < 900)
-#  define LZO_BROKEN_INTEGRAL_CONSTANTS 1
-#endif
 #if defined(_CRAY) && defined(_CRAY1)
 #  define LZO_BROKEN_SIGNED_RIGHT_SHIFT 1
 #endif
@@ -353,19 +345,6 @@
 #  else
 #    error "check your limits.h header"
 #  endif
-#elif defined(__WATCOMC__)
-#  if defined(__NT__) && (UINT_MAX == LZO_0xffffL)
-#    define LZO_OS_DOS16        1
-#    define LZO_INFO_OS         "dos16"
-#  elif defined(__NT__) && (__WATCOMC__ < 1100)
-#    define LZO_OS_WIN32        1
-#    define LZO_INFO_OS         "win32"
-#  elif defined(__linux__) || defined(__LINUX__)
-#    define LZO_OS_POSIX        1
-#    define LZO_INFO_OS         "posix"
-#  else
-#    error "please specify a target using the -bt compiler option"
-#  endif
 #elif defined(__palmos__)
 #  define LZO_OS_PALMOS         1
 #  define LZO_INFO_OS           "palmos"
@@ -664,10 +643,6 @@
 #  define LZO_CC_TOPSPEEDC      1
 #  define LZO_INFO_CC           "TopSpeed C"
 #  define LZO_INFO_CCVER        LZO_PP_MACRO_EXPAND(__TSC__)
-#elif defined(__WATCOMC__)
-#  define LZO_CC_WATCOMC        1
-#  define LZO_INFO_CC           "Watcom C"
-#  define LZO_INFO_CCVER        LZO_PP_MACRO_EXPAND(__WATCOMC__)
 #elif defined(__ZTC__)
 #  define LZO_CC_ZORTECHC       1
 #  define LZO_INFO_CC           "Zortech C"
@@ -1071,9 +1046,6 @@ extern "C" {
 #  define LZO_MM_AHSHIFT      ((unsigned) _AHSHIFT)
 #elif ((LZO_CC_AZTECC || LZO_CC_PACIFICC) && LZO_OS_DOS16)
 #  define LZO_MM_AHSHIFT      12
-#elif (LZO_CC_WATCOMC)
-   extern unsigned char _HShift;
-#  define LZO_MM_AHSHIFT      ((unsigned) _HShift)
 #else
 #  error "FIXME - implement LZO_MM_AHSHIFT"
 #endif
@@ -1280,7 +1252,7 @@ extern "C" {
 #  define LZO_ITRUNC(t,e)                   LZO_STATIC_CAST(t, e)
 #endif
 #if !defined(__lzo_cte)
-#  if (LZO_CC_MSC || LZO_CC_WATCOMC)
+#  if (LZO_CC_MSC)
 #    define __lzo_cte(e)            ((void)0,(e))
 #  elif 1
 #    define __lzo_cte(e)            ((void)0,(e))
@@ -1306,8 +1278,6 @@ extern "C" {
 #    define LZO_UNUSED(var)         {LZO_EXTERN_C int lzo_unused__[1-2*!(sizeof(var)>0)];}
 #  elif (LZO_CC_PACIFICC)
 #    define LZO_UNUSED(var)         ((void) sizeof(var))
-#  elif (LZO_CC_WATCOMC) && defined(__cplusplus)
-#    define LZO_UNUSED(var)         ((void) var)
 #  else
 #    define LZO_UNUSED(var)         ((void) &var)
 #  endif
@@ -1330,7 +1300,7 @@ extern "C" {
 #if !defined(LZO_UNUSED_LABEL)
 #  if (LZO_CC_CLANG >= 0x020800ul)
 #    define LZO_UNUSED_LABEL(l)     (__lzo_gnuc_extension__ ((void) ((const void *) &&l)))
-#  elif (LZO_CC_ARMCC || LZO_CC_CLANG || LZO_CC_INTELC || LZO_CC_WATCOMC)
+#  elif (LZO_CC_ARMCC || LZO_CC_CLANG || LZO_CC_INTELC)
 #    define LZO_UNUSED_LABEL(l)     if __lzo_cte(0) goto l
 #  else
 #    define LZO_UNUSED_LABEL(l)     switch (0) case 1:goto l
@@ -1601,9 +1571,6 @@ extern "C" {
 #elif (LZO_CC_INTELC_MSC) || (LZO_CC_MSC && (_MSC_VER >= 1300))
 #  define __lzo_struct_packed(s)        __pragma(pack(push,1)) struct s {
 #  define __lzo_struct_packed_end()     } __pragma(pack(pop));
-#elif (LZO_CC_WATCOMC && (__WATCOMC__ >= 900))
-#  define __lzo_struct_packed(s)        _Packed struct s {
-#  define __lzo_struct_packed_end()     };
 #endif
 #endif
 #if defined(__lzo_struct_packed) && !defined(__lzo_struct_packed_ma)
@@ -1664,9 +1631,6 @@ extern "C" {
 #elif (LZO_CC_INTELC_MSC) || (LZO_CC_MSC && (_MSC_VER >= 1300))
 #  define __lzo_union_um(s)             __pragma(pack(push,1)) union s {
 #  define __lzo_union_um_end()          } __pragma(pack(pop));
-#elif (LZO_CC_WATCOMC && (__WATCOMC__ >= 900))
-#  define __lzo_union_um(s)             _Packed union s {
-#  define __lzo_union_um_end()          };
 #endif
 #endif
 #if !defined(__lzo_union_am)
@@ -1826,15 +1790,13 @@ LZO_COMPILE_TIME_ASSERT_HEADER(3 == 3)
 #    else
 #      define __lzo_cdecl_qsort         __cdecl
 #    endif
-#  elif (LZO_CC_WATCOMC)
-#    define __lzo_cdecl                 __cdecl
 #  else
 #    define __lzo_cdecl                 __cdecl
 #    define __lzo_cdecl_atexit          __cdecl
 #    define __lzo_cdecl_main            __cdecl
 #    define __lzo_cdecl_qsort           __cdecl
 #  endif
-#  if (LZO_CC_GNUC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PACIFICC || LZO_CC_WATCOMC)
+#  if (LZO_CC_GNUC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PACIFICC)
 #  elif (LZO_OS_OS2 && (LZO_CC_DMC || LZO_CC_SYMANTECC))
 #    define __lzo_cdecl_sighandler      __pascal
 #  elif (LZO_OS_OS2 && (LZO_CC_ZORTECHC))
@@ -1852,8 +1814,6 @@ LZO_COMPILE_TIME_ASSERT_HEADER(3 == 3)
 #  else
 #    define __lzo_cdecl_sighandler      __cdecl
 #  endif
-#elif (LZO_ARCH_I386) && (LZO_CC_WATCOMC)
-#  define __lzo_cdecl                   __cdecl
 #elif LZO_ARCH_M68K && LZO_OS_TOS && LZO_CC_PUREC
 #  define __lzo_cdecl                   cdecl
 #endif
@@ -1878,8 +1838,7 @@ LZO_COMPILE_TIME_ASSERT_HEADER(3 == 3)
 #if !(LZO_CFG_NO_WINDOWS_H)
 #if !defined(LZO_HAVE_WINDOWS_H)
 #if (LZO_OS_CYGWIN || (LZO_OS_EMX && defined(__RSXNT__)) || LZO_OS_WIN32 || LZO_OS_WIN64)
-#  if (LZO_CC_WATCOMC && (__WATCOMC__ < 1000))
-#  elif (LZO_OS_WIN32 && LZO_CC_GNUC) && defined(__PW32__)
+#  if (LZO_OS_WIN32 && LZO_CC_GNUC) && defined(__PW32__)
 #  elif ((LZO_OS_CYGWIN || defined(__MINGW32__)) && (LZO_CC_GNUC && (LZO_CC_GNUC < 0x025f00ul)))
 #  else
 #    define LZO_HAVE_WINDOWS_H 1
@@ -2050,12 +2009,8 @@ LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_LONG == sizeof(long))
 #  define LZO_SIZEOF___INT64        8
 #elif ((LZO_OS_WIN32 || defined(_WIN32)) && (LZO_CC_MSC))
 #  define LZO_SIZEOF___INT64        8
-#elif (LZO_ARCH_I386 && (LZO_CC_WATCOMC && (__WATCOMC__ >= 1100)))
-#  define LZO_SIZEOF___INT64        8
 #elif (LZO_CC_GHS && defined(__LLONG_BIT) && ((__LLONG_BIT-0) == 64))
 #  define LZO_SIZEOF_LONG_LONG      8
-#elif (LZO_CC_WATCOMC && defined(_INTEGRAL_MAX_BITS) && ((_INTEGRAL_MAX_BITS-0) == 64))
-#  define LZO_SIZEOF___INT64        8
 #elif (LZO_OS_OS400 || defined(__OS400__)) && defined(__LLP64_IFC__)
 #  define LZO_SIZEOF_LONG_LONG      8
 #elif (defined(__vms) || defined(__VMS)) && ((__INITIAL_POINTER_SIZE-0) == 64)
diff --git a/common/minilzo.c b/common/minilzo.c
index 69ead91..33991b5 100644
--- a/common/minilzo.c
+++ b/common/minilzo.c
@@ -84,11 +84,6 @@
 #    pragma warn(disable: 2216)
 #  endif
 #endif
-#if 0 && defined(__WATCOMC__)
-#  if (__WATCOMC__ >= 1050) && (__WATCOMC__ < 1060)
-#    pragma warning 203 9
-#  endif
-#endif
 #if !(LZO_CFG_NO_DISABLE_WCRTNONSTDC)
 #ifndef _CRT_NONSTDC_NO_DEPRECATE
 #define _CRT_NONSTDC_NO_DEPRECATE 1
@@ -241,9 +236,6 @@
 #  define LZO_BROKEN_SIZEOF 1
 #endif
 #endif
-#if defined(__WATCOMC__) && (__WATCOMC__ < 900)
-#  define LZO_BROKEN_INTEGRAL_CONSTANTS 1
-#endif
 #if defined(_CRAY) && defined(_CRAY1)
 #  define LZO_BROKEN_SIGNED_RIGHT_SHIFT 1
 #endif
@@ -373,19 +365,6 @@
 #  else
 #    error "check your limits.h header"
 #  endif
-#elif defined(__WATCOMC__)
-#  if defined(__NT__) && (UINT_MAX == LZO_0xffffL)
-#    define LZO_OS_DOS16        1
-#    define LZO_INFO_OS         "dos16"
-#  elif defined(__NT__) && (__WATCOMC__ < 1100)
-#    define LZO_OS_WIN32        1
-#    define LZO_INFO_OS         "win32"
-#  elif defined(__linux__) || defined(__LINUX__)
-#    define LZO_OS_POSIX        1
-#    define LZO_INFO_OS         "posix"
-#  else
-#    error "please specify a target using the -bt compiler option"
-#  endif
 #elif defined(__palmos__)
 #  define LZO_OS_PALMOS         1
 #  define LZO_INFO_OS           "palmos"
@@ -684,10 +663,6 @@
 #  define LZO_CC_TOPSPEEDC      1
 #  define LZO_INFO_CC           "TopSpeed C"
 #  define LZO_INFO_CCVER        LZO_PP_MACRO_EXPAND(__TSC__)
-#elif defined(__WATCOMC__)
-#  define LZO_CC_WATCOMC        1
-#  define LZO_INFO_CC           "Watcom C"
-#  define LZO_INFO_CCVER        LZO_PP_MACRO_EXPAND(__WATCOMC__)
 #elif defined(__ZTC__)
 #  define LZO_CC_ZORTECHC       1
 #  define LZO_INFO_CC           "Zortech C"
@@ -1091,9 +1066,6 @@ extern "C" {
 #  define LZO_MM_AHSHIFT      ((unsigned) _AHSHIFT)
 #elif ((LZO_CC_AZTECC || LZO_CC_PACIFICC) && LZO_OS_DOS16)
 #  define LZO_MM_AHSHIFT      12
-#elif (LZO_CC_WATCOMC)
-   extern unsigned char _HShift;
-#  define LZO_MM_AHSHIFT      ((unsigned) _HShift)
 #else
 #  error "FIXME - implement LZO_MM_AHSHIFT"
 #endif
@@ -1300,7 +1272,7 @@ extern "C" {
 #  define LZO_ITRUNC(t,e)                   LZO_STATIC_CAST(t, e)
 #endif
 #if !defined(__lzo_cte)
-#  if (LZO_CC_MSC || LZO_CC_WATCOMC)
+#  if (LZO_CC_MSC)
 #    define __lzo_cte(e)            ((void)0,(e))
 #  elif 1
 #    define __lzo_cte(e)            ((void)0,(e))
@@ -1326,8 +1298,6 @@ extern "C" {
 #    define LZO_UNUSED(var)         {LZO_EXTERN_C int lzo_unused__[1-2*!(sizeof(var)>0)];}
 #  elif (LZO_CC_PACIFICC)
 #    define LZO_UNUSED(var)         ((void) sizeof(var))
-#  elif (LZO_CC_WATCOMC) && defined(__cplusplus)
-#    define LZO_UNUSED(var)         ((void) var)
 #  else
 #    define LZO_UNUSED(var)         ((void) &var)
 #  endif
@@ -1350,7 +1320,7 @@ extern "C" {
 #if !defined(LZO_UNUSED_LABEL)
 #  if (LZO_CC_CLANG >= 0x020800ul)
 #    define LZO_UNUSED_LABEL(l)     (__lzo_gnuc_extension__ ((void) ((const void *) &&l)))
-#  elif (LZO_CC_ARMCC || LZO_CC_CLANG || LZO_CC_INTELC || LZO_CC_WATCOMC)
+#  elif (LZO_CC_ARMCC || LZO_CC_CLANG || LZO_CC_INTELC)
 #    define LZO_UNUSED_LABEL(l)     if __lzo_cte(0) goto l
 #  else
 #    define LZO_UNUSED_LABEL(l)     switch (0) case 1:goto l
@@ -1621,9 +1591,6 @@ extern "C" {
 #elif (LZO_CC_INTELC_MSC) || (LZO_CC_MSC && (_MSC_VER >= 1300))
 #  define __lzo_struct_packed(s)        __pragma(pack(push,1)) struct s {
 #  define __lzo_struct_packed_end()     } __pragma(pack(pop));
-#elif (LZO_CC_WATCOMC && (__WATCOMC__ >= 900))
-#  define __lzo_struct_packed(s)        _Packed struct s {
-#  define __lzo_struct_packed_end()     };
 #endif
 #endif
 #if defined(__lzo_struct_packed) && !defined(__lzo_struct_packed_ma)
@@ -1684,9 +1651,6 @@ extern "C" {
 #elif (LZO_CC_INTELC_MSC) || (LZO_CC_MSC && (_MSC_VER >= 1300))
 #  define __lzo_union_um(s)             __pragma(pack(push,1)) union s {
 #  define __lzo_union_um_end()          } __pragma(pack(pop));
-#elif (LZO_CC_WATCOMC && (__WATCOMC__ >= 900))
-#  define __lzo_union_um(s)             _Packed union s {
-#  define __lzo_union_um_end()          };
 #endif
 #endif
 #if !defined(__lzo_union_am)
@@ -1846,15 +1810,13 @@ LZO_COMPILE_TIME_ASSERT_HEADER(3 == 3)
 #    else
 #      define __lzo_cdecl_qsort         __cdecl
 #    endif
-#  elif (LZO_CC_WATCOMC)
-#    define __lzo_cdecl                 __cdecl
 #  else
 #    define __lzo_cdecl                 __cdecl
 #    define __lzo_cdecl_atexit          __cdecl
 #    define __lzo_cdecl_main            __cdecl
 #    define __lzo_cdecl_qsort           __cdecl
 #  endif
-#  if (LZO_CC_GNUC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PACIFICC || LZO_CC_WATCOMC)
+#  if (LZO_CC_GNUC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PACIFICC)
 #  elif (LZO_OS_OS2 && (LZO_CC_DMC || LZO_CC_SYMANTECC))
 #    define __lzo_cdecl_sighandler      __pascal
 #  elif (LZO_OS_OS2 && (LZO_CC_ZORTECHC))
@@ -1872,8 +1834,6 @@ LZO_COMPILE_TIME_ASSERT_HEADER(3 == 3)
 #  else
 #    define __lzo_cdecl_sighandler      __cdecl
 #  endif
-#elif (LZO_ARCH_I386) && (LZO_CC_WATCOMC)
-#  define __lzo_cdecl                   __cdecl
 #elif LZO_ARCH_M68K && LZO_OS_TOS && LZO_CC_PUREC
 #  define __lzo_cdecl                   cdecl
 #endif
@@ -1898,8 +1858,7 @@ LZO_COMPILE_TIME_ASSERT_HEADER(3 == 3)
 #if !(LZO_CFG_NO_WINDOWS_H)
 #if !defined(LZO_HAVE_WINDOWS_H)
 #if (LZO_OS_CYGWIN || (LZO_OS_EMX && defined(__RSXNT__)) || LZO_OS_WIN32 || LZO_OS_WIN64)
-#  if (LZO_CC_WATCOMC && (__WATCOMC__ < 1000))
-#  elif (LZO_OS_WIN32 && LZO_CC_GNUC) && defined(__PW32__)
+#  if (LZO_OS_WIN32 && LZO_CC_GNUC) && defined(__PW32__)
 #  elif ((LZO_OS_CYGWIN || defined(__MINGW32__)) && (LZO_CC_GNUC && (LZO_CC_GNUC < 0x025f00ul)))
 #  else
 #    define LZO_HAVE_WINDOWS_H 1
@@ -2070,12 +2029,8 @@ LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_LONG == sizeof(long))
 #  define LZO_SIZEOF___INT64        8
 #elif ((LZO_OS_WIN32 || defined(_WIN32)) && (LZO_CC_MSC))
 #  define LZO_SIZEOF___INT64        8
-#elif (LZO_ARCH_I386 && (LZO_CC_WATCOMC && (__WATCOMC__ >= 1100)))
-#  define LZO_SIZEOF___INT64        8
 #elif (LZO_CC_GHS && defined(__LLONG_BIT) && ((__LLONG_BIT-0) == 64))
 #  define LZO_SIZEOF_LONG_LONG      8
-#elif (LZO_CC_WATCOMC && defined(_INTEGRAL_MAX_BITS) && ((_INTEGRAL_MAX_BITS-0) == 64))
-#  define LZO_SIZEOF___INT64        8
 #elif (LZO_OS_OS400 || defined(__OS400__)) && defined(__LLP64_IFC__)
 #  define LZO_SIZEOF_LONG_LONG      8
 #elif (defined(__vms) || defined(__VMS)) && ((__INITIAL_POINTER_SIZE-0) == 64)
@@ -4158,25 +4113,6 @@ __lzo_init_v2(unsigned v, int s1, int s2, int s3, int s4, int s5,
     return r;
 }
 
-#if !defined(__LZO_IN_MINILZO)
-
-#if (LZO_OS_WIN16 && LZO_CC_WATCOMC) && defined(__SW_BD)
-
-#if 0
-BOOL FAR PASCAL LibMain ( HANDLE hInstance, WORD wDataSegment,
-                          WORD wHeapSize, LPSTR lpszCmdLine )
-#else
-int __far __pascal LibMain ( int a, short b, short c, long d )
-#endif
-{
-    LZO_UNUSED(a); LZO_UNUSED(b); LZO_UNUSED(c); LZO_UNUSED(d);
-    return 1;
-}
-
-#endif
-
-#endif
-
 #endif
 
 #define LZO1X           1
-- 
cgit v1.2.3

