Skip to content

Commit fdbca54

Browse files
committed
Squash warnings on zero-sized structs servo#87.
Changes zero-sized structs to an `enum` and removed unused macro use statement.
1 parent 10c07c7 commit fdbca54

File tree

6 files changed

+16
-11
lines changed

6 files changed

+16
-11
lines changed

src/color_space.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010
use core_foundation::base::{CFRelease, CFRetain, CFTypeID, CFTypeRef, TCFType};
1111
use std::mem;
1212

13-
#[repr(C)]
14-
pub struct __CGColorSpace;
13+
// This is an enum due to zero-sized types warnings.
14+
// For more details see https://github.com/rust-lang/rust/issues/27303
15+
pub enum __CGColorSpace {}
1516

1617
pub type CGColorSpaceRef = *const __CGColorSpace;
1718

src/data_provider.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ pub type CGDataProviderReleaseBytePointerCallback = Option<unsafe extern fn (*mu
2626
pub type CGDataProviderReleaseDataCallback = Option<unsafe extern fn (*mut c_void, *const c_void, size_t)>;
2727
pub type CGDataProviderGetBytesAtPositionCallback = Option<unsafe extern fn (*mut c_void, *mut c_void, off_t, size_t)>;
2828

29-
#[repr(C)]
30-
pub struct __CGDataProvider;
29+
// This is an enum due to zero-sized types warnings.
30+
// For more details see https://github.com/rust-lang/rust/issues/27303
31+
pub enum __CGDataProvider {}
3132

3233
pub type CGDataProviderRef = *const __CGDataProvider;
3334

src/event.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ pub type CGKeyCode = libc::uint16_t;
1212
///
1313
/// [Ref](http://opensource.apple.com/source/IOHIDFamily/IOHIDFamily-700/IOHIDSystem/IOKit/hidsystem/IOLLEvent.h)
1414
bitflags! {
15+
#[repr(C)]
1516
pub struct CGEventFlags: u64 {
1617
const CGEventFlagNull = 0;
1718

@@ -88,8 +89,9 @@ pub enum CGEventTapLocation {
8889
AnnotatedSession,
8990
}
9091

91-
#[repr(C)]
92-
pub struct __CGEvent;
92+
// This is an enum due to zero-sized types warnings.
93+
// For more details see https://github.com/rust-lang/rust/issues/27303
94+
pub enum __CGEvent {}
9395

9496
pub type CGEventRef = *const __CGEvent;
9597

src/event_source.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ pub enum CGEventSourceStateID {
1212
HIDSystemState = 1,
1313
}
1414

15-
#[repr(C)]
16-
pub struct __CGEventSource;
15+
// This is an enum due to zero-sized types warnings.
16+
// For more details see https://github.com/rust-lang/rust/issues/27303
17+
pub enum __CGEventSource {}
1718

1819
pub type CGEventSourceRef = *const __CGEventSource;
1920

src/image.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@ pub enum CGImageByteOrderInfo {
2727
CGImageByteOrder32Big = (4 << 12)
2828
}
2929

30-
#[repr(C)]
31-
pub struct __CGImage;
30+
// This is an enum due to zero-sized types warnings.
31+
// For more details see https://github.com/rust-lang/rust/issues/27303
32+
pub enum __CGImage {}
3233

3334
pub type CGImageRef = *const __CGImage;
3435

src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
// except according to those terms.
99

1010
extern crate libc;
11-
#[macro_use]
1211
extern crate core_foundation;
1312

1413
#[macro_use]

0 commit comments

Comments
 (0)