Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7aa8d9e

Browse files
committed
Update comments in find_typedef.
These comments don't seem to have been touched in a long time. Make themdescribe the current implementation rather than what was here last century,and be a bit more explicit about the unreferenced-typedefs issue.
1 parent8b13e5c commit7aa8d9e

File tree

1 file changed

+14
-23
lines changed

1 file changed

+14
-23
lines changed

‎src/tools/find_typedef

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,27 @@
33
# src/tools/find_typedef
44

55
# This script attempts to find all typedef's in the postgres binaries
6-
# by using 'nm' to report all typedef debugging symbols.
6+
# by using 'objdump' or local equivalent to print typedef debugging symbols.
7+
# We need this because pgindent needs a list of typedef names.
78
#
8-
# For this program to work, you must have compiled allbinaries with
9+
# For this program to work, you must have compiled allcode with
910
# debugging symbols.
1011
#
11-
# This is run on Linux, so you may need to make changes.
12+
# We intentionally examine all files in the targeted directories so as to
13+
# find both .o files and executables. Therefore, ignore error messages about
14+
# unsuitable files being fed to objdump.
1215
#
13-
#Ignore the nm errors about a file not being a binary file.
16+
#This is known to work on Linux and on some BSDen, including Mac OS X.
1417
#
15-
# It gets typedefs by reading "STABS":
18+
# Caution: on the platforms we use, this only prints typedefs that are used
19+
# to declare at least one variable or struct field. If you have say
20+
# "typedef struct foo { ... } foo;", and then the structure is only ever
21+
# referenced as "struct foo", "foo" will not be reported as a typedef,
22+
# causing pgindent to indent the typedef definition oddly. This is not a
23+
# huge problem, since by definition there's just the one misindented line.
1624
#
25+
# We get typedefs by reading "STABS":
1726
# http://www.informatik.uni-frankfurt.de/doc/texi/stabs_toc.html
18-
#
19-
# objdump:
20-
# -G, --stabs Display (in raw form) any STABS info in the file
21-
#
22-
# --stabs
23-
# Display the contents of the .stab, .stab.index, and
24-
# .stab.excl sections from an ELF file. This is only
25-
# useful on systems (such as Solaris 2.0) in which
26-
# .stab debugging symbol-table entries are carried in
27-
# an ELF section. In most other file formats, debug-
28-
# ging symbol-table entries are interleaved with
29-
# linkage symbols, and are visible in the --syms out-
30-
# put.
3127

3228

3329
if ["$#"-eq 0-o!-d"$1" ]
@@ -39,11 +35,6 @@ for DIR
3935
do# if objdump -W is recognized, only one line of error should appear
4036
if [`objdump -W2>&1| wc -l`-eq 1 ]
4137
then# Linux
42-
# Unfortunately the Linux version doesn't show unreferenced typedefs.
43-
# The problem is that they are still in the source code so should be
44-
# indented properly. However, I think pgindent only cares about
45-
# the typedef references, not the definitions, so I think it might
46-
# be fine
4738
objdump -W"$DIR"/*|
4839
egrep -A3'\(DW_TAG_typedef\)'|
4940
awk' $2 == "DW_AT_name" {print $NF}'

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp