Skip to content

Commit

Permalink
Fix the ICE
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaka committed Nov 8, 2014
1 parent 678346e commit f14da1e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
9 changes: 6 additions & 3 deletions src/gl_generator/generators/global_gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,16 +130,19 @@ fn write_fnptr_struct_def(ecx: &ExtCtxt) -> Vec<P<ast::Item>> {
vec![
(quote_item!(ecx,
pub struct FnPtr {
/// The function pointer that will be used when calling the function.
// TODO: put back doccomment
// The function pointer that will be used when calling the function.
f: *const __gl_imports::libc::c_void,
/// True if the pointer points to a real function, false if points to a `panic!` fn.
// TODO: put back doccomment
// True if the pointer points to a real function, false if points to a `panic!` fn.
is_loaded: bool,
}
)).unwrap(),

(quote_item!(ecx,
impl FnPtr {
/// Creates a `FnPtr` from a load attempt.
// TODO: put back doccomment
// Creates a `FnPtr` from a load attempt.
pub fn new(ptr: *const __gl_imports::libc::c_void, failing_fn: *const __gl_imports::libc::c_void) -> FnPtr {
if ptr.is_null() {
FnPtr { f: failing_fn, is_loaded: false }
Expand Down
16 changes: 10 additions & 6 deletions src/gl_generator/generators/struct_gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,19 @@ fn write_fnptr_struct_def(ecx: &ExtCtxt) -> Vec<P<ast::Item>> {
(quote_item!(ecx,
#[allow(dead_code)]
pub struct FnPtr {
/// The function pointer that will be used when calling the function.
// TODO: put back doccomment
// The function pointer that will be used when calling the function.
f: *const __gl_imports::libc::c_void,
/// True if the pointer points to a real function, false if points to a `panic!` fn.
// TODO: put back doccomment
// True if the pointer points to a real function, false if points to a `panic!` fn.
is_loaded: bool,
}
)).unwrap(),

(quote_item!(ecx,
impl FnPtr {
/// Creates a `FnPtr` from a load attempt.
// TODO: put back doccomment
// Creates a `FnPtr` from a load attempt.
fn new(ptr: *const __gl_imports::libc::c_void,
failing_fn: *const __gl_imports::libc::c_void) -> FnPtr {
if ptr.is_null() {
Expand All @@ -99,9 +102,10 @@ fn write_fnptr_struct_def(ecx: &ExtCtxt) -> Vec<P<ast::Item>> {
}
}

/// Returns `true` if the function has been successfully loaded.
///
/// If it returns `false`, calling the corresponding function will fail.
// TODO: put back doccomment
// Returns `true` if the function has been successfully loaded.
//
// If it returns `false`, calling the corresponding function will fail.
#[inline]
#[allow(dead_code)]
pub fn is_loaded(&self) -> bool {
Expand Down

0 comments on commit f14da1e

Please sign in to comment.