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
This commit is contained in:
Viktor Szakats 2025-02-09 18:12:14 +01:00
parent edd013326d
commit 784a8ec2c1
No known key found for this signature in database
GPG Key ID: B5ABD165E2AEF201
36 changed files with 86 additions and 131 deletions

View File

@ -113,6 +113,7 @@ if(PICKY_COMPILER)
-Wtype-limits # clang 2.7 gcc 4.3 -Wtype-limits # clang 2.7 gcc 4.3
-Wunreachable-code # clang 2.7 gcc 4.1 -Wunreachable-code # clang 2.7 gcc 4.1
# -Wunused-macros # clang 2.7 gcc 4.1 # Not practical # -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 -Wunused-parameter # clang 2.7 gcc 4.1
-Wvla # clang 2.8 gcc 4.3 -Wvla # clang 2.8 gcc 4.3
) )

View File

@ -44,6 +44,9 @@ AM_CPPFLAGS += -DCURL_NO_OLDIES
if USE_CPPFLAG_CURL_STATICLIB if USE_CPPFLAG_CURL_STATICLIB
AM_CPPFLAGS += -DCURL_STATICLIB AM_CPPFLAGS += -DCURL_STATICLIB
endif endif
if DOING_NATIVE_WINDOWS
AM_CPPFLAGS += -DWIN32_LEAN_AND_MEAN
endif
# Prevent LIBS from being used for all link targets # Prevent LIBS from being used for all link targets
LIBS = $(BLANK_AT_MAKETIME) LIBS = $(BLANK_AT_MAKETIME)

View File

@ -25,7 +25,7 @@
* Pass in a custom socket for libcurl to use. * Pass in a custom socket for libcurl to use.
* </DESC> * </DESC>
*/ */
#ifdef _WIN32 #ifdef _MSC_VER
#ifndef _WINSOCK_DEPRECATED_NO_WARNINGS #ifndef _WINSOCK_DEPRECATED_NO_WARNINGS
#define _WINSOCK_DEPRECATED_NO_WARNINGS /* for inet_addr() */ #define _WINSOCK_DEPRECATED_NO_WARNINGS /* for inet_addr() */
#endif #endif

View File

@ -30,7 +30,9 @@
#include "curl_memory.h" #include "curl_memory.h"
#include "memdebug.h" #include "memdebug.h"
#ifdef DEBUGBUILD
#define SIGNATURE 0x5c48e9b2 /* Random pattern. */ #define SIGNATURE 0x5c48e9b2 /* Random pattern. */
#endif
/* /*
* Init a bufref struct. * Init a bufref struct.

View 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 { struct cf_socket_ctx {
int transport; int transport;
struct Curl_sockaddr_ex addr; /* address to connect to */ struct Curl_sockaddr_ex addr; /* address to connect to */

View File

@ -65,7 +65,10 @@
/* allow no more than 5 "chained" compression steps */ /* allow no more than 5 "chained" compression steps */
#define MAX_ENCODE_STACK 5 #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 */ #define DECOMPRESS_BUFFER_SIZE 16384 /* buffer size for decompressed data */
#endif
#ifdef HAVE_LIBZ #ifdef HAVE_LIBZ

View File

