On Fri, Jun 24, 2011 at 3:14 PM, Jie Zhang <jzhang...@gmail.com> wrote: > On Mon, Jun 20, 2011 at 6:50 AM, Steve Bennett <ste...@workware.net.au> wrote: >> The default is -Werror, so warnings become errors >> and stop the build. >> Might be better to simply #define FT_STATUS instead. >> >> - LOG_ERROR("FT_Write returned: %lu", status); >> + LOG_ERROR("FT_Write returned: %lu", (unsigned long)status); > > The type of status is ULONG, which is "unsigned long" on Windows but > is "unsigned int" on Linux in FTD2XX driver. So the problem is "%lu" > is not right for status on Linux. If we don't want cast, I think we > can do something like: > > #ifdef __WINDOWS_TYPES__ /* if FTD2XX WinTypes.h is included */ > #define PRulong "u" > #else > #define PRulong "lu" > #endif > > LOG_ERROR("FT_Write returned: %"PRulong, status); > Another fix would be not trying to print the status as a numeric value. We can print it as an error message, so we don't need to handle this tricky situation. Like
LOG_ERROR("FT_Write failed:%s\n", ftd2xx_status_string(status)); UrJTAG uses this method. Regards, Jie _______________________________________________ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development