From 3078abb7e2e6de2b391eef40117bf4a95ce1c52f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
Date: Sat, 23 Mar 2024 14:40:39 +0200
Subject: [PATCH] build: require gnu11 and guarantee assert.h included from
 apk_defines.h

in preparation to use static_assert
---
 Make.rules        | 2 +-
 meson.build       | 2 +-
 src/adb.c         | 1 -
 src/apk.c         | 1 -
 src/apk_crypto.h  | 1 -
 src/apk_defines.h | 1 +
 src/app_mkpkg.c   | 1 -
 src/commit.c      | 1 -
 src/print.c       | 1 -
 9 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/Make.rules b/Make.rules
index 13e685da..d87b435f 100644
--- a/Make.rules
+++ b/Make.rules
@@ -71,7 +71,7 @@ INSTALL		:= install
 INSTALLDIR	:= $(INSTALL) -d
 
 CFLAGS		?= -g -O2
-CFLAGS_ALL	:= -Wall -Wstrict-prototypes -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -std=gnu99 -fPIC
+CFLAGS_ALL	:= -Wall -Wstrict-prototypes -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -std=gnu11 -fPIC
 CFLAGS_ALL	+= $(CFLAGS)
 
 LDFLAGS		?= -g
diff --git a/meson.build b/meson.build
index 7827501e..7f935f68 100644
--- a/meson.build
+++ b/meson.build
@@ -1,7 +1,7 @@
 project(
 	'apk-tools',
 	['c'],
-	default_options : ['c_std=gnu99', 'optimization=2'],
+	default_options : ['c_std=gnu11', 'optimization=2'],
 	version: run_command('./get-version.sh', check: true).stdout().strip(),
 	meson_version: '>=0.55'
 )
diff --git a/src/adb.c b/src/adb.c
index fe614afa..2781821c 100644
--- a/src/adb.c
+++ b/src/adb.c
@@ -1,7 +1,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <assert.h>
 #include <errno.h>
 #include <sys/mman.h>
 #include <sys/stat.h>
diff --git a/src/apk.c b/src/apk.c
index c06801f0..ee6f643a 100644
--- a/src/apk.c
+++ b/src/apk.c
@@ -11,7 +11,6 @@
 #include <fcntl.h>
 #include <ctype.h>
 #include <errno.h>
-#include <assert.h>
 #include <signal.h>
 #include <stdarg.h>
 #include <stdlib.h>
diff --git a/src/apk_crypto.h b/src/apk_crypto.h
index 18bf3b54..287d46f5 100644
--- a/src/apk_crypto.h
+++ b/src/apk_crypto.h
@@ -9,7 +9,6 @@
 #ifndef APK_CRYPTO_H
 #define APK_CRYPTO_H
 
-#include <assert.h>
 #include <string.h>
 #include <openssl/evp.h>
 #include "apk_defines.h"
diff --git a/src/apk_defines.h b/src/apk_defines.h
index d4bab11d..4fd708b9 100644
--- a/src/apk_defines.h
+++ b/src/apk_defines.h
@@ -10,6 +10,7 @@
 #ifndef APK_DEFINES_H
 #define APK_DEFINES_H
 
+#include <assert.h>
 #include <endian.h>
 #include <stdint.h>
 #include <stddef.h>
diff --git a/src/app_mkpkg.c b/src/app_mkpkg.c
index 321a4e12..2d9b9d70 100644
--- a/src/app_mkpkg.c
+++ b/src/app_mkpkg.c
@@ -11,7 +11,6 @@
 #include <errno.h>
 #include <stdio.h>
 #include <fcntl.h>
-#include <assert.h>
 #include <unistd.h>
 #include <sys/stat.h>
 
diff --git a/src/commit.c b/src/commit.c
index 57c58417..63ad9416 100644
--- a/src/commit.c
+++ b/src/commit.c
@@ -7,7 +7,6 @@
  * SPDX-License-Identifier: GPL-2.0-only
  */
 
-#include <assert.h>
 #include <limits.h>
 #include <stdint.h>
 #include <unistd.h>
diff --git a/src/print.c b/src/print.c
index dab98862..e20c7086 100644
--- a/src/print.c
+++ b/src/print.c
@@ -7,7 +7,6 @@
  * SPDX-License-Identifier: GPL-2.0-only
  */
 
-#include <assert.h>
 #include <stdio.h>
 #include <stdarg.h>
 #include <stdlib.h>
-- 
GitLab