From c768719f4c8e1b1796a8a0e7947486e6eb411417 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Mon, 5 Feb 2024 15:02:21 +0100 Subject: [PATCH] snippet/warn-on-use: Add comment. * lib/warn-on-use.h: Document a restriction of _GL_WARN_ON_USE. --- ChangeLog | 5 +++++ lib/warn-on-use.h | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/ChangeLog b/ChangeLog index 5246105f57..88f92c9609 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2024-02-05 Bruno Haible + + snippet/warn-on-use: Add comment. + * lib/warn-on-use.h: Document a restriction of _GL_WARN_ON_USE. + 2024-02-03 Paul Eggert xalloc-oversized: omit unnecessary cast diff --git a/lib/warn-on-use.h b/lib/warn-on-use.h index 8f4d40dcbe..701013a07f 100644 --- a/lib/warn-on-use.h +++ b/lib/warn-on-use.h @@ -32,6 +32,10 @@ _GL_WARN_ON_USE_ATTRIBUTE is for functions with 'static' or 'inline' linkage. + _GL_WARN_ON_USE should not be used more than once for a given function + in a given compilation unit (because this may generate a warning even + if the function is never called). + However, one of the reasons that a function is a portability trap is if it has the wrong signature. Declaring FUNCTION with a different signature in C is a compilation error, so this macro must use the -- 2.39.5