From: Viktor Szakats Date: Sun, 9 Feb 2025 17:12:14 +0000 (+0100) Subject: tidy-up: delete, comment or scope C macros reported unused X-Git-Tag: curl-8_13_0~482 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=784a8ec2c1a3cc4bd676077a28a0d5f6ee7786a5;p=thirdparty%2Fcurl.git tidy-up: delete, comment or scope C macros reported unused To reduce the number `-Wunused-macro` compiler warnings: - delete unused macros. - comment out unused macro that are part of a set. - move macros into the scope they are used. This may be useful to enable by default, but there are tricky cases that I didn't manage to fix and paused the effort. E.g. internal features checks in `openssl.c`. There is more, once those are fixed. Closes #16279 --- diff --git a/CMake/PickyWarnings.cmake b/CMake/PickyWarnings.cmake index 15f771b3e3..6f6d0b9734 100644 --- a/CMake/PickyWarnings.cmake +++ b/CMake/PickyWarnings.cmake @@ -113,6 +113,7 @@ if(PICKY_COMPILER) -Wtype-limits # clang 2.7 gcc 4.3 -Wunreachable-code # clang 2.7 gcc 4.1 # -Wunused-macros # clang 2.7 gcc 4.1 # Not practical + # -Wno-error=unused-macros # clang 2.7 gcc 4.1 -Wunused-parameter # clang 2.7 gcc 4.1 -Wvla # clang 2.8 gcc 4.3 ) diff --git a/docs/examples/Makefile.am b/docs/examples/Makefile.am index d67b4dd6c4..02ba20b99f 100644 --- a/docs/examples/Makefile.am +++ b/docs/examples/Makefile.am @@ -44,6 +44,9 @@ AM_CPPFLAGS += -DCURL_NO_OLDIES if USE_CPPFLAG_CURL_STATICLIB AM_CPPFLAGS += -DCURL_STATICLIB endif +if DOING_NATIVE_WINDOWS +AM_CPPFLAGS += -DWIN32_LEAN_AND_MEAN +endif # Prevent LIBS from being used for all link targets LIBS = $(BLANK_AT_MAKETIME) diff --git a/docs/examples/externalsocket.c b/docs/examples/externalsocket.c index 010654298d..d33823f933 100644 --- a/docs/examples/externalsocket.c +++ b/docs/examples/externalsocket.c @@ -25,7 +25,7 @@ * Pass in a custom socket for libcurl to use. * */ -#ifdef _WIN32 +#ifdef _MSC_VER #ifndef _WINSOCK_DEPRECATED_NO_WARNINGS #define _WINSOCK_DEPRECATED_NO_WARNINGS /* for inet_addr() */ #endif diff --git a/lib/bufref.c b/lib/bufref.c index f048b57011..f89e9a8548 100644 --- a/lib/bufref.c +++ b/lib/bufref.c @@ -30,7 +30,9 @@ #include "curl_memory.h" #include "memdebug.h" +#ifdef DEBUGBUILD #define SIGNATURE 0x5c48e9b2 /* Random pattern. */ +#endif /* * Init a bufref struct. diff --git a/lib/cf-socket.c b/lib/cf-socket.c index a6f98886c5..6250d46499 100644 --- a/lib/cf-socket.c +++ b/lib/cf-socket.c @@ -932,15 +932,6 @@ static CURLcode socket_connect_result(struct Curl_easy *data, } } -/* We have a recv buffer to enhance reads with len < NW_SMALL_READS. - * This happens often on TLS connections where the TLS implementation - * tries to read the head of a TLS record, determine the length of the - * full record and then make a subsequent read for that. - * On large reads, we will not fill the buffer to avoid the double copy. */ -#define NW_RECV_CHUNK_SIZE (64 * 1024) -#define NW_RECV_CHUNKS 1 -#define NW_SMALL_READS (1024) - struct cf_socket_ctx { int transport; struct Curl_sockaddr_ex addr; /* address to connect to */ diff --git a/lib/content_encoding.c b/lib/content_encoding.c index e365af6168..e39ac3ebad 100644 --- a/lib/content_encoding.c +++ b/lib/content_encoding.c @@ -65,7 +65,10 @@ /* allow no more than 5 "chained" compression steps */ #define MAX_ENCODE_STACK 5 + +#if defined(HAVE_LIBZ) || defined(HAVE_BROTLI) || defined(HAVE_ZSTD) #define DECOMPRESS_BUFFER_SIZE 16384 /* buffer size for decompressed data */ +#endif #ifdef HAVE_LIBZ diff --git a/lib/cookie.c b/lib/cookie.c index 556eec4ab6..6fdabfd791 100644 --- a/lib/cookie.c +++ b/lib/cookie.c @@ -483,7 +483,9 @@ static bool invalid_octets(const char *p) #define CERR_COMMENT 11 /* a commented line */ #define CERR_RANGE 12 /* expire range problem */ #define CERR_FIELDS 13 /* incomplete netscape line */ +#ifdef USE_LIBPSL #define CERR_PSL 14 /* a public suffix */ +#endif #define CERR_LIVE_WINS 15 /* The maximum length we accept a date string for the 'expire' keyword. The diff --git a/lib/curl_ntlm_core.c b/lib/curl_ntlm_core.c index 54491fc0a8..c6c5a24b0b 100644 --- a/lib/curl_ntlm_core.c +++ b/lib/curl_ntlm_core.c @@ -144,9 +144,6 @@ #include "curl_memory.h" #include "memdebug.h" -#define NTLMv2_BLOB_SIGNATURE "\x01\x01\x00\x00" -#define NTLMv2_BLOB_LEN (44 -16 + ntlm->target_info_len + 4) - #if !defined(CURL_NTLM_NOT_SUPPORTED) /* * Turns a 56-bit key into being 64-bit wide. @@ -465,6 +462,9 @@ CURLcode Curl_ntlm_core_mk_nt_hash(const char *password, #if !defined(USE_WINDOWS_SSPI) +#define NTLMv2_BLOB_SIGNATURE "\x01\x01\x00\x00" +#define NTLMv2_BLOB_LEN (44 -16 + ntlm->target_info_len + 4) + /* Timestamp in tenths of a microsecond since January 1, 1601 00:00:00 UTC. */ struct ms_filetime { unsigned int dwLowDateTime; @@ -626,7 +626,7 @@ CURLcode Curl_ntlm_core_mk_ntlmv2_resp(unsigned char *ntlmv2hash, /* Concatenate the Type 2 challenge with the BLOB and do HMAC MD5 */ memcpy(ptr + 8, &ntlm->nonce[0], 8); result = Curl_hmacit(&Curl_HMAC_MD5, ntlmv2hash, HMAC_MD5_LENGTH, ptr + 8, - NTLMv2_BLOB_LEN + 8, hmac_output); + NTLMv2_BLOB_LEN + 8, hmac_output); if(result) { free(ptr); return result; diff --git a/lib/curl_sha512_256.c b/lib/curl_sha512_256.c index 46c0bd5341..bde8c0770e 100644 --- a/lib/curl_sha512_256.c +++ b/lib/curl_sha512_256.c @@ -82,7 +82,6 @@ # include # if defined(SHA512_256_DIGEST_SIZE) # define USE_GNUTLS_SHA512_256 1 -# define HAS_SHA512_256_IMPLEMENTATION 1 # endif #endif /* ! HAS_SHA512_256_IMPLEMENTATION && USE_GNUTLS */ @@ -269,9 +268,6 @@ Curl_sha512_256_finish(unsigned char *digest, #else /* No system or TLS backend SHA-512/256 implementation available */ -/* Use local implementation */ -#define HAS_SHA512_256_IMPLEMENTATION 1 - /* ** This implementation of SHA-512/256 hash calculation was originally ** * * ** written by Evgeny Grin (Karlson2k) for GNU libmicrohttpd. ** * * ** The author ported the code to libcurl. The ported code is provided ** * diff --git a/lib/doh.c b/lib/doh.c index 617a761f97..eca0711380 100644 --- a/lib/doh.c +++ b/lib/doh.c @@ -46,9 +46,6 @@ #define DNS_CLASS_IN 0x01 -/* doh_print_buf truncates if the hex string will be more than this */ -#define LOCAL_PB_HEXMAX 400 - #ifndef CURL_DISABLE_VERBOSE_STRINGS static const char * const errors[]={ "", @@ -192,6 +189,10 @@ doh_write_cb(char *contents, size_t size, size_t nmemb, void *userp) } #if defined(USE_HTTPSRR) && defined(DEBUGBUILD) + +/* doh_print_buf truncates if the hex string will be more than this */ +#define LOCAL_PB_HEXMAX 400 + static void doh_print_buf(struct Curl_easy *data, const char *prefix, unsigned char *buf, size_t len) diff --git a/lib/dynbuf.c b/lib/dynbuf.c index 15164265f4..6cabe4d3e5 100644 --- a/lib/dynbuf.c +++ b/lib/dynbuf.c @@ -32,7 +32,9 @@ #define MIN_FIRST_ALLOC 32 +#ifdef DEBUGBUILD #define DYNINIT 0xbee51da /* random pattern */ +#endif /* * Init a dynbuf struct. diff --git a/lib/hash.c b/lib/hash.c index aa9904e709..f6707616a0 100644 --- a/lib/hash.c +++ b/lib/hash.c @@ -34,8 +34,10 @@ #include "memdebug.h" /* random patterns for API verification */ +#ifdef DEBUGBUILD #define HASHINIT 0x7017e781 #define ITERINIT 0x5FEDCBA9 +#endif static void hash_element_dtor(void *user, void *element) diff --git a/lib/http_ntlm.c b/lib/http_ntlm.c index ab6f1dd921..771f81da4c 100644 --- a/lib/http_ntlm.c +++ b/lib/http_ntlm.c @@ -33,8 +33,6 @@ * https://www.innovation.ch/java/ntlm.html */ -#define DEBUG_ME 0 - #include "urldata.h" #include "sendf.h" #include "strcase.h" @@ -55,12 +53,6 @@ #include "curl_memory.h" #include "memdebug.h" -#if DEBUG_ME -# define DEBUG_OUT(x) x -#else -# define DEBUG_OUT(x) Curl_nop_stmt -#endif - CURLcode Curl_input_ntlm(struct Curl_easy *data, bool proxy, /* if proxy or not */ const char *header) /* rest of the www-authenticate: diff --git a/lib/inet_ntop.c b/lib/inet_ntop.c index bce0ed7c56..a447f300de 100644 --- a/lib/inet_ntop.c +++ b/lib/inet_ntop.c @@ -38,7 +38,7 @@ #include "curl_printf.h" #define IN6ADDRSZ 16 -#define INADDRSZ 4 +/* #define INADDRSZ 4 */ #define INT16SZ 2 /* diff --git a/lib/llist.c b/lib/llist.c index a2c199bc62..aa8e04b0d3 100644 --- a/lib/llist.c +++ b/lib/llist.c @@ -32,12 +32,11 @@ /* this must be the last include file */ #include "memdebug.h" +#ifdef DEBUGBUILD #define LLISTINIT 0x100cc001 /* random pattern */ #define NODEINIT 0x12344321 /* random pattern */ #define NODEREM 0x54321012 /* random pattern */ - -#ifdef DEBUGBUILD #define VERIFYNODE(x) verifynode(x) static struct Curl_llist_node *verifynode(struct Curl_llist_node *n) { diff --git a/lib/mqtt.c b/lib/mqtt.c index fe242c7784..b97eab163a 100644 --- a/lib/mqtt.c +++ b/lib/mqtt.c @@ -46,11 +46,11 @@ /* The last #include file should be: */ #include "memdebug.h" -#define MQTT_MSG_CONNECT 0x10 -#define MQTT_MSG_CONNACK 0x20 -#define MQTT_MSG_PUBLISH 0x30 -#define MQTT_MSG_SUBSCRIBE 0x82 -#define MQTT_MSG_SUBACK 0x90 +#define MQTT_MSG_CONNECT 0x10 +/* #define MQTT_MSG_CONNACK 0x20 */ +#define MQTT_MSG_PUBLISH 0x30 +#define MQTT_MSG_SUBSCRIBE 0x82 +#define MQTT_MSG_SUBACK 0x90 #define MQTT_MSG_DISCONNECT 0xe0 #define MQTT_CONNACK_LEN 2 diff --git a/lib/netrc.c b/lib/netrc.c index ba6708991d..00aca78ece 100644 --- a/lib/netrc.c +++ b/lib/netrc.c @@ -26,10 +26,14 @@ #ifndef CURL_DISABLE_NETRC #ifdef HAVE_PWD_H +#ifdef __AMIGA__ #undef __NO_NET_API /* required for AmigaOS to declare getpwuid() */ +#endif #include +#ifdef __AMIGA__ #define __NO_NET_API #endif +#endif #include #include "netrc.h" diff --git a/lib/parsedate.c b/lib/parsedate.c index 65b231ad5c..7bb93616e7 100644 --- a/lib/parsedate.c +++ b/lib/parsedate.c @@ -100,7 +100,9 @@ static int parsedate(const char *date, time_t *output); #define PARSEDATE_OK 0 #define PARSEDATE_FAIL -1 #define PARSEDATE_LATER 1 +#if defined(HAVE_TIME_T_UNSIGNED) || (SIZEOF_TIME_T < 5) #define PARSEDATE_SOONER 2 +#endif #if !defined(CURL_DISABLE_PARSEDATE) || !defined(CURL_DISABLE_FTP) || \ !defined(CURL_DISABLE_FILE) diff --git a/lib/smb.c b/lib/smb.c index d22030ccc7..35fd93401e 100644 --- a/lib/smb.c +++ b/lib/smb.c @@ -77,7 +77,7 @@ #define SMB_FLAGS_CANONICAL_PATHNAMES 0x10 #define SMB_FLAGS_CASELESS_PATHNAMES 0x08 -#define SMB_FLAGS2_UNICODE_STRINGS 0x8000 +/* #define SMB_FLAGS2_UNICODE_STRINGS 0x8000 */ #define SMB_FLAGS2_IS_LONG_NAME 0x0040 #define SMB_FLAGS2_KNOWS_LONG_NAME 0x0001 diff --git a/lib/url.c b/lib/url.c index 516ee08a1a..94e495e3c0 100644 --- a/lib/url.c +++ b/lib/url.c @@ -836,8 +836,6 @@ static bool ssh_config_matches(struct connectdata *one, return Curl_safecmp(one->proto.sshc.rsa, two->proto.sshc.rsa) && Curl_safecmp(one->proto.sshc.rsa_pub, two->proto.sshc.rsa_pub); } -#else -#define ssh_config_matches(x,y) FALSE #endif struct url_conn_match { diff --git a/lib/vauth/digest.c b/lib/vauth/digest.c index 0acfcace1d..8143366301 100644 --- a/lib/vauth/digest.c +++ b/lib/vauth/digest.c @@ -50,6 +50,7 @@ #include "curl_memory.h" #include "memdebug.h" +#ifndef USE_WINDOWS_SSPI #define SESSION_ALGO 1 /* for algos with this bit set */ #define ALGO_MD5 0 @@ -59,7 +60,6 @@ #define ALGO_SHA512_256 4 #define ALGO_SHA512_256SESS (ALGO_SHA512_256 | SESSION_ALGO) -#if !defined(USE_WINDOWS_SSPI) #define DIGEST_QOP_VALUE_AUTH (1 << 0) #define DIGEST_QOP_VALUE_AUTH_INT (1 << 1) #define DIGEST_QOP_VALUE_AUTH_CONF (1 << 2) @@ -141,8 +141,8 @@ bool Curl_auth_digest_get_pair(const char *str, char *value, char *content, return TRUE; } -#if !defined(USE_WINDOWS_SSPI) -/* Convert md5 chunk to RFC2617 (section 3.1.3) -suitable ASCII string */ +#ifndef USE_WINDOWS_SSPI +/* Convert MD5 chunk to RFC2617 (section 3.1.3) -suitable ASCII string */ static void auth_digest_md5_to_ascii(unsigned char *source, /* 16 bytes */ unsigned char *dest) /* 33 bytes */ { diff --git a/lib/version.c b/lib/version.c index 6543dcd0bd..bf4c76d016 100644 --- a/lib/version.c +++ b/lib/version.c @@ -422,8 +422,6 @@ static int idn_present(curl_version_info_data *info) return info->libidn != NULL; #endif } -#else -#define idn_present NULL #endif #if defined(USE_SSL) && !defined(CURL_DISABLE_PROXY) && \ diff --git a/lib/vtls/openssl.c b/lib/vtls/openssl.c index 6ded5f3c07..9bc1fde6fe 100644 --- a/lib/vtls/openssl.c +++ b/lib/vtls/openssl.c @@ -151,13 +151,6 @@ #define CONST_EXTS const #define HAVE_ERR_REMOVE_THREAD_STATE_DEPRECATED 1 -/* funny typecast define due to difference in API */ -#ifdef LIBRESSL_VERSION_NUMBER -#define ARG2_X509_signature_print (X509_ALGOR *) -#else -#define ARG2_X509_signature_print -#endif - #else /* For OpenSSL before 1.1.0 */ #define ASN1_STRING_get0_data(x) ASN1_STRING_data(x) @@ -850,14 +843,6 @@ static void ossl_bio_cf_method_free(BIO_METHOD *m) #endif -/* - * Number of bytes to read from the random number seed file. This must be - * a finite value (because some entropy "files" like /dev/urandom have - * an infinite length), but must be large enough to provide enough - * entropy to properly seed OpenSSL's PRNG. - */ -#define RAND_LOAD_LENGTH 1024 - #ifdef HAVE_KEYLOG_CALLBACK static void ossl_keylog_callback(const SSL *ssl, const char *line) { @@ -1042,6 +1027,14 @@ static CURLcode ossl_seed(struct Curl_easy *data) RAND_add(randb, (int)len, (double)len/2); } while(!rand_enough()); + /* + * Number of bytes to read from the random number seed file. This must be + * a finite value (because some entropy "files" like /dev/urandom have + * an infinite length), but must be large enough to provide enough + * entropy to properly seed OpenSSL's PRNG. + */ +# define RAND_LOAD_LENGTH 1024 + { /* generates a default path for the random seed file */ char fname[256]; diff --git a/lib/vtls/schannel.c b/lib/vtls/schannel.c index 2af29a42ec..59fe428abe 100644 --- a/lib/vtls/schannel.c +++ b/lib/vtls/schannel.c @@ -80,10 +80,6 @@ # define HAS_ALPN_SCHANNEL #endif -#ifndef BCRYPT_CHACHA20_POLY1305_ALGORITHM -#define BCRYPT_CHACHA20_POLY1305_ALGORITHM L"CHACHA20_POLY1305" -#endif - #ifndef BCRYPT_CHAIN_MODE_CCM #define BCRYPT_CHAIN_MODE_CCM L"ChainingModeCCM" #endif @@ -232,8 +228,6 @@ schannel_set_ssl_version_min_max(DWORD *enabled_protocols, return CURLE_OK; } -/* longest is 26, buffer is slightly bigger */ -#define LONGEST_ALG_ID 32 #define CIPHEROPTION(x) {#x, x} struct algo { diff --git a/lib/vtls/x509asn1.c b/lib/vtls/x509asn1.c index 0bc0a75a4b..d10dd09578 100644 --- a/lib/vtls/x509asn1.c +++ b/lib/vtls/x509asn1.c @@ -28,14 +28,14 @@ defined(USE_SCHANNEL) || defined(USE_SECTRANSP) || \ defined(USE_MBEDTLS) -#if defined(USE_WOLFSSL) || defined(USE_SCHANNEL) +#if defined(USE_GNUTLS) || defined(USE_SCHANNEL) || defined(USE_SECTRANSP) || \ + defined(USE_MBEDTLS) || defined(USE_WOLFSSL) #define WANT_PARSEX509 /* uses Curl_parseX509() */ #endif #if defined(USE_GNUTLS) || defined(USE_SCHANNEL) || defined(USE_SECTRANSP) || \ defined(USE_MBEDTLS) #define WANT_EXTRACT_CERTINFO /* uses Curl_extract_certinfo() */ -#define WANT_PARSEX509 /* ... uses Curl_parseX509() */ #endif #include @@ -64,10 +64,10 @@ #define CURL_ASN1_MAX ((size_t) 0x40000) /* 256K */ /* ASN.1 classes. */ -#define CURL_ASN1_UNIVERSAL 0 -#define CURL_ASN1_APPLICATION 1 -#define CURL_ASN1_CONTEXT_SPECIFIC 2 -#define CURL_ASN1_PRIVATE 3 +/* #define CURL_ASN1_UNIVERSAL 0 */ +/* #define CURL_ASN1_APPLICATION 1 */ +/* #define CURL_ASN1_CONTEXT_SPECIFIC 2 */ +/* #define CURL_ASN1_PRIVATE 3 */ /* ASN.1 types. */ #define CURL_ASN1_BOOLEAN 1 @@ -76,27 +76,27 @@ #define CURL_ASN1_OCTET_STRING 4 #define CURL_ASN1_NULL 5 #define CURL_ASN1_OBJECT_IDENTIFIER 6 -#define CURL_ASN1_OBJECT_DESCRIPTOR 7 -#define CURL_ASN1_INSTANCE_OF 8 -#define CURL_ASN1_REAL 9 +/* #define CURL_ASN1_OBJECT_DESCRIPTOR 7 */ +/* #define CURL_ASN1_INSTANCE_OF 8 */ +/* #define CURL_ASN1_REAL 9 */ #define CURL_ASN1_ENUMERATED 10 -#define CURL_ASN1_EMBEDDED 11 +/* #define CURL_ASN1_EMBEDDED 11 */ #define CURL_ASN1_UTF8_STRING 12 -#define CURL_ASN1_RELATIVE_OID 13 -#define CURL_ASN1_SEQUENCE 16 -#define CURL_ASN1_SET 17 +/* #define CURL_ASN1_RELATIVE_OID 13 */ +/* #define CURL_ASN1_SEQUENCE 16 */ +/* #define CURL_ASN1_SET 17 */ #define CURL_ASN1_NUMERIC_STRING 18 #define CURL_ASN1_PRINTABLE_STRING 19 #define CURL_ASN1_TELETEX_STRING 20 -#define CURL_ASN1_VIDEOTEX_STRING 21 +/* #define CURL_ASN1_VIDEOTEX_STRING 21 */ #define CURL_ASN1_IA5_STRING 22 #define CURL_ASN1_UTC_TIME 23 #define CURL_ASN1_GENERALIZED_TIME 24 -#define CURL_ASN1_GRAPHIC_STRING 25 +/* #define CURL_ASN1_GRAPHIC_STRING 25 */ #define CURL_ASN1_VISIBLE_STRING 26 -#define CURL_ASN1_GENERAL_STRING 27 +/* #define CURL_ASN1_GENERAL_STRING 27 */ #define CURL_ASN1_UNIVERSAL_STRING 28 -#define CURL_ASN1_CHARACTER_STRING 29 +/* #define CURL_ASN1_CHARACTER_STRING 29 */ #define CURL_ASN1_BMP_STRING 30 diff --git a/lib/warnless.c b/lib/warnless.c index 41699600be..38a8017ca2 100644 --- a/lib/warnless.c +++ b/lib/warnless.c @@ -45,19 +45,13 @@ #include #define CURL_MASK_UCHAR ((unsigned char)~0) -#define CURL_MASK_SCHAR (CURL_MASK_UCHAR >> 1) #define CURL_MASK_USHORT ((unsigned short)~0) -#define CURL_MASK_SSHORT (CURL_MASK_USHORT >> 1) #define CURL_MASK_UINT ((unsigned int)~0) #define CURL_MASK_SINT (CURL_MASK_UINT >> 1) #define CURL_MASK_ULONG ((unsigned long)~0) -#define CURL_MASK_SLONG (CURL_MASK_ULONG >> 1) - -#define CURL_MASK_UCOFFT ((unsigned CURL_TYPEOF_CURL_OFF_T)~0) -#define CURL_MASK_SCOFFT (CURL_MASK_UCOFFT >> 1) #define CURL_MASK_USIZE_T ((size_t)~0) #define CURL_MASK_SSIZE_T (CURL_MASK_USIZE_T >> 1) diff --git a/m4/curl-compilers.m4 b/m4/curl-compilers.m4 index 9339187efc..fbda4936a0 100644 --- a/m4/curl-compilers.m4 +++ b/m4/curl-compilers.m4 @@ -832,6 +832,7 @@ AC_DEFUN([CURL_SET_COMPILER_WARNING_OPTS], [ # CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [switch-enum]) # Not used because this basically disallows default case CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [type-limits]) # CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [unused-macros]) # Not practical + # tmp_CFLAGS="$tmp_CFLAGS -Wno-error=unused-macros" CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [unreachable-code unused-parameter]) fi # @@ -1016,6 +1017,7 @@ AC_DEFUN([CURL_SET_COMPILER_WARNING_OPTS], [ CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [redundant-decls]) # CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [switch-enum]) # Not used because this basically disallows default case # CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [unused-macros]) # Not practical + # tmp_CFLAGS="$tmp_CFLAGS -Wno-error=unused-macros" fi # dnl Only gcc 4.2 or later diff --git a/src/tool_cb_see.c b/src/tool_cb_see.c index c86ea7fb17..08eb7c354b 100644 --- a/src/tool_cb_see.c +++ b/src/tool_cb_see.c @@ -31,13 +31,6 @@ #include "memdebug.h" /* keep this as LAST include */ -/* OUR_MAX_SEEK_L has 'long' data type, OUR_MAX_SEEK_O has 'curl_off_t, - both represent the same value. Maximum offset used here when we lseek - using a 'long' data type offset */ - -#define OUR_MAX_SEEK_L 2147483647L - 1L -#define OUR_MAX_SEEK_O CURL_OFF_T_C(0x7FFFFFFF) - CURL_OFF_T_C(0x1) - /* ** callback for CURLOPT_SEEKFUNCTION ** @@ -51,6 +44,13 @@ int tool_seek_cb(void *userdata, curl_off_t offset, int whence) #if (SIZEOF_CURL_OFF_T > SIZEOF_OFF_T) && !defined(USE_WIN32_LARGE_FILES) +/* OUR_MAX_SEEK_L has 'long' data type, OUR_MAX_SEEK_O has 'curl_off_t, + both represent the same value. Maximum offset used here when we lseek + using a 'long' data type offset */ + +#define OUR_MAX_SEEK_L 2147483647L - 1L +#define OUR_MAX_SEEK_O CURL_OFF_T_C(0x7FFFFFFF) - CURL_OFF_T_C(0x1) + /* The offset check following here is only interesting if curl_off_t is larger than off_t and we are not using the Win32 large file support macros that provide the support to do 64-bit seeks correctly */ diff --git a/src/tool_doswin.c b/src/tool_doswin.c index 171b063b9f..c075912318 100644 --- a/src/tool_doswin.c +++ b/src/tool_doswin.c @@ -45,8 +45,6 @@ #ifdef _WIN32 # undef PATH_MAX # define PATH_MAX MAX_PATH - -# define _use_lfn(f) (1) /* long filenames always available */ #elif !defined(__DJGPP__) || (__DJGPP__ < 2) /* DJGPP 2.0 has _use_lfn() */ # define _use_lfn(f) (0) /* long filenames never available */ #elif defined(__DJGPP__) @@ -215,7 +213,7 @@ SANITIZEcode sanitize_file_name(char **const sanitized, const char *file_name, return SANITIZE_ERR_OK; } -#if defined(MSDOS) +#ifdef MSDOS /* Test if truncating a path to a file will leave at least a single character in the filename. Filenames suffixed by an alternate data stream cannot be diff --git a/src/tool_setopt.c b/src/tool_setopt.c index 52ae0f9607..3770c9e495 100644 --- a/src/tool_setopt.c +++ b/src/tool_setopt.c @@ -185,12 +185,12 @@ static const struct NameValue setopt_nv_CURLNONZERODEFAULTS[] = { } \ } while(0) -#define DECL0(s) ADD((&easysrc_decl, s)) +/* #define DECL0(s) ADD((&easysrc_decl, s)) */ #define DECL1(f,a) ADDF((&easysrc_decl, f,a)) -#define DATA0(s) ADD((&easysrc_data, s)) +/* #define DATA0(s) ADD((&easysrc_data, s)) */ #define DATA1(f,a) ADDF((&easysrc_data, f,a)) -#define DATA2(f,a,b) ADDF((&easysrc_data, f,a,b)) +/* #define DATA2(f,a,b) ADDF((&easysrc_data, f,a,b)) */ #define DATA3(f,a,b,c) ADDF((&easysrc_data, f,a,b,c)) #define CODE0(s) ADD((&easysrc_code, s)) @@ -198,11 +198,11 @@ static const struct NameValue setopt_nv_CURLNONZERODEFAULTS[] = { #define CODE2(f,a,b) ADDF((&easysrc_code, f,a,b)) #define CODE3(f,a,b,c) ADDF((&easysrc_code, f,a,b,c)) -#define CLEAN0(s) ADD((&easysrc_clean, s)) +/* #define CLEAN0(s) ADD((&easysrc_clean, s)) */ #define CLEAN1(f,a) ADDF((&easysrc_clean, f,a)) -#define REM0(s) ADD((&easysrc_toohard, s)) -#define REM1(f,a) ADDF((&easysrc_toohard, f,a)) +/* #define REM0(s) ADD((&easysrc_toohard, s)) */ +/* #define REM1(f,a) ADDF((&easysrc_toohard, f,a)) */ #define REM3(f,a,b,c) ADDF((&easysrc_toohard, f,a,b,c)) /* Escape string to C string syntax. Return NULL if out of memory. @@ -715,6 +715,4 @@ nomem: return ret; } -#else /* CURL_DISABLE_LIBCURL_OPTION */ - #endif /* CURL_DISABLE_LIBCURL_OPTION */ diff --git a/tests/http/clients/Makefile.am b/tests/http/clients/Makefile.am index 935614c5fd..bae747f1d4 100644 --- a/tests/http/clients/Makefile.am +++ b/tests/http/clients/Makefile.am @@ -45,6 +45,9 @@ AM_CPPFLAGS += -DCURL_NO_OLDIES if USE_CPPFLAG_CURL_STATICLIB AM_CPPFLAGS += -DCURL_STATICLIB endif +if DOING_NATIVE_WINDOWS +AM_CPPFLAGS += -DWIN32_LEAN_AND_MEAN +endif # Prevent LIBS from being used for all link targets LIBS = $(BLANK_AT_MAKETIME) diff --git a/tests/http/clients/ws-data.c b/tests/http/clients/ws-data.c index 9632ea2989..c55eb9f958 100644 --- a/tests/http/clients/ws-data.c +++ b/tests/http/clients/ws-data.c @@ -40,9 +40,6 @@ #endif #ifdef _WIN32 -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif #include #else #include diff --git a/tests/http/clients/ws-pingpong.c b/tests/http/clients/ws-pingpong.c index f11d217f47..b2cf135469 100644 --- a/tests/http/clients/ws-pingpong.c +++ b/tests/http/clients/ws-pingpong.c @@ -34,9 +34,6 @@ #include #ifdef _WIN32 -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif #include #else #include diff --git a/tests/server/mqttd.c b/tests/server/mqttd.c index bf0d69d669..4927d1105e 100644 --- a/tests/server/mqttd.c +++ b/tests/server/mqttd.c @@ -65,12 +65,6 @@ #ifdef USE_WINSOCK #undef EINTR #define EINTR 4 /* errno.h value */ -#undef EAGAIN -#define EAGAIN 11 /* errno.h value */ -#undef ENOMEM -#define ENOMEM 12 /* errno.h value */ -#undef EINVAL -#define EINVAL 22 /* errno.h value */ #endif #define DEFAULT_PORT 1883 /* MQTT default port */ @@ -86,15 +80,11 @@ #define MQTT_MSG_CONNECT 0x10 #define MQTT_MSG_CONNACK 0x20 #define MQTT_MSG_PUBLISH 0x30 -#define MQTT_MSG_PUBACK 0x40 +/* #define MQTT_MSG_PUBACK 0x40 */ #define MQTT_MSG_SUBSCRIBE 0x82 #define MQTT_MSG_SUBACK 0x90 #define MQTT_MSG_DISCONNECT 0xe0 -#define MQTT_CONNACK_LEN 4 -#define MQTT_SUBACK_LEN 5 -#define MQTT_CLIENTID_LEN 12 /* "curl0123abcd" */ - struct configurable { unsigned char version; /* initial version byte in the request must match this */ diff --git a/tests/server/rtspd.c b/tests/server/rtspd.c index 707d20706e..0df94ae56c 100644 --- a/tests/server/rtspd.c +++ b/tests/server/rtspd.c @@ -68,7 +68,6 @@ static const char *ipv_inuse = "IPv4"; static int serverlogslocked = 0; #define REQBUFSIZ 150000 -#define REQBUFSIZ_TXT "149999" static long prevtestno = -1; /* previous test number we served */ static long prevpartno = -1; /* previous part number we served */ diff --git a/tests/server/socksd.c b/tests/server/socksd.c index 27c9c2aa57..6788a1a540 100644 --- a/tests/server/socksd.c +++ b/tests/server/socksd.c @@ -86,12 +86,6 @@ #ifdef USE_WINSOCK #undef EINTR #define EINTR 4 /* errno.h value */ -#undef EAGAIN -#define EAGAIN 11 /* errno.h value */ -#undef ENOMEM -#define ENOMEM 12 /* errno.h value */ -#undef EINVAL -#define EINVAL 22 /* errno.h value */ #endif #define DEFAULT_PORT 8905