Hi,
addr2line.c:457 has:
char *name = NULL;
if (sscanf (string, "(%m[^)])%" PRIiMAX "%n", &name,
&addr, &i) == 2
&& string[i] == '\0')
parsed = adjust_to_section (name, &addr, dwfl);
switch (sscanf (string, "%m[^-+]%n%" PRIiMAX "%n", &name,
&i, &addr, &j))
And in the portability branch that got changed to:
char *name = NULL;
if (sscanf (string, "(%a[^)])%" PRIiMAX "%n", &name,
&addr, &i) == 2
&& string[i] == '\0')
parsed = adjust_to_section (name, &addr, dwfl);
switch (sscanf (string, "%a[^-+]%n%" PRIiMAX "%n", &name,
&i, &addr, &j))
But I think that that doesn't make sense. Isn't %m the gnu extention,
and that %a now follows the C99 standard and expects a float *?
Kurt
Show replies by thread
The older GNU extension is %as or %a[ and %ms/%m[ was added after C99
usurped %a. Newer GNU implementations support both in that %a is a flag if
followed by s or [ and a specifier otherwise. Hence the code is correct
for portability to both old and new GNU C libraries.
On Fri, Feb 24, 2012 at 01:41:09PM -0800, Roland McGrath wrote:
The older GNU extension is %as or %a[ and %ms/%m[ was added after
C99
usurped %a. Newer GNU implementations support both in that %a is a flag if
followed by s or [ and a specifier otherwise. Hence the code is correct
for portability to both old and new GNU C libraries.
Then I assume it's a bug in gcc to give a warning about this?
Kurt
Then I assume it's a bug in gcc to give a warning about this?
It's a debatable question. I suppose gcc's format grokking could be made
to vary based on -std= or something. I suspect they just won't want to
change it, since it's only for compatibility with obsolete versions of
things that anybody's source would use %as nowadays.