This just makes sure that all format strings are given as literals to printf like functions so the compiler can see and check them. Remove all no_Wformat, add -Wformat=2 unconditionally to AM_CFLAGS.
Signed-off-by: Mark Wielaard mjw@redhat.com --- backends/ChangeLog | 10 ++++++ backends/Makefile.am | 3 +- backends/aarch64_regs.c | 30 +++++++++++++---- config/ChangeLog | 4 +++ config/eu.am | 5 ++- src/ChangeLog | 18 +++++++++++ src/Makefile.am | 6 +--- src/nm.c | 86 ++++++++++++++++++++++++------------------------- src/size.c | 30 ++++++----------- src/strings.c | 33 +++++++++++++------ tests/ChangeLog | 4 +++ tests/Makefile.am | 1 - 12 files changed, 138 insertions(+), 92 deletions(-)
diff --git a/backends/ChangeLog b/backends/ChangeLog index a742eb2..0df6819 100644 --- a/backends/ChangeLog +++ b/backends/ChangeLog @@ -1,3 +1,13 @@ +2014-01-22 Mark Wielaard mjw@redhat.com + + * Makefile.am (aarch64_regs_no_Wformat): Removed. + * aarch64_regs.c (regtype): Add bool nr argument. snprintf arg + when nr is true. + (regtyper): New function. + (regtypen): Likewise. + (aarch64_register_info): Call either regtyper or regtypen not + regtype directly. + 2014-01-14 Mark Wielaard mjw@redhat.com
* aarch64_symbol.c (aarch64_check_special_symbol): Check shdr is diff --git a/backends/Makefile.am b/backends/Makefile.am index b8bea36..90e93a8 100644 --- a/backends/Makefile.am +++ b/backends/Makefile.am @@ -1,6 +1,6 @@ ## Process this file with automake to create Makefile.in ## -## Copyright (C) 2000-2010, 2013 Red Hat, Inc. +## Copyright (C) 2000-2010, 2013, 2014 Red Hat, Inc. ## Copyright (C) 2012 Tilera Corporation ## This file is part of elfutils. ## @@ -86,7 +86,6 @@ aarch64_SRCS = aarch64_init.c aarch64_regs.c aarch64_symbol.c \ aarch64_corenote.c aarch64_retval.c aarch64_cfi.c libebl_aarch64_pic_a_SOURCES = $(aarch64_SRCS) am_libebl_aarch64_pic_a_OBJECTS = $(aarch64_SRCS:.c=.os) -aarch64_regs_no_Wformat = yes
sparc_SRCS = sparc_init.c sparc_symbol.c sparc_regs.c sparc_retval.c \ sparc_corenote.c sparc64_corenote.c sparc_auxv.c diff --git a/backends/aarch64_regs.c b/backends/aarch64_regs.c index aec201f..bd10c46 100644 --- a/backends/aarch64_regs.c +++ b/backends/aarch64_regs.c @@ -1,5 +1,5 @@ /* Register names and numbers for AArch64 DWARF. - Copyright (C) 2013 Red Hat, Inc. + Copyright (C) 2013, 2014 Red Hat, Inc. This file is part of elfutils.
This file is free software; you can redistribute it and/or modify @@ -47,32 +47,48 @@ aarch64_register_info (Ebl *ebl __attribute__ ((unused)), return 128;
ssize_t - regtype (const char *setname, int type, const char *fmt, int arg) + regtype (const char *setname, int type, const char *rname, bool nr, int arg) { *setnamep = setname; *typep = type; - int s = snprintf (name, namelen, fmt, arg); + int s; + if (nr) + s = snprintf (name, namelen, "%s%d", rname, arg); + else + s = snprintf (name, namelen, "%s", rname); if (s < 0 || (unsigned) s >= namelen) return -1; return s + 1; }
+ ssize_t + regtyper (const char *setname, int type, const char *rname) + { + return regtype (setname, type, rname, false, 0); + } + + ssize_t + regtypen (const char *setname, int type, const char *rname, int arg) + { + return regtype (setname, type, rname, true, arg); + } + *prefix = ""; *bits = 64;
switch (regno) { case 0 ... 30: - return regtype ("integer", DW_ATE_signed, "x%d", regno); + return regtypen ("integer", DW_ATE_signed, "x", regno);
case 31: - return regtype ("integer", DW_ATE_address, "sp", 0); + return regtyper ("integer", DW_ATE_address, "sp");
case 32: return 0;
case 33: - return regtype ("integer", DW_ATE_address, "elr", 0); + return regtyper ("integer", DW_ATE_address, "elr");
case 34 ... 63: return 0; @@ -84,7 +100,7 @@ aarch64_register_info (Ebl *ebl __attribute__ ((unused)), integers. 128-bit quad-word is the only singular value that covers the whole register, so mark the register thus. */ *bits = 128; - return regtype ("FP/SIMD", DW_ATE_unsigned, "v%d", regno - 64); + return regtypen ("FP/SIMD", DW_ATE_unsigned, "v", regno - 64);
case 96 ... 127: return 0; diff --git a/config/ChangeLog b/config/ChangeLog index 53fddec..0fca489 100644 --- a/config/ChangeLog +++ b/config/ChangeLog @@ -1,3 +1,7 @@ +2014-01-22 Mark Wielaard mjw@redhat.com + + * eu.am (AM_CFLAGS): Unconditionally add -Wformat=2. + 2014-01-03 Mark Wielaard mjw@redhat.com
* elfutils.spec.in: Update for 0.158. diff --git a/config/eu.am b/config/eu.am index 38718c7..d2b4e79 100644 --- a/config/eu.am +++ b/config/eu.am @@ -1,6 +1,6 @@ ## Common automake fragments for elfutils subdirectory makefiles. ## -## Copyright (C) 2010 Red Hat, Inc. +## Copyright (C) 2010, 2014 Red Hat, Inc. ## ## This file is part of elfutils. ## @@ -31,10 +31,9 @@
DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -DLOCALEDIR='"${localedir}"' AM_CPPFLAGS = -I. -I$(srcdir) -I$(top_srcdir)/lib -I.. -AM_CFLAGS = -std=gnu99 -Wall -Wshadow \ +AM_CFLAGS = -std=gnu99 -Wall -Wshadow -Wformat=2 \ $(if $($(*F)_no_Werror),,-Werror) \ $(if $($(*F)_no_Wunused),,-Wunused -Wextra) \ - $(if $($(*F)_no_Wformat),-Wno-format,-Wformat=2) \ $($(*F)_CFLAGS)
if MUDFLAP diff --git a/src/ChangeLog b/src/ChangeLog index 8bbcff4..a277e0d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,21 @@ +2014-01-22 Mark Wielaard mjw@redhat.com + + * Makefile.am (nm_no_Wformat): Removed. + (size_no_Wformat): Likewise. + (strings_no_Wformat): Likewise. + (addr2line_no_Wformat): Likewise. + * size.c (show_sysv): Use fmtstr directly as literal in printf. + (show_sysv_one_line): Likewise. + * strings.c (locfmt): Removed. + (radix): New static enum. + (parse_opt): Set radix, not locfmt. + (process_chunk_mb): Use fmtstr directly as literal in printf based + on radix. + (process_chunk): Likewise. + * nm.c (show_symbols_sysv): Use fmtstr directly as literal in printf. + (show_symbols_bsd): Likewise. + (show_symbols_posix): Likewise. + 2014-01-21 Mark Wielaard mjw@redhat.com
* stack.c (show_inlines): New static boolean. diff --git a/src/Makefile.am b/src/Makefile.am index 9a78348..e371160 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,6 +1,6 @@ ## Process this file with automake to create Makefile.in ## -## Copyright (C) 1996-2013 Red Hat, Inc. +## Copyright (C) 1996-2014 Red Hat, Inc. ## This file is part of elfutils. ## ## This file is free software; you can redistribute it and/or modify @@ -88,10 +88,6 @@ if DEMANGLE demanglelib = -lstdc++ endif
-nm_no_Wformat = yes -size_no_Wformat = yes -strings_no_Wformat = yes -addr2line_no_Wformat = yes # XXX While the file is not finished, don't warn about this ldgeneric_no_Wunused = yes
diff --git a/src/nm.c b/src/nm.c index 62efb2d..82807bf 100644 --- a/src/nm.c +++ b/src/nm.c @@ -1,5 +1,5 @@ /* Print symbol information from ELF file in human-readable form. - Copyright (C) 2000-2008, 2009, 2011, 2012 Red Hat, Inc. + Copyright (C) 2000-2008, 2009, 2011, 2012, 2014 Red Hat, Inc. This file is part of elfutils. Written by Ulrich Drepper drepper@redhat.com, 2000.
@@ -794,15 +794,6 @@ show_symbols_sysv (Ebl *ebl, GElf_Word strndx, const char *fullname, /* TRANS: the "sysv|" parts makes the string unique. */ longest_where, sgettext ("sysv|Line"));
- /* Which format string to use (different radix for numbers). */ - const char *number_fmtstr; - if (radix == radix_hex) - number_fmtstr = "%0*" PRIx64; - else if (radix == radix_decimal) - number_fmtstr = "%0*" PRId64; - else - number_fmtstr = "%0*" PRIo64; - #ifdef USE_DEMANGLE size_t demangle_buffer_len = 0; char *demangle_buffer = NULL; @@ -850,9 +841,15 @@ show_symbols_sysv (Ebl *ebl, GElf_Word strndx, const char *fullname, addressbuf[0] = sizebuf[0] = '\0'; else { - snprintf (addressbuf, sizeof (addressbuf), number_fmtstr, + snprintf (addressbuf, sizeof (addressbuf), + (radix == radix_hex ? "%0*" PRIx64 + : (radix == radix_decimal ? "%0*" PRId64 + : "%0*" PRIo64)), digits, syms[cnt].sym.st_value); - snprintf (sizebuf, sizeof (sizebuf), number_fmtstr, + snprintf (sizebuf, sizeof (sizebuf), + (radix == radix_hex ? "%0*" PRIx64 + : (radix == radix_decimal ? "%0*" PRId64 + : "%0*" PRIo64)), digits, syms[cnt].sym.st_size); }
@@ -929,19 +926,6 @@ show_symbols_bsd (Elf *elf, const GElf_Ehdr *ehdr, GElf_Word strndx, if (prefix != NULL && ! print_file_name) printf ("\n%s:\n", fname);
- static const char *const fmtstrs[] = - { - [radix_hex] = "%6$s%2$0*1$" PRIx64 "%8$s %7$s%3$c%4$s %5$s", - [radix_decimal] = "%6$s%*" PRId64 "%8$s %7$s%3$c%4$s %5$s", - [radix_octal] = "%6$s%2$0*1$" PRIo64 "%8$s %7$s%3$c%4$s %5$s" - }; - static const char *const sfmtstrs[] = - { - [radix_hex] = "%6$s%2$0*1$" PRIx64 "%8$s %10$0*9$" PRIx64 " %7$s%3$c%4$s %5$s", - [radix_decimal] = "%6$s%2$*1$" PRId64 "%8$s %10$*9$" PRId64 " %7$s%3$c%4$s %5$s", - [radix_octal] = "%6$s%2$0*1$" PRIo64 "%8$s %10$0*9$" PRIo64 " %7$s%3$c%4$s %5$s" - }; - #ifdef USE_DEMANGLE size_t demangle_buffer_len = 0; char *demangle_buffer = NULL; @@ -1016,16 +1000,34 @@ show_symbols_bsd (Elf *elf, const GElf_Ehdr *ehdr, GElf_Word strndx, else color = color_symbol; } - - printf (print_size && syms[cnt].sym.st_size != 0 - ? sfmtstrs[radix] : fmtstrs[radix], - digits, syms[cnt].sym.st_value, - class_type_char (elf, ehdr, &syms[cnt].sym), marker, - symstr, - color_mode ? color_address : "", - color, - color_mode ? color_off : "", - digits, (uint64_t) syms[cnt].sym.st_size); + if (print_size && syms[cnt].sym.st_size != 0) + printf ((radix == radix_hex + ? "%6$s%2$0*1$" PRIx64 "%8$s %10$0*9$" PRIx64 + " %7$s%3$c%4$s %5$s" + : (radix == radix_decimal + ? "%6$s%2$*1$" PRId64 "%8$s %10$*9$" PRId64 + " %7$s%3$c%4$s %5$s" + : "%6$s%2$0*1$" PRIo64 "%8$s %10$0*9$" PRIo64 + " %7$s%3$c%4$s %5$s")), + digits, syms[cnt].sym.st_value, + class_type_char (elf, ehdr, &syms[cnt].sym), marker, + symstr, + color_mode ? color_address : "", + color, + color_mode ? color_off : "", + digits, (uint64_t) syms[cnt].sym.st_size); + else + printf ((radix == radix_hex + ? "%6$s%2$0*1$" PRIx64 "%8$s %7$s%3$c%4$s %5$s" + : (radix == radix_decimal + ? "%6$s%2$*1$" PRId64 "%8$s %7$s%3$c%4$s %5$s" + : "%6$s%2$0*1$" PRIo64 "%8$s %7$s%3$c%4$s %5$s")), + digits, syms[cnt].sym.st_value, + class_type_char (elf, ehdr, &syms[cnt].sym), marker, + symstr, + color_mode ? color_address : "", + color, + color_mode ? color_off : ""); }
if (color_mode) @@ -1047,14 +1049,6 @@ show_symbols_posix (Elf *elf, const GElf_Ehdr *ehdr, GElf_Word strndx, if (prefix != NULL && ! print_file_name) printf ("%s:\n", fullname);
- const char *fmtstr; - if (radix == radix_hex) - fmtstr = "%s %c%s %0*" PRIx64 " %0*" PRIx64 "\n"; - else if (radix == radix_decimal) - fmtstr = "%s %c%s %*" PRId64 " %*" PRId64 "\n"; - else - fmtstr = "%s %c%s %0*" PRIo64 " %0*" PRIo64 "\n"; - int digits = length_map[gelf_getclass (elf) - 1][radix];
#ifdef USE_DEMANGLE @@ -1096,7 +1090,11 @@ show_symbols_posix (Elf *elf, const GElf_Ehdr *ehdr, GElf_Word strndx, putchar_unlocked (' '); }
- printf (fmtstr, + printf ((radix == radix_hex + ? "%s %c%s %0*" PRIx64 " %0*" PRIx64 "\n" + : (radix == radix_decimal + ? "%s %c%s %*" PRId64 " %*" PRId64 "\n" + : "%s %c%s %0*" PRIo64 " %0*" PRIo64 "\n")), symstr, class_type_char (elf, ehdr, &syms[cnt].sym), mark_special diff --git a/src/size.c b/src/size.c index dfa46b1..9db55c8 100644 --- a/src/size.c +++ b/src/size.c @@ -1,5 +1,5 @@ /* Print size information from ELF file. - Copyright (C) 2000-2007,2009,2012 Red Hat, Inc. + Copyright (C) 2000-2007,2009,2012,2014 Red Hat, Inc. This file is part of elfutils. Written by Ulrich Drepper drepper@redhat.com, 2000.
@@ -441,14 +441,6 @@ show_sysv (Elf *elf, const char *prefix, const char *fname, digits - 2, sgettext ("sysv|size"), digits, sgettext ("sysv|addr"));
- const char *fmtstr; - if (radix == radix_hex) - fmtstr = "%-*s %*" PRIx64 " %*" PRIx64 "\n"; - else if (radix == radix_decimal) - fmtstr = "%-*s %*" PRId64 " %*" PRId64 "\n"; - else - fmtstr = "%-*s %*" PRIo64 " %*" PRIo64 "\n"; - /* Iterate over all sections. */ GElf_Off total = 0; while ((scn = elf_nextscn (elf, scn)) != NULL) @@ -459,7 +451,11 @@ show_sysv (Elf *elf, const char *prefix, const char *fname, /* Ignore all sections which are not used at runtime. */ if ((shdr->sh_flags & SHF_ALLOC) != 0) { - printf (fmtstr, + printf ((radix == radix_hex + ? "%-*s %*" PRIx64 " %*" PRIx64 "\n" + : (radix == radix_decimal + ? "%-*s %*" PRId64 " %*" PRId64 "\n" + : "%-*s %*" PRIo64 " %*" PRIo64 "\n")), maxlen, elf_strptr (elf, shstrndx, shdr->sh_name), digits - 2, shdr->sh_size, digits, shdr->sh_addr); @@ -490,14 +486,6 @@ show_sysv_one_line (Elf *elf) error (EXIT_FAILURE, 0, gettext ("cannot get section header string table index"));
- const char *fmtstr; - if (radix == radix_hex) - fmtstr = "%" PRIx64 "(%s)"; - else if (radix == radix_decimal) - fmtstr = "%" PRId64 "(%s)"; - else - fmtstr = "%" PRIo64 "(%s)"; - /* Iterate over all sections. */ GElf_Off total = 0; bool first = true; @@ -515,8 +503,10 @@ show_sysv_one_line (Elf *elf) fputs_unlocked (" + ", stdout); first = false;
- printf (fmtstr, shdr->sh_size, - elf_strptr (elf, shstrndx, shdr->sh_name)); + printf ((radix == radix_hex ? "%" PRIx64 "(%s)" + : (radix == radix_decimal ? "%" PRId64 "(%s)" + : "%" PRIo64 "(%s)")), + shdr->sh_size, elf_strptr (elf, shstrndx, shdr->sh_name));
total += shdr->sh_size; } diff --git a/src/strings.c b/src/strings.c index 084eb99..37210a7 100644 --- a/src/strings.c +++ b/src/strings.c @@ -1,5 +1,5 @@ /* Print the strings of printable characters in files. - Copyright (C) 2005-2010, 2012 Red Hat, Inc. + Copyright (C) 2005-2010, 2012, 2014 Red Hat, Inc. This file is part of elfutils. Written by Ulrich Drepper drepper@redhat.com, 2005.
@@ -116,8 +116,15 @@ static bool char_7bit; /* True if file names should be printed before strings. */ static bool print_file_name;
-/* Location print format string. */ -static const char *locfmt; +/* Radix for printed numbers. */ +static enum +{ + radix_none = 0, + radix_decimal, + radix_hex, + radix_octal +} radix = radix_none; +
/* Page size in use. */ static size_t ps; @@ -279,16 +286,16 @@ parse_opt (int key, char *arg, switch (arg[0]) { case 'd': - locfmt = "%7" PRId64 " "; + radix = radix_decimal; break;
case 'o': octfmt: - locfmt = "%7" PRIo64 " "; + radix = radix_octal; break;
case 'x': - locfmt = "%7" PRIx64 " "; + radix = radix_hex; break;
default: @@ -355,8 +362,11 @@ process_chunk_mb (const char *fname, const unsigned char *buf, off64_t to, fputs_unlocked (": ", stdout); }
- if (unlikely (locfmt != NULL)) - printf (locfmt, (int64_t) to - len - (buf - start)); + if (unlikely (radix != radix_none)) + printf ((radix == radix_octal ? "%7" PRIo64 " " + : (radix == radix_decimal ? "%7" PRId64 " " + : "%7" PRIx64 " ")), + (int64_t) to - len - (buf - start));
if (unlikely (*unprinted != NULL)) { @@ -420,8 +430,11 @@ process_chunk (const char *fname, const unsigned char *buf, off64_t to, fputs_unlocked (": ", stdout); }
- if (likely (locfmt != NULL)) - printf (locfmt, (int64_t) to - len - (buf - start)); + if (likely (radix != radix_none)) + printf ((radix == radix_octal ? "%7" PRIo64 " " + : (radix == radix_decimal ? "%7" PRId64 " " + : "%7" PRIx64 " ")), + (int64_t) to - len - (buf - start));
if (unlikely (*unprinted != NULL)) { diff --git a/tests/ChangeLog b/tests/ChangeLog index aa468c4..cbf2672 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,7 @@ +2014-01-22 Mark Wielaard mjw@redhat.com + + * Makefile.am (line2addr_no_Wformat): Removed. + 2014-01-21 Mark Wielaard mjw@redhat.com
* Makefile.am (TESTS): Add run-stack-i-test.sh. diff --git a/tests/Makefile.am b/tests/Makefile.am index aa13cfa..c75e796 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -355,7 +355,6 @@ get_lines_LDADD = $(libdw) $(libelf) $(libmudflap) get_files_LDADD = $(libdw) $(libelf) $(libmudflap) get_aranges_LDADD = $(libdw) $(libelf) $(libmudflap) allfcts_LDADD = $(libdw) $(libelf) $(libmudflap) -line2addr_no_Wformat = yes line2addr_LDADD = $(libdw) $(libmudflap) addrscopes_LDADD = $(libdw) $(libmudflap) funcscopes_LDADD = $(libdw) $(libmudflap)
On Thu, 2014-01-23 at 01:37 +0100, Mark Wielaard wrote:
This just makes sure that all format strings are given as literals to printf like functions so the compiler can see and check them. Remove all no_Wformat, add -Wformat=2 unconditionally to AM_CFLAGS.
On irc Petr pointed out that some lines in src/nm.c looked horribly involved with this change because the format strings were broken up over multiple lines. I changed those to just define the format strings on their own line and use the short macro as the actual format string.
No other changes were made to the patch pushed to master (as attached).
Cheers,
Mark
Mark Wielaard mjw@redhat.com writes:
diff --git a/backends/aarch64_regs.c b/backends/aarch64_regs.c index aec201f..bd10c46 100644 --- a/backends/aarch64_regs.c +++ b/backends/aarch64_regs.c @@ -47,32 +47,48 @@ aarch64_register_info (Ebl *ebl __attribute__ ((unused)), return 128;
ssize_t
- regtype (const char *setname, int type, const char *fmt, int arg)
- regtype (const char *setname, int type, const char *rname, bool nr, int arg)
Regarding this chunk, actually this can be made simpler by using __attribute__ ((format)). I had thought that would be too involved, but it's actually pretty clean IMO. What say you?
From 27ffb08c789ca9c4b2635ca89b4004b324fb4ea4 Mon Sep 17 00:00:00 2001
Message-Id: 27ffb08c789ca9c4b2635ca89b4004b324fb4ea4.1391095070.git.pmachata@redhat.com From: Petr Machata pmachata@redhat.com Date: Thu, 30 Jan 2014 15:34:33 +0100 Subject: [PATCH] backends: Make aarch64_regs.c checkable by -Wprintf Gcc: nnimap+mail.corp.redhat.com:Sent To: elfutils-devel@lists.fedorahosted.org
--- backends/ChangeLog | 8 ++++++++ backends/aarch64_regs.c | 35 +++++++++++++---------------------- 2 files changed, 21 insertions(+), 22 deletions(-)
diff --git a/backends/ChangeLog b/backends/ChangeLog index 212b9f6..2863c00 100644 --- a/backends/ChangeLog +++ b/backends/ChangeLog @@ -1,3 +1,11 @@ +2014-01-30 Petr Machata pmachata@redhat.com + + * aarch64_regs.c (aarch64_register_info.regtype): Make this + variadic printf-like function. Call one vsnprintf instead of two + snprintf's. + (regtyper, regtypen): Drop. + (aarch64_register_info): Adjust callers. + 2014-01-26 Mark Wielaard mjw@redhat.com
* Makefile.am (arm_SRCS): Add arm_initreg.c. diff --git a/backends/aarch64_regs.c b/backends/aarch64_regs.c index bd10c46..7a8a678 100644 --- a/backends/aarch64_regs.c +++ b/backends/aarch64_regs.c @@ -33,6 +33,7 @@ #include <stdio.h> #include <string.h> #include <dwarf.h> +#include <stdarg.h>
#define BACKEND aarch64_ #include "libebl_CPU.h" @@ -46,49 +47,39 @@ aarch64_register_info (Ebl *ebl __attribute__ ((unused)), if (name == NULL) return 128;
+ __attribute__ ((format (printf, 3, 4))) ssize_t - regtype (const char *setname, int type, const char *rname, bool nr, int arg) + regtype (const char *setname, int type, const char *fmt, ...) { *setnamep = setname; *typep = type; - int s; - if (nr) - s = snprintf (name, namelen, "%s%d", rname, arg); - else - s = snprintf (name, namelen, "%s", rname); + + va_list ap; + va_start (ap, fmt); + int s = vsnprintf (name, namelen, fmt, ap); + va_end(ap); + if (s < 0 || (unsigned) s >= namelen) return -1; return s + 1; }
- ssize_t - regtyper (const char *setname, int type, const char *rname) - { - return regtype (setname, type, rname, false, 0); - } - - ssize_t - regtypen (const char *setname, int type, const char *rname, int arg) - { - return regtype (setname, type, rname, true, arg); - } - *prefix = ""; *bits = 64;
switch (regno) { case 0 ... 30: - return regtypen ("integer", DW_ATE_signed, "x", regno); + return regtype ("integer", DW_ATE_signed, "x%d", regno);
case 31: - return regtyper ("integer", DW_ATE_address, "sp"); + return regtype ("integer", DW_ATE_address, "sp");
case 32: return 0;
case 33: - return regtyper ("integer", DW_ATE_address, "elr"); + return regtype ("integer", DW_ATE_address, "elr");
case 34 ... 63: return 0; @@ -100,7 +91,7 @@ aarch64_register_info (Ebl *ebl __attribute__ ((unused)), integers. 128-bit quad-word is the only singular value that covers the whole register, so mark the register thus. */ *bits = 128; - return regtypen ("FP/SIMD", DW_ATE_unsigned, "v", regno - 64); + return regtype ("FP/SIMD", DW_ATE_unsigned, "v%d", regno - 64);
case 96 ... 127: return 0;
On Thu, 2014-01-30 at 16:25 +0100, Petr Machata wrote:
Mark Wielaard mjw@redhat.com writes:
- regtype (const char *setname, int type, const char *fmt, int arg)
- regtype (const char *setname, int type, const char *rname, bool nr, int arg)
Regarding this chunk, actually this can be made simpler by using __attribute__ ((format)). I had thought that would be too involved, but it's actually pretty clean IMO. What say you?
O, nice. No more silly wrapper functions. Please do push.
Thanks,
Mark
elfutils-devel@lists.fedorahosted.org