0001-core-zlib-fix-build-warning-when-_LFS64_LARGEFILE-is.patch 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. From 82becbadd5918ed7ad3c2b651ce479084b5feb2a Mon Sep 17 00:00:00 2001
  2. From: Etienne Carriere <etienne.carriere@linaro.org>
  3. Date: Mon, 10 May 2021 15:58:41 +0200
  4. Subject: core: zlib: fix build warning when _LFS64_LARGEFILE is not defined
  5. In zlib, _LFS64_LARGEFILE is expected to be a boolean directive, either
  6. 1 (true) or 0 (false). Depending on toolchain version and directives
  7. build may produces warnings (as shown below with gcc 9.3) when the macro
  8. is not defined hence this change to default it to value 0 (false).
  9. core/lib/zlib/zutil.h:196:39: warning: "_LFS64_LARGEFILE" is not defined, evaluates to 0 [-Wundef]
  10. 196 | (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0)
  11. | ^~~~~~~~~~~~~~~~
  12. In file included from core/lib/zlib/adler32.c:9:
  13. core/lib/zlib/zutil.h:196:39: warning: "_LFS64_LARGEFILE" is not defined, evaluates to 0 [-Wundef]
  14. 196 | (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0)
  15. | ^~~~~~~~~~~~~~~~
  16. CC out/core/lib/zlib/zutil.o
  17. In file included from core/lib/zlib/inftrees.c:7:
  18. core/lib/zlib/zutil.h:196:39: warning: "_LFS64_LARGEFILE" is not defined, evaluates to 0 [-Wundef]
  19. 196 | (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0)
  20. | ^~~~~~~~~~~~~~~~
  21. In file included from core/lib/zlib/inflate.c:84:
  22. core/lib/zlib/zutil.h:196:39: warning: "_LFS64_LARGEFILE" is not defined, evaluates to 0 [-Wundef]
  23. 196 | (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0)
  24. | ^~~~~~~~~~~~~~~~
  25. In file included from core/lib/zlib/zutil.c:9:
  26. core/lib/zlib/zutil.h:196:39: warning: "_LFS64_LARGEFILE" is not defined, evaluates to 0 [-Wundef]
  27. 196 | (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0)
  28. | ^~~~~~~~~~~~~~~~
  29. Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
  30. Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
  31. ---
  32. core/lib/zlib/zconf.h | 5 +++++
  33. 1 file changed, 5 insertions(+)
  34. diff --git a/core/lib/zlib/zconf.h b/core/lib/zlib/zconf.h
  35. index 0bca18be..a7d13741 100644
  36. --- a/core/lib/zlib/zconf.h
  37. +++ b/core/lib/zlib/zconf.h
  38. @@ -487,6 +487,11 @@ typedef uLong FAR uLongf;
  39. # endif
  40. #endif
  41. +/* Other places expect _LFS64_LARGEFILE to be defined with a valid value */
  42. +#ifndef _LFS64_LARGEFILE
  43. +#define _LFS64_LARGEFILE 0
  44. +#endif
  45. +
  46. #if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0
  47. # define Z_LFS64
  48. #endif
  49. --
  50. 2.17.1