Bug 56710 - src/mapi/glapi/glapitemp.h:1640:1: warning: no previous prototype for ‘glReadBufferNV’ [-Wmissing-prototypes]
Summary: src/mapi/glapi/glapitemp.h:1640:1: warning: no previous prototype for ‘glRead...
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Mesa core (show other bugs)
Version: git
Hardware: x86-64 (AMD64) Linux (All)
: medium blocker
Assignee: Kristian Høgsberg
QA Contact: mesa-dev
URL:
Whiteboard:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2012-11-03 07:53 UTC by Vinson Lee
Modified: 2013-06-28 12:46 UTC (History)
5 users (show)

See Also:
i915 platform:
i915 features:


Attachments
kludge (2.15 KB, patch)
2012-11-27 17:51 UTC, Jon Turney
Details | Splinter Review
patch (412 bytes, patch)
2013-01-14 21:44 UTC, Matt Turner
Details | Splinter Review

Description Vinson Lee 2012-11-03 07:53:15 UTC
mesa: 84b437213294ff4e1a3bcae2f9cbb36a9b4955c4 (master)

Several -Wmissing-prototypes compiler warnings have been introduced to the SCons MinGW build.

$ scons platform=windows toolchain=crossmingw
[...]
  Compiling src/mapi/glapi/glapi_dispatch.c ...
In file included from src/mapi/glapi/glapi_dispatch.c:90:0:
src/mapi/glapi/glapitemp.h:1640:1: warning: no previous prototype for ‘glReadBufferNV’ [-Wmissing-prototypes]
src/mapi/glapi/glapitemp.h: In function ‘glShaderSource’:
src/mapi/glapi/glapitemp.h:4434:4: warning: passing argument 3 of ‘(__builtin_expect(_glapi_Dispatch != 0u, 1l) == 0l ? _glapi_get_dispatch() : _glapi_Dispatch)->ShaderSourceARB’ discards ‘const’ qualifier from pointer target type [enabled by default]
src/mapi/glapi/glapitemp.h:4434:4: note: expected ‘const GLcharARB **’ but argument is of type ‘const GLchar * const*’
src/mapi/glapi/glapitemp.h: At top level:
src/mapi/glapi/glapitemp.h:4749:1: warning: no previous prototype for ‘glDrawBuffersNV’ [-Wmissing-prototypes]
src/mapi/glapi/glapitemp.h:4851:1: warning: no previous prototype for ‘glFlushMappedBufferRangeEXT’ [-Wmissing-prototypes]
src/mapi/glapi/glapitemp.h:4863:1: warning: no previous prototype for ‘glMapBufferRangeEXT’ [-Wmissing-prototypes]
src/mapi/glapi/glapitemp.h:4887:1: warning: no previous prototype for ‘glBindVertexArrayOES’ [-Wmissing-prototypes]
src/mapi/glapi/glapitemp.h:4899:1: warning: no previous prototype for ‘glGenVertexArraysOES’ [-Wmissing-prototypes]
src/mapi/glapi/glapitemp.h: In function ‘glMultiDrawElements’:
src/mapi/glapi/glapitemp.h:6197:4: warning: passing argument 4 of ‘(__builtin_expect(_glapi_Dispatch != 0u, 1l) == 0l ? _glapi_get_dispatch() : _glapi_Dispatch)->MultiDrawElementsEXT’ discards ‘const’ qualifier from pointer target type [enabled by default]
src/mapi/glapi/glapitemp.h:6197:4: note: expected ‘const GLvoid **’ but argument is of type ‘const GLvoid * const*’
src/mapi/glapi/glapitemp.h: At top level:
src/mapi/glapi/glapitemp.h:7191:1: warning: no previous prototype for ‘glDeleteVertexArraysOES’ [-Wmissing-prototypes]
src/mapi/glapi/glapitemp.h:7219:1: warning: no previous prototype for ‘glIsVertexArrayOES’ [-Wmissing-prototypes]
src/mapi/glapi/glapitemp.h: In function ‘glTransformFeedbackVaryings’:
src/mapi/glapi/glapitemp.h:8685:4: warning: passing argument 3 of ‘(__builtin_expect(_glapi_Dispatch != 0u, 1l) == 0l ? _glapi_get_dispatch() : _glapi_Dispatch)->TransformFeedbackVaryingsEXT’ discards ‘const’ qualifier from pointer target type [enabled by default]
src/mapi/glapi/glapitemp.h:8685:4: note: expected ‘const char **’ but argument is of type ‘const GLchar * const*’


