Silence linker warnings with -flto

This commit is contained in:
Stephan Hadinger 2022-01-14 20:47:33 +01:00
parent 5eb25ef1c4
commit a0922c11cd
3 changed files with 17 additions and 12 deletions

View File

@ -46,10 +46,10 @@
#endif // USE_WEBCLIENT_HTTPS #endif // USE_WEBCLIENT_HTTPS
// #ifdef HTTPCLIENT_1_1_COMPATIBLE // #ifdef HTTPCLIENT_1_1_COMPATIBLE
class TransportTraits class TransportTraitsLight
{ {
public: public:
virtual ~TransportTraits() virtual ~TransportTraitsLight()
{ {
} }
@ -72,7 +72,7 @@ public:
#ifdef USE_WEBCLIENT_HTTPS #ifdef USE_WEBCLIENT_HTTPS
static const uint8_t _fingerprint_any[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }; static const uint8_t _fingerprint_any[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 };
class BearSSLTraits : public TransportTraits class BearSSLTraits : public TransportTraitsLight
{ {
public: public:
BearSSLTraits(int recv, int xmit) : BearSSLTraits(int recv, int xmit) :
@ -221,7 +221,7 @@ bool HTTPClientLight::begin(String url, const char* CAcert)
} }
_secure = true; _secure = true;
#ifdef USE_WEBCLIENT_HTTPS #ifdef USE_WEBCLIENT_HTTPS
_transportTraits = TransportTraitsPtr(new BearSSLTraits(16384, 0)); _transportTraits = TransportTraitsLightPtr(new BearSSLTraits(16384, 0));
// set buffer to 16KB half duplex, so we won't lose responses bigger than 16KB // set buffer to 16KB half duplex, so we won't lose responses bigger than 16KB
// half duplex is well suited for HTTPS: one request followed by responses // half duplex is well suited for HTTPS: one request followed by responses
#else #else
@ -251,7 +251,7 @@ bool HTTPClientLight::begin(String url)
if (!beginInternal(url, "http")) { if (!beginInternal(url, "http")) {
return begin(url, (const char*)NULL); return begin(url, (const char*)NULL);
} }
_transportTraits = TransportTraitsPtr(new TransportTraits()); _transportTraits = TransportTraitsLightPtr(new TransportTraitsLight());
if(!_transportTraits) { if(!_transportTraits) {
log_e("could not create transport traits"); log_e("could not create transport traits");
return false; return false;
@ -328,7 +328,7 @@ bool HTTPClientLight::beginInternal(String url, const char* expectedProtocol)
// _host = host; // _host = host;
// _port = port; // _port = port;
// _uri = uri; // _uri = uri;
// // _transportTraits = TransportTraitsPtr(new TransportTraits()); TODO // // _transportTraits = TransportTraitsLightPtr(new TransportTraitsLight()); TODO
// _transportTraits = nullptr; // _transportTraits = nullptr;
// log_d("host: %s port: %d uri: %s", host.c_str(), port, uri.c_str()); // log_d("host: %s port: %d uri: %s", host.c_str(), port, uri.c_str());
// return true; // return true;
@ -351,7 +351,7 @@ bool HTTPClientLight::beginInternal(String url, const char* expectedProtocol)
// return false; // return false;
// } // }
// _secure = true; // _secure = true;
// _transportTraits = TransportTraitsPtr(new TLSTraits(CAcert)); // _transportTraits = TransportTraitsLightPtr(new TLSTraits(CAcert));
// return true; // return true;
// } // }
@ -372,7 +372,7 @@ bool HTTPClientLight::beginInternal(String url, const char* expectedProtocol)
// return false; // return false;
// } // }
// _secure = true; // _secure = true;
// _transportTraits = TransportTraitsPtr(new TLSTraits(CAcert, cli_cert, cli_key)); // _transportTraits = TransportTraitsLightPtr(new TLSTraits(CAcert, cli_cert, cli_key));
// return true; // return true;
// } // }
#endif // HTTPCLIENT_1_1_COMPATIBLE #endif // HTTPCLIENT_1_1_COMPATIBLE

View File

@ -141,6 +141,11 @@
// } followRedirects_t; // } followRedirects_t;
#ifdef HTTPCLIENT_1_1_COMPATIBLE
class TransportTraitsLight;
typedef std::unique_ptr<TransportTraitsLight> TransportTraitsLightPtr;
#endif
class HTTPClientLight class HTTPClientLight
{ {
@ -231,7 +236,7 @@ protected:
#ifdef HTTPCLIENT_1_1_COMPATIBLE #ifdef HTTPCLIENT_1_1_COMPATIBLE
TransportTraitsPtr _transportTraits; TransportTraitsLightPtr _transportTraits;
std::unique_ptr<WiFiClient> _tcpDeprecated; std::unique_ptr<WiFiClient> _tcpDeprecated;
#endif #endif

View File

@ -4,12 +4,12 @@
* To use: `import tasmota` * To use: `import tasmota`
*******************************************************************/ *******************************************************************/
#include "be_constobj.h" #include "be_constobj.h"
#include "be_ctypes.h"
struct dummy_struct {}; // we need a struct name but don't need any meaningful content, we just take the address
extern struct TasmotaGlobal_t TasmotaGlobal; extern struct TasmotaGlobal_t TasmotaGlobal;
extern struct TSettings * Settings; extern struct TSettings * Settings;
extern struct dummy_struct be_tasmota_global_struct; extern const be_ctypes_structure_t be_tasmota_global_struct;
extern struct dummy_struct be_tasmota_settings_struct; extern const be_ctypes_structure_t be_tasmota_settings_struct;
extern int l_getFreeHeap(bvm *vm); extern int l_getFreeHeap(bvm *vm);
extern int l_arch(bvm *vm); extern int l_arch(bvm *vm);