From ad547fcf7b3c0191f63396b94c797bfbb4147f62 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 16 Oct 2018 23:35:44 +0200 Subject: [PATCH] travis: add build for "configure --disable-verbose" Closes #3144 --- .travis.yml | 8 +++++++- lib/arpa_telnet.h | 6 +++++- lib/doh.c | 8 ++++++++ lib/http2.c | 5 ++++- lib/sendf.h | 2 +- lib/vtls/openssl.c | 29 ++++++++++++++++++++--------- 6 files changed, 45 insertions(+), 13 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2e69198168..5998f4c2c9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -57,6 +57,10 @@ matrix: compiler: gcc dist: trusty env: T=normal C="--enable-ares" + - os: linux + compiler: gcc + dist: trusty + env: T=normal C="--disable-verbose" CPPFLAGS="-Wno-variadic-macros" NOTESTS=1 - os: linux compiler: gcc dist: trusty @@ -296,7 +300,9 @@ script: if [ "$T" = "normal" ]; then ./configure --enable-warnings --enable-werror $C make && make examples - make test-nonflaky + if [ -z $NOTESTS ]; then + make test-nonflaky + fi if [ -n $CHECKSRC ]; then make checksrc fi diff --git a/lib/arpa_telnet.h b/lib/arpa_telnet.h index ec238729dd..232680e7d6 100644 --- a/lib/arpa_telnet.h +++ b/lib/arpa_telnet.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2018, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -37,6 +37,7 @@ #define CURL_NEW_ENV_VAR 0 #define CURL_NEW_ENV_VALUE 1 +#ifndef CURL_DISABLE_VERBOSE_STRINGS /* * The telnet options represented as strings */ @@ -53,6 +54,7 @@ static const char * const telnetoptions[]= "TERM SPEED", "LFLOW", "LINEMODE", "XDISPLOC", "OLD-ENVIRON", "AUTHENTICATION", "ENCRYPT", "NEW-ENVIRON" }; +#endif #define CURL_TELOPT_MAXIMUM CURL_TELOPT_NEW_ENVIRON @@ -76,6 +78,7 @@ static const char * const telnetoptions[]= #define CURL_DONT 254 /* DON'T use this option! */ #define CURL_IAC 255 /* Interpret As Command */ +#ifndef CURL_DISABLE_VERBOSE_STRINGS /* * Then those numbers represented as strings: */ @@ -86,6 +89,7 @@ static const char * const telnetcmds[]= "AYT", "EC", "EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC" }; +#endif #define CURL_TELCMD_MINIMUM CURL_xEOF /* the first one */ #define CURL_TELCMD_MAXIMUM CURL_IAC /* surprise, 255 is the last one! ;-) */ diff --git a/lib/doh.c b/lib/doh.c index 019ac789c0..ef6013db9d 100644 --- a/lib/doh.c +++ b/lib/doh.c @@ -41,6 +41,7 @@ #define DNS_CLASS_IN 0x01 #define DOH_MAX_RESPONSE_SIZE 3000 /* bytes */ +#ifndef CURL_DISABLE_VERBOSE_STRINGS static const char * const errors[]={ "", "Bad label", @@ -63,6 +64,7 @@ static const char *doh_strerror(DOHcode code) return errors[code]; return "bad error code"; } +#endif #ifdef DEBUGBUILD #define UNITTEST @@ -640,6 +642,7 @@ UNITTEST DOHcode doh_decode(unsigned char *doh, return DOH_OK; /* ok */ } +#ifndef CURL_DISABLE_VERBOSE_STRINGS static void showdoh(struct Curl_easy *data, struct dohentry *d) { @@ -675,6 +678,9 @@ static void showdoh(struct Curl_easy *data, infof(data, "CNAME: %s\n", d->cname[i].alloc); } } +#else +#define showdoh(x,y) +#endif /* * doh2ai() @@ -791,10 +797,12 @@ doh2ai(const struct dohentry *de, const char *hostname, int port) return firstai; } +#ifndef CURL_DISABLE_VERBOSE_STRINGS static const char *type2name(DNStype dnstype) { return (dnstype == DNS_TYPE_A)?"A":"AAAA"; } +#endif UNITTEST void de_cleanup(struct dohentry *d) { diff --git a/lib/http2.c b/lib/http2.c index ed47b73b25..0c5f6db0b4 100644 --- a/lib/http2.c +++ b/lib/http2.c @@ -1108,7 +1108,8 @@ static ssize_t data_source_read_callback(nghttp2_session *session, return nread; } -#ifdef NGHTTP2_HAS_ERROR_CALLBACK +#if defined(NGHTTP2_HAS_ERROR_CALLBACK) && \ + !defined(CURL_DISABLE_VERBOSE_STRINGS) static int error_callback(nghttp2_session *session, const char *msg, size_t len, @@ -1226,7 +1227,9 @@ CURLcode Curl_http2_init(struct connectdata *conn) /* nghttp2_on_header_callback */ nghttp2_session_callbacks_set_on_header_callback(callbacks, on_header); +#ifndef CURL_DISABLE_VERBOSE_STRINGS nghttp2_session_callbacks_set_error_callback(callbacks, error_callback); +#endif /* The nghttp2 session is not yet setup, do it */ rc = nghttp2_session_client_new(&conn->proto.httpc.h2, callbacks, conn); diff --git a/lib/sendf.h b/lib/sendf.h index 7627fe6c5f..c68b017daa 100644 --- a/lib/sendf.h +++ b/lib/sendf.h @@ -36,7 +36,7 @@ void Curl_failf(struct Curl_easy *, const char *fmt, ...); #elif defined(HAVE_VARIADIC_MACROS_GCC) #define infof(x...) Curl_nop_stmt #else -#define infof (void) +#error "missing VARIADIC macro define, fix and rebuild!" #endif #else /* CURL_DISABLE_VERBOSE_STRINGS */ diff --git a/lib/vtls/openssl.c b/lib/vtls/openssl.c index 2eb58015fc..4d1a95ed4e 100644 --- a/lib/vtls/openssl.c +++ b/lib/vtls/openssl.c @@ -1418,6 +1418,10 @@ static bool subj_alt_hostcheck(struct Curl_easy *data, } #else { +#ifdef CURL_DISABLE_VERBOSE_STRINGS + (void)dispname; + (void)data; +#endif if(Curl_cert_hostcheck(match_pattern, hostname)) { infof(data, " subjectAltName: host \"%s\" matched cert's \"%s\"\n", dispname, match_pattern); @@ -2082,6 +2086,7 @@ select_next_proto_cb(SSL *ssl, } #endif /* HAS_NPN */ +#ifndef CURL_DISABLE_VERBOSE_STRINGS static const char * get_ssl_version_txt(SSL *ssl) { @@ -2108,6 +2113,7 @@ get_ssl_version_txt(SSL *ssl) } return "unknown"; } +#endif static CURLcode set_ssl_version_min_max(long *ctx_options, struct connectdata *conn, @@ -3193,7 +3199,7 @@ static CURLcode servercert(struct connectdata *conn, { CURLcode result = CURLE_OK; int rc; - long lerr, len; + long lerr; struct Curl_easy *data = conn->data; X509 *issuer; BIO *fp = NULL; @@ -3236,15 +3242,20 @@ static CURLcode servercert(struct connectdata *conn, buffer, sizeof(buffer)); infof(data, " subject: %s\n", rc?"[NONE]":buffer); - ASN1_TIME_print(mem, X509_get0_notBefore(BACKEND->server_cert)); - len = BIO_get_mem_data(mem, (char **) &ptr); - infof(data, " start date: %.*s\n", len, ptr); - (void)BIO_reset(mem); +#ifndef CURL_DISABLE_VERBOSE_STRINGS + { + long len; + ASN1_TIME_print(mem, X509_get0_notBefore(BACKEND->server_cert)); + len = BIO_get_mem_data(mem, (char **) &ptr); + infof(data, " start date: %.*s\n", len, ptr); + (void)BIO_reset(mem); - ASN1_TIME_print(mem, X509_get0_notAfter(BACKEND->server_cert)); - len = BIO_get_mem_data(mem, (char **) &ptr); - infof(data, " expire date: %.*s\n", len, ptr); - (void)BIO_reset(mem); + ASN1_TIME_print(mem, X509_get0_notAfter(BACKEND->server_cert)); + len = BIO_get_mem_data(mem, (char **) &ptr); + infof(data, " expire date: %.*s\n", len, ptr); + (void)BIO_reset(mem); + } +#endif BIO_free(mem);