[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] chdir-long: avoid -Werror=unused-variable with -DNDEBUG

From: Norihiro Tanaka
Subject: [PATCH] chdir-long: avoid -Werror=unused-variable with -DNDEBUG
Date: Sat, 20 Dec 2014 14:15:48 +0900

If we set -DNDEBUG in CPPFLAGS, fail to build close_fail.c with
-Werror=unused-variable, as close_fail is used only to do assertion.

This patch avoids declaration of close_fail if defined NDEBUG.

$ LC_ALL=C make
make  all-recursive
make[1]: Entering directory '/usr/src/grep-2.21'
Making all in po
make[2]: Entering directory '/usr/src/grep-2.21/po'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/usr/src/grep-2.21/po'
Making all in lib
make[2]: Entering directory '/usr/src/grep-2.21/lib'
make  all-am
make[3]: Entering directory '/usr/src/grep-2.21/lib'
  CC       chdir-long.o
chdir-long.c: In function 'cdb_free':
chdir-long.c:62:12: error: unused variable 'close_fail' 
       bool close_fail = close (cdb->fd);
cc1: all warnings being treated as errors
Makefile:1587: recipe for target 'chdir-long.o' failed
make[3]: *** [chdir-long.o] Error 1
make[3]: Leaving directory '/usr/src/grep-2.21/lib'
Makefile:1362: recipe for target 'all' failed
make[2]: *** [all] Error 2
make[2]: Leaving directory '/usr/src/grep-2.21/lib'
Makefile:1254: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/usr/src/grep-2.21'
Makefile:1195: recipe for target 'all' failed
make: *** [all] Error 2

Attachment: 0001-chdir-long-avoid-Werror-unused-variable-with-DNDEBUG.patch
Description: Text document

reply via email to

[Prev in Thread] Current Thread [Next in Thread]