@ -483,7 +483,9 @@ static bool invalid_octets(const char *p)
#define CERR_COMMENT 11 /* a commented line */ #define CERR_COMMENT 11 /* a commented line */
#define CERR_RANGE 12 /* expire range problem */ #define CERR_RANGE 12 /* expire range problem */
#define CERR_FIELDS 13 /* incomplete netscape line */ #define CERR_FIELDS 13 /* incomplete netscape line */
#ifdef USE_LIBPSL
#define CERR_PSL 14 /* a public suffix */ #define CERR_PSL 14 /* a public suffix */
#endif
#define CERR_LIVE_WINS 15 #define CERR_LIVE_WINS 15
/* The maximum length we accept a date string for the 'expire' keyword. The /* The maximum length we accept a date string for the 'expire' keyword. The

View File

@ -144,9 +144,6 @@
#include "curl_memory.h" #include "curl_memory.h"
#include "memdebug.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) #if !defined(CURL_NTLM_NOT_SUPPORTED)
/* /*
* Turns a 56-bit key into being 64-bit wide. * 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) #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. */ /* Timestamp in tenths of a microsecond since January 1, 1601 00:00:00 UTC. */
struct ms_filetime { struct ms_filetime {
unsigned int dwLowDateTime; 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 */ /* Concatenate the Type 2 challenge with the BLOB and do HMAC MD5 */
memcpy(ptr + 8, &ntlm->nonce[0], 8); memcpy(ptr + 8, &ntlm->nonce[0], 8);
result = Curl_hmacit(&Curl_HMAC_MD5, ntlmv2hash, HMAC_MD5_LENGTH, ptr + 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) { if(result) {
free(ptr); free(ptr);
return result; return result;

View File

@ -82,7 +82,6 @@
# include <nettle/sha.h> # include <nettle/sha.h>
# if defined(SHA512_256_DIGEST_SIZE) # if defined(SHA512_256_DIGEST_SIZE)
# define USE_GNUTLS_SHA512_256 1 # define USE_GNUTLS_SHA512_256 1
# define HAS_SHA512_256_IMPLEMENTATION 1
# endif # endif
#endif /* ! HAS_SHA512_256_IMPLEMENTATION && USE_GNUTLS */ #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 */ #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 ** * /* ** This implementation of SHA-512/256 hash calculation was originally ** *
* ** written by Evgeny Grin (Karlson2k) for GNU libmicrohttpd. ** * * ** written by Evgeny Grin (Karlson2k) for GNU libmicrohttpd. ** *
* ** The author ported the code to libcurl. The ported code is provided ** * * ** The author ported the code to libcurl. The ported code is provided ** *

View File

@ -46,9 +46,6 @@
#define DNS_CLASS_IN 0x01 #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 #ifndef CURL_DISABLE_VERBOSE_STRINGS
static const char * const errors[]={ 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) #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, static void doh_print_buf(struct Curl_easy *data,
const char *prefix, const char *prefix,
unsigned char *buf, size_t len) unsigned char *buf, size_t len)

View File

@ -32,7 +32,9 @@
#define MIN_FIRST_ALLOC 32 #define MIN_FIRST_ALLOC 32
#ifdef DEBUGBUILD
#define DYNINIT 0xbee51da /* random pattern */ #define DYNINIT 0xbee51da /* random pattern */
#endif
/* /*
* Init a dynbuf struct. * Init a dynbuf struct.

View File

@ -34,8 +34,10 @@
#include "memdebug.h" #include "memdebug.h"
/* random patterns for API verification */ /* random patterns for API verification */
#ifdef DEBUGBUILD
#define HASHINIT 0x7017e781 #define HASHINIT 0x7017e781
#define ITERINIT 0x5FEDCBA9 #define ITERINIT 0x5FEDCBA9
#endif
static void static void
hash_element_dtor(void *user, void *element) hash_element_dtor(void *user, void *element)

View File

@ -33,8 +33,6 @@
* https://www.innovation.ch/java/ntlm.html * https://www.innovation.ch/java/ntlm.html
*/ */
#define DEBUG_ME 0
#include "urldata.h" #include "urldata.h"
#include "sendf.h" #include "sendf.h"
#include "strcase.h" #include "strcase.h"
@ -55,12 +53,6 @@
#include "curl_memory.h" #include "curl_memory.h"
#include "memdebug.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, CURLcode Curl_input_ntlm(struct Curl_easy *data,
bool proxy, /* if proxy or not */ bool proxy, /* if proxy or not */
const char *header) /* rest of the www-authenticate: const char *header) /* rest of the www-authenticate:

View File

@ -38,7 +38,7 @@
#include "curl_printf.h" #include "curl_printf.h"
#define IN6ADDRSZ 16 #define IN6ADDRSZ 16
#define INADDRSZ 4 /* #define INADDRSZ 4 */
#define INT16SZ 2 #define INT16SZ 2
/* /*

View File

@ -32,12 +32,11 @@
/* this must be the last include file */ /* this must be the last include file */
#include "memdebug.h" #include "memdebug.h"
#ifdef DEBUGBUILD
#define LLISTINIT 0x100cc001 /* random pattern */ #define LLISTINIT 0x100cc001 /* random pattern */
#define NODEINIT 0x12344321 /* random pattern */ #define NODEINIT 0x12344321 /* random pattern */
#define NODEREM 0x54321012 /* random pattern */ #define NODEREM 0x54321012 /* random pattern */
#ifdef DEBUGBUILD
#define VERIFYNODE(x) verifynode(x) #define VERIFYNODE(x) verifynode(x)
static struct Curl_llist_node *verifynode(struct Curl_llist_node *n) static struct Curl_llist_node *verifynode(struct Curl_llist_node *n)
{ {

View File

@ -46,11 +46,11 @@
/* The last #include file should be: */ /* The last #include file should be: */
#include "memdebug.h" #include "memdebug.h"
#define MQTT_MSG_CONNECT 0x10 #define MQTT_MSG_CONNECT 0x10
#define MQTT_MSG_CONNACK 0x20 /* #define MQTT_MSG_CONNACK 0x20 */
#define MQTT_MSG_PUBLISH 0x30 #define MQTT_MSG_PUBLISH 0x30
#define MQTT_MSG_SUBSCRIBE 0x82 #define MQTT_MSG_SUBSCRIBE 0x82
#define MQTT_MSG_SUBACK 0x90 #define MQTT_MSG_SUBACK 0x90
#define MQTT_MSG_DISCONNECT 0xe0 #define MQTT_MSG_DISCONNECT 0xe0
#define MQTT_CONNACK_LEN 2 #define MQTT_CONNACK_LEN 2

View File

@ -26,10 +26,14 @@
#ifndef CURL_DISABLE_NETRC #ifndef CURL_DISABLE_NETRC
#ifdef HAVE_PWD_H #ifdef HAVE_PWD_H
#ifdef __AMIGA__
#undef __NO_NET_API /* required for AmigaOS to declare getpwuid() */ #undef __NO_NET_API /* required for AmigaOS to declare getpwuid() */
#endif
#include <pwd.h> #include <pwd.h>
#ifdef __AMIGA__
#define __NO_NET_API #define __NO_NET_API
#endif #endif
#endif
#include <curl/curl.h> #include <curl/curl.h>
#include "netrc.h" #include "netrc.h"

View File

@ -100,7 +100,9 @@ static int parsedate(const char *date, time_t *output);
#define PARSEDATE_OK 0 #define PARSEDATE_OK 0
#define PARSEDATE_FAIL -1 #define PARSEDATE_FAIL -1
#define PARSEDATE_LATER 1 #define PARSEDATE_LATER 1
#if defined(HAVE_TIME_T_UNSIGNED) || (SIZEOF_TIME_T < 5)
#define PARSEDATE_SOONER 2 #define PARSEDATE_SOONER 2
#endif
#if !defined(CURL_DISABLE_PARSEDATE) || !defined(CURL_DISABLE_FTP) || \ #if !defined(CURL_DISABLE_PARSEDATE) || !defined(CURL_DISABLE_FTP) || \
!defined(CURL_DISABLE_FILE) !defined(CURL_DISABLE_FILE)

View File

@ -77,7 +77,7 @@
#define SMB_FLAGS_CANONICAL_PATHNAMES 0x10 #define SMB_FLAGS_CANONICAL_PATHNAMES 0x10
#define SMB_FLAGS_CASELESS_PATHNAMES 0x08 #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_IS_LONG_NAME 0x0040
#define SMB_FLAGS2_KNOWS_LONG_NAME 0x0001 #define SMB_FLAGS2_KNOWS_LONG_NAME 0x0001

View File

@ -836,8 +836,6 @@ static bool ssh_config_matches(struct connectdata *one,
return Curl_safecmp(one->proto.sshc.rsa, two->proto.sshc.rsa) && return Curl_safecmp(one->proto.sshc.rsa, two->proto.sshc.rsa) &&
Curl_safecmp(one->proto.sshc.rsa_pub, two->proto.sshc.rsa_pub); Curl_safecmp(one->proto.sshc.rsa_pub, two->proto.sshc.rsa_pub);
} }
#else
#define ssh_config_matches(x,y) FALSE
#endif #endif
struct url_conn_match { struct url_conn_match {

View File

@ -50,6 +50,7 @@
#include "curl_memory.h" #include "curl_memory.h"
#include "memdebug.h" #include "memdebug.h"
#ifndef USE_WINDOWS_SSPI
#define SESSION_ALGO 1 /* for algos with this bit set */ #define SESSION_ALGO 1 /* for algos with this bit set */
#define ALGO_MD5 0 #define ALGO_MD5 0
@ -59,7 +60,6 @@
#define ALGO_SHA512_256 4 #define ALGO_SHA512_256 4
#define ALGO_SHA512_256SESS (ALGO_SHA512_256 | SESSION_ALGO) #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 (1 << 0)
#define DIGEST_QOP_VALUE_AUTH_INT (1 << 1) #define DIGEST_QOP_VALUE_AUTH_INT (1 << 1)
#define DIGEST_QOP_VALUE_AUTH_CONF (1 << 2) #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; return TRUE;
} }
#if !defined(USE_WINDOWS_SSPI) #ifndef USE_WINDOWS_SSPI
/* Convert md5 chunk to RFC2617 (section 3.1.3) -suitable ASCII string */ /* Convert MD5 chunk to RFC2617 (section 3.1.3) -suitable ASCII string */
static void auth_digest_md5_to_ascii(unsigned char *source, /* 16 bytes */ static void auth_digest_md5_to_ascii(unsigned char *source, /* 16 bytes */
unsigned char *dest) /* 33 bytes */ unsigned char *dest) /* 33 bytes */
{ {

View File

@ -422,8 +422,6 @@ static int idn_present(curl_version_info_data *info)
return info->libidn != NULL; return info->libidn != NULL;
#endif #endif
} }
#else
#define idn_present NULL
#endif #endif
#if defined(USE_SSL) && !defined(CURL_DISABLE_PROXY) && \ #if defined(USE_SSL) && !defined(CURL_DISABLE_PROXY) && \

View File

@ -151,13 +151,6 @@
#define CONST_EXTS const #define CONST_EXTS const
#define HAVE_ERR_REMOVE_THREAD_STATE_DEPRECATED 1 #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 #else
/* For OpenSSL before 1.1.0 */ /* For OpenSSL before 1.1.0 */
#define ASN1_STRING_get0_data(x) ASN1_STRING_data(x) #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 #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 #ifdef HAVE_KEYLOG_CALLBACK
static void ossl_keylog_callback(const SSL *ssl, const char *line) 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); RAND_add(randb, (int)len, (double)len/2);
} while(!rand_enough()); } 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 */ /* generates a default path for the random seed file */
char fname[256]; char fname[256];

View File

@ -80,10 +80,6 @@
# define HAS_ALPN_SCHANNEL # define HAS_ALPN_SCHANNEL
#endif #endif
#ifndef BCRYPT_CHACHA20_POLY1305_ALGORITHM
#define BCRYPT_CHACHA20_POLY1305_ALGORITHM L"CHACHA20_POLY1305"
#endif
#ifndef BCRYPT_CHAIN_MODE_CCM #ifndef BCRYPT_CHAIN_MODE_CCM
#define BCRYPT_CHAIN_MODE_CCM L"ChainingModeCCM" #define BCRYPT_CHAIN_MODE_CCM L"ChainingModeCCM"
#endif #endif
@ -232,8 +228,6 @@ schannel_set_ssl_version_min_max(DWORD *enabled_protocols,
return CURLE_OK; return CURLE_OK;
} }
/* longest is 26, buffer is slightly bigger */
#define LONGEST_ALG_ID 32
#define CIPHEROPTION(x) {#x, x} #define CIPHEROPTION(x) {#x, x}
struct algo { struct algo {

View File

@ -28,14 +28,14 @@
defined(USE_SCHANNEL) || defined(USE_SECTRANSP) || \ defined(USE_SCHANNEL) || defined(USE_SECTRANSP) || \
defined(USE_MBEDTLS) 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() */ #define WANT_PARSEX509 /* uses Curl_parseX509() */
#endif #endif
#if defined(USE_GNUTLS) || defined(USE_SCHANNEL) || defined(USE_SECTRANSP) || \ #if defined(USE_GNUTLS) || defined(USE_SCHANNEL) || defined(USE_SECTRANSP) || \
defined(USE_MBEDTLS) defined(USE_MBEDTLS)
#define WANT_EXTRACT_CERTINFO /* uses Curl_extract_certinfo() */ #define WANT_EXTRACT_CERTINFO /* uses Curl_extract_certinfo() */
#define WANT_PARSEX509 /* ... uses Curl_parseX509() */
#endif #endif
#include <curl/curl.h> #include <curl/curl.h>
@ -64,10 +64,10 @@
#define CURL_ASN1_MAX ((size_t) 0x40000) /* 256K */ #define CURL_ASN1_MAX ((size_t) 0x40000) /* 256K */
/* ASN.1 classes. */ /* ASN.1 classes. */
#define CURL_ASN1_UNIVERSAL 0 /* #define CURL_ASN1_UNIVERSAL 0 */
#define CURL_ASN1_APPLICATION 1 /* #define CURL_ASN1_APPLICATION 1 */
#define CURL_ASN1_CONTEXT_SPECIFIC 2 /* #define CURL_ASN1_CONTEXT_SPECIFIC 2 */
#define CURL_ASN1_PRIVATE 3 /* #define CURL_ASN1_PRIVATE 3 */
/* ASN.1 types. */ /* ASN.1 types. */
#define CURL_ASN1_BOOLEAN 1 #define CURL_ASN1_BOOLEAN 1
@ -76,27 +76,27 @@
#define CURL_ASN1_OCTET_STRING 4 #define CURL_ASN1_OCTET_STRING 4
#define CURL_ASN1_NULL 5 #define CURL_ASN1_NULL 5
#define CURL_ASN1_OBJECT_IDENTIFIER 6 #define CURL_ASN1_OBJECT_IDENTIFIER 6
#define CURL_ASN1_OBJECT_DESCRIPTOR 7 /* #define CURL_ASN1_OBJECT_DESCRIPTOR 7 */
#define CURL_ASN1_INSTANCE_OF 8 /* #define CURL_ASN1_INSTANCE_OF 8 */
#define CURL_ASN1_REAL 9 /* #define CURL_ASN1_REAL 9 */
#define CURL_ASN1_ENUMERATED 10 #define CURL_ASN1_ENUMERATED 10
#define CURL_ASN1_EMBEDDED 11 /* #define CURL_ASN1_EMBEDDED 11 */
#define CURL_ASN1_UTF8_STRING 12 #define CURL_ASN1_UTF8_STRING 12
#define CURL_ASN1_RELATIVE_OID 13 /* #define CURL_ASN1_RELATIVE_OID 13 */
#define CURL_ASN1_SEQUENCE 16 /* #define CURL_ASN1_SEQUENCE 16 */
#define CURL_ASN1_SET 17 /* #define CURL_ASN1_SET 17 */
#define CURL_ASN1_NUMERIC_STRING 18 #define CURL_ASN1_NUMERIC_STRING 18
#define CURL_ASN1_PRINTABLE_STRING 19 #define CURL_ASN1_PRINTABLE_STRING 19
#define CURL_ASN1_TELETEX_STRING 20 #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_IA5_STRING 22
#define CURL_ASN1_UTC_TIME 23 #define CURL_ASN1_UTC_TIME 23
#define CURL_ASN1_GENERALIZED_TIME 24 #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_VISIBLE_STRING 26
#define CURL_ASN1_GENERAL_STRING 27 /* #define CURL_ASN1_GENERAL_STRING 27 */
#define CURL_ASN1_UNIVERSAL_STRING 28 #define CURL_ASN1_UNIVERSAL_STRING 28
#define CURL_ASN1_CHARACTER_STRING 29 /* #define CURL_ASN1_CHARACTER_STRING 29 */
#define CURL_ASN1_BMP_STRING 30 #define CURL_ASN1_BMP_STRING 30

View File

@ -45,19 +45,13 @@
#include <limits.h> #include <limits.h>
#define CURL_MASK_UCHAR ((unsigned char)~0) #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_USHORT ((unsigned short)~0)
#define CURL_MASK_SSHORT (CURL_MASK_USHORT >> 1)
#define CURL_MASK_UINT ((unsigned int)~0) #define CURL_MASK_UINT ((unsigned int)~0)
#define CURL_MASK_SINT (CURL_MASK_UINT >> 1) #define CURL_MASK_SINT (CURL_MASK_UINT >> 1)
#define CURL_MASK_ULONG ((unsigned long)~0) #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_USIZE_T ((size_t)~0)
#define CURL_MASK_SSIZE_T (CURL_MASK_USIZE_T >> 1) #define CURL_MASK_SSIZE_T (CURL_MASK_USIZE_T >> 1)

View 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], [switch-enum]) # Not used because this basically disallows default case
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [type-limits]) CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [type-limits])
# CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [unused-macros]) # Not practical # 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]) CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [unreachable-code unused-parameter])
fi 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], [redundant-decls])
# CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [switch-enum]) # Not used because this basically disallows default case # 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 # CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [unused-macros]) # Not practical
# tmp_CFLAGS="$tmp_CFLAGS -Wno-error=unused-macros"
fi fi
# #
dnl Only gcc 4.2 or later dnl Only gcc 4.2 or later

