read_printf.ln revision 1.2
1# $NetBSD: read_printf.ln,v 1.2 2021/08/08 11:07:19 rillig Exp $ 2# 3# Test reading of declarations and usage of printf-like functions. 4 5# void my_printf(const char *, ...); 60sprintf-def.c 7Sprintf-def.c 83d0.3d9my_printfF2PcCEV 9 100sprintf-use.c 11Sprintf-use.c 12 13# my_printf("string %s", "string %s%%%3d"); 14# 15# Argument 1 is converted to 'const char *', due to the function prototype. 16# After that, is it not a string literal anymore, therefore no information 17# about this argument is written to the .ln file. 18# 19# Argument 2 is part of the '...', therefore no conversion to 'const char *' 20# takes place. Since it is still the address of a string, its value is 21# analyzed for printf format specifiers. This is unnecessary though since in 22# this example, the format string is already in argument 1, but not 2. 2311c0.11 s2"%s%%%3d" i 9my_printf f2 PcC PC V 24 25# my_printf("int %d", 12345); 26# 27# Argument 2 is a positive integer. 2812c0.12 p2 i 9my_printf f2 PcC I V 29 30# my_printf("%s %d %p", "\t", -6, (const void *)0); 31# 32# Argument 2 is a string without any printf-like format specifiers. 33# Argument 3 is a negative integer. 34# Argument 4 has no further interesting properties. 3513c0.13 s2"" n3 i 9my_printf f4 PcC PC I PcV V 36 37# See tests/lint1/emit.c, function cover_outqchar. 38161c0.161 s2"%" i 9my_printf f2 PcC PC V 39162c0.162 s2"%s"i 9my_printf f2 PcC PC V 40163c0.163 s2"%%" i 9my_printf f2 PcC PC V 41164c0.164 s2"%\a%\b%\f%\n%\r%\t%\v%\177" i 9my_printf f2 PcC PC V 42