Re: explicit_bzero-tests: pacify -Wmissing-declarations

2020-05-28 Thread Paul Eggert
On 5/28/20 3:24 PM, Bruno Haible wrote:
> Agreed. Please go ahead. I'll deal with possible xlc/Sun cc/MSVC build 
> failures
> then.

OK, I installed the attached.
>From ef7cc081f5c0d1b71f60f71d5e0f4a9ddf76bb28 Mon Sep 17 00:00:00 2001
From: Paul Eggert 
Date: Thu, 28 May 2020 16:02:32 -0700
Subject: [PATCH] explicit_bzero-tests: improve -Wmissing-declarations
 pacification

* tests/test-explicit_bzero.c: Now noinline.
Suggested by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2020-05/msg00300.html
---
 ChangeLog   | 7 +++
 tests/test-explicit_bzero.c | 2 +-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 602923d3f..0a62f572d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2020-05-28  Paul Eggert  
+
+	explicit_bzero-tests: improve -Wmissing-declarations pacification
+	* tests/test-explicit_bzero.c: Now noinline.
+	Suggested by Bruno Haible in:
+	https://lists.gnu.org/r/bug-gnulib/2020-05/msg00300.html
+
 2020-05-28  Bruno Haible  
 
 	Fix build errors due to read-file changes (regression from 2020-05-27).
diff --git a/tests/test-explicit_bzero.c b/tests/test-explicit_bzero.c
index 385fd12a9..b5698f898 100644
--- a/tests/test-explicit_bzero.c
+++ b/tests/test-explicit_bzero.c
@@ -128,7 +128,7 @@ test_heap (void)
  2. Verify that the memory has been erased.
Implement them in the same function, so that they access the same memory
range on the stack.  */
-static int
+static int _GL_ATTRIBUTE_NOINLINE
 do_secret_stuff (volatile int pass)
 {
   char stackbuf[SECRET_SIZE];
-- 
2.26.1



Re: explicit_bzero-tests: pacify -Wmissing-declarations

2020-05-28 Thread Bruno Haible
Paul Eggert wrote:
> > Is it possible to portably mark 'do_secret_stuff' as not-inline?
> 
> We can use _GL_ATTRIBUTE_NOINLINE. That should be good enough for any
> GCC-compatible compiler. We don't need to worry much about the other 
> compilers;
> most of them will work anyway, and if any don't we could deal with them
> individually I suppose.

Agreed. Please go ahead. I'll deal with possible xlc/Sun cc/MSVC build failures
then.

Bruno




Re: explicit_bzero-tests: pacify -Wmissing-declarations

2020-05-28 Thread Paul Eggert
On 5/25/20 12:28 AM, Bruno Haible wrote:
> Is it possible to portably mark 'do_secret_stuff' as not-inline?

We can use _GL_ATTRIBUTE_NOINLINE. That should be good enough for any
GCC-compatible compiler. We don't need to worry much about the other compilers;
most of them will work anyway, and if any don't we could deal with them
individually I suppose.



explicit_bzero-tests: pacify -Wmissing-declarations

2020-05-25 Thread Bruno Haible
Hi Paul,

> * tests/test-explicit_bzero.c (do_secret_stuff, test_stack):
>   Now static.

It's OK to mark 'test_stack' static. But for 'do_secret_stuff', it invites the
compiler to inline the function and then to do different optimizations for
pass == 1 and pass == 2, which will break the test.

Is it possible to portably mark 'do_secret_stuff' as not-inline? If not, then
I would prefer to revert the change and instead add a function declaration, to
avoid the warning.

Bruno