On Thu, Dec 19, 2013 at 11:44:54AM -0800, Saurabh Shah wrote: So that vsnprintf on windows has C99 like semantics. Signed-off-by: Saurabh Shah <ssaur...@nicira.com<mailto:ssaur...@nicira.com>>
Doesn't snprintf() need the same treatment? Is there a reason not to handle it in the same patch? Ah, thanks, I missed this. Someone had defined snprintf to sprintf_s and I didn't catch that. If the approach is fine I can update the patch with a similar wrapper for snprintf. (I hope I am not missing any other print function :)) With this patch applied, if I add a file lib/stdio.h with the following contents: #if defined __need_FILE || defined __need___FILE /* Special invocation from within glibc. */ #include_next <stdio.h> #elif !defined STDIO_H_WRAPPER #define STDIO_H_WRAPPER 1 #include_next <stdio.h> #undef snprintf #define snprintf(...) ((void) snprintf(__VA_ARGS__)) #undef vsnprintf #define vsnprintf(...) ((void) vsnprintf(__VA_ARGS__)) #endif /* stdio.h wrapper */ then I get plenty of errors: ../lib/command-line.c: In function 'proctitle_set': ../lib/command-line.c:172:7: error: void value not ignored as it ought to be ../lib/vlandev.c: In function 'vlandev_dummy_add': ../lib/vlandev.c:318:5: error: void value not ignored as it ought to be ../lib/json.c: In function 'json_serialized_length': ../lib/json.c:1743:9: error: void value not ignored as it ought to be ../lib/json.c:1746:9: error: void value not ignored as it ought to be ../lib/match.c: In function 'match_format': ../lib/match.c:924:9: error: void value not ignored as it ought to be ../lib/socket-util.c: In function 'shorten_name_via_proc': ../lib/socket-util.c:377:9: error: void value not ignored as it ought to be ../lib/socket-util.c: In function 'shorten_name_via_symlink': ../lib/socket-util.c:418:13: error: void value not ignored as it ought to be ../lib/socket-util.c:433:13: error: void value not ignored as it ought to be I think, this is because the lib/stdio.h you defined wants the caller to ignore the return type of snprintf, but they don't. I get the same error if I just add lib/stdio.h without any of my changes. This change should ideally not affect any non-windows at all, other than a function indirection.
_______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev