Skip to content

Commit 34d3a67

Browse files
tob2Tobias Burnus
authored and
Tobias Burnus
committed
make-obstacks-texi.pl: New.
contrib/ 2013-03-06 Tobias Burnus <[email protected]> * make-obstacks-texi.pl: New. libiberty/ 2013-03-06 Tobias Burnus <[email protected]> * libiberty.texi: Update comment, remove lowersections. * obstacks.texi: Regenerate. From-SVN: r196486
1 parent 3c27ce4 commit 34d3a67

File tree

5 files changed

+81
-28
lines changed

5 files changed

+81
-28
lines changed

contrib/ChangeLog

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2013-03-06 Tobias Burnus <[email protected]>
2+
3+
* make-obstacks-texi.pl: New.
4+
15
2013-02-27 Rainer Orth <[email protected]>
26

37
* make_sunver.pl: Enforce C locale.

contrib/make-obstacks-texi.pl

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/usr/bin/perl -w
2+
3+
# (C) 2013 Free Software Foundation
4+
# Contributed by Tobias Burnus
5+
#
6+
# This script is Free Software, and it can be copied, distributed and
7+
# modified as defined in the GNU General Public License. A copy of
8+
# its license can be downloaded from http://www.gnu.org/copyleft/gpl.html
9+
10+
use strict;
11+
use File::Basename;
12+
13+
14+
if ($#ARGV != 0 or $ARGV[0] eq "") {
15+
my $name = basename($0);
16+
17+
print "\nUSAGE: `$name` memory.texi\n\n";
18+
print "Reads GLIBC's manual/memory.texi and extracts the obstacks section\n"
19+
."Redirect the output to update GCC's libiberty/obstacks.texi\n\n";
20+
exit 1;
21+
}
22+
23+
open (IN, "<$ARGV[0]") || die "Cannot open '$ARGV[0]': $!";
24+
my $data = join ("", <IN>);
25+
close (IN);
26+
27+
$data =~ s/.*\@node Obstacks\n/\@node Obstacks\n/s;
28+
$data =~ s/\n\@node [^\n]+\n\@subsection.*/\n/s;
29+
30+
# Add refs to GLIBC
31+
$data =~ s/(\@p?xref{[^}]*)}/$1, , , libc, The GNU C Library Reference Manual}/gs;
32+
33+
34+
# And undo the refs which are in this file
35+
my @nodes = grep /^\@node /, (split /\n/, $data);
36+
37+
foreach my $node (@nodes) {
38+
$node =~ s/\@node //;
39+
$node =~ s/,.*//;
40+
$node =~ s/ / *\n?/g;
41+
chomp ($node);
42+
43+
$data =~ s/(\@p?xref{$node), , , libc, The GNU C Library Reference Manual}/$1}/gsi;
44+
}
45+
46+
print $data;

libiberty/ChangeLog

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2013-03-06 Tobias Burnus <[email protected]>
2+
3+
* libiberty.texi: Update comment, remove lowersections.
4+
* obstacks.texi: Regenerate.
5+
16
2013-03-05 Jakub Jelinek <[email protected]>
27

38
PR middle-end/56526

libiberty/libiberty.texi

+1-6
Original file line numberDiff line numberDiff line change
@@ -241,13 +241,8 @@ central location from which to use, maintain, and distribute them.
241241
* Obstacks:: Stacks of arbitrary objects.
242242
@end menu
243243

244-
@c This is generated from the glibc manual using a make-obstacks-texi.sh
245-
@c script of Phil's. Hope it's accurate.
246-
@lowersections
247-
@lowersections
244+
@c This is generated from the glibc manual using contrib/make-obstacks-texi.pl
248245
@include obstacks.texi
249-
@raisesections
250-
@raisesections
251246

252247
@node Functions
253248
@chapter Function, Variable, and Macro Listing.

libiberty/obstacks.texi

+25-22
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@node Obstacks
2-
@chapter Obstacks
2+
@subsection Obstacks
33
@cindex obstacks
44

55
An @dfn{obstack} is a pool of memory containing a stack of objects. You
@@ -15,25 +15,25 @@ the objects are usually small. And the only space overhead per object is
1515
the padding needed to start each object on a suitable boundary.
1616

1717
@menu
18-
* Creating Obstacks:: How to declare an obstack in your program.
19-
* Preparing for Obstacks:: Preparations needed before you can
20-
use obstacks.
18+
* Creating Obstacks:: How to declare an obstack in your program.
19+
* Preparing for Obstacks:: Preparations needed before you can
20+
use obstacks.
2121
* Allocation in an Obstack:: Allocating objects in an obstack.
2222
* Freeing Obstack Objects:: Freeing objects in an obstack.
23-
* Obstack Functions:: The obstack functions are both
24-
functions and macros.
23+
* Obstack Functions:: The obstack functions are both
24+
functions and macros.
2525
* Growing Objects:: Making an object bigger by stages.
26-
* Extra Fast Growing:: Extra-high-efficiency (though more
27-
complicated) growing objects.
26+
* Extra Fast Growing:: Extra-high-efficiency (though more
27+
complicated) growing objects.
2828
* Status of an Obstack:: Inquiries about the status of an obstack.
2929
* Obstacks Data Alignment:: Controlling alignment of objects in obstacks.
3030
* Obstack Chunks:: How obstacks obtain and release chunks;
31-
efficiency considerations.
31+
efficiency considerations.
3232
* Summary of Obstacks::
3333
@end menu
3434

