[Mesa-dev] [PATCH mesa 08/16] amd/addrlib: fix DEBUG guards

Marek Olšák maraeo at gmail.com
Fri Nov 24 18:24:58 UTC 2017


I'd like to keep the code as-is, because addrlib is an external project.

However, since you Cc'd addrlib developers, they can apply the changes
to addrlib (if they want) and we can get the changes when we update
addrlib in Mesa.

Marek

On Fri, Nov 24, 2017 at 7:07 PM, Eric Engestrom
<eric.engestrom at imgtec.com> wrote:
> Use the normal `#ifdef` style used by the rest of Mesa, instead of
> sometimes locally defining DEBUG on non-debug builds and then relying on
> the precompiler converting #undef'ed macros to 0 when checking.
>
> Signed-off-by: Eric Engestrom <eric.engestrom at imgtec.com>
> ---
> I would argue this block should go, as all it does is enable debug
> prints on release builds with asserts. It doesn't make sense to me that
> the fact asserts are enabled is relevant to this.
> ---
>  src/amd/addrlib/core/addrcommon.h    | 8 +++-----
>  src/amd/addrlib/core/addrobject.cpp  | 2 +-
>  src/amd/addrlib/gfx9/gfx9addrlib.cpp | 2 +-
>  3 files changed, 5 insertions(+), 7 deletions(-)
>
> diff --git a/src/amd/addrlib/core/addrcommon.h b/src/amd/addrlib/core/addrcommon.h
> index 80ea0eb247aa48dcb176..1a7473a4d33c1271f077 100644
> --- a/src/amd/addrlib/core/addrcommon.h
> +++ b/src/amd/addrlib/core/addrcommon.h
> @@ -41,9 +41,7 @@
>  #include <assert.h>
>
>  #if !defined(DEBUG)
> -#ifdef NDEBUG
> -#define DEBUG 0
> -#else
> +#ifndef NDEBUG
>  #define DEBUG 1
>  #endif
>  #endif
> @@ -51,7 +49,7 @@
>  ////////////////////////////////////////////////////////////////////////////////////////////////////
>  // Platform specific debug break defines
>  ////////////////////////////////////////////////////////////////////////////////////////////////////
> -#if DEBUG
> +#ifdef DEBUG
>      #if defined(__GNUC__)
>          #define ADDR_DBG_BREAK()    assert(false)
>      #elif defined(__APPLE__)
> @@ -82,7 +80,7 @@
>  ////////////////////////////////////////////////////////////////////////////////////////////////////
>  // Debug print macro from legacy address library
>  ////////////////////////////////////////////////////////////////////////////////////////////////////
> -#if DEBUG
> +#ifdef DEBUG
>
>  #define ADDR_PRNT(a)    Object::DebugPrint a
>
> diff --git a/src/amd/addrlib/core/addrobject.cpp b/src/amd/addrlib/core/addrobject.cpp
> index 452feb5fac0fbd6404bc..04c343d3da1c1d62b334 100644
> --- a/src/amd/addrlib/core/addrobject.cpp
> +++ b/src/amd/addrlib/core/addrobject.cpp
> @@ -213,7 +213,7 @@ VOID Object::DebugPrint(
>      ...
>      ) const
>  {
> -#if DEBUG
> +#ifdef DEBUG
>      if (m_client.callbacks.debugPrint != NULL)
>      {
>          ADDR_DEBUGPRINT_INPUT debugPrintInput = {0};
> diff --git a/src/amd/addrlib/gfx9/gfx9addrlib.cpp b/src/amd/addrlib/gfx9/gfx9addrlib.cpp
> index 1d42cbfc8a3a50c84343..48de5016807944043fdf 100644
> --- a/src/amd/addrlib/gfx9/gfx9addrlib.cpp
> +++ b/src/amd/addrlib/gfx9/gfx9addrlib.cpp
> @@ -3718,7 +3718,7 @@ ADDR_E_RETURNCODE Gfx9Lib::HwlGetPreferredSurfaceSetting(
>                          returnCode = ADDR_NOTSUPPORTED;
>                      }
>
> -#if DEBUG
> +#ifdef DEBUG
>                      // Post sanity check, at least AddrLib should accept the output generated by its own
>                      if (pOut->swizzleMode != ADDR_SW_LINEAR)
>                      {
> --
> Cheers,
>   Eric
>


More information about the mesa-dev mailing list