fix build when --enable-checking is false

Message ID 20210519064857.3466017-1-eschwartz@archlinux.org
State New
Headers show
Series
  • fix build when --enable-checking is false
Related show

Commit Message

Libor Bukata via Binutils May 19, 2021, 6:48 a.m.
The ENABLE_CHECKING macro is only ever defined in confdefs.h when
enabled, and otherwise gets inconsistently:

- explicitly checked in some files where it is used, to define it to 0
  if it isn't yet defined
- or at the use site, checked via a preprocessor #if check rather than a
  compiler if() check.

In commit ebb17864920d1b15f3c392ce5cd22ddee169e825 one use of this macro
got added which violates this expectation.

The resulting build error is generally not noticeable since
bfd/development.sh makes the build a development build by default.
---
 binutils/dwarf.c | 4 ++++
 1 file changed, 4 insertions(+)

-- 
2.31.1

Comments

Libor Bukata via Binutils May 19, 2021, 11:09 a.m. | #1
Hi Eli,

> +#ifndef ENABLE_CHECKING

> +#define ENABLE_CHECKING 0

> +#endif


Approved and applied.  Thanks for the patch.

Cheers
   Nick
Libor Bukata via Binutils May 19, 2021, 1:11 p.m. | #2
On Wed, May 19, 2021 at 02:48:57AM -0400, Eli Schwartz via Binutils wrote:
> diff --git a/binutils/dwarf.c b/binutils/dwarf.c

> index 6dd98789e28..cfc1436df64 100644

> --- a/binutils/dwarf.c

> +++ b/binutils/dwarf.c

> @@ -41,6 +41,10 @@

>  #define CHAR_BIT 8

>  #endif

>  

> +#ifndef ENABLE_CHECKING

> +#define ENABLE_CHECKING 0

> +#endif

> +

>  #undef MAX

>  #undef MIN

>  #define MAX(a, b) ((a) > (b) ? (a) : (b))


Thanks for fixing this.

-- 
Alan Modra
Australia Development Lab, IBM

Patch

diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index 6dd98789e28..cfc1436df64 100644
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -41,6 +41,10 @@ 
 #define CHAR_BIT 8
 #endif
 
+#ifndef ENABLE_CHECKING
+#define ENABLE_CHECKING 0
+#endif
+
 #undef MAX
 #undef MIN
 #define MAX(a, b) ((a) > (b) ? (a) : (b))