Skip to content

Commit

Permalink
gdb/doc: handle (r), (tm) and (c) symbols in man pages
Browse files Browse the repository at this point in the history
The gdb.1 man page is generated based on the content of the gdb.texi
file.  The conversion is done using the texi2pod script.  However, in
downstream GDB, some copyright notices are included in the man pages,
and they contain characters not available in ASCII.

One of the issue is the use of the "™" symbol which causes build
failures:

    Wide character in printf at /usr/share/perl5/vendor_perl/Pod/Simple.pm line 573.
    gdb.pod around line 511: Non-ASCII character seen before =encoding in 'Instinctâ„¢,'. Assuming UTF-8
    rm -f gdbserver.pod
    POD document had syntax errors at /usr/bin/pod2man line 69.
    make[3]: *** [Makefile:604: stabs.pdf] Error 1
    make[3]: *** Waiting for unfinished jobs....

Fix this by making sure that texi2pod.pl emits "=encoding utf-8", so
pod2man knows the .pod file uses utf-8 characters.  For this to work, we
also need to pass the "--utf8" flag when calling pod2man.  This might
cause some issue if one was to build the manpages with a *roff
implementation that does not support utf-8 (see pod2man(1)).

While doing this, I also noticed that the man page includes
"@registeredsymbol{}" which should obviously be replaced by "®".  The
texi2pod script also already replaces "@copyright{}" with "(c)", but
since we now support utf-8, we can use "©" instead.

Bug: SWDEV-469207
Change-Id: I18b91150a134bca4896cf22b608bc5685587fb6e
(cherry picked from commit b60b39b)
(cherry picked from commit a7510bb1f631098f4523108dba55460fff533b33)
  • Loading branch information
lancesix committed Jul 11, 2024
1 parent 7a7d51c commit 7ba4b4f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion etc/texi2pod.pl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#! /usr/bin/perl -w

# Copyright (C) 1999-2023 Free Software Foundation, Inc.
# Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.

# This file is part of GCC.

Expand Down Expand Up @@ -202,7 +203,8 @@

# Character entities. First the ones that can be replaced by raw text
# or discarded outright:
s/\@copyright\{\}/(c)/g;
s/\@copyright\{\}/©/g;
s/\@registeredsymbol\{\}/®/g;
s/\@dots\{\}/.../g;
s/\@enddots\{\}/..../g;
s/\@([.!? ])/$1/g;
Expand Down Expand Up @@ -342,6 +344,8 @@
$sects{NAME} = "$fn \- $tl\n";
$sects{FOOTNOTES} .= "=back\n" if exists $sects{FOOTNOTES};

print "=encoding utf-8\n\n";

for $sect (qw(NAME SYNOPSIS TARGET DESCRIPTION OPTIONS ENVIRONMENT FILES
BUGS NOTES FOOTNOTES SEEALSO AUTHOR COPYRIGHT)) {
if(exists $sects{$sect}) {
Expand Down
4 changes: 2 additions & 2 deletions gdb/doc/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,9 @@ TEXI2POD = perl $(srcdir)/../../etc/texi2pod.pl \
$(MAKEINFOFLAGS) $(MAKEINFO_EXTRA_FLAGS)

POD2MAN1 = pod2man --center="GNU Development Tools" \
--release="gdb-`sed q version.subst`" --section=1
--release="gdb-`sed q version.subst`" --section=1 --utf8
POD2MAN5 = pod2man --center="GNU Development Tools" \
--release="gdb-`sed q version.subst`" --section=5
--release="gdb-`sed q version.subst`" --section=5 --utf8

# List of man pages generated from gdb.texi
MAN1S = gdb.1 gdbserver.1 gcore.1 gdb-add-index.1
Expand Down

0 comments on commit 7ba4b4f

Please sign in to comment.