Mercurial > hg > xemacs-beta
changeset 5825:5d5aeb79edb4
Fix build with g++.
This patch fixes various issues that cause build failures with g++ 4.8.3.
See <CAHCOHQ=6yKcjQELvG8FOHXcWVez+HufUWb4FdcJKpUNhm+8B=g@mail.gmail.com> in
xemacs-patches.
author | Jerry James <james@xemacs.org> |
---|---|
date | Thu, 06 Nov 2014 09:34:06 -0700 |
parents | 6928877dbc26 |
children | 98681721a588 a3234d587dc2 |
files | src/ChangeLog src/ExternalClient-Xlib.c src/database.c src/lisp.h src/sysdll.c src/tls.c |
diffstat | 6 files changed, 46 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog Sat Oct 25 15:59:31 2014 +0200 +++ b/src/ChangeLog Thu Nov 06 09:34:06 2014 -0700 @@ -1,3 +1,18 @@ +2014-11-05 Jerry James <james@xemacs.org> + + * ExternalClient-Xlib.c (ExternalClientEventHandler): Cast integer + to long before casting to XPointer, which may be larger than int. + * database.c: Use BEGIN_C_DECLS/END_C_DECLS around dbm definitions. + * lisp.h (ALLOCA): Use NULL instead of (void) 0 to placate g++. + (MALLOC_OR_ALLOCA): Ditto. + (XSTRING_LENGTH): Use an explicit temporary with NEW_GC so g++ 4.8 + won't create an uninitialized anonymous temporary. + (XSTRING_DATA): Ditto. + * sysdll.c: Check whether HAVE_LTDL is defined, not its value. + * tls.c (tls_open): Add typecast to xmalloc call in the nss, + gnutls, and openssl versions to satisfy g++. In the gnutls version, + use gnutls_certificate_type_t appropriately. + 2014-10-25 Michael Sperber <mike@xemacs.org> * fontcolor-x.c (x_font_instance_truename):
--- a/src/ExternalClient-Xlib.c Sat Oct 25 15:59:31 2014 +0200 +++ b/src/ExternalClient-Xlib.c Thu Nov 06 09:34:06 2014 -0700 @@ -134,9 +134,10 @@ else return; XFindContext(display, win, focus_context, ¤t_focus); - if (focus_status != (int) current_focus) + if ((XPointer) (long) focus_status != current_focus) { - XSaveContext(display, win, focus_context, (XPointer) focus_status); + XSaveContext(display, win, focus_context, + (XPointer) (long) focus_status); extw_send_notify_3(display, win, focus_status ? extw_notify_focus_in : extw_notify_focus_out, 0, 0, 0);
--- a/src/database.c Sat Oct 25 15:59:31 2014 +0200 +++ b/src/database.c Thu Nov 06 09:34:06 2014 -0700 @@ -83,6 +83,7 @@ #endif /* HAVE_BERKELEY_DB */ #ifdef HAVE_DBM +BEGIN_C_DECLS # ifdef TRUST_NDBM_H_PROTOTYPES # include NDBM_H_FILE # else /* not TRUST_NDBM_H_PROTOTYPES */ @@ -91,10 +92,6 @@ using C++, since they are of the form `datum dbm_firstkey()', without any args given. */ -#if defined(__cplusplus) || defined(c_plusplus) -extern "C" { -#endif - /* Parameters to dbm_store for simple insertion or replacement. */ #define DBM_INSERT 0 #define DBM_REPLACE 1 @@ -119,11 +116,9 @@ DBM *dbm_open(const char *, int, mode_t); int dbm_store(DBM *, datum, datum, int); -#if defined(__cplusplus) || defined(c_plusplus) -} -#endif +# endif /* (not) TRUST_NDBM_H_PROTOTYPES */ +END_C_DECLS -# endif /* (not) TRUST_NDBM_H_PROTOTYPES */ Lisp_Object Qdbm; #endif /* HAVE_DBM */
--- a/src/lisp.h Sat Oct 25 15:59:31 2014 +0200 +++ b/src/lisp.h Thu Nov 06 09:34:06 2014 -0700 @@ -1368,7 +1368,7 @@ __temp_alloca_size__ = (size), \ __temp_alloca_size__ > MAX_ALLOCA_VS_C_ALLOCA ? \ xemacs_c_alloca (__temp_alloca_size__) : \ - (need_to_check_c_alloca ? xemacs_c_alloca (0) : (void) 0, \ + (need_to_check_c_alloca ? xemacs_c_alloca (0) : NULL, \ alloca (__temp_alloca_size__))) /* Version of ALLOCA() that is guaranteed to work inside of function calls @@ -1402,7 +1402,7 @@ __temp_alloca_size__ = (size), \ __temp_alloca_size__ > MAX_ALLOCA_VS_MALLOC ? \ xmalloc_and_record_unwind (__temp_alloca_size__) : \ - (need_to_check_c_alloca ? xemacs_c_alloca (0) : (void) 0, \ + (need_to_check_c_alloca ? xemacs_c_alloca (0) : NULL, \ alloca (__temp_alloca_size__))) /* -------------- convenience functions for memory allocation ------------- */ @@ -2643,13 +2643,27 @@ #ifdef NEW_GC #define STRING_DATA_OBJECT(s) ((s)->data_object) #define XSTRING_DATA_OBJECT(s) (STRING_DATA_OBJECT (XSTRING (s))) -#define XSTRING_LENGTH(s) (XSTRING_DATA_SIZE (XSTRING (s))) +DECLARE_INLINE_HEADER ( +Bytecount +XSTRING_LENGTH (Lisp_Object s) +) +{ + Lisp_String *str = XSTRING (s); + return XSTRING_DATA_SIZE (str); +} #else /* not NEW_GC */ #define XSTRING_LENGTH(s) (XSTRING (s)->size_) #endif /* not NEW_GC */ #define XSTRING_PLIST(s) (XSTRING (s)->plist) #ifdef NEW_GC -#define XSTRING_DATA(s) (XSTRING_DATA_DATA (XSTRING (s))) +DECLARE_INLINE_HEADER ( +Ibyte * +XSTRING_DATA (Lisp_Object s) +) +{ + Lisp_String *str = XSTRING (s); + return XSTRING_DATA_DATA (str); +} #else /* not NEW_GC */ #define XSTRING_DATA(s) (XSTRING (s)->data_ + 0) #endif /* not NEW_GC */
--- a/src/sysdll.c Sat Oct 25 15:59:31 2014 +0200 +++ b/src/sysdll.c Thu Nov 06 09:34:06 2014 -0700 @@ -454,7 +454,7 @@ NSLinkEditError (&c, &errorNumber, &fileNameWithError, &errorString); return build_extstring (errorString, Qerror_message_encoding); } -#elif HAVE_LTDL +#elif defined(HAVE_LTDL) /* Libtool's libltdl */ #include <ltdl.h>
--- a/src/tls.c Sat Oct 25 15:59:31 2014 +0200 +++ b/src/tls.c Thu Nov 06 09:34:06 2014 -0700 @@ -122,7 +122,7 @@ } /* Create the socket */ - nspr = xmalloc (sizeof (*nspr)); + nspr = (tls_state_t *) xmalloc (sizeof (*nspr)); nspr->tls_refcount = 2; nspr->tls_file_desc = SSL_ImportFD (nss_model, PR_OpenTCPSocket (addr->sa_family)); @@ -507,7 +507,7 @@ setsockopt (s, IPPROTO_TCP, TCP_NODELAY, &val, sizeof(val)); /* Create the state object */ - gnutls = xmalloc (sizeof (*gnutls)); + gnutls = (tls_state_t *) xmalloc (sizeof (*gnutls)); gnutls->tls_refcount = 2; /* Initialize the session object */ @@ -615,7 +615,9 @@ gnutls_datum_t msg; #ifdef HAVE_GNUTLS_CERTIFICATE_VERIFICATION_STATUS_PRINT - int type = gnutls_certificate_type_get (gnutls->tls_session); + gnutls_certificate_type_t type; + + type = gnutls_certificate_type_get (gnutls->tls_session); err = gnutls_certificate_verification_status_print (status, type, &msg, 0); #else @@ -966,7 +968,7 @@ setsockopt (s, IPPROTO_TCP, TCP_NODELAY, &val, sizeof(val)); /* Create the state object */ - openssl = xmalloc (sizeof (*openssl)); + openssl = (tls_state_t *) xmalloc (sizeof (*openssl)); openssl->tls_refcount = 2; /* Create the connection object */