Skip to contentSkip to conversation

Define _GNU_SOURCE for a declaration of strptime

PATCH New Florian Weimer 1 participant 1 message Dec 14, 2022 EFI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Define _GNU_SOURCE for a declaration of strptime

This is needed for compatibility with future C compilers which reject implicit function declarations by default. Without _GNU_SOURCE (or a similar feature test macro), <time.h> does not declare the strptime function, and compilation can fail.

---
 Make.rules | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Make.rules +1 -1
index 903a5a4..d4de1ef 100644
@@ -14,7 +14,7 @@ else
 $(error unknown architecture $(ARCH))
 endif
 INCDIR	   = -I$(TOPDIR)include/ -I/usr/include/efi -I/usr/include/efi/$(ARCH) -I/usr/include/efi/protocol
-CPPFLAGS   = -DCONFIG_$(ARCH)
+CPPFLAGS   = -DCONFIG_$(ARCH) -D_GNU_SOURCE
 CFLAGS	   = -O2 -g $(ARCH3264) -fpic -Wall -fshort-wchar -fno-strict-aliasing -fno-merge-constants -fno-stack-protector -ffreestanding -fno-stack-check
 LDFLAGS	   = -nostdlib
 CRTOBJ		= crt0-efi-$(ARCH).o

Related to:

<https://fedoraproject.org/wiki/Changes/PortingToModernC>
<https://fedoraproject.org/wiki/Toolchain/PortingToModernC>