mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
build: Always use EXTERN_UNLESS_MAIN_MODULE pattern.
* common/util.h (EXTERN_UNLESS_MAIN_MODULE): Add the definion only here but now without the Norcroft-C. Change all other places where it gets defined. * common/iobuf.h (iobuf_debug_mode): Declare unconditionally as extern. * common/iobuf.c (iobuf_debug_mode): Define it here. * agent/gpg-agent.c (INCLUDED_BY_MAIN_MODULE): Define here and also in all main modules of all other programs. * g10/main.h: Put util.h before the local header files. -- This change is required for use with gcc/ld's LTO feature which does not allow common blocks. Further gcc 10 will make -fno-common the default and thus this chnage is always needed. What a pitty. Co-authored-by: Tomáš Mráz GnuPG-bug-id: 4831 Signed-off-by: Werner Koch <wk@gnupg.org> (cherry picked from commit 21d9bd8b87a9f793a106095e3838eb71825189d7) - Applied respective chnages also to gpg-card and keyboxd. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
5681b8eaa4
commit
6aff8a1328
@ -55,6 +55,7 @@
|
||||
|
||||
|
||||
/* A large struct name "opt" to keep global flags */
|
||||
EXTERN_UNLESS_MAIN_MODULE
|
||||
struct
|
||||
{
|
||||
unsigned int debug; /* Debug flags (DBG_foo_VALUE) */
|
||||
|
@ -48,6 +48,7 @@
|
||||
#endif
|
||||
#include <npth.h>
|
||||
|
||||
#define INCLUDED_BY_MAIN_MODULE 1
|
||||
#define GNUPG_COMMON_NEED_AFLOCAL
|
||||
#include "agent.h"
|
||||
#include <assuan.h> /* Malloc hooks and socket wrappers. */
|
||||
|
@ -43,6 +43,7 @@
|
||||
# include <windows.h> /* To initialize the sockets. fixme */
|
||||
#endif
|
||||
|
||||
#define INCLUDED_BY_MAIN_MODULE 1
|
||||
#include "agent.h"
|
||||
#include "../common/simple-pwquery.h"
|
||||
#include "../common/i18n.h"
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include <fcntl.h> /* for setmode() */
|
||||
#endif
|
||||
|
||||
#define INCLUDED_BY_MAIN_MODULE 1
|
||||
#include "agent.h"
|
||||
#include "../common/i18n.h"
|
||||
#include "../common/get-passphrase.h"
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
|
||||
#define INCLUDED_BY_MAIN_MODULE 1
|
||||
#include "agent.h"
|
||||
|
||||
|
||||
|
@ -123,6 +123,7 @@ struct close_cache_s
|
||||
typedef struct close_cache_s *close_cache_t;
|
||||
static close_cache_t close_cache;
|
||||
|
||||
int iobuf_debug_mode;
|
||||
|
||||
|
||||
#ifdef HAVE_W32_SYSTEM
|
||||
|
@ -249,14 +249,7 @@ struct iobuf_struct
|
||||
int subno;
|
||||
};
|
||||
|
||||
#ifndef EXTERN_UNLESS_MAIN_MODULE
|
||||
#if defined (__riscos__) && !defined (INCLUDED_BY_MAIN_MODULE)
|
||||
#define EXTERN_UNLESS_MAIN_MODULE extern
|
||||
#else
|
||||
#define EXTERN_UNLESS_MAIN_MODULE
|
||||
#endif
|
||||
#endif
|
||||
EXTERN_UNLESS_MAIN_MODULE int iobuf_debug_mode;
|
||||
extern int iobuf_debug_mode;
|
||||
|
||||
|
||||
/* Change the default size for all IOBUFs to KILOBYTE. This needs to
|
||||
|
@ -48,6 +48,14 @@
|
||||
#define GPG_ERR_KEYBOXD 317
|
||||
#endif /*GPG_ERROR_VERSION_NUMBER*/
|
||||
|
||||
#ifndef EXTERN_UNLESS_MAIN_MODULE
|
||||
# if !defined (INCLUDED_BY_MAIN_MODULE)
|
||||
# define EXTERN_UNLESS_MAIN_MODULE extern
|
||||
# else
|
||||
# define EXTERN_UNLESS_MAIN_MODULE
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Hash function used with libksba. */
|
||||
#define HASH_FNC ((void (*)(void *, const void*,size_t))gcry_md_write)
|
||||
|
||||
|
@ -55,6 +55,7 @@
|
||||
#endif /*HTTP_USE_GNUTLS*/
|
||||
|
||||
|
||||
#define INCLUDED_BY_MAIN_MODULE 1
|
||||
#define GNUPG_COMMON_NEED_AFLOCAL
|
||||
#include "dirmngr.h"
|
||||
|
||||
|
@ -77,6 +77,7 @@ struct fingerprint_list_s
|
||||
|
||||
|
||||
/* A large struct named "opt" to keep global flags. */
|
||||
EXTERN_UNLESS_MAIN_MODULE
|
||||
struct
|
||||
{
|
||||
unsigned int debug; /* debug flags (DBG_foo_VALUE) */
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include <config.h>
|
||||
#include <errno.h>
|
||||
|
||||
#define INCLUDED_BY_MAIN_MODULE 1
|
||||
#include "gpg.h"
|
||||
#include "packet.h"
|
||||
#include "keydb.h"
|
||||
|
@ -22,9 +22,9 @@
|
||||
|
||||
#include "../common/types.h"
|
||||
#include "../common/iobuf.h"
|
||||
#include "../common/util.h"
|
||||
#include "keydb.h"
|
||||
#include "keyedit.h"
|
||||
#include "../common/util.h"
|
||||
|
||||
/* It could be argued that the default cipher should be 3DES rather
|
||||
than AES128, and the default compression should be 0
|
||||
|
@ -30,14 +30,6 @@
|
||||
#include "../common/session-env.h"
|
||||
#include "../common/compliance.h"
|
||||
|
||||
#ifndef EXTERN_UNLESS_MAIN_MODULE
|
||||
/* Norcraft can't cope with common symbols */
|
||||
#if defined (__riscos__) && !defined (INCLUDED_BY_MAIN_MODULE)
|
||||
#define EXTERN_UNLESS_MAIN_MODULE extern
|
||||
#else
|
||||
#define EXTERN_UNLESS_MAIN_MODULE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Declaration of a keyserver spec type. The definition is found in
|
||||
../common/keyserver.h. */
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define INCLUDED_BY_MAIN_MODULE 1
|
||||
#include "gpg.h"
|
||||
|
||||
/* A unit test consists of one or more tests. Tests can be broken
|
||||
|
@ -32,7 +32,6 @@
|
||||
#include "../common/session-env.h"
|
||||
#include "../common/strlist.h"
|
||||
|
||||
|
||||
/* Debug values and macros. */
|
||||
#define DBG_MOUNT_VALUE 1 /* Debug mount or device stuff. */
|
||||
#define DBG_CRYPTO_VALUE 4 /* Debug low level crypto. */
|
||||
@ -48,6 +47,7 @@
|
||||
/* A large struct named "opt" to keep global flags. Note that this
|
||||
struct is used by g13 and g13-syshelp and thus some fields may only
|
||||
make sense for one of them. */
|
||||
EXTERN_UNLESS_MAIN_MODULE
|
||||
struct
|
||||
{
|
||||
unsigned int debug; /* Debug flags (DBG_foo_VALUE). */
|
||||
|
@ -31,6 +31,7 @@
|
||||
#endif
|
||||
#include <unistd.h>
|
||||
|
||||
#define INCLUDED_BY_MAIN_MODULE 1
|
||||
#include "g13-syshelp.h"
|
||||
|
||||
#include <gcrypt.h>
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include <fcntl.h>
|
||||
#include <npth.h>
|
||||
|
||||
#define INCLUDED_BY_MAIN_MODULE 1
|
||||
#include "g13.h"
|
||||
|
||||
#include <gcrypt.h>
|
||||
|
@ -46,6 +46,7 @@
|
||||
#endif
|
||||
#include <npth.h>
|
||||
|
||||
#define INCLUDED_BY_MAIN_MODULE 1
|
||||
#define GNUPG_COMMON_NEED_AFLOCAL
|
||||
#include "keyboxd.h"
|
||||
#include <assuan.h> /* Malloc hooks and socket wrappers. */
|
||||
|
@ -33,6 +33,7 @@
|
||||
|
||||
|
||||
/* A large struct name "opt" to keep global flags */
|
||||
EXTERN_UNLESS_MAIN_MODULE
|
||||
struct
|
||||
{
|
||||
unsigned int debug; /* Debug flags (DBG_foo_VALUE) */
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include <signal.h>
|
||||
#include <npth.h>
|
||||
|
||||
#define INCLUDED_BY_MAIN_MODULE 1
|
||||
#define GNUPG_COMMON_NEED_AFLOCAL
|
||||
#include "scdaemon.h"
|
||||
#include <ksba.h>
|
||||
|
@ -46,6 +46,7 @@
|
||||
|
||||
|
||||
/* A large struct name "opt" to keep global flags. */
|
||||
EXTERN_UNLESS_MAIN_MODULE
|
||||
struct
|
||||
{
|
||||
unsigned int debug; /* Debug flags (DBG_foo_VALUE). */
|
||||
|
@ -28,6 +28,8 @@
|
||||
#include <fcntl.h>
|
||||
/*#include <mcheck.h>*/
|
||||
|
||||
#define INCLUDED_BY_MAIN_MODULE 1
|
||||
|
||||
#include "gpgsm.h"
|
||||
#include <gcrypt.h>
|
||||
#include <assuan.h> /* malloc hooks */
|
||||
|
@ -53,6 +53,7 @@ struct keyserver_spec
|
||||
|
||||
|
||||
/* A large struct named "opt" to keep global flags. */
|
||||
EXTERN_UNLESS_MAIN_MODULE
|
||||
struct
|
||||
{
|
||||
unsigned int debug; /* debug flags (DBG_foo_VALUE) */
|
||||
|
@ -27,6 +27,8 @@
|
||||
# include <readline/readline.h>
|
||||
#endif /*HAVE_LIBREADLINE*/
|
||||
|
||||
#define INCLUDED_BY_MAIN_MODULE 1
|
||||
|
||||
#include "../common/util.h"
|
||||
#include "../common/status.h"
|
||||
#include "../common/i18n.h"
|
||||
|
@ -25,6 +25,7 @@
|
||||
|
||||
|
||||
/* We keep all global options in the structure OPT. */
|
||||
EXTERN_UNLESS_MAIN_MODULE
|
||||
struct
|
||||
{
|
||||
int interactive;
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#define INCLUDED_BY_MAIN_MODULE 1
|
||||
#include "../common/util.h"
|
||||
#include "../common/status.h"
|
||||
#include "../common/i18n.h"
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include <sys/stat.h>
|
||||
#include <dirent.h>
|
||||
|
||||
#define INCLUDED_BY_MAIN_MODULE 1
|
||||
#include "../common/util.h"
|
||||
#include "../common/init.h"
|
||||
#include "../common/sysutils.h"
|
||||
|
@ -30,6 +30,7 @@
|
||||
|
||||
|
||||
/* We keep all global options in the structure OPT. */
|
||||
EXTERN_UNLESS_MAIN_MODULE
|
||||
struct
|
||||
{
|
||||
int verbose;
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define INCLUDED_BY_MAIN_MODULE 1
|
||||
#include "gpgconf.h"
|
||||
#include "../common/i18n.h"
|
||||
#include "../common/sysutils.h"
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "../common/util.h"
|
||||
|
||||
/* We keep all global options in the structure OPT. */
|
||||
EXTERN_UNLESS_MAIN_MODULE
|
||||
struct
|
||||
{
|
||||
int verbose; /* Verbosity level. */
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#define INCLUDED_BY_MAIN_MODULE 1
|
||||
#include "../common/util.h"
|
||||
#include "../common/i18n.h"
|
||||
#include "../common/sysutils.h"
|
||||
|
@ -23,7 +23,9 @@
|
||||
#include "../common/util.h"
|
||||
#include "../common/strlist.h"
|
||||
|
||||
|
||||
/* We keep all global options in the structure OPT. */
|
||||
EXTERN_UNLESS_MAIN_MODULE
|
||||
struct
|
||||
{
|
||||
int verbose;
|
||||
|
Loading…
x
Reference in New Issue
Block a user