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

Olivier MARTIN olivier@labapart.com
Thu Nov 5 23:11:00 GMT 2015


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__'
See:
- 
https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#Common-Function-Attributes
- 
http://clang.llvm.org/docs/LanguageExtensions.html#messages-on-deprecated-and-unavailable-attributes

One other solution would be to introduce a new macro such as 
_DEPRECATED.

--
Olivier MARTIN
Lab A Part - http://labapart.com



More information about the Newlib mailing list