mapi: THREADS was always defined, remove it

THREADS was defined if HAVE_PTHREADS or _WIN32 was defined.  That's
always the case.  The build would die in c11/threads.h otherwise.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
This commit is contained in:
Brian Paul
2015-03-04 19:17:57 -07:00
parent fac77912b5
commit 18db13f586
7 changed files with 13 additions and 56 deletions
+1 -5
View File
@@ -138,10 +138,6 @@ class PrintGenericStubs(gl_XML.gl_print_base):
print '# define GL_PREFIX(n) GLNAME(CONCAT(gl,n))'
print '# endif'
print ''
print '#if defined(HAVE_PTHREAD) || defined(_WIN32)'
print '# define THREADS'
print '#endif'
print ''
print '\t.text'
print ''
print '#ifdef GLX_USE_TLS'
@@ -170,7 +166,7 @@ class PrintGenericStubs(gl_XML.gl_print_base):
print '\tmovl\t(%rax), %edi'
print '\tjmp\tpthread_getspecific@PLT'
print ''
print '#elif defined(THREADS)'
print '#else'
print ''
print '\t.extern\t_glapi_get_dispatch'
print ''
+2 -12
View File
@@ -78,9 +78,6 @@ class PrintGenericStubs(gl_XML.gl_print_base):
print '#define GLOBL_FN(x) GLOBL x'
print '#endif'
print ''
print '#if defined(HAVE_PTHREAD) || defined(_WIN32)'
print '# define THREADS'
print '#endif'
print ''
print '#ifdef GLX_USE_TLS'
print ''
@@ -109,7 +106,7 @@ class PrintGenericStubs(gl_XML.gl_print_base):
print '\tJMP(GL_OFFSET(off)) ;\t\t\t\t\\'
print '1:\tCALL(_x86_get_dispatch) ;\t\t\t\\'
print '\tJMP(GL_OFFSET(off))'
print '#elif defined(THREADS)'
print '#else'
print '# define GL_STUB(fn,off,fn_alt)\t\t\t\\'
print 'ALIGNTEXT16;\t\t\t\t\t\t\\'
print 'GLOBL_FN(GL_PREFIX(fn, fn_alt));\t\t\t\\'
@@ -120,13 +117,6 @@ class PrintGenericStubs(gl_XML.gl_print_base):
print '\tJMP(GL_OFFSET(off)) ;\t\t\t\t\\'
print '1:\tCALL(_glapi_get_dispatch) ;\t\t\t\\'
print '\tJMP(GL_OFFSET(off))'
print '#else /* Non-threaded version. */'
print '# define GL_STUB(fn,off,fn_alt)\t\t\t\\'
print 'ALIGNTEXT16;\t\t\t\t\t\t\\'
print 'GLOBL_FN(GL_PREFIX(fn, fn_alt));\t\t\t\\'
print 'GL_PREFIX(fn, fn_alt):\t\t\t\t\t\\'
print '\tMOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) ;\t\\'
print '\tJMP(GL_OFFSET(off))'
print '#endif'
print ''
print '#ifdef HAVE_ALIAS'
@@ -164,7 +154,7 @@ class PrintGenericStubs(gl_XML.gl_print_base):
print '\tCALL(GLNAME(pthread_getspecific))'
print '\tADD_L(CONST(28), ESP)'
print '\tRET'
print '#elif defined(THREADS)'
print '#else'
print 'EXTERN GLNAME(_glapi_get_dispatch)'
print '#endif'
print ''
+2 -11
View File
@@ -103,21 +103,12 @@ _GLAPI_EXPORT extern const void *_glapi_Context;
_GLAPI_EXPORT extern struct _glapi_table *_glapi_Dispatch;
_GLAPI_EXPORT extern void *_glapi_Context;
# ifdef THREADS
# define GET_DISPATCH() \
#define GET_DISPATCH() \
(likely(_glapi_Dispatch) ? _glapi_Dispatch : _glapi_get_dispatch())
# define GET_CURRENT_CONTEXT(C) struct gl_context *C = (struct gl_context *) \
#define GET_CURRENT_CONTEXT(C) struct gl_context *C = (struct gl_context *) \
(likely(_glapi_Context) ? _glapi_Context : _glapi_get_context())
# else
# define GET_DISPATCH() _glapi_Dispatch
# define GET_CURRENT_CONTEXT(C) struct gl_context *C = (struct gl_context *) _glapi_Context
# endif
#endif /* defined (GLX_USE_TLS) */
+1 -3
View File
@@ -120,11 +120,9 @@ fill_in_entrypoint_offset(_glapi_proc entrypoint, unsigned int offset)
#if defined(GLX_USE_TLS)
*((unsigned int *)(code + 8)) = 4 * offset;
#elif defined(THREADS)
#else
*((unsigned int *)(code + 11)) = 4 * offset;
*((unsigned int *)(code + 22)) = 4 * offset;
#else
*((unsigned int *)(code + 7)) = 4 * offset;
#endif
}
+1 -3
View File
@@ -86,10 +86,8 @@ get_entrypoint_address(unsigned int functionOffset);
#if defined(USE_X86_ASM)
# if defined(GLX_USE_TLS)
# define DISPATCH_FUNCTION_SIZE 16
# elif defined(THREADS)
# define DISPATCH_FUNCTION_SIZE 32
# else
# define DISPATCH_FUNCTION_SIZE 16
# define DISPATCH_FUNCTION_SIZE 32
# endif
#endif
+6 -16
View File
@@ -112,11 +112,9 @@ struct mapi_table *u_current_table =
(struct mapi_table *) table_noop_array;
void *u_current_context;
#ifdef THREADS
struct u_tsd u_current_table_tsd;
static struct u_tsd u_current_context_tsd;
static int ThreadSafe;
#endif /* THREADS */
#endif /* defined(GLX_USE_TLS) */
/*@}*/
@@ -125,14 +123,14 @@ static int ThreadSafe;
void
u_current_destroy(void)
{
#if defined(THREADS) && !defined(GLX_USE_TLS)
#if !defined(GLX_USE_TLS)
u_tsd_destroy(&u_current_table_tsd);
u_tsd_destroy(&u_current_context_tsd);
#endif
}
#if defined(THREADS) && !defined(GLX_USE_TLS)
#if !defined(GLX_USE_TLS)
static void
u_current_init_tsd(void)
@@ -234,11 +232,9 @@ u_current_set_context(const void *ptr)
#if defined(GLX_USE_TLS)
u_current_context = (void *) ptr;
#elif defined(THREADS)
#else
u_tsd_set(&u_current_context_tsd, (void *) ptr);
u_current_context = (ThreadSafe) ? NULL : (void *) ptr;
#else
u_current_context = (void *) ptr;
#endif
}
@@ -252,12 +248,10 @@ u_current_get_context_internal(void)
{
#if defined(GLX_USE_TLS)
return u_current_context;
#elif defined(THREADS)
#else
return (ThreadSafe)
? u_tsd_get(&u_current_context_tsd)
: u_current_context;
#else
return u_current_context;
#endif
}
@@ -278,11 +272,9 @@ u_current_set_table(const struct mapi_table *tbl)
#if defined(GLX_USE_TLS)
u_current_table = (struct mapi_table *) tbl;
#elif defined(THREADS)
#else
u_tsd_set(&u_current_table_tsd, (void *) tbl);
u_current_table = (ThreadSafe) ? NULL : (void *) tbl;
#else
u_current_table = (struct mapi_table *) tbl;
#endif
}
@@ -294,10 +286,8 @@ u_current_get_table_internal(void)
{
#if defined(GLX_USE_TLS)
return u_current_table;
#elif defined(THREADS)
#else
return (struct mapi_table *) ((ThreadSafe) ?
u_tsd_get(&u_current_table_tsd) : (void *) u_current_table);
#else
return u_current_table;
#endif
}
-6
View File
@@ -48,12 +48,6 @@
#include "c11/threads.h"
#if defined(HAVE_PTHREAD) || defined(_WIN32)
#ifndef THREADS
#define THREADS
#endif
#endif
/*
* Error messages
*/