]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tidy-up: delete, comment or scope C macros reported unused
authorViktor Szakats <commit@vsz.me>
Sun, 9 Feb 2025 17:12:14 +0000 (18:12 +0100)
committerViktor Szakats <commit@vsz.me>
Fri, 14 Feb 2025 09:37:14 +0000 (10:37 +0100)
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

36 files changed:
CMake/PickyWarnings.cmake
docs/examples/Makefile.am
docs/examples/externalsocket.c
lib/bufref.c
lib/cf-socket.c
lib/content_encoding.c
lib/cookie.c
lib/curl_ntlm_core.c
lib/curl_sha512_256.c
lib/doh.c
lib/dynbuf.c
lib/hash.c
lib/http_ntlm.c
lib/inet_ntop.c
lib/llist.c
lib/mqtt.c
lib/netrc.c
lib/parsedate.c
lib/smb.c
lib/url.c
lib/vauth/digest.c
lib/version.c
lib/vtls/openssl.c
lib/vtls/schannel.c
lib/vtls/x509asn1.c
lib/warnless.c
m4/curl-compilers.m4
src/tool_cb_see.c
src/tool_doswin.c
src/tool_setopt.c
tests/http/clients/Makefile.am
tests/http/clients/ws-data.c
tests/http/clients/ws-pingpong.c
tests/server/mqttd.c
tests/server/rtspd.c
tests/server/socksd.c

index 15f771b3e34419512763b5c885917cf5ebc47c58..6f6d0b97347612623655bbe9bc110c5fd3a383d6 100644 (file)
@@ -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
     )
index d67b4dd6c4e7a586062d171c1d0fe3a8b1df20cb..02ba20b99fb7b3c8e0d59bc03e72579e2fdbf3c0 100644 (file)
@@ -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)
index 010654298d4358bded0d08a6a10e188f1d2758c1..d33823f9337e9b9aa8d7bf75cdabb6e8e69a0747 100644 (file)
@@ -25,7 +25,7 @@
  * Pass in a custom socket for libcurl to use.
  * </DESC>
  */
-#ifdef _WIN32
+#ifdef _MSC_VER
 #ifndef _WINSOCK_DEPRECATED_NO_WARNINGS
 #define _WINSOCK_DEPRECATED_NO_WARNINGS  /* for inet_addr() */
 #endif
index f048b57011996c261d60d1e9c26b2718b8db538a..f89e9a8548492675dc338ef7d6389e3ec8178ba6 100644 (file)
@@ -30,7 +30,9 @@
 #include "curl_memory.h"
 #include "memdebug.h"
 
+#ifdef DEBUGBUILD
 #define SIGNATURE 0x5c48e9b2    /* Random pattern. */
+#endif
 
 /*
  * Init a bufref struct.
index a6f98886c50f886841652d276a26b0999622ad54..6250d46499cadcd2dcb7772ec79367c29a2074f6 100644 (file)
@@ -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 */
index e365af61682e00a618bd8f2c2a1aeaf236eaf67c..e39ac3ebadc8809919a8c7824ea3c66c3256ace1 100644 (file)
 
 /* 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
 
index 556eec4ab6d6cba399d848949424dfe7e01bcbf0..6fdabfd7914ffa4009e186af10c20f3f3110ea98 100644 (file)
@@ -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
index 54491fc0a89aea91cd604bda130e445bee9bfdff..c6c5a24b0b432d6fbef59a88e842d3cc6a522f6c 100644 (file)
 #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;
index 46c0bd5341185401261923eddd25ed7d6cd10cd0..bde8c0770e01b8016ff5d05431f2226dcbe112d2 100644 (file)
@@ -82,7 +82,6 @@
 #  include <nettle/sha.h>
 #  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 ** *
index 617a761f9754816f33ca61a1b9bd13c3ffc76782..eca071138055d8bc80c006562baa136a198f28d5 100644 (file)
--- 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)
index 15164265f480d998359f542faa8051ce99b09c50..6cabe4d3e599c58278a023775285db07212d032a 100644 (file)
@@ -32,7 +32,9 @@
 
 #define MIN_FIRST_ALLOC 32
 
+#ifdef DEBUGBUILD
 #define DYNINIT 0xbee51da /* random pattern */
+#endif
 
 /*
  * Init a dynbuf struct.
index aa9904e7099e9aa67a9be515fa293ef48676bce2..f6707616a0f7ea4a3d2e7e7c9b055f2ef4cbe5e5 100644 (file)
 #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)
index ab6f1dd9212eb1a4471a25cf051464c29983a9e4..771f81da4c965f8280852143357d6a2c155127d8 100644 (file)
@@ -33,8 +33,6 @@
  * https://www.innovation.ch/java/ntlm.html
  */
 
-#define DEBUG_ME 0
-
 #include "urldata.h"
 #include "sendf.h"
 #include "strcase.h"
 #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:
index bce0ed7c569d59bc8c01f91ced5b86a1e0a1a467..a447f300de17e233461d8036f64b7865d5a8451e 100644 (file)
@@ -38,7 +38,7 @@
 #include "curl_printf.h"
 
 #define IN6ADDRSZ       16
