Emit documentation on constants (#471)

Fixes #403
This commit is contained in:
Arnav Singh 2020-02-10 16:51:57 -08:00 committed by GitHub
parent 3b97f4ff6b
commit c6809b00fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 256 additions and 0 deletions

View File

@ -489,6 +489,8 @@ impl Constant {
_ => &self.value,
};
self.documentation.write(config, out);
if config.constant.allow_static_const && config.language == Language::Cxx {
out.write(if in_body { "inline " } else { "static " });
if let Type::ConstPtr(..) = self.ty {

View File

@ -11,10 +11,25 @@
typedef struct {
uint8_t bits;
} StyleAlignFlags;
/**
* 'auto'
*/
#define StyleAlignFlags_AUTO (StyleAlignFlags){ .bits = 0 }
/**
* 'normal'
*/
#define StyleAlignFlags_NORMAL (StyleAlignFlags){ .bits = 1 }
/**
* 'start'
*/
#define StyleAlignFlags_START (StyleAlignFlags){ .bits = (1 << 1) }
/**
* 'end'
*/
#define StyleAlignFlags_END (StyleAlignFlags){ .bits = (1 << 2) }
/**
* 'flex-start'
*/
#define StyleAlignFlags_FLEX_START (StyleAlignFlags){ .bits = (1 << 3) }
void root(StyleAlignFlags flags);

View File

@ -11,10 +11,25 @@
typedef struct {
uint8_t bits;
} StyleAlignFlags;
/**
* 'auto'
*/
#define StyleAlignFlags_AUTO (StyleAlignFlags){ .bits = 0 }
/**
* 'normal'
*/
#define StyleAlignFlags_NORMAL (StyleAlignFlags){ .bits = 1 }
/**
* 'start'
*/
#define StyleAlignFlags_START (StyleAlignFlags){ .bits = (1 << 1) }
/**
* 'end'
*/
#define StyleAlignFlags_END (StyleAlignFlags){ .bits = (1 << 2) }
/**
* 'flex-start'
*/
#define StyleAlignFlags_FLEX_START (StyleAlignFlags){ .bits = (1 << 3) }
#ifdef __cplusplus

View File

@ -42,10 +42,15 @@ struct StyleAlignFlags {
static const StyleAlignFlags END;
static const StyleAlignFlags FLEX_START;
};
/// 'auto'
inline const StyleAlignFlags StyleAlignFlags::AUTO = StyleAlignFlags{ /* .bits = */ 0 };
/// 'normal'
inline const StyleAlignFlags StyleAlignFlags::NORMAL = StyleAlignFlags{ /* .bits = */ 1 };
/// 'start'
inline const StyleAlignFlags StyleAlignFlags::START = StyleAlignFlags{ /* .bits = */ (1 << 1) };
/// 'end'
inline const StyleAlignFlags StyleAlignFlags::END = StyleAlignFlags{ /* .bits = */ (1 << 2) };
/// 'flex-start'
inline const StyleAlignFlags StyleAlignFlags::FLEX_START = StyleAlignFlags{ /* .bits = */ (1 << 3) };
extern "C" {

View File

@ -11,10 +11,25 @@
typedef struct {
uint8_t bits;
} AlignFlags;
/**
* 'auto'
*/
#define AlignFlags_AUTO (AlignFlags){ .bits = 0 }
/**
* 'normal'
*/
#define AlignFlags_NORMAL (AlignFlags){ .bits = 1 }
/**
* 'start'
*/
#define AlignFlags_START (AlignFlags){ .bits = (1 << 1) }
/**
* 'end'
*/
#define AlignFlags_END (AlignFlags){ .bits = (1 << 2) }
/**
* 'flex-start'
*/
#define AlignFlags_FLEX_START (AlignFlags){ .bits = (1 << 3) }
void root(AlignFlags flags);

View File

@ -11,10 +11,25 @@
typedef struct {
uint8_t bits;
} AlignFlags;
/**
* 'auto'
*/
#define AlignFlags_AUTO (AlignFlags){ .bits = 0 }
/**
* 'normal'
*/
#define AlignFlags_NORMAL (AlignFlags){ .bits = 1 }
/**
* 'start'
*/
#define AlignFlags_START (AlignFlags){ .bits = (1 << 1) }
/**
* 'end'
*/
#define AlignFlags_END (AlignFlags){ .bits = (1 << 2) }
/**
* 'flex-start'
*/
#define AlignFlags_FLEX_START (AlignFlags){ .bits = (1 << 3) }
#ifdef __cplusplus

View File

@ -37,10 +37,15 @@ struct AlignFlags {
return *this;
}
};
/// 'auto'
static const AlignFlags AlignFlags_AUTO = AlignFlags{ /* .bits = */ 0 };
/// 'normal'
static const AlignFlags AlignFlags_NORMAL = AlignFlags{ /* .bits = */ 1 };
/// 'start'
static const AlignFlags AlignFlags_START = AlignFlags{ /* .bits = */ (1 << 1) };
/// 'end'
static const AlignFlags AlignFlags_END = AlignFlags{ /* .bits = */ (1 << 2) };
/// 'flex-start'
static const AlignFlags AlignFlags_FLEX_START = AlignFlags{ /* .bits = */ (1 << 3) };
extern "C" {

View File

@ -11,10 +11,25 @@
typedef struct StyleAlignFlags {
uint8_t bits;
} StyleAlignFlags;
/**
* 'auto'
*/
#define StyleAlignFlags_AUTO (StyleAlignFlags){ .bits = 0 }
/**
* 'normal'
*/
#define StyleAlignFlags_NORMAL (StyleAlignFlags){ .bits = 1 }
/**
* 'start'
*/
#define StyleAlignFlags_START (StyleAlignFlags){ .bits = (1 << 1) }
/**
* 'end'
*/
#define StyleAlignFlags_END (StyleAlignFlags){ .bits = (1 << 2) }
/**
* 'flex-start'
*/
#define StyleAlignFlags_FLEX_START (StyleAlignFlags){ .bits = (1 << 3) }
void root(StyleAlignFlags flags);

View File

@ -11,10 +11,25 @@
typedef struct StyleAlignFlags {
uint8_t bits;
} StyleAlignFlags;
/**
* 'auto'
*/
#define StyleAlignFlags_AUTO (StyleAlignFlags){ .bits = 0 }
/**
* 'normal'
*/
#define StyleAlignFlags_NORMAL (StyleAlignFlags){ .bits = 1 }
/**
* 'start'
*/
#define StyleAlignFlags_START (StyleAlignFlags){ .bits = (1 << 1) }
/**
* 'end'
*/
#define StyleAlignFlags_END (StyleAlignFlags){ .bits = (1 << 2) }
/**
* 'flex-start'
*/
#define StyleAlignFlags_FLEX_START (StyleAlignFlags){ .bits = (1 << 3) }
#ifdef __cplusplus

View File

@ -11,10 +11,25 @@
typedef struct AlignFlags {
uint8_t bits;
} AlignFlags;
/**
* 'auto'
*/
#define AlignFlags_AUTO (AlignFlags){ .bits = 0 }
/**
* 'normal'
*/
#define AlignFlags_NORMAL (AlignFlags){ .bits = 1 }
/**
* 'start'
*/
#define AlignFlags_START (AlignFlags){ .bits = (1 << 1) }
/**
* 'end'
*/
#define AlignFlags_END (AlignFlags){ .bits = (1 << 2) }
/**
* 'flex-start'
*/
#define AlignFlags_FLEX_START (AlignFlags){ .bits = (1 << 3) }
void root(AlignFlags flags);

View File

@ -11,10 +11,25 @@
typedef struct AlignFlags {
uint8_t bits;
} AlignFlags;
/**
* 'auto'
*/
#define AlignFlags_AUTO (AlignFlags){ .bits = 0 }
/**
* 'normal'
*/
#define AlignFlags_NORMAL (AlignFlags){ .bits = 1 }
/**
* 'start'
*/
#define AlignFlags_START (AlignFlags){ .bits = (1 << 1) }
/**
* 'end'
*/
#define AlignFlags_END (AlignFlags){ .bits = (1 << 2) }
/**
* 'flex-start'
*/
#define AlignFlags_FLEX_START (AlignFlags){ .bits = (1 << 3) }
#ifdef __cplusplus

View File

@ -13,10 +13,19 @@
#define LEFTCURLY '{'
/**
* A
* multi-line
* doc
* comment.
*/
#define NEG_ONE -1
#define NEWLINE '\n'
/**
* A single-line doc comment.
*/
#define POS_ONE 1
#define QUOTE '\''

View File

@ -13,10 +13,19 @@
#define LEFTCURLY '{'
/**
* A
* multi-line
* doc
* comment.
*/
#define NEG_ONE -1
#define NEWLINE '\n'
/**
* A single-line doc comment.
*/
#define POS_ONE 1
#define QUOTE '\''

View File

@ -13,10 +13,19 @@
#define LEFTCURLY '{'
/**
* A
* multi-line
* doc
* comment.
*/
#define NEG_ONE -1
#define NEWLINE '\n'
/**
* A single-line doc comment.
*/
#define POS_ONE 1
#define QUOTE '\''

View File

@ -13,10 +13,19 @@
#define LEFTCURLY '{'
/**
* A
* multi-line
* doc
* comment.
*/
#define NEG_ONE -1
#define NEWLINE '\n'
/**
* A single-line doc comment.
*/
#define POS_ONE 1
#define QUOTE '\''

View File

@ -13,10 +13,15 @@ static const uint32_t HEART = L'\U00002764';
static const uint32_t LEFTCURLY = '{';
/// A
/// multi-line
/// doc
/// comment.
static const int8_t NEG_ONE = -1;
static const uint32_t NEWLINE = '\n';
/// A single-line doc comment.
static const int8_t POS_ONE = 1;
static const uint32_t QUOTE = '\'';

View File

@ -11,10 +11,25 @@
struct StyleAlignFlags {
uint8_t bits;
};
/**
* 'auto'
*/
#define StyleAlignFlags_AUTO (StyleAlignFlags){ .bits = 0 }
/**
* 'normal'
*/
#define StyleAlignFlags_NORMAL (StyleAlignFlags){ .bits = 1 }
/**
* 'start'
*/
#define StyleAlignFlags_START (StyleAlignFlags){ .bits = (1 << 1) }
/**
* 'end'
*/
#define StyleAlignFlags_END (StyleAlignFlags){ .bits = (1 << 2) }
/**
* 'flex-start'
*/
#define StyleAlignFlags_FLEX_START (StyleAlignFlags){ .bits = (1 << 3) }
void root(struct StyleAlignFlags flags);

View File

@ -11,10 +11,25 @@
struct StyleAlignFlags {
uint8_t bits;
};
/**
* 'auto'
*/
#define StyleAlignFlags_AUTO (StyleAlignFlags){ .bits = 0 }
/**
* 'normal'
*/
#define StyleAlignFlags_NORMAL (StyleAlignFlags){ .bits = 1 }
/**
* 'start'
*/
#define StyleAlignFlags_START (StyleAlignFlags){ .bits = (1 << 1) }
/**
* 'end'
*/
#define StyleAlignFlags_END (StyleAlignFlags){ .bits = (1 << 2) }
/**
* 'flex-start'
*/
#define StyleAlignFlags_FLEX_START (StyleAlignFlags){ .bits = (1 << 3) }
#ifdef __cplusplus

View File

@ -11,10 +11,25 @@
struct AlignFlags {
uint8_t bits;
};
/**
* 'auto'
*/
#define AlignFlags_AUTO (AlignFlags){ .bits = 0 }
/**
* 'normal'
*/
#define AlignFlags_NORMAL (AlignFlags){ .bits = 1 }
/**
* 'start'
*/
#define AlignFlags_START (AlignFlags){ .bits = (1 << 1) }
/**
* 'end'
*/
#define AlignFlags_END (AlignFlags){ .bits = (1 << 2) }
/**
* 'flex-start'
*/
#define AlignFlags_FLEX_START (AlignFlags){ .bits = (1 << 3) }
void root(struct AlignFlags flags);

View File

@ -11,10 +11,25 @@
struct AlignFlags {
uint8_t bits;
};
/**
* 'auto'
*/
#define AlignFlags_AUTO (AlignFlags){ .bits = 0 }
/**
* 'normal'
*/
#define AlignFlags_NORMAL (AlignFlags){ .bits = 1 }
/**
* 'start'
*/
#define AlignFlags_START (AlignFlags){ .bits = (1 << 1) }
/**
* 'end'
*/
#define AlignFlags_END (AlignFlags){ .bits = (1 << 2) }
/**
* 'flex-start'
*/
#define AlignFlags_FLEX_START (AlignFlags){ .bits = (1 << 3) }
#ifdef __cplusplus

View File

@ -13,10 +13,19 @@
#define LEFTCURLY '{'
/**
* A
* multi-line
* doc
* comment.
*/
#define NEG_ONE -1
#define NEWLINE '\n'
/**
* A single-line doc comment.
*/
#define POS_ONE 1
#define QUOTE '\''

View File

@ -13,10 +13,19 @@
#define LEFTCURLY '{'
/**
* A
* multi-line
* doc
* comment.
*/
#define NEG_ONE -1
#define NEWLINE '\n'
/**
* A single-line doc comment.
*/
#define POS_ONE 1
#define QUOTE '\''

View File

@ -12,7 +12,12 @@ pub const ZOM: f32 = 3.14;
pub(crate) const DONT_EXPORT_CRATE: i32 = 20;
const DONT_EXPORT_PRIV: i32 = 30;
/// A single-line doc comment.
pub const POS_ONE: i8 = 1;
/// A
/// multi-line
/// doc
/// comment.
pub const NEG_ONE: i8 = -1;
// Some doc for shifting //