Re: Apply function attributes (e.g., [[gnu::access()]]) to pointees too

2024-07-12 Thread Alejandro Colomar via Gcc
Hi Martin, On Thu, Jul 11, 2024 at 06:34:04PM GMT, Alejandro Colomar wrote: > Hi Martin, David, > > On Thu, Jul 11, 2024 at 06:08:38PM GMT, David Brown wrote: > > On 11/07/2024 11:58, Martin Uecker via Gcc wrote: > > > > [[gnu::access(read_write, 1)]] > > > > [[gnu::access(read_on

Re: Apply function attributes (e.g., [[gnu::access()]]) to pointees too

2024-07-11 Thread Alejandro Colomar via Gcc
Hi Martin, David, On Thu, Jul 11, 2024 at 06:08:38PM GMT, David Brown wrote: > On 11/07/2024 11:58, Martin Uecker via Gcc wrote: > > > [[gnu::access(read_write, 1)]] > > > [[gnu::access(read_only, 2)]] > > > [[gnu::nonnull(1, 2)]] > > > [[gnu::null_terminated_string_arg(2)]] > > > char *

Re: Apply function attributes (e.g., [[gnu::access()]]) to pointees too

2024-07-11 Thread David Brown via Gcc
On 11/07/2024 11:58, Martin Uecker via Gcc wrote: Am Donnerstag, dem 11.07.2024 um 11:35 +0200 schrieb Alejandro Colomar via Gcc: Hi, I was wondering how we could extend attributes such as gnu::access() to apply it to pointees too. Currently, there's no way to specify the access mode of a poi

Re: Apply function attributes (e.g., [[gnu::access()]]) to pointees too

2024-07-11 Thread Martin Uecker via Gcc
Am Donnerstag, dem 11.07.2024 um 11:35 +0200 schrieb Alejandro Colomar via Gcc: > Hi, > > I was wondering how we could extend attributes such as gnu::access() to > apply it to pointees too. Currently, there's no way to specify the > access mode of a pointee. > > Let's take for example strsep(3

Re: [C2x] Disallow function attributes after function identifier

2022-06-13 Thread Jonathan Wakely via Gcc
On Sat, 11 Jun 2022 at 21:17, Alejandro Colomar wrote: > P.S.: Please consider deprecating 'auto' some day. It would be nice to > see C++'s auto in ISO C some day, even if it's 2060. I'm not entirely > happy doing `#define auto __auto_type` (of course it's UB, but it's nice) ;) There's a proposa

Re: [C2x] Disallow function attributes after function identifier

2022-06-11 Thread Alejandro Colomar via Gcc
On 6/11/22 14:08, Gabriel Ravier wrote: > Do we want to add a completely unnecessary feature, just for symmetry with C++, even if it poses a danger of breaking (both human and script) readability of function declarations/definitions, especially when hidden in macros? I actually don't get th

Re: [C2x] Disallow function attributes after function identifier

2022-06-11 Thread Jonathan Wakely via Gcc
On Sat, 11 Jun 2022, 10:00 Alejandro Colomar, wrote: > Hi Jonathan, > > On 6/11/22 00:47, Jonathan Wakely wrote: > > Well, I'd argue the same reasons to remove it from C++. Don't know > how > > useful that feature is for C++, though. I bet not much, but am not > an > > expert in the

Re: [C2x] Disallow function attributes after function identifier

2022-06-11 Thread Gabriel Ravier via Gcc
On 6/11/22 11:03, Alejandro Colomar via Gcc wrote: > Hi Jonathan, > > On 6/11/22 00:47, Jonathan Wakely wrote: >> Well, I'd argue the same reasons to remove it from C++.  Don't know how >> useful that feature is for C++, though.  I bet not much, but am not an >> expert in the langua

Re: [C2x] Disallow function attributes after function identifier

2022-06-11 Thread Alejandro Colomar via Gcc
Hi Jonathan, On 6/11/22 00:47, Jonathan Wakely wrote: Well, I'd argue the same reasons to remove it from C++.  Don't know how useful that feature is for C++, though.  I bet not much, but am not an expert in the language. It's used in libstdc++ because I couldn't get an attribute to

Re: [C2x] Disallow function attributes after function identifier

2022-06-10 Thread Jonathan Wakely via Gcc
On Fri, 10 Jun 2022, 22:29 Alejandro Colomar via Gcc, wrote: > [I reordered some of your answers, to better answer] > > Hi Jakub, > > On 6/10/22 23:16, Jakub Jelinek wrote: > > On Fri, Jun 10, 2022 at 10:40:15PM +0200, Alejandro Colomar via Gcc > wrote: > >> So, could you please drop that from C2

Re: [C2x] Disallow function attributes after function identifier

2022-06-10 Thread Alejandro Colomar via Gcc
Hi Joseph, On 6/10/22 23:09, Joseph Myers wrote: P.S.: The latest draft that I know of is N2731. I guess there are newer ones. Could you please name the latest one? It's N2912 (June 8 version - the version originally published on June 7 had various problems; there are still some issues, espec

Re: [C2x] Disallow function attributes after function identifier

2022-06-10 Thread Alejandro Colomar via Gcc
[I reordered some of your answers, to better answer] Hi Jakub, On 6/10/22 23:16, Jakub Jelinek wrote: On Fri, Jun 10, 2022 at 10:40:15PM +0200, Alejandro Colomar via Gcc wrote: So, could you please drop that from C2x? No! [[attr0]] void foo (void), bar (void); appertains to both declara

Re: [C2x] Disallow function attributes after function identifier

2022-06-10 Thread Jakub Jelinek via Gcc
On Fri, Jun 10, 2022 at 10:40:15PM +0200, Alejandro Colomar via Gcc wrote: > So, could you please drop that from C2x? No! For one it diverges from C++, but also it means something different at the different locations. [[attr0]] void foo (void), bar (void); appertains to both declarations, while v

Re: [C2x] Disallow function attributes after function identifier

2022-06-10 Thread Joseph Myers
On Fri, 10 Jun 2022, Alejandro Colomar via Gcc wrote: > I'd like to suggest a change in C2x regarding attributes. The attribute syntax is supposed to accept attributes in exactly the places they are accepted in C++ (and appertaining to the same entity, for each such place), for constructs prese

[C2x] Disallow function attributes after function identifier

2022-06-10 Thread Alejandro Colomar via Gcc
Hi, Joseph! I'd like to suggest a change in C2x regarding attributes. Right now, the draft allows function attributes to go right at the beginning of a function prototype, or just before the opening parenthesis: [[attr]] type f(params); type f [[attr]](params); I'd argue against

Re: GCC Common-Function-Attributes/const

2018-11-28 Thread Richard Biener
s used in a > > [[gnu::const(...)]] annotated function each call to this function is > > considered an observable effect to the function. > > > > > > *[[gnu::const([():],...)]]* > > This is an extension to the old [[gnu::const]] attribute. But: When some of > &g

Re: GCC Common-Function-Attributes/const

2018-11-27 Thread Martin Sebor
[CC gcc list and Sandra] Thanks for the suggestions. I agree that the documentation should make it possible to answer at least the basic questions on your list. We'll see about incorporating them. In general, attributes that affect optimization are implemented at a level where higher-level dis

Re: GCC Common-Function-Attributes/const

2018-11-26 Thread Martin Sebor
pend on a function/expression, which calls the annotated function. *[[gnu::calls([():],...)]]* This function attributes tells the compiler, that the given expression might be called inside. This makes older values recieved from [[gnu::const(...)]] functions (which depend on (parts of) the expression)

GCC Common-Function-Attributes/const

2018-11-26 Thread cmdLP #CODE
tated function. *[[gnu::calls([():],...)]]* This function attributes tells the compiler, that the given expression might be called inside. This makes older values recieved from [[gnu::const(...)]] functions (which depend on (parts of) the expression) dirty when called. The attribute is inherited to p

[DOC, RFC] Partial integration of sections: 3.18.54 x86 Options and 6.31.32 x86 Function Attributes

2016-07-18 Thread Martin Liška
t (options)' accepts all options as mentioned in [3], expect ... If it's acceptable opinion, I can prepare a patch. Thanks, Martin [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71652#c4 [2] https://gcc.gnu.org/onlinedocs/gcc/x86-Function-Attributes.html#x86-Function-Attributes [3]

Re: function attributes

2013-10-16 Thread Nagaraju Mekala
Hi Umesh/Ian, I followed the steps and it has generated the required branch instruction. Thankyou so much for the links and steps. On Wed, Oct 16, 2013 at 4:00 PM, Umesh Kalappa wrote: > Here you go , > > a)define new field in the struct "CUMULATIVE_ARGS" says as int long_call; > > b)set

Re: function attributes

2013-10-16 Thread Umesh Kalappa
Here you go , a)define new field in the struct "CUMULATIVE_ARGS" says as int long_call; b)set the field long_call to known vlaue@ init_cumulative_args() . c)In the TARGET_FUNCTION_ARG hook The last time this MACRO is called, it is called with MODE == VOIDmode, and its result is