-#define INADDRSZ         4
+/* #define INADDRSZ         4 */
 #define INT16SZ          2
 
 /*
index a2c199bc626bb7b2483687923c049756e32733d5..aa8e04b0d317f42afc1f07046aea620716f600cc 100644 (file)
 /* 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)
 {
index fe242c778471263a4b742c9c91fa23b6b4ceaf18..b97eab163ae2df9ea2c82b9f7ebe0bb05ce9c6c7 100644 (file)
 /* 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
index ba6708991dfde444f91621b50929653ed9ec1d94..00aca78ece9bbe340e4d74f02b5bdb9fb35a27c6 100644 (file)
 #ifndef CURL_DISABLE_NETRC
 
 #ifdef HAVE_PWD_H
+#ifdef __AMIGA__
 #undef __NO_NET_API /* required for AmigaOS to declare getpwuid() */
+#endif
 #include <pwd.h>
+#ifdef __AMIGA__
 #define __NO_NET_API
 #endif
+#endif
 
 #include <curl/curl.h>
 #include "netrc.h"
index 65b231ad5c69f415533ab61b1ebd7f27c16d94b9..7bb93616e798fcb33faaf0d7d4b54d807d60d027 100644 (file)
@@ -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)
index d22030ccc7528552d5ed73f228a552ec7ec6baa6..35fd93401e9c1581d5870778b8eedf50ac07dfb1 100644 (file)
--- 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
 
index 516ee08a1aa0bb63f735ec955e09f4b176b9fc3a..94e495e3c0e4345d92dc7b5093dd411411a475b0 100644 (file)
--- 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 {
index 0acfcace1d13abc343cba03ca42add1066f64f85..81433663015d55dcce84a4302abf350be05ec04e 100644 (file)
@@ -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 */
 {
index 6543dcd0bd5f102f7710086b4bca44a932fa5766..bf4c76d016c57bcfe76a14b4d700134139de0364 100644 (file)
@@ -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) && \
index 6ded5f3c0791499702030434611ac7d8d2ecbbdb..9bc1fde6fe4e6594b604e1edad8f45a4487b8abb 100644 (file)
 #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];
index 2af29a42ec8df80e5fd435e63cddad05f7957643..59fe428abef26d05de38fcbe54b6bdc2045f9fe7 100644 (file)
 #  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 {
index 0bc0a75a4bff273e5dbe8ad3498d21c699cfcc62..d10dd0957895a1f68ce65324eea783b6f0d7eaa9 100644 (file)
   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 <curl/curl.h>
 #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
 #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
 
 
index 41699600beece2afd759d9609e33a87bb509917c..38a8017ca259748ae6be2651dbb3a4a1c9e7df2c 100644 (file)
 #include <limits.h>
 
 #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)
index 9339187efc467b60a8ae82aebbd376f44b6c6de1..fbda4936a00c5a66c18483876cbc3c6ad99bf49a 100644 (file)
@@ -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
index c86ea7fb17ea15c8e35136b153d30fa6b12bc3ba..08eb7c354b7f6efc697bfd5f79bcb756d1499dbb 100644 (file)
 
 #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 */
index 171b063b9fc200aebf3693b97d7d29ae1e367e56..c075912318f4901dc4abd4735031f5bf5194a3cc 100644 (file)
@@ -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
index 52ae0f9607477dc95a1b780abdc5542f5f966238..3770c9e495565ffe1c44b7c47c8b387d3cb0cd99 100644 (file)
@@ -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 */
index 935614c5fd043d51ad93416a11fc3e232fa9b3c9..bae747f1d41043431eb5819d6ef4f5d2f527d3e3 100644 (file)
@@ -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)
index 9632ea29897a518ec85f37659a953c3ecb59059c..c55eb9f95871f956995e34eadcd29613a91481e0 100644 (file)
@@ -40,9 +40,6 @@
 #endif
 
 #ifdef _WIN32
-#ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN
-#endif
 #include <windows.h>
 #else
 #include <sys/time.h>
index f11d217f47c8146ffd75276da7a3f12ec9bcae3a..b2cf1354693a56492fba09a9a51f9e68b4527b14 100644 (file)
@@ -34,9 +34,6 @@
 #include <string.h>
 
 #ifdef _WIN32
-#ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN
-#endif
 #include <windows.h>
 #else
 #include <sys/time.h>
index bf0d69d669efc57b2ce0c5029242c86c71f6b3ce..4927d1105e89328109b6d1ffcfbb7715c4490b32 100644 (file)
 #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 */
 #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 */
index 707d20706eaf2e4def1a38f95813cba4c366e2f7..0df94ae56c46da8b598c2f0ed7544655b8dd10cd 100644 (file)
@@ -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 */
index 27c9c2aa5756c7e904a8482da43bd8d9c9dfeacb..6788a1a540fe816939c22e24a1c2ebdc7e116b9b 100644 (file)
 #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