[Piglit] [PATCH 04/29] util: Add ifdef quards around redefined macros

Paul Berry stereotype441 at gmail.com
Tue May 22 11:30:36 PDT 2012


I'm a little concerned about this.  The idea of piglit-dispatch.h is that
it implements the same interface as the gl and egl headers, but in an
implementation-agnostic way so that we can choose at run time whether to
dispatch a test through GL or EGL.  (I haven't implemented EGL support in
piglit-dispatch yet though--I was waiting until Chad had made more progress
with Waffle).  So piglit source files shouldn't be including both the
standard gl/egl headers and piglit-dispatch.h.  It should be including just
piglit-dispatch.h.

Perhaps it would be better to modify piglit-dispatch.h to do something like
this:

#ifdef GLAPIENTRY
#error "when including piglit-dispatch.h, don't also include gl.h"
#endif

Along with a comment explaining the situation in more detail...

On 21 May 2012 11:08, Pauli Nieminen <pauli.nieminen at linux.intel.com> wrote:

> APIENTRY and GLAPIENTRY are defined in gl or egl headers. To avoid
> compiler warning guard the defines with ifdefs.
>
> Signed-off-by: Pauli Nieminen <pauli.nieminen at linux.intel.com>
> ---
>  tests/util/piglit-dispatch.h |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/tests/util/piglit-dispatch.h b/tests/util/piglit-dispatch.h
> index ef2687a..002b8c0 100644
> --- a/tests/util/piglit-dispatch.h
> +++ b/tests/util/piglit-dispatch.h
> @@ -63,8 +63,12 @@ extern "C" {
>  #ifndef _WIN32
>
>  /* APIENTRY and GLAPIENTRY are not used on Linux or Mac. */
> +#ifndef APIENTRY
>  #define APIENTRY
> +#endif
> +#ifndef GLAPIENTRY
>  #define GLAPIENTRY
> +#endif
>
>  #else
>
> --
> 1.7.5.4
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20120522/22672813/attachment.html>


More information about the Piglit mailing list