https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85139
--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> --- To avoid the warning, cast the argument of the %04X directive to unsigned short: snprintf(s, sizeof(s), "usb:v%04Xp%04X*", (unsigned short)vn, (unsigned short)pn); (Note that even though casting an int to signed short will most likely work, it isn't strictly correct.)