diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2020-07-10 15:32:00 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2020-07-10 15:32:00 +0000 |
commit | 02465eaa6ef6160acc6540b5f414940ca42725e3 (patch) | |
tree | 2b889a25e1c365b611089321f7fc6ffaa1f38bf5 | |
parent | 7ed89b172705ad890011a1a43d1780ed97130585 (diff) |
base tree had only two uses of the printf %n format string, in this file.
Appending "%n" to the format string to capture the output-length in bytes
(into an uninitialized variable) is exactly the same as using the printf
return value. Why did they do this so unnaturally?
(normally we don't change gcc import code, but I'm doing a study of %n
prevelance)
ok millert
-rw-r--r-- | gnu/gcc/gcc/genmodes.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gnu/gcc/gcc/genmodes.c b/gnu/gcc/gcc/genmodes.c index 0a70dea23e6..5a91a50edef 100644 --- a/gnu/gcc/gcc/genmodes.c +++ b/gnu/gcc/gcc/genmodes.c @@ -787,7 +787,7 @@ calc_wider_mode (void) #define tagged_printf(FMT, ARG, TAG) do { \ int count_; \ - printf (" " FMT ",%n", ARG, &count_); \ + count_ = printf (" " FMT ",", ARG); \ printf ("%*s/* %s */\n", 27 - count_, "", TAG); \ } while (0) @@ -822,7 +822,7 @@ enum machine_mode\n{"); for (m = modes[c]; m; m = m->next) { int count_; - printf (" %smode,%n", m->name, &count_); + count_ = printf (" %smode,", m->name); printf ("%*s/* %s:%d */\n", 27 - count_, "", trim_filename (m->file), m->line); } |