clang_18_libpng.patch raw

   1  fix Qt macOS build with Clang 18
   2  
   3      See:
   4      https://github.com/pnggroup/libpng/commit/893b8113f04d408cc6177c6de19c9889a48faa24.
   5  
   6      In a similar manner as zlib (madler/zlib#895),
   7      libpng contains a header configuration that's no longer valid and
   8      hasn't been exercised for the macOS target.
   9  
  10      - The target OS conditional macros are misused. Specifically
  11        `TARGET_OS_MAC` covers all Apple targets, including iOS, and it
  12        should not be checked with `#if defined` as they would always be
  13        defined (to either 1 or 0) on Apple platforms.
  14      - `#include <fp.h>` no longer works for the macOS target and results
  15        in a compilation failure. macOS ships all required functions in
  16        `math.h`, and clients should use `math.h` instead.
  17  
  18  --- a/qtbase/src/3rdparty/libpng/pngpriv.h
  19  +++ b/qtbase/src/3rdparty/libpng/pngpriv.h
  20  @@ -514,18 +514,8 @@
  21       */
  22   #  include <float.h>
  23   
  24  -#  if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \
  25  -    defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC)
  26  -   /* We need to check that <math.h> hasn't already been included earlier
  27  -    * as it seems it doesn't agree with <fp.h>, yet we should really use
  28  -    * <fp.h> if possible.
  29  -    */
  30  -#    if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__)
  31  -#      include <fp.h>
  32  -#    endif
  33  -#  else
  34  -#    include <math.h>
  35  -#  endif
  36  +#  include <math.h>
  37  +
  38   #  if defined(_AMIGA) && defined(__SASC) && defined(_M68881)
  39      /* Amiga SAS/C: We must include builtin FPU functions when compiling using
  40       * MATH=68881
  41