From: Brian Paul Date: Thu, 25 Nov 2004 23:22:56 +0000 (+0000) Subject: Started some assorted clean-ups in #defines, typedefs, etc. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=936028f8b0db83595fda77ed4b9f30452cdf9c8b;p=mesa.git Started some assorted clean-ups in #defines, typedefs, etc. Next: move all the Windows/WGL stuff into the drivers/windows/ directory. --- diff --git a/src/mesa/main/glheader.h b/src/mesa/main/glheader.h index 5068e90c609..0266b77f1b0 100644 --- a/src/mesa/main/glheader.h +++ b/src/mesa/main/glheader.h @@ -20,7 +20,7 @@ /* * Mesa 3-D graphics library - * Version: 6.2 + * Version: 6.3 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * @@ -70,20 +70,23 @@ #include +/* This is no longer uses since we dumped autoconf/automake! */ #ifdef HAVE_CONFIG_H #include "conf.h" #endif #if defined(_WIN32) && !defined(__WIN32__) && !defined(__CYGWIN__) && !defined(BUILD_FOR_SNAP) -# define __WIN32__ -# define finite _finite +# define __WIN32__ +# define finite _finite #endif #if defined(__WATCOMC__) -# define finite _finite +# define finite _finite +# pragma disable_message(201) /* Disable unreachable code warnings */ #endif + #if !defined(OPENSTEP) && (defined(__WIN32__) && !defined(__CYGWIN__)) && !defined(BUILD_FOR_SNAP) # if !defined(__GNUC__) /* mingw environment */ # pragma warning( disable : 4068 ) /* unknown pragma */ @@ -133,23 +136,20 @@ # define GLWINAPIV #endif /* WIN32 / CYGWIN bracket */ -/* compatibility guard so we don't need to change client code */ +/* XXX why is this here? + * It should probaby be somewhere in src/mesa/drivers/windows/ + */ +/* compatibility guard so we don't need to change client code */ #if defined(_WIN32) && !defined(_WINDEF_) && !defined(_WINDEF_H) && !defined(_GNU_H_WINDOWS32_BASE) && !defined(OPENSTEP) && !defined(__CYGWIN__) && !defined(BUILD_FOR_SNAP) -#if 0 -# define CALLBACK GLCALLBACK -typedef void *HGLRC; -typedef void *HDC; -#endif typedef int (GLAPIENTRY *PROC)(); typedef unsigned long COLORREF; #endif -/* Make sure we include glext.h from gl.h */ -#define GL_GLEXT_PROTOTYPES - - +/* XXX why is this here? + * It should probaby be somewhere in src/mesa/drivers/windows/ + */ #if defined(_WIN32) && !defined(_WINGDI_) && !defined(_WINGDI_H) && !defined(_GNU_H_WINDOWS32_DEFINES) && !defined(OPENSTEP) && !defined(BUILD_FOR_SNAP) # define WGL_FONT_LINES 0 # define WGL_FONT_POLYGONS 1 @@ -192,23 +192,13 @@ typedef struct tagPIXELFORMATDESCRIPTOR PIXELFORMATDESCRIPTOR, *PPIXELFORMATDESC #define LE32_TO_CPU( x ) CPU_TO_LE32( x ) -/* This is a macro on IRIX */ -#ifdef _P -#undef _P -#endif - - - +#define GL_GLEXT_PROTOTYPES #include "GL/gl.h" #include "GL/glext.h" -#ifndef CAPI -#if defined(WIN32) && !defined(BUILD_FOR_SNAP) +#if !defined(CAPI) && defined(WIN32) && !defined(BUILD_FOR_SNAP) #define CAPI _cdecl -#else -#define CAPI -#endif #endif #include @@ -258,9 +248,9 @@ typedef GLushort GLhalfARB; -/* Disable unreachable code warnings for Watcom C++ */ -#ifdef __WATCOMC__ -#pragma disable_message(201) +/* This is a macro on IRIX */ +#ifdef _P +#undef _P #endif @@ -313,6 +303,16 @@ typedef GLushort GLhalfARB; #endif +/* If we build the library with gcc's -fvisibility=hidden flag, we'll + * use the PUBLIC macro to mark functions that are to be exported. + */ +#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 303 +# define PUBLIC __attribute__((visibility("default"))) +#else +# define PUBLIC +#endif + + /* Some compilers don't like some of Mesa's const usage */ #ifdef NO_CONST # define CONST @@ -331,22 +331,10 @@ typedef GLushort GLhalfARB; #if !defined __GNUC__ || __GNUC__ < 3 -# define __builtin_expect(x, y) x +# define __builtin_expect(x, y) x #endif - -/** - * Sometimes we treat GLfloats as GLints. On x86 systems, moving a float - * as a int (thereby using integer registers instead of FP registers) is - * a performance win. Typically, this can be done with ordinary casts. - * But with gcc's -fstrict-aliasing flag (which defaults to on in gcc 3.0) - * these casts generate warnings. - * The following union typedef is used to solve that. - */ -typedef union { GLfloat f; GLint i; } fi_type; - - #include "config.h" #endif /* GLHEADER_H */ diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h index a928b20ad56..b69b5fa31a1 100644 --- a/src/mesa/main/imports.h +++ b/src/mesa/main/imports.h @@ -198,6 +198,20 @@ extern void _ext_mesa_free_pixelbuffer( void *pb ); /*@}*/ +/**********************************************************************/ + + +/** + * Sometimes we treat GLfloats as GLints. On x86 systems, moving a float + * as a int (thereby using integer registers instead of FP registers) is + * a performance win. Typically, this can be done with ordinary casts. + * But with gcc's -fstrict-aliasing flag (which defaults to on in gcc 3.0) + * these casts generate warnings. + * The following union typedef is used to solve that. + */ +typedef union { GLfloat f; GLint i; } fi_type; + + /********************************************************************** * Math macros