[Mesa-dev] [PATCH] mesa/extensions: Define the size of the extension array

Brian Paul brianp at vmware.com
Thu Nov 12 15:17:01 PST 2015


On 11/12/2015 04:03 PM, Nanley Chery wrote:
> From: Nanley Chery <nanley.g.chery at intel.com>
>
> Hopefully fixes the MSVC build error reported by Roland.
>
> Signed-off-by: Nanley Chery <nanley.g.chery at intel.com>
> ---
>
> I'm not sure why the array size being unknown is an issue. Please let
> me know if this fixes the build issue.
>
>   src/mesa/main/extensions.c |  2 +-
>   src/mesa/main/extensions.h | 17 ++++++++---------
>   2 files changed, 9 insertions(+), 10 deletions(-)
>
> diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
> index b81bcc5..83c9bff 100644
> --- a/src/mesa/main/extensions.c
> +++ b/src/mesa/main/extensions.c
> @@ -53,7 +53,7 @@ static char *cant_disable_extensions = NULL;
>   /**
>    * \brief Table of supported OpenGL extensions for all API's.
>    */
> -const struct mesa_extension _mesa_extension_table[] = {
> +const struct mesa_extension _mesa_extension_table[MESA_EXTENSION_COUNT] = {
>   #define EXT(name_str, driver_cap, gll_ver, glc_ver, gles_ver, gles2_ver, yyyy) \
>           { .name = "GL_" #name_str, .offset = o(driver_cap), \
>             .version = { \
> diff --git a/src/mesa/main/extensions.h b/src/mesa/main/extensions.h
> index e4671be..ba47b68 100644
> --- a/src/mesa/main/extensions.h
> +++ b/src/mesa/main/extensions.h
> @@ -55,6 +55,13 @@ _mesa_get_extension_count(struct gl_context *ctx);
>   extern const GLubyte *
>   _mesa_get_enabled_extension(struct gl_context *ctx, GLuint index);
>
> +/* Generate enums for the generated functions below */
> +enum {
> +#define EXT(name_str, ...) MESA_EXTENSION_##name_str,
> +#include "extensions_table.h"
> +#undef EXT
> +   MESA_EXTENSION_COUNT
> +};
>
>   /**
>    * \brief An element of the \c extension_table.
> @@ -75,15 +82,7 @@ struct mesa_extension {
>      /** Year the extension was proposed or approved.  Used to sort the
>       * extension string chronologically. */
>      uint16_t year;
> -} extern const _mesa_extension_table[];
> -
> -
> -/* Generate enums for the functions below */
> -enum {
> -#define EXT(name_str, ...) MESA_EXTENSION_##name_str,
> -#include "extensions_table.h"
> -#undef EXT
> -};
> +} extern const _mesa_extension_table[MESA_EXTENSION_COUNT];

The patch I posted which simply moves the extern array declaration to a 
separate statement fixes my MSVC build here.

-Brian



More information about the mesa-dev mailing list