diff mbox series

ATTRIBUTE_NONSTRING

Message ID 20180427014126.GN18288@bubble.grove.modra.org
State New
Headers show
Series ATTRIBUTE_NONSTRING | expand

Commit Message

Alan Modra April 27, 2018, 1:41 a.m. UTC
This patch adds ATTRIBUTE_NONSTRING, which will be used to curb
-Wstringop-truncation warnings in binutils.  OK to apply?

	* ansidecl.h (ATTRIBUTE_NONSTRING): Define.

Comments

Hans-Peter Nilsson April 27, 2018, 10:24 p.m. UTC | #1
On Fri, 27 Apr 2018, Alan Modra wrote:

> This patch adds ATTRIBUTE_NONSTRING, which will be used to curb
> -Wstringop-truncation warnings in binutils.  OK to apply?
>
> 	* ansidecl.h (ATTRIBUTE_NONSTRING): Define.
>
> diff --git a/include/ansidecl.h b/include/ansidecl.h
> index c11daff..ec5f34d 100644
> --- a/include/ansidecl.h
> +++ b/include/ansidecl.h
> @@ -283,6 +283,15 @@ So instead we use the macro below and test it against specific values.  */
>  # endif /* GNUC >= 4.9 */
>  #endif /* ATTRIBUTE_NO_SANITIZE_UNDEFINED */
>
> +/* Attribute 'nonstring' was valid as of gcc 8.  */
> +#ifndef ATTRIBUTE_NONSTRING
> +# if GCC_VERSION >= 8000
> +#  define ATTRIBUTE_NONSTRING __attribute__ ((nonstring))

Uglify nonstring (as __nonstring__)?

brgds, H-P
Alan Modra April 28, 2018, 6:25 a.m. UTC | #2
On Fri, Apr 27, 2018 at 06:24:28PM -0400, Hans-Peter Nilsson wrote:
> On Fri, 27 Apr 2018, Alan Modra wrote:
> 
> > This patch adds ATTRIBUTE_NONSTRING, which will be used to curb
> > -Wstringop-truncation warnings in binutils.  OK to apply?
> >
> > 	* ansidecl.h (ATTRIBUTE_NONSTRING): Define.
> >
> > diff --git a/include/ansidecl.h b/include/ansidecl.h
> > index c11daff..ec5f34d 100644
> > --- a/include/ansidecl.h
> > +++ b/include/ansidecl.h
> > @@ -283,6 +283,15 @@ So instead we use the macro below and test it against specific values.  */
> >  # endif /* GNUC >= 4.9 */
> >  #endif /* ATTRIBUTE_NO_SANITIZE_UNDEFINED */
> >
> > +/* Attribute 'nonstring' was valid as of gcc 8.  */
> > +#ifndef ATTRIBUTE_NONSTRING
> > +# if GCC_VERSION >= 8000
> > +#  define ATTRIBUTE_NONSTRING __attribute__ ((nonstring))
> 
> Uglify nonstring (as __nonstring__)?

Yes, that would be better.  I copied the immediately preceding
ATTRIBUTE_NO_SANITIZE_UNDEFINED without thinking.
Pedro Alves April 30, 2018, 6:15 p.m. UTC | #3
On 04/27/2018 02:41 AM, Alan Modra wrote:
> This patch adds ATTRIBUTE_NONSTRING, which will be used to curb
> -Wstringop-truncation warnings in binutils.  OK to apply?
> 
> 	* ansidecl.h (ATTRIBUTE_NONSTRING): Define.

+1, FWIW.

Thanks,
Pedro Alves
Jeff Law May 1, 2018, 5:28 p.m. UTC | #4
On 04/28/2018 12:25 AM, Alan Modra wrote:
> On Fri, Apr 27, 2018 at 06:24:28PM -0400, Hans-Peter Nilsson wrote:
>> On Fri, 27 Apr 2018, Alan Modra wrote:
>>
>>> This patch adds ATTRIBUTE_NONSTRING, which will be used to curb
>>> -Wstringop-truncation warnings in binutils.  OK to apply?
>>>
>>> 	* ansidecl.h (ATTRIBUTE_NONSTRING): Define.
>>>
>>> diff --git a/include/ansidecl.h b/include/ansidecl.h
>>> index c11daff..ec5f34d 100644
>>> --- a/include/ansidecl.h
>>> +++ b/include/ansidecl.h
>>> @@ -283,6 +283,15 @@ So instead we use the macro below and test it against specific values.  */
>>>  # endif /* GNUC >= 4.9 */
>>>  #endif /* ATTRIBUTE_NO_SANITIZE_UNDEFINED */
>>>
>>> +/* Attribute 'nonstring' was valid as of gcc 8.  */
>>> +#ifndef ATTRIBUTE_NONSTRING
>>> +# if GCC_VERSION >= 8000
>>> +#  define ATTRIBUTE_NONSTRING __attribute__ ((nonstring))
>>
>> Uglify nonstring (as __nonstring__)?
> 
> Yes, that would be better.  I copied the immediately preceding
> ATTRIBUTE_NO_SANITIZE_UNDEFINED without thinking.
OK with uglification.

jeff
diff mbox series

Patch

diff --git a/include/ansidecl.h b/include/ansidecl.h
index c11daff..ec5f34d 100644
--- a/include/ansidecl.h
+++ b/include/ansidecl.h
@@ -283,6 +283,15 @@  So instead we use the macro below and test it against specific values.  */
 # endif /* GNUC >= 4.9 */
 #endif /* ATTRIBUTE_NO_SANITIZE_UNDEFINED */
 
+/* Attribute 'nonstring' was valid as of gcc 8.  */
+#ifndef ATTRIBUTE_NONSTRING
+# if GCC_VERSION >= 8000
+#  define ATTRIBUTE_NONSTRING __attribute__ ((nonstring))
+# else
+#  define ATTRIBUTE_NONSTRING
+# endif
+#endif
+
 /* We use __extension__ in some places to suppress -pedantic warnings
    about GCC extensions.  This feature didn't work properly before
    gcc 2.8.  */