Brian Paul <[EMAIL PROTECTED]> wrote:
> When this many warnings are being generated, something should be
> done to fix them. If we get used to seeing a lot of warnings
> everytime we compile Mesa we may someday miss a really important
> one. Ideally, Mesa would compile clean without any warnings on all
> major compilers. That's probably not realistic but something to
> strive for.
Actually it is achievable, but it does take work (and regular
compiles with multiple compilers). I can help out in that area,
because we strive to ensure that all our MGL code compiles clean with
all supported compilers, and we have achived that goal. The only
modules that have never compiled clean are Mesa (a couple of
unreachable code problems in the old 3.1 code base).
> Microsoft has the same problem with its gl.h file. It depends
> upon windows.h but does not include it. So unfortunately, yes, you
> do have to #ifdef/#include "windows.h"/#endif in portable GL
> programs. But not when using GLUT since glut.h #includes
> "windows.h" for you.
Actually this is not the case. The only reason the Windows header
files are included is to define a couple of calling conventions for
the Windows functions (specifically WINGDIAPI, APIENTRY and
CALLBACK). We worked around this problem a while back in our OpenGL
headers used in the MGL. The cool thing about this is that Windows
code compiles *so* much faster without including <windows.h>. The way
to fix this is to add the following at the start of your gl.h header
file (and change all the GLAPIENTRY's in Mesa to be APIENTRY again
like it used to be):
--- cut here ---
/*
Define these as macros compatible with <windows.h> for Windows code.
Note that we also set things up so that we can remove the #defines at
the end of our header to avoid conflicts with the real <windows.h>
headers later on. Note that we also allow you to include the regular
<windows.h> header before gl\gl.h for porting code, however you would
be better off removing it as your code will compile significantly
faster ;-).
NOTE: For Win32 code we use the __stdcall calling convetions to be
compatible with regular Win32 OpenGL libraries. However for non
Win32 environments we use __cdecl calling conventions. __stdcall
and __cdecl are actually identical except for passing of variable
arguments
*/
#ifndef WINGDIAPI
#define clean_WINGDIAPI
#define WINGDIAPI
#endif
#ifndef APIENTRY
#define clean_APIENTRY
#define APIENTRY _STDCALL
#endif
#ifndef CALLBACK
#define clean_CALLBACK
#define CALLBACK _STDCALL
#endif
#ifdef PTR_DECL_IN_FRONT
#define APIENTRYP * APIENTRY
#define CALLBACKP * CALLBACK
#else
#define APIENTRYP APIENTRY *
#define CALLBACKP CALLBACK *
#endif
--- cut here ---
> In the next version of Mesa, I'd like to create a new glheader.h
> file which will be included in the Mesa sources instead of gl.h.
> glheader.h will include gl.h and whatever platform-specific headers
> might be needed, such as windows.h. Furthermore, it would have any
> #pragmas needed for specific environments. Hopefully some of the
> Windows-specific stuff can then be removed from Mesa's gl.h file.
Use the stuff I mentioned above, and you can do it. Note that we
don't compile our version of Mesa with the regular Mesa header files,
but instead compile it using our own OpenGL header files (derived
from the SGI code base). The reason for this is that we can include
workarounds such as the above, but we can also allow our code to turn
all OpenGL function calls into macro invocations via function
pointers, allowing us to switch OpenGL implementations on the fly on
the Windows platform.
I can post our gl.h header files if anyone is interested (or you can
get them from our MGL graphics library source archives).
Regards,
+---------------------------------------------------------------+
| SciTech Software - Building Truly Plug'n'Play Software! |
+---------------------------------------------------------------+
| Kendall Bennett | Email: [EMAIL PROTECTED] |
| Director of Engineering | Phone: (530) 894 8400 |
| SciTech Software, Inc. | Fax : (530) 894 9069 |
| 505 Wall Street | ftp : ftp.scitechsoft.com |
| Chico, CA 95928, USA | www : http://www.scitechsoft.com |
+---------------------------------------------------------------+
_______________________________________________
Mesa-dev maillist - [EMAIL PROTECTED]
http://lists.mesa3d.org/mailman/listinfo/mesa-dev