Re: function attributes

2013-10-16 Thread Nagaraju Mekala
Yes.. I still had no luck. Do you have any thoughts on this?? On Wed, Oct 16, 2013 at 2:05 PM, Umesh Kalappa wrote: > You still stuck with this issue ??? > > ~Umesh > > On Tue, Oct 15, 2013 at 9:08 PM, Ian Lance Taylor wrote: >> On Tue, Oct 15, 2013 at 8:04 AM, Nagaraju Mekala >> wrote: >>> H

Re: function attributes

2013-10-16 Thread Umesh Kalappa
You still stuck with this issue ??? ~Umesh On Tue, Oct 15, 2013 at 9:08 PM, Ian Lance Taylor wrote: > On Tue, Oct 15, 2013 at 8:04 AM, Nagaraju Mekala > wrote: >> Hi Ian, >> >> Thanks for the reply. >> >> On Fri, Oct 11, 2013 at 10:31 PM, Ian Lance Taylor wrote: >>> On Fri, Oct 11, 2013 at

Re: function attributes

2013-10-15 Thread Ian Lance Taylor
On Tue, Oct 15, 2013 at 8:04 AM, Nagaraju Mekala wrote: > Hi Ian, > > Thanks for the reply. > > On Fri, Oct 11, 2013 at 10:31 PM, Ian Lance Taylor wrote: >> On Fri, Oct 11, 2013 at 9:20 AM, Nagaraju Mekala >> wrote: >>> >>> I observed that in rs6000 port longcall is implemented by using >>>

