1
0
mirror of https://github.com/golang/go synced 2024-11-26 00:07:57 -07:00

gofmt'ed godefs

R=rsc
http://go/go-review/1020001
This commit is contained in:
Robert Griesemer 2009-11-05 15:35:53 -08:00
parent 6a4940ee23
commit 441e775dad

View File

@ -6,7 +6,7 @@
Godefs is a bootstrapping tool for porting the Go runtime to new systems. Godefs is a bootstrapping tool for porting the Go runtime to new systems.
It translates C type declarations into C or Go type declarations It translates C type declarations into C or Go type declarations
with the same memory layout. with the same memory layout.
Usage: godefs [-g package] [-c cc] [-f cc-arg]... [defs.c ...] Usage: godefs [-g package] [-c cc] [-f cc-arg]... [defs.c ...]
@ -18,13 +18,13 @@ definitions.
The input to godefs is a C input file that can be compiled by The input to godefs is a C input file that can be compiled by
the host system's standard C compiler (typically gcc). the host system's standard C compiler (typically gcc).
This file is expected to define new types and enumerated constants This file is expected to define new types and enumerated constants
whose names begin with $ (a legal identifier character in gcc). whose names begin with $ (a legal identifier character in gcc).
Godefs compile the given input file with the host compiler and Godefs compile the given input file with the host compiler and
then parses the debug info embedded in the assembly output. then parses the debug info embedded in the assembly output.
This is far easier than reading system headers on most machines. This is far easier than reading system headers on most machines.
The output from godefs is either C output intended for the The output from godefs is either C output intended for the
Plan 9 C compiler tool chain (6c, 8c, or 5c) or Go output. Plan 9 C compiler tool chain (6c, 8c, or 5c) or Go output.
The options are: The options are:
@ -35,7 +35,7 @@ The options are:
-c cc -c cc
set the name of the host system's C compiler (default "gcc") set the name of the host system's C compiler (default "gcc")
-f cc-arg -f cc-arg
add cc-arg to the command line when invoking the system C compiler add cc-arg to the command line when invoking the system C compiler
(for example, -f -m64 to invoke gcc -m64). (for example, -f -m64 to invoke gcc -m64).
@ -56,17 +56,17 @@ then "godefs x.c" generates:
// godefs x.c // godefs x.c
// MACHINE GENERATED - DO NOT EDIT. // MACHINE GENERATED - DO NOT EDIT.
// Constants // Constants
enum { enum {
S_IFMT = 0xf000, S_IFMT = 0xf000,
S_IFIFO = 0x1000, S_IFIFO = 0x1000,
S_IFCHR = 0x2000, S_IFCHR = 0x2000,
}; };
// Types // Types
#pragma pack on #pragma pack on
typedef struct Timespec Timespec; typedef struct Timespec Timespec;
struct Timespec { struct Timespec {
int64 tv_sec; int64 tv_sec;
@ -78,18 +78,18 @@ and "godefs -g MyPackage x.c" generates:
// godefs -g MyPackage x.c // godefs -g MyPackage x.c
// MACHINE GENERATED - DO NOT EDIT. // MACHINE GENERATED - DO NOT EDIT.
package MyPackage package MyPackage
// Constants // Constants
const ( const (
S_IFMT = 0xf000; S_IFMT = 0xf000;
S_IFIFO = 0x1000; S_IFIFO = 0x1000;
S_IFCHR = 0x2000; S_IFCHR = 0x2000;
) )
// Types // Types
type Timespec struct { type Timespec struct {
Sec int64; Sec int64;
Nsec int64; Nsec int64;