mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-07-13 03:09:51 +03:00
Selectively apply _GNU_SOURCE to fix implicit function declaration errors. ``` In file included from command.c:14: command.c: In function 'handle_localecho_command': port.h:115:20: error: implicit declaration of function 'strcasecmp'; did you mean 'wcscasecmp'? [-Wimplicit-function-declaration] 115 | # define cstrcmp strcasecmp | ^~~~~~~~~~ command.c:182:14: note: in expansion of macro 'cstrcmp' 182 | else if (cstrcmp(args->data + offset, "on") == 0) local_echo(1); | ^~~~~~~ command.c: In function 'do_file_load': command.c:551:29: error: implicit declaration of function 'strdup'; did you mean 'strcmp'? [-Wimplicit-function-declaration] 551 | *savename = strdup( file->name ); | ^~~~~~ | strcmp command.c:551:27: error: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion] 551 | *savename = strdup( file->name ); | ^ ```
98 lines
2.1 KiB
Diff
98 lines
2.1 KiB
Diff
Define macros to fix implicit function declaration errors.
|
|
---
|
|
--- a/src/expr.c
|
|
+++ b/src/expr.c
|
|
@@ -13,6 +13,8 @@
|
|
* Parses and evaluates expressions.
|
|
********************************************************************/
|
|
|
|
+#define _GNU_SOURCE
|
|
+
|
|
#include "tfconfig.h"
|
|
#include <math.h>
|
|
#include <limits.h>
|
|
--- a/src/history.c
|
|
+++ b/src/history.c
|
|
@@ -13,6 +13,8 @@
|
|
* Handles text queuing and file I/O for logs. *
|
|
****************************************************************/
|
|
|
|
+#define _GNU_SOURCE
|
|
+
|
|
#include <limits.h>
|
|
#include "tfconfig.h"
|
|
#include "port.h"
|
|
--- a/src/pattern.c
|
|
+++ b/src/pattern.c
|
|
@@ -10,6 +10,8 @@
|
|
* Regexp wrappers and glob pattern matching.
|
|
*/
|
|
|
|
+#define _GNU_SOURCE
|
|
+
|
|
#include "tfconfig.h"
|
|
#if HAVE_LOCALE_H
|
|
# include <locale.h>
|
|
--- a/src/port.h
|
|
+++ b/src/port.h
|
|
@@ -6,6 +6,8 @@
|
|
* General Public License. See the file "COPYING" for details.
|
|
************************************************************************/
|
|
|
|
+#define _GNU_SOURCE
|
|
+
|
|
#ifndef PORT_H
|
|
#define PORT_H
|
|
|
|
@@ -86,6 +88,7 @@
|
|
#if STDC_HEADERS
|
|
# include <stdlib.h>
|
|
# include <string.h>
|
|
+# include <strings.h> /* strcasecmp() */
|
|
#else
|
|
extern void free();
|
|
# if HAVE_MEMORY_H
|
|
--- a/src/signals.c
|
|
+++ b/src/signals.c
|
|
@@ -8,6 +8,8 @@
|
|
|
|
/* Signal handling, core dumps, job control, and interactive shells */
|
|
|
|
+#define _POSIX_C_SOURCE 199309L /* for siginfo_t */
|
|
+
|
|
#include "tfconfig.h"
|
|
#include <signal.h>
|
|
#include <setjmp.h>
|
|
--- a/src/socket.c
|
|
+++ b/src/socket.c
|
|
@@ -16,6 +16,8 @@
|
|
* Autologin handled here.
|
|
***************************************************************/
|
|
|
|
+#define _POSIX_C_SOURCE 199309L /* for siginfo_t */
|
|
+
|
|
#include "tfconfig.h"
|
|
#include <sys/types.h>
|
|
#if HAVE_SYS_SELECT_H
|
|
--- a/src/util.c
|
|
+++ b/src/util.c
|
|
@@ -15,6 +15,8 @@
|
|
* Mail checker
|
|
*/
|
|
|
|
+#define _GNU_SOURCE
|
|
+
|
|
#include "tfconfig.h"
|
|
#if HAVE_LOCALE_H
|
|
# include <locale.h>
|
|
--- a/src/variable.c
|
|
+++ b/src/variable.c
|
|
@@ -10,6 +10,8 @@
|
|
* Internal and environment variables *
|
|
**************************************/
|
|
|
|
+#define _GNU_SOURCE /* timercmp() */
|
|
+
|
|
#include "tfconfig.h"
|
|
#include "port.h"
|
|
#include "tf.h"
|