From 188adb1d6a5ce4cd322d26ab1740d513ded3cd21 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Thu, 23 Oct 2008 02:37:21 +0000 Subject: [PATCH] reverse patch #6948. one of the new gcc attributes seems to be causing trouble. --- gtk/actions.c | 2 ++ libtransmission/Makefile.am | 1 - libtransmission/blocklist.h | 29 ++++++++++++----------- libtransmission/handshake.h | 8 +++---- libtransmission/peer-io.h | 31 +++++++++++++----------- libtransmission/peer-mgr.h | 9 ++++--- libtransmission/session.h | 10 ++++++-- libtransmission/tr-gnuc.h | 40 ------------------------------- libtransmission/transmission.h | 5 ++-- libtransmission/utils.h | 43 ++++++++++++++++++++++++++++++---- 10 files changed, 92 insertions(+), 86 deletions(-) diff --git a/gtk/actions.c b/gtk/actions.c index a7fafdc44..a0a4b72f0 100644 --- a/gtk/actions.c +++ b/gtk/actions.c @@ -21,6 +21,8 @@ #include "lock.h" #include "logo.h" +#define UNUSED G_GNUC_UNUSED + static TrCore * myCore = NULL; static GtkActionGroup * myGroup = NULL; diff --git a/libtransmission/Makefile.am b/libtransmission/Makefile.am index c257c75f0..bc3a3ce00 100644 --- a/libtransmission/Makefile.am +++ b/libtransmission/Makefile.am @@ -88,7 +88,6 @@ noinst_HEADERS = \ torrent.h \ tracker.h \ tr-getopt.h \ - tr-gnuc.h \ transmission.h \ trevent.h \ upnp.h \ diff --git a/libtransmission/blocklist.h b/libtransmission/blocklist.h index 1c4a9a38b..7b285b34d 100644 --- a/libtransmission/blocklist.h +++ b/libtransmission/blocklist.h @@ -13,31 +13,32 @@ #ifndef TR_BLOCKLIST_H #define TR_BLOCKLIST_H -#include "tr-gnuc.h" - struct in_addr; typedef struct tr_blocklist tr_blocklist; tr_blocklist* _tr_blocklistNew( const char * filename, - int isEnabled ) TR_GNUC_MALLOC; + int isEnabled ); -int _tr_blocklistExists ( const tr_blocklist * blocklist ); +int _tr_blocklistExists( const tr_blocklist * ); -const char* _tr_blocklistGetFilename ( const tr_blocklist * blocklist ); +const char* _tr_blocklistGetFilename( const tr_blocklist * ); -int _tr_blocklistGetRuleCount( const tr_blocklist * blocklist ); +int _tr_blocklistGetRuleCount( const tr_blocklist * ); -void _tr_blocklistFree ( tr_blocklist * blocklist ); +void _tr_blocklistFree( tr_blocklist * ); -int _tr_blocklistIsEnabled ( tr_blocklist * blocklist ); +int _tr_blocklistIsEnabled( tr_blocklist * ); -void _tr_blocklistSetEnabled ( tr_blocklist * blocklist, - int isEnabled ); +void _tr_blocklistSetEnabled( tr_blocklist *, + int isEnabled ); -int _tr_blocklistHasAddress ( tr_blocklist * blocklist, - const struct in_addr * addr ); +int _tr_blocklistHasAddress( + tr_blocklist *, + const struct + in_addr * addr ); -int _tr_blocklistSetContent ( tr_blocklist * blocklist, - const char * filename ); +int _tr_blocklistSetContent( + tr_blocklist *, + const char * filename ); #endif diff --git a/libtransmission/handshake.h b/libtransmission/handshake.h index f1d8f8a1f..9f9c529aa 100644 --- a/libtransmission/handshake.h +++ b/libtransmission/handshake.h @@ -29,12 +29,12 @@ typedef int ( *handshakeDoneCB )( struct tr_handshake * handshake, tr_handshake * tr_handshakeNew( struct tr_peerIo * io, tr_encryption_mode encryptionMode, handshakeDoneCB doneCB, - void * doneUserData ) - TR_GNUC_MALLOC; + void * doneUserData ); const struct in_addr * tr_handshakeGetAddr( - const struct tr_handshake * handshake, - uint16_t * setme_port ); + const struct tr_handshake * handshake, + uint16_t + * setme_port ); void tr_handshakeAbort( tr_handshake * handshake ); diff --git a/libtransmission/peer-io.h b/libtransmission/peer-io.h index ca56f69fc..e04069aec 100644 --- a/libtransmission/peer-io.h +++ b/libtransmission/peer-io.h @@ -17,8 +17,6 @@ *** **/ -#include "tr-gnuc.h" - struct in_addr; struct evbuffer; struct bufferevent; @@ -30,17 +28,17 @@ typedef struct tr_peerIo tr_peerIo; *** **/ -tr_peerIo* tr_peerIoNewOutgoing( struct tr_handle * session, - const struct in_addr * addr, - int port, - const uint8_t * torrentHash ) - TR_GNUC_MALLOC; +tr_peerIo* tr_peerIoNewOutgoing( + struct tr_handle * session, + const struct in_addr * addr, + int port, + const uint8_t * + torrentHash ); -tr_peerIo* tr_peerIoNewIncoming( struct tr_handle * session, - const struct in_addr * addr, - uint16_t port, - int socket ) - TR_GNUC_MALLOC; +tr_peerIo* tr_peerIoNewIncoming( struct tr_handle * session, + const struct in_addr * addr, + uint16_t port, + int socket ); void tr_peerIoFree( tr_peerIo * io ); @@ -70,13 +68,13 @@ const char* tr_peerIoAddrStr( const struct in_addr * addr, const char* tr_peerIoGetAddrStr( const tr_peerIo * io ); const struct in_addr*tr_peerIoGetAddress( const tr_peerIo * io, - uint16_t * port ); + uint16_t * port ); const uint8_t* tr_peerIoGetTorrentHash( tr_peerIo * io ); int tr_peerIoHasTorrentHash( const tr_peerIo * io ); -void tr_peerIoSetTorrentHash( tr_peerIo * io, +void tr_peerIoSetTorrentHash( tr_peerIo * io, const uint8_t * hash ); int tr_peerIoReconnect( tr_peerIo * io ); @@ -123,6 +121,11 @@ void tr_peerIoSetIOFuncs( tr_peerIo * io, int tr_peerIoWantsBandwidth( const tr_peerIo * io, tr_direction ); +#if 0 +void tr_peerIoTryRead( tr_peerIo * io ); + +#endif + void tr_peerIoWrite( tr_peerIo * io, const void * writeme, size_t writemeLen ); diff --git a/libtransmission/peer-mgr.h b/libtransmission/peer-mgr.h index 154d43027..9ef34639d 100644 --- a/libtransmission/peer-mgr.h +++ b/libtransmission/peer-mgr.h @@ -15,8 +15,11 @@ #include /* uint16_t */ -#include "net.h" /* struct in_addr */ -#include "tr-gnuc.h" +#ifdef WIN32 + #include /* struct in_addr */ +#else + #include /* struct in_addr */ +#endif struct in_addr; struct tr_handle; @@ -43,7 +46,7 @@ tr_pex; int tr_pexCompare( const void * a, const void * b ); -tr_peerMgr* tr_peerMgrNew( struct tr_handle * ) TR_GNUC_MALLOC; +tr_peerMgr* tr_peerMgrNew( struct tr_handle * ); void tr_peerMgrFree( tr_peerMgr * manager ); diff --git a/libtransmission/session.h b/libtransmission/session.h index 7bd0a7dd9..18cd0d8f7 100644 --- a/libtransmission/session.h +++ b/libtransmission/session.h @@ -27,7 +27,13 @@ #define TR_NAME "Transmission" -#include "tr-gnuc.h" +#ifndef UNUSED + #ifdef __GNUC__ + #define UNUSED __attribute__ ( ( unused ) ) + #else + #define UNUSED + #endif +#endif enum { @@ -41,7 +47,7 @@ enum typedef enum { TR_NET_OK, TR_NET_ERROR, TR_NET_WAIT } tr_tristate_t; -uint8_t* tr_peerIdNew( void ) TR_GNUC_MALLOC; +uint8_t* tr_peerIdNew( void ); const uint8_t* tr_getPeerId( void ); diff --git a/libtransmission/tr-gnuc.h b/libtransmission/tr-gnuc.h index a7cbf6436..e69de29bb 100644 --- a/libtransmission/tr-gnuc.h +++ b/libtransmission/tr-gnuc.h @@ -1,40 +0,0 @@ -#ifndef TR_GNUC_H -#define TR_GNUC_H 1 - -#ifndef UNUSED - #ifdef __GNUC__ - #define UNUSED __attribute__ ( ( unused ) ) - #else - #define UNUSED - #endif -#endif - -#ifndef TR_GNUC_PRINTF - #ifdef __GNUC__ - #define TR_GNUC_PRINTF( fmt,\ - args ) __attribute__ ( ( format ( printf, fmt,\ - args ) ) ) - #else - #define TR_GNUC_PRINTF( fmt, args ) - #endif -#endif - -#ifndef TR_GNUC_NULL_TERMINATED - #if __GNUC__ >= 4 - #define TR_GNUC_NULL_TERMINATED __attribute__ ( ( __sentinel__ ) ) - #else - #define TR_GNUC_NULL_TERMINATED - #endif -#endif - -#if __GNUC__ > 2 || ( __GNUC__ == 2 && __GNUC_MINOR__ >= 96 ) - #define TR_GNUC_CONST __attribute__ ( ( __const ) ) - #define TR_GNUC_PURE __attribute__ ( ( __pure__ ) ) - #define TR_GNUC_MALLOC __attribute__ ( ( __malloc__ ) ) -#else - #define TR_GNUC_CONST - #define TR_GNUC_PURE - #define TR_GNUC_MALLOC -#endif - -#endif diff --git a/libtransmission/transmission.h b/libtransmission/transmission.h index c118b9c8f..91c620fac 100644 --- a/libtransmission/transmission.h +++ b/libtransmission/transmission.h @@ -36,7 +36,6 @@ extern "C" { #endif -#include "tr-gnuc.h" #include "version.h" #include /* uintN_t */ @@ -728,7 +727,7 @@ tr_ctorMode; struct tr_benc; -tr_ctor* tr_ctorNew( const tr_handle * handle ) TR_GNUC_MALLOC; +tr_ctor* tr_ctorNew( const tr_handle * handle ); void tr_ctorFree( tr_ctor * ctor ); @@ -810,7 +809,7 @@ int tr_torrentParse( const tr_handle * handle, TR_EDUPLICATE if there's already a matching torrent object. */ tr_torrent * tr_torrentNew( tr_handle * handle, const tr_ctor * ctor, - int * setmeError ) TR_GNUC_MALLOC; + int * setmeError ); /** @} */ diff --git a/libtransmission/utils.h b/libtransmission/utils.h index 2fa9a0a17..f5dfae3df 100644 --- a/libtransmission/utils.h +++ b/libtransmission/utils.h @@ -47,7 +47,40 @@ extern "C" { #define TRUE 1 #endif -#include "tr-gnuc.h" +#ifndef UNUSED + #ifdef __GNUC__ + #define UNUSED __attribute__ ( ( unused ) ) + #else + #define UNUSED + #endif +#endif + +#ifndef TR_GNUC_PRINTF + #ifdef __GNUC__ + #define TR_GNUC_PRINTF( fmt,\ + args ) __attribute__ ( ( format ( printf, fmt,\ + args ) ) ) + #else + #define TR_GNUC_PRINTF( fmt, args ) + #endif +#endif + +#ifndef TR_GNUC_NULL_TERMINATED + #if __GNUC__ >= 4 + #define TR_GNUC_NULL_TERMINATED __attribute__ ( ( __sentinel__ ) ) + #else + #define TR_GNUC_NULL_TERMINATED + #endif +#endif + +#if __GNUC__ > 2 || ( __GNUC__ == 2 && __GNUC_MINOR__ >= 96 ) + #define TR_GNUC_PURE __attribute__ ( ( __pure__ ) ) + #define TR_GNUC_MALLOC __attribute__ ( ( __malloc__ ) ) +#else + #define TR_GNUC_PURE + #define TR_GNUC_MALLOC +#endif + /*** **** @@ -159,10 +192,10 @@ void tr_timevalMsec( uint64_t milliseconds, /* return the current date in milliseconds */ -uint64_t tr_date( void ) TR_GNUC_CONST; +uint64_t tr_date( void ); /* wait the specified number of milliseconds */ -void tr_wait( uint64_t delay_milliseconds ) TR_GNUC_CONST; +void tr_wait( uint64_t delay_milliseconds ); /*** **** @@ -229,7 +262,7 @@ int tr_snprintf( char * buf, const char * fmt, ... ) TR_GNUC_PRINTF( 3, 4 ); -const char* tr_strerror( int ) TR_GNUC_CONST; +const char* tr_strerror( int ); char* tr_strstrip( char * str ); @@ -326,7 +359,7 @@ tr_bitfield* tr_bitfieldOr( tr_bitfield*, && tr_bitfieldHasFast( bitfield, nth ) ) double tr_getRatio( double numerator, - double denominator ) TR_GNUC_CONST; + double denominator ); #ifdef __cplusplus } -- 2.40.0