hw/xwin: Fix some of the warnings in generated gl wrapper code

Fix some of the warnings in generated gl wrapper code:
- glWinResolveHelper takes a const char * argument
- ensure formal parameter names don't collide with reserved names or shadow
global declarations (e.g. near, far, index (from string.h), remainder (from
math.h), pointer (from Xdefs.h) by postpending a '_'.

generated_gl_wrappers.c:13:3: warning: passing argument 2 of 'glWinResolveHelper' discards qualifiers from pointer target type
glwrap.c:70:1: note: expected 'char *' but argument is of type 'const char *'
[repeated many times]
generated_gl_wrappers.c: In function 'glVertexAttrib1dARBWrapper': generated_gl_wrappers.c:6884:47: warning: declaration of 'index' shadows a global declaration [-Wshadow]
generated_gl_wrappers.c:6886:3: warning: passing argument 2 of 'glWinResolveHelper' discards qualifiers from pointer target type
[repeated many times]

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
This commit is contained in:
Jon TURNEY 2012-09-27 17:23:43 +01:00
parent f7f0739311
commit 0ea65df8a5
2 changed files with 5 additions and 7 deletions

View File

@ -146,9 +146,8 @@ for line in glspec :
arglist_use = m1.group(2)
wrappers[function] = {}
# near and far might be reserved words or macros so can't be used as formal parameter names
arglist_use = arglist_use.replace('near','zNear')
arglist_use = arglist_use.replace('far','zFar')
# ensure formal parameter names don't collide with reserved names or shadow global declarations
arglist_use = ',' .join([i.rstrip() + '_' for i in arglist_use.split(",")])
wrappers[function]['arglist_use'] = arglist_use
param_count = 0
@ -217,9 +216,8 @@ for w in sorted(wrappers.keys()) :
if k.startswith('param') :
l = wrappers[w][k].split()
# near and far might be reserved words or macros so can't be used as formal parameter names
l[0] = l[0].replace('near','zNear')
l[0] = l[0].replace('far','zFar')
# ensure formal parameter names don't collide with reserved names or shadow global declarations
l[0] = l[0] + '_'
if l[2] == 'in' :
if l[3] == 'array' :

View File

@ -67,7 +67,7 @@ glWinCallDelta(void)
}
static PROC
glWinResolveHelper(PROC * cache, char *symbol)
glWinResolveHelper(PROC * cache, const char *symbol)
{
PROC proc = NULL;