r-lyeh-archived/sole

-Wunused-value compiler warning

jcuga opened this issue · 2 comments

jcuga commented

Hey great library. One minor issue (which I have locally fixed) is that on gcc version:

gcc (GCC) 4.9.2 20150212 (Red Hat 4.9.2-6)

I had to manually disable a -Wunused-value compiler warning. So for those who require warning-free compilations, you would have to edit the sole.cpp file to disable this warning:

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-value"
$linux({
    struct ifreq ifr;

    int s = socket(PF_INET, SOCK_DGRAM, 0);
    if (s == -1) return ("cannot open socket"), false;

    std::strcpy(ifr.ifr_name, "eth0");
    int rc = ioctl(s, SIOCGIFHWADDR, &ifr);
    close(s);
    if (rc < 0) return ("cannot get MAC address"), false;
    struct sockaddr* sa = reinterpret_cast<struct sockaddr*>(&ifr.ifr_addr);
    _node.resize( sizeof(sa->sa_data) );
    std::memcpy(_node.data(), sa->sa_data, _node.size() );
    return true;
})
#pragma GCC diagnostic pop

Not sure if you care to fix this or not, but just letting you know. Thanks!

Aha. I' ll take a look thanks :)

Should be fixed in latest commit from now :)