face: silence silly warning thrown by clang.

Clang 3.3 complains about a "missing field initializer" for struct ifreq.
However, according to the standard, if there are fewer initializers in a
brace-enclosed list than there are elements or members of an aggregate,
the remainder of the aggregate shall be initialized implicitly as if they
were declared static, i.e. with zero or default-constructed value.

Therefore using "= {0}" is correct (and common practice in C). Emitting
a warning doesn't make sense. As a matter of fact recent GCC releases
disabled it.

Luckily this is C++ and we can simply use the "empty braces" initializer
(which wouldn't be valid C99 syntax) to silence the compiler.

Change-Id: Ibee8d17cc9b5d0eaa5270c52f3596b7994b5e911
This commit is contained in:
Davide Pesavento authored and Alexander Afanasyev committed 2014-03-21 15:44:42 -07:00
1 parent d8d4d98656
commit e4631003a9
1 file changed
+2 -1
+2 -1
View File
@@ -152,6 +152,7 @@ EthernetFace::sendPacket(const ndn::Block& block)
/// we should reserve some space at the beginning and at the end
ndn::EncodingBuffer buffer(block);
// pad with zeroes if the payload is too short
if (block.size() < ethernet::MIN_DATA_LEN)
{
static const uint8_t padding[ethernet::MIN_DATA_LEN] = {0};
@@ -271,7 +272,7 @@ EthernetFace::getInterfaceMtu() const
size_t mtu = ethernet::MAX_DATA_LEN;
#ifdef SIOCGIFMTU
ifreq ifr = {0};
ifreq ifr = {};
std::strncpy(ifr.ifr_name, m_interfaceName.c_str(), sizeof(ifr.ifr_name) - 1);
if (::ioctl(m_socket->native_handle(), SIOCGIFMTU, &ifr) < 0)