11.3Srillig# $NetBSD: read_printf.ln,v 1.3 2021/08/24 23:38:51 rillig Exp $ 21.1Srillig# 31.1Srillig# Test reading of declarations and usage of printf-like functions. 41.1Srillig 51.1Srillig# void my_printf(const char *, ...); 61.3Srillig0 s printf-def.c 71.3SrilligS printf-def.c 81.3Srillig3 d 0.3 d 9my_printf F2 PcC E V 91.1Srillig 101.3Srillig0 s printf-use.c 111.3SrilligS printf-use.c 121.1Srillig 131.1Srillig# my_printf("string %s", "string %s%%%3d"); 141.1Srillig# 151.1Srillig# Argument 1 is converted to 'const char *', due to the function prototype. 161.1Srillig# After that, is it not a string literal anymore, therefore no information 171.1Srillig# about this argument is written to the .ln file. 181.1Srillig# 191.1Srillig# Argument 2 is part of the '...', therefore no conversion to 'const char *' 201.1Srillig# takes place. Since it is still the address of a string, its value is 211.1Srillig# analyzed for printf format specifiers. This is unnecessary though since in 221.1Srillig# this example, the format string is already in argument 1, but not 2. 231.3Srillig11 c 0.11 s2"%s%%%3d" i 9my_printf f2 PcC PC V 241.1Srillig 251.1Srillig# my_printf("int %d", 12345); 261.1Srillig# 271.1Srillig# Argument 2 is a positive integer. 281.3Srillig12 c 0.12 p2 i 9my_printf f2 PcC I V 291.1Srillig 301.1Srillig# my_printf("%s %d %p", "\t", -6, (const void *)0); 311.1Srillig# 321.1Srillig# Argument 2 is a string without any printf-like format specifiers. 331.1Srillig# Argument 3 is a negative integer. 341.1Srillig# Argument 4 has no further interesting properties. 351.3Srillig13 c 0.13 s2"" n3 i 9my_printf f4 PcC PC I PcV V 361.2Srillig 371.2Srillig# See tests/lint1/emit.c, function cover_outqchar. 381.3Srillig161 c 0.161 s2"%" i 9my_printf f2 PcC PC V 391.3Srillig162 c 0.162 s2"%s"i 9my_printf f2 PcC PC V 401.3Srillig163 c 0.163 s2"%%" i 9my_printf f2 PcC PC V 411.3Srillig164 c 0.164 s2"%\a%\b%\f%\n%\r%\t%\v%\177" i 9my_printf f2 PcC PC V 42