Re: function attributes

2013-10-15 Thread Nagaraju Mekala
Hi Ian, Thanks for the reply. On Fri, Oct 11, 2013 at 10:31 PM, Ian Lance Taylor wrote: > On Fri, Oct 11, 2013 at 9:20 AM, Nagaraju Mekala > wrote: >> >> I observed that in rs6000 port longcall is implemented by using >> CALL_LONG define. >> #define CALL_LONG 0x0008 /* always call indir

Re: function attributes

2013-10-11 Thread Ian Lance Taylor
On Fri, Oct 11, 2013 at 9:20 AM, Nagaraju Mekala wrote: > > I observed that in rs6000 port longcall is implemented by using > CALL_LONG define. > #define CALL_LONG 0x0008 /* always call indirect */ > In the md file they are checking the operand with CALL_LONG > if (INTVAL (operands[3]) & CALL_

Re: function attributes

2013-10-11 Thread Nagaraju Mekala
func) >> { >> tree a; >> if (TREE_CODE (func) != FUNCTION_DECL) >> return 0; >> a = lookup_attribute ("super", DECL_ATTRIBUTES (func)); >> return a != NULL_TREE; >> } >> >> >> How to get the information of function att

Re: function attributes

2013-10-11 Thread Ian Lance Taylor
(tree func) > { > tree a; > if (TREE_CODE (func) != FUNCTION_DECL) > return 0; > a = lookup_attribute ("super", DECL_ATTRIBUTES (func)); > return a != NULL_TREE; > } > > > How to get the information of function attributes even before entering

function attributes

2013-10-11 Thread Nagaraju Mekala
CTION_DECL) return 0; a = lookup_attribute ("super", DECL_ATTRIBUTES (func)); return a != NULL_TREE; } How to get the information of function attributes even before entering to prologue or during function call itself?? Thanks, Nag

Re: asm in inline function invalidating function attributes?

2011-10-17 Thread Andi Kleen
> > At least the Linux kernel has a couple such cases ("nasty inline asm to > > hide register clobbering in calls") and it's always ugly and hard to > > maintain. > > It would simply be an alternate ABI that makes all registers callee-saved? Yes exactly that. -Andi -- a...@linux.intel.com -- Sp

Re: asm in inline function invalidating function attributes?

2011-10-17 Thread Ulrich Drepper
On Mon, Oct 17, 2011 at 02:57, Richard Guenther > It would simply be an alternate ABI that makes all registers callee-saved? > I suppose that would be not too hard to add. That would be great. There are quite a few interfaces which have a trivial normal case and only in special situations you ne

Re: asm in inline function invalidating function attributes?

