Pull requests

#1 Merged
Repository
jrsimmons jrsimmons
Branch
kill_warnings_cptr
Repository
alfonse alfonse
Branch
default

Explicitly cast function pointers to avoid compiler warnings.

Author
  1. Josh Simmons
Reviewers
Description

Trying to kill off some unfriendly compiler warnings by explicitly casting the OpenGL function pointers. Maybe not the nicest way to go about it but works well enough.

This leaves a couple of warnings about casting between function pointer types but removes the vast majority.

Comments (3)

  1. Jason McKesson repo owner

    Under what circumstances are you getting these compiler warnings? I don't get them on MingW, Visual Studio, or even GCC on Linux. And that's with warnings cranked up.

  2. Josh Simmons author

    Default warning in GCC (4.7.1) and I think -Wall in clang both under linux.

    I couldn't even disable the damn warning in GCC, it's under -Wincompatible-pointer-types in clang.

    The implicit cast to function pointer does it pretty reliably I thought? Let me take another look.

  3. Josh Simmons author

    Yeah so this code: http://codepad.org/vqbv8a9P warns by default on GCC 4.7.1 (also impossible to disable) and Clang 3.1.

    test.c: In function 'main':
    test.c:17:11: warning: assignment from incompatible pointer type [enabled by default]
    
    
    test.c:17:11: warning: incompatible pointer types assigning to 'void (*)(int)' from 'fn_ptr' (aka 'void (*)(void)') [-Wincompatible-pointer-types]
    my_fn = get_blah();
          ^ ~~~~~~~~~~