read_printf.ln revision 1.1
11.1Srillig# $NetBSD: read_printf.ln,v 1.1 2021/08/07 23:52:32 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.1Srillig0sprintf-def.c
71.1SrilligSprintf-def.c
81.1Srillig3d0.3d9my_printfF2PcCEV
91.1Srillig
101.1Srillig0sprintf-use.c
111.1SrilligSprintf-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.1Srillig11c0.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.1Srillig12c0.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.1Srillig13c0.13 s2"" n3 i 9my_printf f4 PcC PC I PcV V
36