View File

@ -31,13 +31,6 @@
#include "memdebug.h" /* keep this as LAST include */ #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 ** 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) #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 /* 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 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 */ macros that provide the support to do 64-bit seeks correctly */

View File

@ -45,8 +45,6 @@
#ifdef _WIN32 #ifdef _WIN32
# undef PATH_MAX # undef PATH_MAX
# define PATH_MAX MAX_PATH # 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() */ #elif !defined(__DJGPP__) || (__DJGPP__ < 2) /* DJGPP 2.0 has _use_lfn() */
# define _use_lfn(f) (0) /* long filenames never available */ # define _use_lfn(f) (0) /* long filenames never available */
#elif defined(__DJGPP__) #elif defined(__DJGPP__)
@ -215,7 +213,7 @@ SANITIZEcode sanitize_file_name(char **const sanitized, const char *file_name,
return SANITIZE_ERR_OK; 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 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 the filename. Filenames suffixed by an alternate data stream cannot be

View File

@ -185,12 +185,12 @@ static const struct NameValue setopt_nv_CURLNONZERODEFAULTS[] = {
} \ } \
} while(0) } 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 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 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 DATA3(f,a,b,c) ADDF((&easysrc_data, f,a,b,c))
#define CODE0(s) ADD((&easysrc_code, s)) #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 CODE2(f,a,b) ADDF((&easysrc_code, f,a,b))
#define CODE3(f,a,b,c) ADDF((&easysrc_code, f,a,b,c)) #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 CLEAN1(f,a) ADDF((&easysrc_clean, f,a))
#define REM0(s) ADD((&easysrc_toohard, s)) /* #define REM0(s) ADD((&easysrc_toohard, s)) */
#define REM1(f,a) ADDF((&easysrc_toohard, f,a)) /* #define REM1(f,a) ADDF((&easysrc_toohard, f,a)) */
#define REM3(f,a,b,c) ADDF((&easysrc_toohard, f,a,b,c)) #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. /* Escape string to C string syntax. Return NULL if out of memory.
@ -715,6 +715,4 @@ nomem:
return ret; return ret;
} }
#else /* CURL_DISABLE_LIBCURL_OPTION */
#endif /* CURL_DISABLE_LIBCURL_OPTION */ #endif /* CURL_DISABLE_LIBCURL_OPTION */

