bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
* [PATCH] test-canonicalize: avoid a build failure
@ 2020-02-04  1:04 Pádraig Brady
  2020-02-04  2:15 ` Bruno Haible
  2020-02-11  2:27 ` Bruno Haible
  0 siblings, 2 replies; 3+ messages in thread
From: Pádraig Brady @ 2020-02-04  1:04 UTC (permalink / raw)
  To: bug-gnulib

* tests/test-canonicalize.c: Protect the inclusion of null-ptr.h
with the same guard as that used to protect usage of the null_ptr
function, so that one doesn't get a -Werror=unused build failure,
warning about the function being defined but unused.
* tests/test-canonicalize-lgpl.c: Likewise.
---
 ChangeLog                      | 9 +++++++++
 tests/test-canonicalize-lgpl.c | 5 ++++-
 tests/test-canonicalize.c      | 5 ++++-
 3 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 2a86791a8..5e524c56d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2020-02-04  Pádraig Brady  <P@draigBrady.com>
+
+	test-canonicalize: avoid a build failure
+	* tests/test-canonicalize.c: Protect the inclusion of null-ptr.h
+	with the same guard as that used to protect usage of the null_ptr
+	function, so that one doesn't get a -Werror=unused build failure,
+	warning about the function being defined but unused.
+	* tests/test-canonicalize-lgpl.c: Likewise.
+
 2020-02-02  Bruno Haible  <bruno@clisp.org>
 
 	Document the new modules list-c++, set-c++, oset-c++, map-c++, omap-c++.
diff --git a/tests/test-canonicalize-lgpl.c b/tests/test-canonicalize-lgpl.c
index fb49b2047..ff829814e 100644
--- a/tests/test-canonicalize-lgpl.c
+++ b/tests/test-canonicalize-lgpl.c
@@ -39,7 +39,10 @@ SIGNATURE_CHECK (canonicalize_file_name, char *, (const char *));
 #include "same-inode.h"
 #include "ignore-value.h"
 
-#include "null-ptr.h"
+#if GNULIB_defined_canonicalize_file_name
+# include "null-ptr.h"
+#endif
+
 #include "macros.h"
 
 #define BASE "t-can-lgpl.tmp"
diff --git a/tests/test-canonicalize.c b/tests/test-canonicalize.c
index 81580c53d..e0b623f19 100644
--- a/tests/test-canonicalize.c
+++ b/tests/test-canonicalize.c
@@ -36,7 +36,10 @@
 #include "same-inode.h"
 #include "ignore-value.h"
 
-#include "null-ptr.h"
+#if GNULIB_defined_canonicalize_file_name
+# include "null-ptr.h"
+#endif
+
 #include "macros.h"
 
 #define BASE "t-can.tmp"
-- 
2.24.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] test-canonicalize: avoid a build failure
  2020-02-04  1:04 [PATCH] test-canonicalize: avoid a build failure Pádraig Brady
@ 2020-02-04  2:15 ` Bruno Haible
  2020-02-11  2:27 ` Bruno Haible
  1 sibling, 0 replies; 3+ messages in thread
From: Bruno Haible @ 2020-02-04  2:15 UTC (permalink / raw)
  To: bug-gnulib

> +	* tests/test-canonicalize.c: Protect the inclusion of null-ptr.h
> +	with the same guard as that used to protect usage of the null_ptr
> +	function

The patch is OK.

However, I would appreciate if you don't call a warning a "build failure"
or an "error".

Reasons:

  1. Adding -Werror to the CFLAGS is under the responsibility of the package
     and/or person who builds the package. Gnulib does not add -Werror.

  2. For this reason, someone who builds the package has a much easier
     fix/workaround -- namely, just remove '-Werror' in one or two places in
     the Makefiles -- than when there is e.g. a syntax error or a link error.

  3. Gnulib does not and can not guarantee warning-free compilation, because
     there are so many platforms, so many compiler warning options, and
     sometimes even false positives among the warnings.
     All that Gnulib guarantees is an error-free compilation *without* -Werror.

Bruno



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] test-canonicalize: avoid a build failure
  2020-02-04  1:04 [PATCH] test-canonicalize: avoid a build failure Pádraig Brady
  2020-02-04  2:15 ` Bruno Haible
@ 2020-02-11  2:27 ` Bruno Haible
  1 sibling, 0 replies; 3+ messages in thread
From: Bruno Haible @ 2020-02-11  2:27 UTC (permalink / raw)
  To: bug-gnulib

> * tests/test-canonicalize.c: Protect the inclusion of null-ptr.h
> with the same guard as that used to protect usage of the null_ptr
> function

The same thing is needed in test-ptsname_r.c:


2020-02-10  Bruno Haible  <bruno@clisp.org>

	ptsname_r-tests: Avoid unused function warning.
	* tests/test-ptsname_r.c: Don't include null-ptr.h if we don't need it.

diff --git a/tests/test-ptsname_r.c b/tests/test-ptsname_r.c
index 24be52f..381e3da 100644
--- a/tests/test-ptsname_r.c
+++ b/tests/test-ptsname_r.c
@@ -36,7 +36,10 @@ SIGNATURE_CHECK (ptsname_r, int, (int, char *, size_t));
 
 #include "same-inode.h"
 
-#include "null-ptr.h"
+#if GNULIB_defined_ptsname_r
+# include "null-ptr.h"
+#endif
+
 #include "macros.h"
 
 /* Compare two slave names.



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-02-11  2:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-04  1:04 [PATCH] test-canonicalize: avoid a build failure Pádraig Brady
2020-02-04  2:15 ` Bruno Haible
2020-02-11  2:27 ` Bruno Haible

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).