dd3218d73b3ffba98b885709ef086577e7cb8594 is the first bad commit
commit dd3218d73b3ffba98b885709ef086577e7cb8594
Author: Paul Berry <stereotype441@gmail.com>
Date:   Tue Oct 23 13:46:04 2012 -0700

    dispatch: Include GLES1-only functions in dispatch table.
    
    Previously dispatch table-related code was generated from gl_API.xml,
    so it did not include slots for GLES1-only functions (such as those
    taking fixed-point arguments).
    
    This patch generates dispatch table-related code from
    gl_and_es_API.xml, so that GLES1-only functions are included.  This
    paves the way for future patches that will unify the GLES1 dispatch
    table with the dispatch tables for the other APIs.
    
    The following generated files are affected:
    - glapi_x86.S
    - glapi_x86-64.S
    - glapi_sparc.S
    - glprocs.h
    - glapitemp.h
    - glapitable.h
    - glapi_gentable.c
    - dispatch.h
    - remap_helper.h
    
    Since this change affects makefiles, a full rebuild is required.
    
    Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
    
    v2: Adjust dependencies to ensure that generated files will be rebuilt
    whenever any ES-related XML source files are changed.
    
    Reviewed-by: Chad Versace <chad.versace@linux.intel.com>

:040000 040000 f8e806d873dccc97bebb76e10290b52456f77ff2 ed5a3e86134872d8e8209087ee9461f34eeb88b4 M	src
bisect run success
Comment 1 Jon Turney 2012-11-21 18:04:02 UTC
These warnings are also seen with the autotool build if you ./configure with --disable-asm (or build for a target where that is the default)
Comment 2 Jon Turney 2012-11-27 17:48:56 UTC
(In reply to comment #1)
> These warnings are also seen with the autotool build if you ./configure with
> --disable-asm (or build for a target where that is the default)

... and since the autotool build uses -Werror=missing-prototypes, these warnings are fatal.

See also commits 8f3be339 (which fixed a similar issue once already), and 3ed8d42 (which reverted the fix to fix it somewhere else [1])

[1] http://lists.freedesktop.org/archives/mesa-dev/2012-July/023899.html
Comment 3 Jon Turney 2012-11-27 17:51:58 UTC
Created attachment 70672 [details] [review]
kludge

Attached is a kludgy patch which jumps through the necessary hoops to include the GLES2 prototypes to fix these warnings, but I don't think this is the right way to fix this.
Comment 4 Alan Hourihane 2012-12-03 11:21:10 UTC
Kristian, 

This still seems to be a problem.

I can reproduce here too.
Comment 5 Alan Hourihane 2012-12-03 11:23:41 UTC
These are the current errors I see.....

In file included from glapi_dispatch.c:90:
../../../src/mapi/glapi/glapitemp.h:1640: error: no previous prototype for 'glReadBufferNV'
../../../src/mapi/glapi/glapitemp.h:4198: error: no previous prototype for 'glDrawBuffersNV'
../../../src/mapi/glapi/glapitemp.h:6377: error: no previous prototype for 'glFlushMappedBufferRangeEXT'
../../../src/mapi/glapi/glapitemp.h:6389: error: no previous prototype for 'glMapBufferRangeEXT'
../../../src/mapi/glapi/glapitemp.h:6401: error: no previous prototype for 'glBindVertexArrayOES'
../../../src/mapi/glapi/glapitemp.h:6413: error: no previous prototype for 'glDeleteVertexArraysOES'
../../../src/mapi/glapi/glapitemp.h:6433: error: no previous prototype for 'glGenVertexArraysOES'
../../../src/mapi/glapi/glapitemp.h:6445: error: no previous prototype for 'glIsVertexArrayOES'
../../../src/mapi/glapi/glapitemp.h: In function 'glMultiDrawElements':
../../../src/mapi/glapi/glapitemp.h:7541: warning: passing argument 4 of '(__builtin_expect(_glapi_Dispatch != 0u, 1l) != 0l ? _glapi_Dispatch : _glapi_get_dispatch())->MultiDrawElementsEXT' discards qualifiers from pointer target type
../../../src/mapi/glapi/glapitemp.h:7541: note: expected 'const GLvoid **' but argument is of type 'const GLvoid * const*'
Comment 6 Vinson Lee 2013-01-14 00:30:17 UTC
mesa: 6acef6c5f779ed0ba390f556479c428a36d70edb (master)

This bug is still present and blocks autotools builds with disable-asm.
Comment 7 Paul Berry 2013-01-14 01:00:11 UTC
(In reply to comment #6)
> mesa: 6acef6c5f779ed0ba390f556479c428a36d70edb (master)
> 
> This bug is still present and blocks autotools builds with disable-asm.

What parameters are you passing to ./configure (or equivalently, autogen.sh)?

This is what I'm using, and I can build without problems:

./autogen.sh \
    --with-gallium-drivers= \
    --enable-gles1 \
    --disable-glut \
    --disable-asm \
    --enable-debug \
    --enable-egl \
    --enable-gles2 \
    --enable-texture-float \
    --enable-shared-glapi \
    --enable-glx-tls \
    "--prefix=$PLATFORM_INSTALL_DIR" \
    --with-dri-drivers=swrast,i915,i965 \
    CFLAGS="-O0 $CFLAGS" \
    CXXFLAGS="-O0 $CXXFLAGS"
Comment 8 Vinson Lee 2013-01-14 01:40:29 UTC
(In reply to comment #7)
> 
> What parameters are you passing to ./configure (or equivalently, autogen.sh)?
> 

I can reproduce the build error with this configuration.

./autogen.sh --with-gallium-drivers=swrast --disable-dri --disable-asm
Comment 9 Matt Turner 2013-01-14 21:44:53 UTC
Created attachment 73024 [details] [review]
patch

3 of the other 4 inclusions of glapi/glapitemp.h 

(i.e., these:
src/mesa/drivers/x11/glxapi.c
src/mesa/drivers/osmesa/osmesa.c
src/gallium/targets/libgl-xlib/xlib.c
)

include it in a 

#ifdef GLX_INDIRECT_RENDERING

...

#define _GLAPI_SKIP_NORMAL_ENTRY_POINTS
#include "glapi/glapitemp.h"

#endif /* GLX_INDIRECT_RENDERING */

pattern.

src/mapi/glapi/glapi_nop.c does not, but I guess a nop implementation is allowed to be different.

src/mapi/glapi/glapi_dispatch.c does this

#if !(defined(USE_X86_ASM) || defined(USE_X86_64_ASM) || defined(USE_SPARC_ASM))

...

#ifdef GLX_INDIRECT_RENDERING
/* those link to libglapi.a should provide the entry points */
#define _GLAPI_SKIP_PROTO_ENTRY_POINTS
#endif
#include "glapi/glapitemp.h"

#endif /* USE_X86_ASM */

I have no idea about this code or this patch, but the patch makes glapi_dispatch.c match the inclusion pattern of the other files.

I've build tested it with

--with-gallium-drivers= --disable-dri --disable-asm;

--with-gallium-drivers= --disable-dri --disable-asm --enable-osmesa --disable-driglx-direct --enable-xlib-glx;

--with-gallium-drivers= --disable-asm --with-dri-drivers=
Comment 10 Matt Turner 2013-01-18 18:21:06 UTC
Patch sent to mailing list.
Comment 11 Matt Turner 2013-01-18 20:05:14 UTC
(In reply to comment #10)
> Patch sent to mailing list.

It's been pointed out to me that

_GLAPI_SKIP_NORMAL_ENTRY_POINTS and
_GLAPI_SKIP_PROTO_ENTRY_POINTS

are different things.
Comment 12 Jon Turney 2013-03-12 19:46:24 UTC
Adding some insight from IRC about the correct fix:

jturney: mattst88: I don't think that warning fix patch is right
jturney: including glapitemp.h with _GLAPI_SKIP_PROTO_ENTRY_POINTS and with _GLAPI_SKIP_NORMAL_ENTRY_POINTS aren't the same
krh: mattst88: the core problem there was that both gl2ext and glext was being included in the same header file
krh: and we had a hand-hacked version to gl2ext.h that didn't break when we did that
krh: but when I update to a pristine upstream gl2ext.h it broke
mattst88: jturney, krh: would someone like to send a different patch in that case? :)
jturney: Well, I have already sent a different but also wrong patch :-)
mattst88: oh, I didn't even notice that _GLAPI_SKIP_NORMAL_ENTRY_POINTS and _GLAPI_SKIP_PROTO_ENTRY_POINTS were different.
jturney: ^.^
krh: I think the right approach is to hand-code a header file with the union of entry points needed in the file that tries to include both ext.h file
krh: but it's been a while since I looked at it
krh: but more fundamentally, there's a problem with trying to include both glext.h and gl2ext.h headers, and that's probably what should be addressed
Comment 13 Andreas Boll 2013-06-20 20:44:22 UTC
Could you still reproduce this bug?
It should be fixed/worked around with this commit:

http://cgit.freedesktop.org/mesa/mesa/commit/?id=5ea43e65498505fc5d11d63668cda165146eb55b
Comment 14 Jon Turney 2013-06-28 10:26:49 UTC
(In reply to comment #13)
> Could you still reproduce this bug?

Appears to be fixed to me.
Comment 15 Andreas Boll 2013-06-28 12:46:08 UTC
(In reply to comment #14)
> (In reply to comment #13)
> > Could you still reproduce this bug?
> 
> Appears to be fixed to me.

Thanks for testing.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.