This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
[PATCH] Avoid YESSTR and NOSTR
- From: Ulf Hermann <ulf dot hermann at qt dot io>
- To: <elfutils-devel at sourceware dot org>
- Date: Thu, 20 Apr 2017 15:47:49 +0200
- Subject: [PATCH] Avoid YESSTR and NOSTR
- Authentication-results: sourceware.org; auth=none
- Authentication-results: sourceware.org; dkim=none (message not signed) header.d=none;sourceware.org; dmarc=none action=none header.from=qt.io;
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qtcompany.onmicrosoft.com; s=selector1-qt-io; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=mM3mfC4TRXzdaFxfXfkWzXTWwsy+qk1GYhZADjB0Wks=; b=mNxBVMziguakbp2bsnM1Ir8OeN+NepzEVBjEuMIvw7Cp6m5Lshysrr6e/q1RvmL6FhTxEgrmohVGlVSc3gTuJte7oRymRY0kzuVWZPcT8imSkO83TRnkF/XLItcLUSvs1pPQB+OgK6t1na5lEbQmevNnoRpnliFj7RkU9kF6YNc=
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
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 <ulf.hermann@qt.io>
---
src/ChangeLog | 5 +++++
src/readelf.c | 6 +++---
tests/ChangeLog | 6 ++++++
tests/run-readelf-dwz-multi.sh | 30 +++++++++++++++---------------
tests/run-readelf-zdebug-rel.sh | 6 +++---
5 files changed, 32 insertions(+), 21 deletions(-)
diff --git a/src/ChangeLog b/src/ChangeLog
index a1bec19..e0a591e 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2017-04-20 Ulf Hermann <ulf.hermann@qt.io>
+
+ * readelf.c: Replace YESSTR and NOSTR with gettext ("yes") and
+ gettext ("no"), respectively.
+
2017-04-05 Mark Wielaard <mark@klomp.org>
* elflint.c (check_elf_header): Decompress all sections.
diff --git a/src/readelf.c b/src/readelf.c
index 97a43b0..6f6095d 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 ebcd7bc..c4e76d1 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,5 +1,11 @@
2017-04-20 Ulf Hermann <ulf.hermann@qt.io>
+ * 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 <ulf.hermann@qt.io>
+
* backtrace-child.c: Include sys/ptrace.h only on linux.
* backtrace-dwarf.c: Likewise.
diff --git a/tests/run-readelf-dwz-multi.sh b/tests/run-readelf-dwz-multi.sh
index 27e0f38..23ca944 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 <main>
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 <main>
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 <call_foo>
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 <call_foo>
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 <main>
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 88ea5bf..1232d63 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"
--
2.1.4