bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
* explicit_bzero-tests: pacify -Wmissing-declarations
@ 2020-05-25  7:28 Bruno Haible
  2020-05-28 22:11 ` Paul Eggert
  0 siblings, 1 reply; 4+ messages in thread
From: Bruno Haible @ 2020-05-25  7:28 UTC (permalink / raw)
  To: bug-gnulib

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



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

* Re: explicit_bzero-tests: pacify -Wmissing-declarations
  2020-05-25  7:28 explicit_bzero-tests: pacify -Wmissing-declarations Bruno Haible
@ 2020-05-28 22:11 ` Paul Eggert
  2020-05-28 22:24   ` Bruno Haible
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Eggert @ 2020-05-28 22:11 UTC (permalink / raw)
  To: Bruno Haible; +Cc: bug-gnulib

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.


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

* Re: explicit_bzero-tests: pacify -Wmissing-declarations
  2020-05-28 22:11 ` Paul Eggert
@ 2020-05-28 22:24   ` Bruno Haible
  2020-05-28 23:04     ` Paul Eggert
  0 siblings, 1 reply; 4+ messages in thread
From: Bruno Haible @ 2020-05-28 22:24 UTC (permalink / raw)
  To: Paul Eggert; +Cc: bug-gnulib

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



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

* Re: explicit_bzero-tests: pacify -Wmissing-declarations
  2020-05-28 22:24   ` Bruno Haible
@ 2020-05-28 23:04     ` Paul Eggert
  0 siblings, 0 replies; 4+ messages in thread
From: Paul Eggert @ 2020-05-28 23:04 UTC (permalink / raw)
  To: Bruno Haible; +Cc: bug-gnulib

[-- Attachment #1: Type: text/plain, Size: 161 bytes --]

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.

[-- Attachment #2: 0001-explicit_bzero-tests-improve-Wmissing-declarations-p.patch --]
[-- Type: text/x-patch, Size: 1486 bytes --]

From ef7cc081f5c0d1b71f60f71d5e0f4a9ddf76bb28 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
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  <eggert@cs.ucla.edu>
+
+	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  <bruno@clisp.org>
 
 	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


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

end of thread, other threads:[~2020-05-28 23:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-25  7:28 explicit_bzero-tests: pacify -Wmissing-declarations Bruno Haible
2020-05-28 22:11 ` Paul Eggert
2020-05-28 22:24   ` Bruno Haible
2020-05-28 23:04     ` Paul Eggert

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).