[PATCH 3/3] Drop superfluous global variable definitions

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


The only place where the EXTERN macro mechanism is used to define the
global variables 'portfd_is_socket' and 'portfd_is_connected' 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 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/minicom.h b/src/minicom.h
index e3a68ba..a94d123 100644
--- a/src/minicom.h
+++ b/src/minicom.h
@@ -122,8 +122,8 @@ enum Socket_type {
   Socket_type_unix = 1,
   Socket_type_tcp = 2,
 };
-EXTERN enum Socket_type portfd_is_socket;	/* File descriptor is a unix socket */
-EXTERN int portfd_is_connected;	/* 1 if the socket is connected */
+extern enum Socket_type portfd_is_socket;	/* File descriptor is a unix socket */
+extern int portfd_is_connected;	/* 1 if the socket is connected */
 static inline int portfd_connected(void)
 {
   return (portfd_is_socket && !portfd_is_connected) ? -1 : portfd;
-- 
2.24.1




More information about the minicom-devel mailing list