Created
October 10, 2015 20:21
-
-
Save jonm/d41b53500278527ab671 to your computer and use it in GitHub Desktop.
catching type errors for arguments fed to format strings
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[~/src/SillyMUD/src]$ make | |
gcc -g -DIMPL_SECURITY -DNEW_RENT -DLEVEL_LOSS -DNEWEXP -DGROUP_NAMES -Werror -DIMPL_SECURITY -DNEW_RENT -DLEVEL_LOSS -DNEWEXP -DGROUP_NAMES -c -o act.info.o act.info.c | |
act.info.c:2785:58: error: format specifies type 'int' but the argument has type | |
'long' [-Werror,-Wformat] | |
sprintf(buf, "Total number of rooms in world: %d\n\r", room_count); | |
~~ ^~~~~~~~~~ | |
%ld | |
/usr/include/secure/_stdio.h:47:56: note: expanded from macro 'sprintf' | |
__builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__) | |
^ | |
act.info.c:2800:60: error: format specifies type 'int' but the argument has type | |
'long' [-Werror,-Wformat] | |
sprintf(buf, "Total number of monsters in game: %d\n\r", mob_count); | |
~~ ^~~~~~~~~ | |
%ld | |
/usr/include/secure/_stdio.h:47:56: note: expanded from macro 'sprintf' | |
__builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__) | |
^ | |
act.info.c:2803:59: error: format specifies type 'int' but the argument has type | |
'long' [-Werror,-Wformat] | |
sprintf(buf, "Total number of objects in game: %d\n\r", obj_count); | |
~~ ^~~~~~~~~ | |
%ld | |
/usr/include/secure/_stdio.h:47:56: note: expanded from macro 'sprintf' | |
__builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__) | |
^ | |
... | |
5 errors generated. | |
make: *** [act.info.o] Error 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment