servo: Merge #11245 - geckolib: Support constants in classes (from emilio:geckolib-consts); r=bholley

Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data:
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy --faster` does not report any errors
- [ ] These changes fix #__ (github issue number if applicable).

Either:
- [ ] These changes do not require tests because geckolib isn't tested here.

Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process.

---

Newest bindgen adds support for in-class statics.

This patch updates this to take them into account.

Source-Repo: https://github.com/servo/servo
Source-Revision: 2f39e10cccb79af76c10c9092b4f6166833a3ea0
This commit is contained in:
Emilio Cobos Álvarez 2016-05-18 12:26:18 -07:00
Родитель 7d70cec87c
Коммит ce3451ee2d
2 изменённых файлов: 143 добавлений и 35 удалений

Просмотреть файл

@ -1,6 +1,7 @@
/* automatically generated by rust-bindgen */ /* automatically generated by rust-bindgen */
#[derive(Copy, Debug)] #[derive(Copy, Debug)]
#[repr(C)]
pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>); pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
impl <T> __BindgenUnionField<T> { impl <T> __BindgenUnionField<T> {
#[inline] #[inline]
@ -64,6 +65,8 @@ pub const NS_ERROR_MODULE_BASE_OFFSET: ::std::os::raw::c_uint = 69;
pub const MOZ_STRING_WITH_OBSOLETE_API: ::std::os::raw::c_uint = 1; pub const MOZ_STRING_WITH_OBSOLETE_API: ::std::os::raw::c_uint = 1;
pub const NSID_LENGTH: ::std::os::raw::c_uint = 39; pub const NSID_LENGTH: ::std::os::raw::c_uint = 39;
pub const NS_NUMBER_OF_FLAGS_IN_REFCNT: ::std::os::raw::c_uint = 2; pub const NS_NUMBER_OF_FLAGS_IN_REFCNT: ::std::os::raw::c_uint = 2;
pub const _STL_PAIR_H: ::std::os::raw::c_uint = 1;
pub const _GLIBCXX_UTILITY: ::std::os::raw::c_uint = 1;
pub const TWIPS_PER_POINT_INT: ::std::os::raw::c_uint = 20; pub const TWIPS_PER_POINT_INT: ::std::os::raw::c_uint = 20;
pub const POINTS_PER_INCH_INT: ::std::os::raw::c_uint = 72; pub const POINTS_PER_INCH_INT: ::std::os::raw::c_uint = 72;
pub const NS_FONT_VARIANT_NORMAL: ::std::os::raw::c_uint = 0; pub const NS_FONT_VARIANT_NORMAL: ::std::os::raw::c_uint = 0;
@ -1544,8 +1547,16 @@ fn bindgen_test_layout_nsAutoString() {
assert_eq!(::std::mem::size_of::<nsAutoString>() , 160usize); assert_eq!(::std::mem::size_of::<nsAutoString>() , 160usize);
assert_eq!(::std::mem::align_of::<nsAutoString>() , 8usize); assert_eq!(::std::mem::align_of::<nsAutoString>() , 8usize);
} }
pub enum Dont_Instantiate_nsTArray_of { } #[repr(C)]
pub enum Instead_Use_nsTArray_of { } #[derive(Debug, Copy, Clone)]
pub struct Dont_Instantiate_nsTArray_of<A> {
pub _phantom0: ::std::marker::PhantomData<A>,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Instead_Use_nsTArray_of<A> {
pub _phantom0: ::std::marker::PhantomData<A>,
}
#[repr(C)] #[repr(C)]
#[derive(Debug, Copy)] #[derive(Debug, Copy)]
pub struct nsTArrayElementTraits; pub struct nsTArrayElementTraits;
@ -1911,7 +1922,12 @@ pub type nsCID = nsID;
* interface. * interface.
*/ */
pub type nsIID = nsID; pub type nsIID = nsID;
pub enum COMTypeInfo { } #[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct COMTypeInfo<T, U> {
pub _phantom0: ::std::marker::PhantomData<T>,
pub _phantom1: ::std::marker::PhantomData<U>,
}
/** /**
* Basic component object model interface. Objects which implement * Basic component object model interface. Objects which implement
* this interface support runtime interface discovery (QueryInterface) * this interface support runtime interface discovery (QueryInterface)
@ -1975,6 +1991,10 @@ fn bindgen_test_layout_nsAutoRefCnt() {
assert_eq!(::std::mem::size_of::<nsAutoRefCnt>() , 8usize); assert_eq!(::std::mem::size_of::<nsAutoRefCnt>() , 8usize);
assert_eq!(::std::mem::align_of::<nsAutoRefCnt>() , 8usize); assert_eq!(::std::mem::align_of::<nsAutoRefCnt>() , 8usize);
} }
extern "C" {
#[link_name = "_ZN12nsAutoRefCnt12isThreadSafeE"]
pub static nsAutoRefCnt_consts_isThreadSafe: bool;
}
#[repr(C)] #[repr(C)]
#[derive(Debug)] #[derive(Debug)]
pub struct ThreadSafeAutoRefCnt { pub struct ThreadSafeAutoRefCnt {
@ -1985,6 +2005,10 @@ fn bindgen_test_layout_ThreadSafeAutoRefCnt() {
assert_eq!(::std::mem::size_of::<ThreadSafeAutoRefCnt>() , 8usize); assert_eq!(::std::mem::size_of::<ThreadSafeAutoRefCnt>() , 8usize);
assert_eq!(::std::mem::align_of::<ThreadSafeAutoRefCnt>() , 8usize); assert_eq!(::std::mem::align_of::<ThreadSafeAutoRefCnt>() , 8usize);
} }
extern "C" {
#[link_name = "_ZN7mozilla20ThreadSafeAutoRefCnt12isThreadSafeE"]
pub static ThreadSafeAutoRefCnt_consts_isThreadSafe: bool;
}
/** /**
* There are two ways of implementing QueryInterface, and we use both: * There are two ways of implementing QueryInterface, and we use both:
* *
@ -2040,7 +2064,6 @@ pub struct RefPtr_ConstRemovingRefPtrTraits<T, U> {
#[derive(Debug, Copy, Clone)] #[derive(Debug, Copy, Clone)]
pub struct RefPtrGetterAddRefs<T> { pub struct RefPtrGetterAddRefs<T> {
pub mTargetSmartPtr: *mut RefPtr<T>, pub mTargetSmartPtr: *mut RefPtr<T>,
pub _phantom0: ::std::marker::PhantomData<T>,
} }
#[repr(C)] #[repr(C)]
#[derive(Debug, Copy)] #[derive(Debug, Copy)]
@ -2175,7 +2198,6 @@ pub struct nsCOMPtr<T> {
#[derive(Debug)] #[derive(Debug)]
pub struct nsGetterAddRefs<T> { pub struct nsGetterAddRefs<T> {
pub mTargetSmartPtr: *mut nsCOMPtr<T>, pub mTargetSmartPtr: *mut nsCOMPtr<T>,
pub _phantom0: ::std::marker::PhantomData<T>,
} }
#[repr(C)] #[repr(C)]
#[derive(Debug)] #[derive(Debug)]
@ -2198,7 +2220,6 @@ pub struct nsAutoPtr_Proxy<T, R, Args> {
#[derive(Debug, Copy, Clone)] #[derive(Debug, Copy, Clone)]
pub struct nsAutoPtrGetterTransfers<T> { pub struct nsAutoPtrGetterTransfers<T> {
pub mTargetSmartPtr: *mut nsAutoPtr<T>, pub mTargetSmartPtr: *mut nsAutoPtr<T>,
pub _phantom0: ::std::marker::PhantomData<T>,
} }
pub type PLDHashNumber = u32; pub type PLDHashNumber = u32;
#[repr(C)] #[repr(C)]
@ -2225,6 +2246,16 @@ fn bindgen_test_layout_Checker() {
assert_eq!(::std::mem::size_of::<Checker>() , 8usize); assert_eq!(::std::mem::size_of::<Checker>() , 8usize);
assert_eq!(::std::mem::align_of::<Checker>() , 4usize); assert_eq!(::std::mem::align_of::<Checker>() , 4usize);
} }
extern "C" {
#[link_name = "_ZN7Checker5kIdleE"]
pub static Checker_consts_kIdle: ::std::os::raw::c_uint;
#[link_name = "_ZN7Checker6kRead1E"]
pub static Checker_consts_kRead1: ::std::os::raw::c_uint;
#[link_name = "_ZN7Checker8kReadMaxE"]
pub static Checker_consts_kReadMax: ::std::os::raw::c_uint;
#[link_name = "_ZN7Checker6kWriteE"]
pub static Checker_consts_kWrite: ::std::os::raw::c_uint;
}
#[repr(C)] #[repr(C)]
pub struct PLDHashTable { pub struct PLDHashTable {
pub mOps: *const PLDHashTableOps, pub mOps: *const PLDHashTableOps,
@ -2268,6 +2299,23 @@ fn bindgen_test_layout_PLDHashTable() {
assert_eq!(::std::mem::size_of::<PLDHashTable>() , 48usize); assert_eq!(::std::mem::size_of::<PLDHashTable>() , 48usize);
assert_eq!(::std::mem::align_of::<PLDHashTable>() , 8usize); assert_eq!(::std::mem::align_of::<PLDHashTable>() , 8usize);
} }
extern "C" {
#[link_name = "_ZN12PLDHashTable12kMaxCapacityE"]
pub static PLDHashTable_consts_kMaxCapacity: ::std::os::raw::c_uint;
#[link_name = "_ZN12PLDHashTable12kMinCapacityE"]
pub static PLDHashTable_consts_kMinCapacity: ::std::os::raw::c_uint;
#[link_name = "_ZN12PLDHashTable17kMaxInitialLengthE"]
pub static PLDHashTable_consts_kMaxInitialLength: ::std::os::raw::c_uint;
#[link_name = "_ZN12PLDHashTable21kDefaultInitialLengthE"]
pub static PLDHashTable_consts_kDefaultInitialLength:
::std::os::raw::c_uint;
#[link_name = "_ZN12PLDHashTable9kHashBitsE"]
pub static PLDHashTable_consts_kHashBits: ::std::os::raw::c_uint;
#[link_name = "_ZN12PLDHashTable12kGoldenRatioE"]
pub static PLDHashTable_consts_kGoldenRatio: ::std::os::raw::c_uint;
#[link_name = "_ZN12PLDHashTable14kCollisionFlagE"]
pub static PLDHashTable_consts_kCollisionFlag: ::std::os::raw::c_uint;
}
pub type PLDHashHashKey = pub type PLDHashHashKey =
::std::option::Option<unsafe extern "C" fn(aKey: ::std::option::Option<unsafe extern "C" fn(aKey:
*const ::std::os::raw::c_void) *const ::std::os::raw::c_void)
@ -2426,6 +2474,37 @@ pub enum SheetType {
Count = 10, Count = 10,
Unknown = -1, Unknown = -1,
} }
/**
* StaticAutoPtr and StaticRefPtr are like nsAutoPtr and nsRefPtr, except they
* are suitable for use as global variables.
*
* In particular, a global instance of Static{Auto,Ref}Ptr doesn't cause the
* compiler to emit a static initializer (in release builds, anyway).
*
* In order to accomplish this, Static{Auto,Ref}Ptr must have a trivial
* constructor and destructor. As a consequence, it cannot initialize its raw
* pointer to 0 on construction, and it cannot delete/release its raw pointer
* upon destruction.
*
* Since the compiler guarantees that all global variables are initialized to
* 0, these trivial constructors are safe. Since we rely on this, the clang
* plugin, run as part of our "static analysis" builds, makes it a compile-time
* error to use Static{Auto,Ref}Ptr as anything except a global variable.
*
* Static{Auto,Ref}Ptr have a limited interface as compared to ns{Auto,Ref}Ptr;
* this is intentional, since their range of acceptable uses is smaller.
*/
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct StaticAutoPtr<T> {
pub mRawPtr: *mut T,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct StaticRefPtr<T> {
pub mRawPtr: *mut T,
}
pub enum Zero { }
pub enum _cairo_surface { } pub enum _cairo_surface { }
pub type cairo_surface_t = _cairo_surface; pub type cairo_surface_t = _cairo_surface;
pub enum _cairo_user_data_key { } pub enum _cairo_user_data_key { }
@ -2507,28 +2586,13 @@ pub struct piecewise_construct_t;
impl ::std::clone::Clone for piecewise_construct_t { impl ::std::clone::Clone for piecewise_construct_t {
fn clone(&self) -> Self { *self } fn clone(&self) -> Self { *self }
} }
pub enum tuple { }
#[repr(C)] #[repr(C)]
#[derive(Debug, Copy, Clone)] #[derive(Debug, Copy, Clone)]
pub struct pair<_T1, _T2> { pub struct pair<_T1, _T2> {
pub first: _T1, pub first: _T1,
pub second: _T2, pub second: _T2,
} }
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct __make_pair_return_impl<_Tp> {
pub _phantom0: ::std::marker::PhantomData<_Tp>,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct __make_pair_return<_Tp> {
pub _phantom0: ::std::marker::PhantomData<_Tp>,
}
#[repr(C)]
#[derive(Debug, Copy)]
pub struct __get_pair;
impl ::std::clone::Clone for __get_pair {
fn clone(&self) -> Self { *self }
}
pub type Float = f32; pub type Float = f32;
#[repr(i8)] #[repr(i8)]
#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)]
@ -2785,6 +2849,16 @@ pub enum SideBits {
eSideBitsLeftRight = 10, eSideBitsLeftRight = 10,
eSideBitsAll = 15, eSideBitsAll = 15,
} }
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct tuple_size<_Tp> {
pub _phantom0: ::std::marker::PhantomData<_Tp>,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct tuple_element<_Tp> {
pub _phantom0: ::std::marker::PhantomData<_Tp>,
}
pub type nscoord = i32; pub type nscoord = i32;
#[repr(C)] #[repr(C)]
pub struct nsIntPoint { pub struct nsIntPoint {
@ -3540,6 +3614,9 @@ pub enum nsCSSPropertyLogicalGroup {
eCSSPropertyLogicalGroup_COUNT = 9, eCSSPropertyLogicalGroup_COUNT = 9,
} }
pub type nscolor = u32; pub type nscolor = u32;
#[repr(i8)]
#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)]
pub enum nsHexColorType { NoAlpha = 0, AllowAlpha = 1, }
/** /**
* This structure precedes the string buffers "we" allocate. It may be the * This structure precedes the string buffers "we" allocate. It may be the
* case that nsTAString::mData does not point to one of these special * case that nsTAString::mData does not point to one of these special
@ -3673,12 +3750,14 @@ pub enum nsCSSUnit {
eCSSUnit_RGBAColor = 82, eCSSUnit_RGBAColor = 82,
eCSSUnit_HexColor = 83, eCSSUnit_HexColor = 83,
eCSSUnit_ShortHexColor = 84, eCSSUnit_ShortHexColor = 84,
eCSSUnit_PercentageRGBColor = 85, eCSSUnit_HexColorAlpha = 85,
eCSSUnit_PercentageRGBAColor = 86, eCSSUnit_ShortHexColorAlpha = 86,
eCSSUnit_HSLColor = 87, eCSSUnit_PercentageRGBColor = 87,
eCSSUnit_HSLAColor = 88, eCSSUnit_PercentageRGBAColor = 88,
eCSSUnit_Percent = 90, eCSSUnit_HSLColor = 89,
eCSSUnit_Number = 91, eCSSUnit_HSLAColor = 90,
eCSSUnit_Percent = 100,
eCSSUnit_Number = 101,
eCSSUnit_PhysicalMillimeter = 200, eCSSUnit_PhysicalMillimeter = 200,
eCSSUnit_ViewportWidth = 700, eCSSUnit_ViewportWidth = 700,
eCSSUnit_ViewportHeight = 701, eCSSUnit_ViewportHeight = 701,
@ -3814,6 +3893,10 @@ fn bindgen_test_layout_nsCSSRect() {
assert_eq!(::std::mem::size_of::<nsCSSRect>() , 64usize); assert_eq!(::std::mem::size_of::<nsCSSRect>() , 64usize);
assert_eq!(::std::mem::align_of::<nsCSSRect>() , 8usize); assert_eq!(::std::mem::align_of::<nsCSSRect>() , 8usize);
} }
extern "C" {
#[link_name = "_ZN9nsCSSRect5sidesE"]
pub static mut nsCSSRect_consts_sides: [::std::os::raw::c_void; 4usize];
}
#[repr(C)] #[repr(C)]
#[derive(Debug)] #[derive(Debug)]
pub struct nsCSSRect_heap { pub struct nsCSSRect_heap {
@ -3975,6 +4058,11 @@ fn bindgen_test_layout_nsCSSCornerSizes() {
assert_eq!(::std::mem::size_of::<nsCSSCornerSizes>() , 64usize); assert_eq!(::std::mem::size_of::<nsCSSCornerSizes>() , 64usize);
assert_eq!(::std::mem::align_of::<nsCSSCornerSizes>() , 8usize); assert_eq!(::std::mem::align_of::<nsCSSCornerSizes>() , 8usize);
} }
extern "C" {
#[link_name = "_ZN16nsCSSCornerSizes7cornersE"]
pub static mut nsCSSCornerSizes_consts_corners:
[::std::os::raw::c_void; 4usize];
}
pub enum WritingMode { } pub enum WritingMode { }
pub type CounterValue = i32; pub type CounterValue = i32;
pub enum NegativeType { } pub enum NegativeType { }
@ -4174,7 +4262,6 @@ pub struct HandleRefPtr<T> {
#[derive(Debug)] #[derive(Debug)]
pub struct ArenaRefPtr<T> { pub struct ArenaRefPtr<T> {
pub mPtr: RefPtr<T>, pub mPtr: RefPtr<T>,
pub _phantom0: ::std::marker::PhantomData<T>,
} }
#[repr(u32)] #[repr(u32)]
#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)]
@ -4600,6 +4687,14 @@ fn bindgen_test_layout_nsStyleImageLayers() {
assert_eq!(::std::mem::size_of::<nsStyleImageLayers>() , 168usize); assert_eq!(::std::mem::size_of::<nsStyleImageLayers>() , 168usize);
assert_eq!(::std::mem::align_of::<nsStyleImageLayers>() , 8usize); assert_eq!(::std::mem::align_of::<nsStyleImageLayers>() , 8usize);
} }
extern "C" {
#[link_name = "_ZN18nsStyleImageLayers21kBackgroundLayerTableE"]
pub static mut nsStyleImageLayers_consts_kBackgroundLayerTable:
*const nsCSSProperty;
#[link_name = "_ZN18nsStyleImageLayers15kMaskLayerTableE"]
pub static mut nsStyleImageLayers_consts_kMaskLayerTable:
*const nsCSSProperty;
}
#[repr(C)] #[repr(C)]
pub struct nsStyleBackground { pub struct nsStyleBackground {
pub mImage: nsStyleImageLayers, pub mImage: nsStyleImageLayers,
@ -4740,6 +4835,14 @@ fn bindgen_test_layout_nsStyleList() {
assert_eq!(::std::mem::size_of::<nsStyleList>() , 48usize); assert_eq!(::std::mem::size_of::<nsStyleList>() , 48usize);
assert_eq!(::std::mem::align_of::<nsStyleList>() , 8usize); assert_eq!(::std::mem::align_of::<nsStyleList>() , 8usize);
} }
extern "C" {
#[link_name = "_ZN11nsStyleList14sInitialQuotesE"]
pub static mut nsStyleList_consts_sInitialQuotes:
StaticRefPtr<nsStyleQuoteValues>;
#[link_name = "_ZN11nsStyleList11sNoneQuotesE"]
pub static mut nsStyleList_consts_sNoneQuotes:
StaticRefPtr<nsStyleQuoteValues>;
}
#[repr(C)] #[repr(C)]
#[derive(Debug)] #[derive(Debug)]
pub struct nsStyleGridLine { pub struct nsStyleGridLine {
@ -4752,6 +4855,12 @@ fn bindgen_test_layout_nsStyleGridLine() {
assert_eq!(::std::mem::size_of::<nsStyleGridLine>() , 24usize); assert_eq!(::std::mem::size_of::<nsStyleGridLine>() , 24usize);
assert_eq!(::std::mem::align_of::<nsStyleGridLine>() , 8usize); assert_eq!(::std::mem::align_of::<nsStyleGridLine>() , 8usize);
} }
extern "C" {
#[link_name = "_ZN15nsStyleGridLine8kMinLineE"]
pub static nsStyleGridLine_consts_kMinLine: ::std::os::raw::c_int;
#[link_name = "_ZN15nsStyleGridLine8kMaxLineE"]
pub static nsStyleGridLine_consts_kMaxLine: ::std::os::raw::c_int;
}
#[repr(C)] #[repr(C)]
#[derive(Debug)] #[derive(Debug)]
pub struct nsStyleGridTemplate { pub struct nsStyleGridTemplate {
@ -5286,6 +5395,10 @@ fn bindgen_test_layout_nsStyleColumn() {
assert_eq!(::std::mem::size_of::<nsStyleColumn>() , 56usize); assert_eq!(::std::mem::size_of::<nsStyleColumn>() , 56usize);
assert_eq!(::std::mem::align_of::<nsStyleColumn>() , 8usize); assert_eq!(::std::mem::align_of::<nsStyleColumn>() , 8usize);
} }
extern "C" {
#[link_name = "_ZN13nsStyleColumn15kMaxColumnCountE"]
pub static nsStyleColumn_consts_kMaxColumnCount: ::std::os::raw::c_uint;
}
#[repr(u32)] #[repr(u32)]
#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)]
pub enum nsStyleSVGPaintType { pub enum nsStyleSVGPaintType {
@ -5496,12 +5609,6 @@ fn bindgen_test_layout_nsStyleEffects() {
assert_eq!(::std::mem::align_of::<nsStyleEffects>() , 8usize); assert_eq!(::std::mem::align_of::<nsStyleEffects>() , 8usize);
} }
/** /**
* This class is used to replace nsTArray in order to allow generating rust
* bindings for it, and for related classes.
*
* If this class or some of the following asserts have to change, please ping
* bholley, heycam, or emilio first.
*
* <div rustbindgen replaces="nsTArray"></div> * <div rustbindgen replaces="nsTArray"></div>
*/ */
#[repr(C)] #[repr(C)]

Просмотреть файл

@ -98,6 +98,7 @@ export RUST_BACKTRACE=1
-match "utility" \ -match "utility" \
-match "pair" \ -match "pair" \
-match "SheetParsingMode.h" \ -match "SheetParsingMode.h" \
-match "StaticPtr.h" \
-blacklist-type "IsDestructibleFallbackImpl" \ -blacklist-type "IsDestructibleFallbackImpl" \
-blacklist-type "IsDestructibleFallback" \ -blacklist-type "IsDestructibleFallback" \
-opaque-type "nsIntMargin" \ -opaque-type "nsIntMargin" \