mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-29 05:21:37 +03:00
Add -Werror to acceptance builds for C and CPP (#4369)
Use platform.local.txt to add -Werror to GCC for the build of all code. Any warnings on a submitted patch will cause an error. Several examples and libraries had warnings/errors (missing returns on functions, types, etc.). Clean those up with this commit as well.
This commit is contained in:
committed by
GitHub
parent
ad42ab69c1
commit
f9ac524b13
@ -204,7 +204,7 @@ unsigned int readRegister(byte registerName, int numBytes) {
|
||||
// take the chip select low to select the device:
|
||||
digitalWrite(chipSelectPin, LOW);
|
||||
// send the device the register you want to read:
|
||||
int command = SPI.transfer(registerName);
|
||||
SPI.transfer(registerName);
|
||||
// send a value of 0 to read the first byte returned:
|
||||
inByte = SPI.transfer(0x00);
|
||||
|
||||
|
@ -108,7 +108,7 @@ void loop()
|
||||
}
|
||||
|
||||
// send an NTP request to the time server at the given address
|
||||
unsigned long sendNTPpacket(char* address)
|
||||
void sendNTPpacket(char* address)
|
||||
{
|
||||
// set all bytes in the buffer to 0
|
||||
memset(packetBuffer, 0, NTP_PACKET_SIZE);
|
||||
|
@ -282,9 +282,12 @@ uint16_t DNSClient::ProcessResponse(uint16_t aTimeout, IPAddress& aAddress)
|
||||
}
|
||||
iUdp.read(header, DNS_HEADER_SIZE);
|
||||
|
||||
uint16_t header_flags = htons(*((uint16_t*)&header[2]));
|
||||
uint16_t staging; // Staging used to avoid type-punning warnings
|
||||
memcpy(&staging, &header[2], sizeof(uint16_t));
|
||||
uint16_t header_flags = htons(staging);
|
||||
memcpy(&staging, &header[0], sizeof(uint16_t));
|
||||
// Check that it's a response to this request
|
||||
if ( ( iRequestId != (*((uint16_t*)&header[0])) ) ||
|
||||
if ( ( iRequestId != staging ) ||
|
||||
((header_flags & QUERY_RESPONSE_MASK) != (uint16_t)RESPONSE_FLAG) )
|
||||
{
|
||||
// Mark the entire packet as read
|
||||
@ -301,7 +304,8 @@ uint16_t DNSClient::ProcessResponse(uint16_t aTimeout, IPAddress& aAddress)
|
||||
}
|
||||
|
||||
// And make sure we've got (at least) one answer
|
||||
uint16_t answerCount = htons(*((uint16_t*)&header[6]));
|
||||
memcpy(&staging, &header[6], sizeof(uint16_t));
|
||||
uint16_t answerCount = htons(staging);
|
||||
if (answerCount == 0 )
|
||||
{
|
||||
// Mark the entire packet as read
|
||||
@ -310,7 +314,8 @@ uint16_t DNSClient::ProcessResponse(uint16_t aTimeout, IPAddress& aAddress)
|
||||
}
|
||||
|
||||
// Skip over any questions
|
||||
for (uint16_t i =0; i < htons(*((uint16_t*)&header[4])); i++)
|
||||
memcpy(&staging, &header[4], sizeof(uint16_t));
|
||||
for (uint16_t i =0; i < htons(staging); i++)
|
||||
{
|
||||
// Skip over the name
|
||||
uint8_t len;
|
||||
|
@ -364,6 +364,7 @@ uint16_t recvfrom(SOCKET s, uint8_t *buf, uint16_t len, uint8_t *addr, uint16_t
|
||||
*/
|
||||
void flush(SOCKET s) {
|
||||
// TODO
|
||||
(void) s;
|
||||
}
|
||||
|
||||
uint16_t igmpsend(SOCKET s, const uint8_t * buf, uint16_t len)
|
||||
|
Reference in New Issue
Block a user