From: Ulf Hermann Date: Thu, 20 Apr 2017 13:47:49 +0000 (+0200) Subject: Avoid YESSTR and NOSTR X-Git-Tag: elfutils-0.169~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9130b539c58d262536d7ef2bd4e49d4e66a3fc08;p=thirdparty%2Felfutils.git Avoid YESSTR and NOSTR Those are deprecated and apparently some implementations of nl_langinfo return empty strings for them. The tests even tested for those empty strings even though the intention of the code was clearly to output "yes" or "no" there. Signed-off-by: Ulf Hermann --- diff --git a/src/ChangeLog b/src/ChangeLog index a1bec198d..e0a591e23 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2017-04-20 Ulf Hermann + + * readelf.c: Replace YESSTR and NOSTR with gettext ("yes") and + gettext ("no"), respectively. + 2017-04-05 Mark Wielaard * elflint.c (check_elf_header): Decompress all sections. diff --git a/src/readelf.c b/src/readelf.c index 97a43b066..6f6095d25 100644 --- a/src/readelf.c +++ b/src/readelf.c @@ -6132,7 +6132,7 @@ attr_callback (Dwarf_Attribute *attrp, void *arg) printf (" %*s%-20s (%s) %s\n", (int) (level * 2), "", dwarf_attr_name (attr), - dwarf_form_name (form), nl_langinfo (flag ? YESSTR : NOSTR)); + dwarf_form_name (form), flag ? gettext ("yes") : gettext ("no")); break; case DW_FORM_flag_present: @@ -6140,7 +6140,7 @@ attr_callback (Dwarf_Attribute *attrp, void *arg) break; printf (" %*s%-20s (%s) %s\n", (int) (level * 2), "", dwarf_attr_name (attr), - dwarf_form_name (form), nl_langinfo (YESSTR)); + dwarf_form_name (form), gettext ("yes")); break; case DW_FORM_exprloc: @@ -7650,7 +7650,7 @@ print_debug_macro_section (Dwfl_Module *dwflmod __attribute__ ((unused)), if (readp + 1 > readendp) goto invalid_data; val = *readp++; - printf (" %s", nl_langinfo (val != 0 ? YESSTR : NOSTR)); + printf (" %s", val != 0 ? gettext ("yes") : gettext ("no")); break; case DW_FORM_string: diff --git a/tests/ChangeLog b/tests/ChangeLog index ebcd7bcce..c4e76d150 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,9 @@ +2017-04-20 Ulf Hermann + + * run-readelf-dwz-multi.sh: Expect readelf to output "yes" for flags + that are set. + * run-readelf-zdebug-rel.sh: Likewise. + 2017-04-20 Ulf Hermann * backtrace-child.c: Include sys/ptrace.h only on linux. diff --git a/tests/run-readelf-dwz-multi.sh b/tests/run-readelf-dwz-multi.sh index 27e0f38c0..23ca944c3 100755 --- a/tests/run-readelf-dwz-multi.sh +++ b/tests/run-readelf-dwz-multi.sh @@ -98,17 +98,17 @@ DWARF section [28] '.debug_info' at offset 0x1078: byte_size (data1) 8 type (GNU_ref_alt) [ 53] [ 31] subprogram - external (flag_present) + external (flag_present) yes name (strp) "main" decl_file (data1) 1 decl_line (data1) 3 - prototyped (flag_present) + prototyped (flag_present) yes type (GNU_ref_alt) [ 3e] low_pc (addr) 0x00000000004006ac
high_pc (udata) 44 (0x00000000004006d8) frame_base (exprloc) [ 0] call_frame_cfa - GNU_all_tail_call_sites (flag_present) + GNU_all_tail_call_sites (flag_present) yes sibling (ref_udata) [ 6e] [ 48] formal_parameter name (strp) "argc" @@ -159,17 +159,17 @@ DWARF section [28] '.debug_info' at offset 0x1078: byte_size (data1) 8 type (GNU_ref_alt) [ 53] [ 31] subprogram - external (flag_present) + external (flag_present) yes name (strp) "main" decl_file (data1) 1 decl_line (data1) 3 - prototyped (flag_present) + prototyped (flag_present) yes type (GNU_ref_alt) [ 3e] low_pc (addr) 0x00000000004006ac
high_pc (udata) 44 (0x00000000004006d8) frame_base (exprloc) [ 0] call_frame_cfa - GNU_all_tail_call_sites (flag_present) + GNU_all_tail_call_sites (flag_present) yes sibling (ref_udata) [ 6e] [ 48] formal_parameter name (strp) "argc" @@ -216,17 +216,17 @@ DWARF section [25] '.debug_info' at offset 0x106c: [ 26] imported_unit import (GNU_ref_alt) [ b] [ 2b] subprogram - external (flag_present) + external (flag_present) yes name (strp) "call_foo" decl_file (data1) 1 decl_line (data1) 3 - prototyped (flag_present) + prototyped (flag_present) yes type (GNU_ref_alt) [ 3e] low_pc (addr) +0x0000000000000670 high_pc (udata) 23 (+0x0000000000000687) frame_base (exprloc) [ 0] call_frame_cfa - GNU_all_call_sites (flag_present) + GNU_all_call_sites (flag_present) yes [ 41] formal_parameter name (string) "fb" decl_file (data1) 1 @@ -256,17 +256,17 @@ DWARF section [25] '.debug_info' at offset 0x106c: [ 26] imported_unit import (GNU_ref_alt) [ b] [ 2b] subprogram - external (flag_present) + external (flag_present) yes name (strp) "call_foo" decl_file (data1) 1 decl_line (data1) 3 - prototyped (flag_present) + prototyped (flag_present) yes type (GNU_ref_alt) [ 3e] low_pc (addr) +0x0000000000000670 high_pc (udata) 23 (+0x0000000000000687) frame_base (exprloc) [ 0] call_frame_cfa - GNU_all_call_sites (flag_present) + GNU_all_call_sites (flag_present) yes [ 41] formal_parameter name (string) "fb" decl_file (data1) 1 @@ -295,17 +295,17 @@ DWARF section [28] '.debug_info' at offset 0x1088: [ 26] imported_unit import (GNU_ref_alt) [ b] [ 2b] subprogram - external (flag_present) + external (flag_present) yes name (GNU_strp_alt) "main" decl_file (data1) 1 decl_line (data1) 8 - prototyped (flag_present) + prototyped (flag_present) yes type (GNU_ref_alt) [ 30] low_pc (addr) 0x00000000004004ec
high_pc (udata) 18 (0x00000000004004fe) frame_base (exprloc) [ 0] call_frame_cfa - GNU_all_call_sites (flag_present) + GNU_all_call_sites (flag_present) yes [ 41] formal_parameter name (GNU_strp_alt) "argc" decl_file (data1) 1 diff --git a/tests/run-readelf-zdebug-rel.sh b/tests/run-readelf-zdebug-rel.sh index 88ea5bf2d..1232d63b3 100755 --- a/tests/run-readelf-zdebug-rel.sh +++ b/tests/run-readelf-zdebug-rel.sh @@ -60,17 +60,17 @@ DWARF section [ 4] '.debug_info' at offset 0x58: high_pc (data8) 24 (0x0000000000000018) stmt_list (sec_offset) 0 [ 2d] subprogram - external (flag_present) + external (flag_present) yes name (strp) "main" decl_file (data1) 1 decl_line (data1) 4 - prototyped (flag_present) + prototyped (flag_present) yes type (ref4) [ 80] low_pc (addr) 000000000000000000 high_pc (data8) 24 (0x0000000000000018) frame_base (exprloc) [ 0] call_frame_cfa - GNU_all_call_sites (flag_present) + GNU_all_call_sites (flag_present) yes sibling (ref4) [ 80] [ 4e] formal_parameter name (strp) "argc"