diff options
author | Brian Paul <[email protected]> | 2015-03-04 19:17:57 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2015-03-05 06:59:43 -0700 |
commit | 18db13f586509f4fc196839886efcfd0715d8db0 (patch) | |
tree | 7804953f7a1481c9c4f07bcc58d457f995d13995 | |
parent | fac77912b5faa2394e0c0a88f3862eae9d87967a (diff) |
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 <[email protected]>
Reviewed-by: José Fonseca <[email protected]>
-rw-r--r-- | src/mapi/glapi/gen/gl_x86-64_asm.py | 6 | ||||
-rw-r--r-- | src/mapi/glapi/gen/gl_x86_asm.py | 14 | ||||
-rw-r--r-- | src/mapi/glapi/glapi.h | 13 | ||||
-rw-r--r-- | src/mapi/glapi/glapi_entrypoint.c | 4 | ||||
-rw-r--r-- | src/mapi/glapi/glapi_priv.h | 4 | ||||
-rw-r--r-- | src/mapi/u_current.c | 22 | ||||
-rw-r--r-- | src/mapi/u_thread.h | 6 |
7 files changed, 13 insertions, 56 deletions
diff --git a/src/mapi/glapi/gen/gl_x86-64_asm.py b/src/mapi/glapi/gen/gl_x86-64_asm.py index 19e0e15b061..5a69e0343b2 100644 --- a/src/mapi/glapi/gen/gl_x86-64_asm.py +++ b/src/mapi/glapi/gen/gl_x86-64_asm.py @@ -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 '' diff --git a/src/mapi/glapi/gen/gl_x86_asm.py b/src/mapi/glapi/gen/gl_x86_asm.py index d87d0bd24c6..f855dbaaa41 100644 --- a/src/mapi/glapi/gen/gl_x86_asm.py +++ b/src/mapi/glapi/gen/gl_x86_asm.py @@ -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 '' diff --git a/src/mapi/glapi/glapi.h b/src/mapi/glapi/glapi.h index e3f76b47c1c..b2d6632493c 100644 --- a/src/mapi/glapi/glapi.h +++ b/src/mapi/glapi/glapi.h @@ -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) */ diff --git a/src/mapi/glapi/glapi_entrypoint.c b/src/mapi/glapi/glapi_entrypoint.c index 362a8f11b40..53104ce5e58 100644 --- a/src/mapi/glapi/glapi_entrypoint.c +++ b/src/mapi/glapi/glapi_entrypoint.c @@ -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 } diff --git a/src/mapi/glapi/glapi_priv.h b/src/mapi/glapi/glapi_priv.h index 92925faacca..d3682603d6f 100644 --- a/src/mapi/glapi/glapi_priv.h +++ b/src/mapi/glapi/glapi_priv.h @@ -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 diff --git a/src/mapi/u_current.c b/src/mapi/u_current.c index c1a486bd0e1..036572483c2 100644 --- a/src/mapi/u_current.c +++ b/src/mapi/u_current.c @@ -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 } diff --git a/src/mapi/u_thread.h b/src/mapi/u_thread.h index e57c69a2430..a3a65c36eba 100644 --- a/src/mapi/u_thread.h +++ b/src/mapi/u_thread.h @@ -48,12 +48,6 @@ #include "c11/threads.h" -#if defined(HAVE_PTHREAD) || defined(_WIN32) -#ifndef THREADS -#define THREADS -#endif -#endif - /* * Error messages */ |