Edward O'Callaghan submitted this change.

View Change

Approvals: build bot (Jenkins): Verified Stefan Reinauer: Looks good to me, approved Sam McNally: Looks good to me, approved
Makefile: Explicitly set '-std=c99'

This matches the build flags that are correctly explicitly defined in
meson.build where-as the Makefile is randomly picking up whatever the
system toolchain happens to default to.

Fix dmi.c while we are here to avoid a re-define of _GNU_SOURCE.

BUG=none
TEST=`make` with both gcc and clang.

Change-Id: I4f973927fc018510a3beaa6c4fa2f356c77c7a6e
Signed-off-by: Edward O'Callaghan <quasisec@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/47908
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Reviewed-by: Sam McNally <sammc@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
---
M Makefile
M dmi.c
2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 09b2154..6d37d55 100644
--- a/Makefile
+++ b/Makefile
@@ -30,7 +30,7 @@
DIFF = diff
PREFIX ?= /usr/local
MANDIR ?= $(PREFIX)/share/man
-CFLAGS ?= -Os -Wall -Wextra -Wno-unused-parameter -Wshadow -Wmissing-prototypes -Wwrite-strings
+CFLAGS ?= -std=c99 -D_DEFAULT_SOURCE -D_POSIX_C_SOURCE=200809L -D_BSD_SOURCE -Os -Wall -Wextra -Wno-unused-parameter -Wshadow -Wmissing-prototypes -Wwrite-strings
EXPORTDIR ?= .
RANLIB ?= ranlib
PKG_CONFIG ?= pkg-config
diff --git a/dmi.c b/dmi.c
index c44221c..3b717cd 100644
--- a/dmi.c
+++ b/dmi.c
@@ -19,7 +19,9 @@

/* strnlen is in POSIX but was a GNU extension up to glibc 2.10 */
#if (__GLIBC__ == 2 && __GLIBC_MINOR__ < 10) || __GLIBC__ < 2
+#ifndef _GNU_SOURCE
#define _GNU_SOURCE
+#endif /* !GNU_SOURCE */
#else
#define _POSIX_C_SOURCE 200809L
#endif

To view, visit change 47908. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I4f973927fc018510a3beaa6c4fa2f356c77c7a6e
Gerrit-Change-Number: 47908
Gerrit-PatchSet: 5
Gerrit-Owner: Edward O'Callaghan <quasisec@chromium.org>
Gerrit-Reviewer: Angel Pons <th3fanbus@gmail.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec@chromium.org>
Gerrit-Reviewer: Nico Huber <nico.h@gmx.de>
Gerrit-Reviewer: Sam McNally <sammc@google.com>
Gerrit-Reviewer: Stefan Reinauer <stefan.reinauer@coreboot.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-CC: Idwer Vollering <vidwer@gmail.com>
Gerrit-CC: Paul Menzel <paulepanter@users.sourceforge.net>
Gerrit-MessageType: merged