Skip to content

Commit

Permalink
Squash warnings on zero-sized structs servo#87.
Browse files Browse the repository at this point in the history
Changes zero-sized structs to an `enum` and removed unused macro use statement.
  • Loading branch information
rthomas committed Jul 27, 2017
1 parent 10c07c7 commit fdbca54
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 11 deletions.
5 changes: 3 additions & 2 deletions src/color_space.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
use core_foundation::base::{CFRelease, CFRetain, CFTypeID, CFTypeRef, TCFType};
use std::mem;

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

pub type CGColorSpaceRef = *const __CGColorSpace;

Expand Down
5 changes: 3 additions & 2 deletions src/data_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ pub type CGDataProviderReleaseBytePointerCallback = Option<unsafe extern fn (*mu
pub type CGDataProviderReleaseDataCallback = Option<unsafe extern fn (*mut c_void, *const c_void, size_t)>;
pub type CGDataProviderGetBytesAtPositionCallback = Option<unsafe extern fn (*mut c_void, *mut c_void, off_t, size_t)>;

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

pub type CGDataProviderRef = *const __CGDataProvider;

Expand Down
6 changes: 4 additions & 2 deletions src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ pub type CGKeyCode = libc::uint16_t;
///
/// [Ref](http://opensource.apple.com/source/IOHIDFamily/IOHIDFamily-700/IOHIDSystem/IOKit/hidsystem/IOLLEvent.h)
bitflags! {
#[repr(C)]
pub struct CGEventFlags: u64 {
const CGEventFlagNull = 0;

Expand Down Expand Up @@ -88,8 +89,9 @@ pub enum CGEventTapLocation {
AnnotatedSession,
}

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

pub type CGEventRef = *const __CGEvent;

Expand Down
5 changes: 3 additions & 2 deletions src/event_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ pub enum CGEventSourceStateID {
HIDSystemState = 1,
}

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

pub type CGEventSourceRef = *const __CGEventSource;

Expand Down
5 changes: 3 additions & 2 deletions src/image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ pub enum CGImageByteOrderInfo {
CGImageByteOrder32Big = (4 << 12)
}

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

pub type CGImageRef = *const __CGImage;

Expand Down
1 change: 0 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
// except according to those terms.

extern crate libc;
#[macro_use]
extern crate core_foundation;

#[macro_use]
Expand Down

0 comments on commit fdbca54

Please sign in to comment.