Skip to content

gen-guest-c: Emit prettier comments.#455

Merged
alexcrichton merged 1 commit intomainfrom
sunfishcode/c-comments
Jan 3, 2023
Merged

gen-guest-c: Emit prettier comments.#455
alexcrichton merged 1 commit intomainfrom
sunfishcode/c-comments

Conversation

@sunfishcode
Copy link
Copy Markdown
Member

Don't insert a newline between a type and its documentation comment. And do insert a newline before the documentation comment. This makes the generated header files prettier.

For example this:

// A timestamp in nanoseconds.
typedef uint64_t wasi_clocks_instant_t;

// A time and date in seconds plus nanoseconds.
typedef struct {
  uint64_t seconds;
  uint32_t nanoseconds;
} wasi_clocks_datetime_t;

Instead of this:

// A timestamp in nanoseconds.

typedef uint64_t wasi_clocks_instant_t;
// A time and date in seconds plus nanoseconds.

typedef struct {
  uint64_t seconds;
  uint32_t nanoseconds;
} wasi_clocks_datetime_t;

Don't insert a newline between a type and its documentation comment. And
do insert a newline before the documentation comment. This makes the
generated header files prettier.

For example this:
```c

// A timestamp in nanoseconds.
typedef uint64_t wasi_clocks_instant_t;

// A time and date in seconds plus nanoseconds.
typedef struct {
  uint64_t seconds;
  uint32_t nanoseconds;
} wasi_clocks_datetime_t;
```

Instead of this:
```c
// A timestamp in nanoseconds.

typedef uint64_t wasi_clocks_instant_t;
// A time and date in seconds plus nanoseconds.

typedef struct {
  uint64_t seconds;
  uint32_t nanoseconds;
} wasi_clocks_datetime_t;
```
@alexcrichton alexcrichton merged commit d24b97f into main Jan 3, 2023
@alexcrichton alexcrichton deleted the sunfishcode/c-comments branch January 3, 2023 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants