This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Replace __attribute((__warning__())) by __attribute__((deprecated()))


On Thu, 2015-11-05 at 22:19 +0000, Olivier MARTIN wrote:
> On 05.11.2015 21:59, Eric Blake wrote:
> > On 11/05/2015 02:51 PM, Olivier Martin wrote:
> >> Clang raises the warning message:
> >> warning: unknown attribute '__warning__' ignored 
> >> [-Wunknown-attributes]
> >> 
> >> Signed-off-by: Olivier Martin <olivier@labapart.com>
> >> ---
> >>  newlib/libc/include/stdlib.h | 4 ++--
> >>  1 file changed, 2 insertions(+), 2 deletions(-)
> >> 
> >> diff --git a/newlib/libc/include/stdlib.h 
> >> b/newlib/libc/include/stdlib.h
> >> index 51a6f0a..fe8a598 100644
> >> --- a/newlib/libc/include/stdlib.h
> >> +++ b/newlib/libc/include/stdlib.h
> >> @@ -112,14 +112,14 @@ int	_EXFUN(mkostemp,(char *, int));
> >>  int	_EXFUN(mkostemps,(char *, int, int));
> >>  int	_EXFUN(mkstemp,(char *));
> >>  int	_EXFUN(mkstemps,(char *, int));
> >> -char *	_EXFUN(mktemp,(char *) _ATTRIBUTE ((__warning__ ("the use of 
> >> `mktemp' is dangerous; use `mkstemp' instead"))));
> >> +char *	_EXFUN(mktemp,(char *) _ATTRIBUTE ((deprecated("the use of 
> >> `mktemp' is dangerous; use `mkstemp' instead"))));
> > 
> > Please spell it __deprecated__, since this is in a header, and we can't
> > stomp on the user's namespace.
> 
> Thanks Eric for the comment but actually the GCC and Clang function 
> attribute is 'deprecated' and not '__deprecated__'

https://gcc.gnu.org/onlinedocs/gcc/Attribute-Syntax.html#Attribute-Syntax

"You may optionally specify attribute names with â__â preceding and
following the name. This allows you to use them in header files without
being concerned about a possible macro of the same name. For example,
you may use the attribute name __noreturn__ instead of noreturn."

As for Clang, that very page says the following wrt __has_attribute:

"The attribute name can also be specified with a preceding and following
__ (double underscore) to avoid interference from a macro with the same
name. For instance, __always_inline__ can be used instead of
always_inline."

Certainly, Clang must support that syntax for __attribute__ too.

-- 
Yaakov Selkowitz
Associate Software Engineer, ARM
Red Hat, Inc.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]