2011-10-16 Thread Richard Guenther
On Mon, Oct 17, 2011 at 1:36 AM, Andi Kleen wrote: > Ulrich Drepper writes: >> >> It's not guaranteed to work in general.  The problem to solve is that >> I know the function which is called is not clobbering any registers. >> If I leave it with the normal function call gcc has to spill >> regist

Re: asm in inline function invalidating function attributes?

2011-10-16 Thread Andi Kleen
Ulrich Drepper writes: > > It's not guaranteed to work in general. The problem to solve is that > I know the function which is called is not clobbering any registers. > If I leave it with the normal function call gcc has to spill > registers. If I can hide the function call the generated code ca

Re: asm in inline function invalidating function attributes?

2011-10-16 Thread Ulrich Drepper
On Sun, Oct 16, 2011 at 14:38, Jakub Jelinek wrote: > If this is about e.g. > 2011-09-14  Ulrich Drepper   > >        * sysdeps/x86_64/fpu/bits/mathinline.h (__MATH_INLINE): Use >        __extern_always_inline. >        Define lrint{f,} and llrint{f,} for 64-bit and in some situations for >      

Re: asm in inline function invalidating function attributes?

2011-10-16 Thread Jakub Jelinek
On Sat, Oct 15, 2011 at 05:52:03PM -0400, Ulrich Drepper wrote: > I think gcc should allow the programmer to tell it something about a > function return value even if the function is inlined and the compiler > can see all the code. Consider the code below. If this is about e.g. 2011-09-14 Ulrich

Re: asm in inline function invalidating function attributes?

2011-10-16 Thread Ulrich Drepper
On Sun, Oct 16, 2011 at 06:31, Richard Guenther wrote: > The question is now, of course why you need to emit calls > from an asm() statement, something which isn't guaranteed > to work anyway (IIRC). It's not guaranteed to work in general. The problem to solve is that I know the function which i

Re: asm in inline function invalidating function attributes?

2011-10-16 Thread Richard Guenther
On Sat, Oct 15, 2011 at 11:52 PM, Ulrich Drepper wrote: > I think gcc should allow the programmer to tell it something about a > function return value even if the function is inlined and the compiler > can see all the code.  Consider the code below. > > If NOINLINE is defined the compiler will cal

asm in inline function invalidating function attributes?

2011-10-15 Thread Ulrich Drepper
I think gcc should allow the programmer to tell it something about a function return value even if the function is inlined and the compiler can see all the code. Consider the code below. If NOINLINE is defined the compiler will call g once. No need to do anything after the h() call since the fun

Re: about function attributes for functions returning a pointer

2010-10-04 Thread Ian Lance Taylor
er the attribute stuff) the warning is gone. In > both cases (and when the function was used) it is put in the > ".init.text" section though. That is in the first case __init worked, > but __maybe_unused did not. Is this intended? Do I something wrong? > What is the most

about function attributes for functions returning a pointer

2010-10-04 Thread Uwe Kleine-König
t.text" section though. That is in the first case __init worked, but __maybe_unused did not. Is this intended? Do I something wrong? What is the most correct position for function attributes for functions returning a pointer? (I'm using gcc 4.3.2 for arm, OSELAS.Toolchain-1.99.3.6 here.

Re: Accessing called function attributes in FUNCTION_ARG macro

2009-05-28 Thread Georg-Johann Lay
Weddington, Eric schrieb: Hi All, This may be a dumb question, but I'm having difficulty finding the answer to this. I'm working on a back-end and I have a function being called for the FUNCTION_ARG macro, and in that function I need to find out the attributes of the called function as this

Accessing called function attributes in FUNCTION_ARG macro

2009-05-28 Thread Weddington, Eric
Hi All, This may be a dumb question, but I'm having difficulty finding the answer to this. I'm working on a back-end and I have a function being called for the FUNCTION_ARG macro, and in that function I need to find out the attributes of the called function as this will affect the calling conv

Re: Adding New Function Attributes

2006-12-08 Thread Ian Lance Taylor
e TARGET_ATTRIBUTE_TABLE and friends. There are examples in several backends, including, e.g., i386. > 2. Any documentation regarding adding new function attributes? Yes, some, in the internals manual around TARGET_ATTRIBUTE_TABLE. > 3. If i have to emit an assembler directive based on the

Adding New Function Attributes

2006-12-07 Thread Rohit Arul Raj
documentation regarding adding new function attributes? 3. If i have to emit an assembler directive based on the flag status, where should i look for? 4. If i specify the attribute at the time of function declaration and i need to update the same flag while defining the function, where should i look to