[Replicant] [libsamsung-ril] [PATCH 8/8] Add missing stdio.h include for asprintf
Denis 'GNUtoo' Carikli
GNUtoo at cyberdimension.org
Fri Aug 21 04:07:04 UTC 2020
Without that fix we have the following with clang and
-Wimplicit-function-declaration when building with Guix:
network.c:219:2: warning: implicit declaration of function 'asprintf'
is invalid in C99 [-Wimplicit-function-declaration]
asprintf(®istration[0], "%d", status);
^
The definition of _GNU_SOURCE is required to remove the warning, and it is
also mentioned in the asprintf man in the SYNOPSIS:
SYNOPSIS
#define _GNU_SOURCE /* See feature_test_macros(7) */
#include <stdio.h>
int asprintf(char **strp, const char *fmt, ...);
[...]
With that fix, libsamsung-ril still compiles fine without any warnings
under Replicant 6.0.
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo at cyberdimension.org>
---
data.c | 2 ++
misc.c | 2 ++
network.c | 2 ++
ss.c | 3 +++
4 files changed, 9 insertions(+)
diff --git a/data.c b/data.c
index dd39926..247b00d 100644
--- a/data.c
+++ b/data.c
@@ -18,6 +18,8 @@
* along with Samsung-RIL. If not, see <http://www.gnu.org/licenses/>.
*/
+#define _GNU_SOURCE
+#include <stdio.h>
#include <stdlib.h>
#include <arpa/inet.h>
diff --git a/misc.c b/misc.c
index e9ec767..bece1c1 100644
--- a/misc.c
+++ b/misc.c
@@ -18,6 +18,8 @@
* along with Samsung-RIL. If not, see <http://www.gnu.org/licenses/>.
*/
+#define _GNU_SOURCE
+#include <stdio.h>
#include <stdlib.h>
#define LOG_TAG "RIL"
diff --git a/network.c b/network.c
index 1ce903e..e24be5e 100644
--- a/network.c
+++ b/network.c
@@ -21,6 +21,8 @@
* along with Samsung-RIL. If not, see <http://www.gnu.org/licenses/>.
*/
+#define _GNU_SOURCE
+#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
diff --git a/ss.c b/ss.c
index 51aa46d..15d2b55 100644
--- a/ss.c
+++ b/ss.c
@@ -18,6 +18,9 @@
* along with Samsung-RIL. If not, see <http://www.gnu.org/licenses/>.
*/
+#define _GNU_SOURCE
+#include <stdio.h>
+
#define LOG_TAG "RIL-SS"
#include <utils/Log.h>
--
2.28.0
More information about the Replicant
mailing list