View File

@ -45,6 +45,9 @@ AM_CPPFLAGS += -DCURL_NO_OLDIES
if USE_CPPFLAG_CURL_STATICLIB if USE_CPPFLAG_CURL_STATICLIB
AM_CPPFLAGS += -DCURL_STATICLIB AM_CPPFLAGS += -DCURL_STATICLIB
endif endif
if DOING_NATIVE_WINDOWS
AM_CPPFLAGS += -DWIN32_LEAN_AND_MEAN
endif
# Prevent LIBS from being used for all link targets # Prevent LIBS from being used for all link targets
LIBS = $(BLANK_AT_MAKETIME) LIBS = $(BLANK_AT_MAKETIME)

View File

@ -40,9 +40,6 @@
#endif #endif
#ifdef _WIN32 #ifdef _WIN32
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h> #include <windows.h>
#else #else
#include <sys/time.h> #include <sys/time.h>

View File

@ -34,9 +34,6 @@
#include <string.h> #include <string.h>
#ifdef _WIN32 #ifdef _WIN32
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h> #include <windows.h>
#else #else
#include <sys/time.h> #include <sys/time.h>

View File

@ -65,12 +65,6 @@
#ifdef USE_WINSOCK #ifdef USE_WINSOCK
#undef EINTR #undef EINTR
#define EINTR 4 /* errno.h value */ #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 #endif
#define DEFAULT_PORT 1883 /* MQTT default port */ #define DEFAULT_PORT 1883 /* MQTT default port */
@ -86,15 +80,11 @@
#define MQTT_MSG_CONNECT 0x10 #define MQTT_MSG_CONNECT 0x10
#define MQTT_MSG_CONNACK 0x20 #define MQTT_MSG_CONNACK 0x20
#define MQTT_MSG_PUBLISH 0x30 #define MQTT_MSG_PUBLISH 0x30
#define MQTT_MSG_PUBACK 0x40 /* #define MQTT_MSG_PUBACK 0x40 */
#define MQTT_MSG_SUBSCRIBE 0x82 #define MQTT_MSG_SUBSCRIBE 0x82
#define MQTT_MSG_SUBACK 0x90 #define MQTT_MSG_SUBACK 0x90
#define MQTT_MSG_DISCONNECT 0xe0 #define MQTT_MSG_DISCONNECT 0xe0
#define MQTT_CONNACK_LEN 4
#define MQTT_SUBACK_LEN 5
#define MQTT_CLIENTID_LEN 12 /* "curl0123abcd" */
struct configurable { struct configurable {
unsigned char version; /* initial version byte in the request must match unsigned char version; /* initial version byte in the request must match
this */ this */

View File

@ -68,7 +68,6 @@ static const char *ipv_inuse = "IPv4";
static int serverlogslocked = 0; static int serverlogslocked = 0;
#define REQBUFSIZ 150000 #define REQBUFSIZ 150000
#define REQBUFSIZ_TXT "149999"
static long prevtestno = -1; /* previous test number we served */ static long prevtestno = -1; /* previous test number we served */
static long prevpartno = -1; /* previous part number we served */ static long prevpartno = -1; /* previous part number we served */

View File

@ -86,12 +86,6 @@
#ifdef USE_WINSOCK #ifdef USE_WINSOCK
#undef EINTR #undef EINTR
#define EINTR 4 /* errno.h value */ #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 #endif
#define DEFAULT_PORT 8905 #define DEFAULT_PORT 8905