named-data-iot/ndn-lite

tlv_make_data: undefined behavior

yoursunny opened this issue · 0 comments

https://travis-ci.org/yoursunny/esp8266ndn/jobs/579081564

In file included from /home/travis/Arduino/libraries/esp8266ndn/src/ndn-lite/encode/wrapper-api.c:16:0:
/home/travis/Arduino/libraries/esp8266ndn/src/ndn-lite/encode/wrapper-api.c: In function 'tlv_make_data':
/home/travis/Arduino/libraries/esp8266ndn/src/ndn-lite/encode/wrapper-api.c:85:26: warning: 'enum TLV_DATAARG_TYPE' is promoted to 'int' when passed through '...'
     argtype = va_arg(vl, enum TLV_DATAARG_TYPE);
                          ^
/home/travis/Arduino/libraries/esp8266ndn/src/ndn-lite/encode/wrapper-api.c:85:26: note: (so you should pass 'int' not 'enum TLV_DATAARG_TYPE' to 'va_arg')
/home/travis/Arduino/libraries/esp8266ndn/src/ndn-lite/encode/wrapper-api.c:85:26: note: if this code is reached, the program will abort

See https://stackoverflow.com/a/23983508 for an explanation on why this is undefined behavior, and how to fix it.