0005-util-cbfstool-Do-not-set-D_XOPEN_SOURCE-on-FreeBSD.patch 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. From 58cd6e0c97c67fdd8948975b74567e1ff6d8d6ee Mon Sep 17 00:00:00 2001
  2. From: Idwer Vollering <vidwer@gmail.com>
  3. Date: Sun, 9 May 2021 18:16:26 +0200
  4. Subject: [PATCH 05/19] util/cbfstool: Do not set -D_XOPEN_SOURCE on FreeBSD
  5. Fixes compilation on FreeBSD CURRENT, and possibly other releases.
  6. The compiler, clang, complained about:
  7. util/cbfstool/cbfstool.c:181:40: error: implicit declaration of function 'memmem' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
  8. util/cbfstool/cbfstool.c:181:31: error: incompatible integer to pointer conversion initializing 'struct metadata_hash_anchor *' with an expression of type 'int' [-Werror,-Wint-conversion]
  9. Signed-off-by: Idwer Vollering <vidwer@gmail.com>
  10. Change-Id: I45c02a21709160df44fc8da329f6c4a9bad24478
  11. Reviewed-on: https://review.coreboot.org/c/coreboot/+/53996
  12. Reviewed-by: Angel Pons <th3fanbus@gmail.com>
  13. Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
  14. ---
  15. util/cbfstool/Makefile.inc | 5 ++++-
  16. 1 file changed, 4 insertions(+), 1 deletion(-)
  17. diff --git a/util/cbfstool/Makefile.inc b/util/cbfstool/Makefile.inc
  18. index 5b49fe80ad..47b89e57b0 100644
  19. --- a/util/cbfstool/Makefile.inc
  20. +++ b/util/cbfstool/Makefile.inc
  21. @@ -95,7 +95,6 @@ TOOLCFLAGS += -Wstrict-prototypes -Wwrite-strings
  22. TOOLCFLAGS += -O2
  23. TOOLCPPFLAGS ?= -D_DEFAULT_SOURCE # memccpy() from string.h
  24. TOOLCPPFLAGS += -D_BSD_SOURCE -D_SVID_SOURCE # _DEFAULT_SOURCE for older glibc
  25. -TOOLCPPFLAGS += -D_XOPEN_SOURCE=700 # strdup() from string.h
  26. TOOLCPPFLAGS += -D_GNU_SOURCE # memmem() from string.h
  27. TOOLCPPFLAGS += -I$(top)/util/cbfstool/flashmap
  28. TOOLCPPFLAGS += -I$(top)/util/cbfstool
  29. @@ -113,6 +112,10 @@ TOOLCPPFLAGS += -I$(top)/src/vendorcode/intel/edk2/uefi_2.4/MdePkg/Include
  30. TOOLLDFLAGS ?=
  31. HOSTCFLAGS += -fms-extensions
  32. +ifneq ($(shell uname -o 2>/dev/null), FreeBSD)
  33. +TOOLCPPFLAGS += -D_XOPEN_SOURCE=700 # strdup() from string.h
  34. +endif
  35. +
  36. ifeq ($(shell uname -s | cut -c-7 2>/dev/null), MINGW32)
  37. TOOLCFLAGS += -mno-ms-bitfields
  38. endif
  39. --
  40. 2.25.1