3535
@node Creating Obstacks
36-
@section Creating Obstacks
36+
@subsubsection Creating Obstacks
3737

3838
The utilities for manipulating obstacks are declared in the header
3939
file @file{obstack.h}.
@@ -74,7 +74,7 @@ directly or indirectly. You must also supply a function to free a chunk.
7474
These matters are described in the following section.
7575

7676
@node Preparing for Obstacks
77-
@section Preparing for Using Obstacks
77+
@subsubsection Preparing for Using Obstacks
7878

7979
Each source file in which you plan to use the obstack functions
8080
must include the header file @file{obstack.h}, like this:
@@ -160,7 +160,7 @@ obstack_alloc_failed_handler = &my_obstack_alloc_failed;
160160
@end defvar
161161

162162
@node Allocation in an Obstack
163-
@section Allocation in an Obstack
163+
@subsubsection Allocation in an Obstack
164164
@cindex allocation (obstacks)
165165

166166
The most direct way to allocate an object in an obstack is with
@@ -233,7 +233,7 @@ Contrast this with the previous example of @code{savestring} using
233233
@code{malloc} (@pxref{Basic Allocation, , , libc, The GNU C Library Reference Manual}).
234234

235235
@node Freeing Obstack Objects
236-
@section Freeing Objects in an Obstack
236+
@subsubsection Freeing Objects in an Obstack
237237
@cindex freeing (obstacks)
238238

239239
To free an object allocated in an obstack, use the function
@@ -265,7 +265,7 @@ frees the chunk (@pxref{Preparing for Obstacks}). Then other
265265
obstacks, or non-obstack allocation, can reuse the space of the chunk.
266266

267267
@node Obstack Functions
268-
@section Obstack Functions and Macros
268+
@subsubsection Obstack Functions and Macros
269269
@cindex macros
270270

271271
The interfaces for using obstacks may be defined either as functions or
@@ -321,7 +321,7 @@ various language extensions in GNU C permit defining the macros so as to
321321
compute each argument only once.
322322

323323
@node Growing Objects
324-
@section Growing Objects
324+
@subsubsection Growing Objects
325325
@cindex growing objects (in obstacks)
326326
@cindex changing the size of a block (obstacks)
327327

@@ -435,7 +435,7 @@ the current object smaller. Just don't try to shrink it beyond zero
435435
length---there's no telling what will happen if you do that.
436436

437437
@node Extra Fast Growing
438-
@section Extra Fast Growing Objects
438+
@subsubsection Extra Fast Growing Objects
439439
@cindex efficiency and obstacks
440440

441441
The usual functions for growing objects incur overhead for checking
@@ -538,7 +538,7 @@ add_string (struct obstack *obstack, const char *ptr, int len)
538538
@end smallexample
539539

540540
@node Status of an Obstack
541-
@section Status of an Obstack
541+
@subsubsection Status of an Obstack
542542
@cindex obstack status
543543
@cindex status of obstack
544544

@@ -580,12 +580,13 @@ obstack_next_free (@var{obstack-ptr}) - obstack_base (@var{obstack-ptr})
580580
@end deftypefun
581581

582582
@node Obstacks Data Alignment
583-
@section Alignment of Data in Obstacks
583+
@subsubsection Alignment of Data in Obstacks
584584
@cindex alignment (in obstacks)
585585

586586
Each obstack has an @dfn{alignment boundary}; each object allocated in
587587
the obstack automatically starts on an address that is a multiple of the
588-
specified boundary. By default, this boundary is 4 bytes.
588+
specified boundary. By default, this boundary is aligned so that
589+
the object can hold any type of data.
589590

590591
To access an obstack's alignment boundary, use the macro
591592
@code{obstack_alignment_mask}, whose function prototype looks like
@@ -597,7 +598,9 @@ this:
597598
The value is a bit mask; a bit that is 1 indicates that the corresponding
598599
bit in the address of an object should be 0. The mask value should be one
599600
less than a power of 2; the effect is that all object addresses are
600-
multiples of that power of 2. The default value of the mask is 3, so that
601+
multiples of that power of 2. The default value of the mask is a value
602+
that allows aligned objects to hold any type of data: for example, if
603+
its value is 3, any type of data can be stored at locations whose
601604
addresses are multiples of 4. A mask value of 0 means an object can start
602605
on any multiple of 1 (that is, no alignment is required).
603606

@@ -620,7 +623,7 @@ This will finish a zero-length object and then do proper alignment for
620623
the next object.
621624

622625
@node Obstack Chunks
623-
@section Obstack Chunks
626+
@subsubsection Obstack Chunks
624627
@cindex efficiency of chunks
625628
@cindex chunks
626629

@@ -676,7 +679,7 @@ if (obstack_chunk_size (obstack_ptr) < @var{new-chunk-size})
676679
@end smallexample
677680

678681
@node Summary of Obstacks
679-
@section Summary of Obstack Functions
682+
@subsubsection Summary of Obstack Functions
680683

681684
Here is a summary of all the functions associated with obstacks. Each
682685
takes the address of an obstack (@code{struct obstack *}) as its first

0 commit comments

Comments
 (0)