[PATCH 3/3] Drop superfluous global variable definitions

Ondřej Lysoněk olysonek at redhat.com
Mon Feb 3 15:09:32 GMT 2020


The only place where the EXTERN macro mechanism is used to define the
global variables 'portfd_is_socket', 'portfd_is_connected' and
'portfd_sock_addr' is minicom.c (by defining an empty EXTERN macro and
including the minicom.h header). The source file sysdep1_s.c already
defines these variables. The sysdep1_s.o object file is always linked
to minicom.o. Thus it is safe to drop the definitions from minicom.c
and only declare the variables in the minicom.h header.

This fixes linking with gcc 10 which uses -fno-common by default,
disallowing multiple global variable definitions.
---
 src/minicom.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/minicom.h b/src/minicom.h
index 0f9693b..1e7cb8c 100644
--- a/src/minicom.h
+++ b/src/minicom.h
@@ -113,9 +113,9 @@ EXTERN char *dial_user;     /* Our username there */
 EXTERN char *dial_pass;     /* Our password */
 
 #ifdef USE_SOCKET
-EXTERN int portfd_is_socket;	/* File descriptor is a unix socket */
-EXTERN int portfd_is_connected;	/* 1 if the socket is connected */
-EXTERN struct sockaddr_un portfd_sock_addr;	/* the unix socket address */
+extern int portfd_is_socket;	/* File descriptor is a unix socket */
+extern int portfd_is_connected;	/* 1 if the socket is connected */
+extern struct sockaddr_un portfd_sock_addr;	/* the unix socket address */
 #define portfd_connected ((portfd_is_socket && !portfd_is_connected) \
                            ? -1 : portfd)
 #else
-- 
2.24.1




More information about the minicom-devel mailing list