Remove duplication for the handling of attributes between different frontends

2025-04-05 Thread Antoni Boucher via Gcc
Hi. We're trying to remove the duplication of the attributes code between the C and libgccjit frontend. The attached patch shows a draft of this attempt that only supports a few attributes. Would that kind of approach be acceptable (I'm not sure since this includes a c-family file in

Remove duplication for the handling of attributes between different frontends in GCC

2025-03-19 Thread Basile Starynkevitch
Hello Antoni Boucher wrote: > We're trying to remove the duplication of the attributes code between > the C and libgccjit frontend. > The attached patch shows a draft of this attempt that only supports a > few attributes. > Would that kind of approach be acceptable (I&#

Re: Remove duplication for the handling of attributes between different frontends

2025-03-18 Thread Richard Biener via Gcc
On Tue, Mar 18, 2025 at 4:49 PM Antoni Boucher via Gcc wrote: > > Hi. > We're trying to remove the duplication of the attributes code between > the C and libgccjit frontend. > The attached patch shows a draft of this attempt that only supports a > few attributes. > Woul

Re: insn attributes: Support blocks of C-code?

2024-07-18 Thread Georg-Johann Lay
return a const char * for the type. Yes, const char* would be easier. I just didn't know how to alloc one, and where. A new const char* property in class attr_desc_would solve it. And then in turn we can pass a const char * to (f)print_c_condition. The MD reader then wouldn't need to know

Re: insn attributes: Support blocks of C-code?

2024-07-17 Thread Richard Sandiford via Gcc
that area; better someone more experienced would take it over. > >> it causes anything to break, I think we should fix whatever that breaking >> thing is. Could you try doing that, as a pre-patch? Or I can give it a >> go, if you'd rather not. > > Yes please.

Re: insn attributes: Support blocks of C-code?

2024-07-16 Thread Georg-Johann Lay
ubmission, but it looks mostly ready to go. Some comments below: diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi index 7f4335e0aac..3e46693e8c2 100644 --- a/gcc/doc/md.texi +++ b/gcc/doc/md.texi @@ -10265,6 +10265,56 @@ so there is no need to explicitly convert the expression into a boolean

Re: insn attributes: Support blocks of C-code?

2024-07-13 Thread Richard Sandiford via Gcc
> in the symbol_ref as an expression. Though I think this > could be a nice addition, in particular because the scanning > side in md_reader already supports the syntax. Looks good to me. I know you said it wasn't a patch submission, but it looks mostly ready to go. Some comments

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

2024-07-12 Thread Alejandro Colomar via Gcc
t; > > > [[gnu::access(read_only, 2)]] > > > > [[gnu::nonnull(1, 2)]] > > > > [[gnu::null_terminated_string_arg(2)]] > > > > char * > > > > strsep(char **restrict sp, const char *delim); > > > &

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

2024-07-11 Thread Alejandro Colomar via Gcc
terminated_string_arg(2)]] > > > char * > > > strsep(char **restrict sp, const char *delim); > > > > The main problem from a user perspective is that > > these are attributes on the function declaration > > and not on the argument (type). > >

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

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

insn attributes: Support blocks of C-code?

2024-07-11 Thread Georg-Johann Lay
65,56 @@ so there is no need to explicitly convert the expression into a boolean (match_test "(x & 2) != 0") @end smallexample +@cindex @code{symbol_ref} and attributes +@item (symbol_ref "@var{quoted-c-expr}") + +Specifies the value of the attribute sub-expression as a C e

Re: GCC/Clang attributes guiding warnings about unused entities

2023-04-28 Thread Stephan Bergmann via Gcc
out unreferenced variables that are initialized via that constructor. <https://reviews.llvm.org/D148505> "Allow `__attribute__((warn_unused))` on individual constructors" would implement that for Clang---but was met with some reservation for now, due to the already somewhat confusing landsc

Re: GCC/Clang attributes guiding warnings about unused entities

2023-04-28 Thread Florian Weimer via Gcc
__attribute__((warn_unused)), the compiler could warn about > unreferenced variables that are initialized via that constructor. > <https://reviews.llvm.org/D148505> "Allow > `__attribute__((warn_unused))` on individual constructors" would > implement that for Clang---but was me

GCC/Clang attributes guiding warnings about unused entities

2023-04-26 Thread Stephan Bergmann via Gcc
[cross-posting this to both the GCC and Clang communities] I have two specific issues on the subject I would like to discuss below. But first a quick overview: C++ has two attributes dealing with warnings about unused entities: * In one direction (making the compiler suppress warnings it

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 co

[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: [PATCH v3] Document that the 'access' and 'nonnull' attributes are independent

2022-04-05 Thread David Malcolm via Gcc
oval of null pointer checks). > > > > > > > That's a fair point. > > > > Here's a v3 of the patch, which tones down the advice, and mentions > > that > > there are caveats when directing the reader to the "nonnull" > > a

Re: [PATCH v3] Document that the 'access' and 'nonnull' attributes are independent

2022-03-25 Thread Martin Sebor via Gcc
* doc/extend.texi (Common Function Attributes): Document that 'access' does not imply 'nonnull'. Signed-off-by: David Malcolm --- gcc/doc/extend.texi | 8 1 file changed, 8 insertions(+) diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index a4a25e8

[PATCH v3] Document that the 'access' and 'nonnull' attributes are independent

2022-03-25 Thread David Malcolm via Gcc
he nonnull attribute here. This > attribute could have pretty dangerous effects in the function > definition > (removal of null pointer checks). > That's a fair point. Here's a v3 of the patch, which tones down the advice, and mentions that there are caveats when directin

Re: [PATCH v2] Document that the 'access' and 'nonnull' attributes are independent

2022-03-23 Thread Sebastian Huber
On 23/03/2022 17:31, Martin Sebor via Gcc-patches wrote: The concern is that the constraints implied by atttributes access and nonnull are independent of each other.  I would suggest to document that without talking about dereferencing because that's not implied by either of them.  E.g., somethi

Re: [PATCH v2] Document that the 'access' and 'nonnull' attributes are independent

2022-03-23 Thread Martin Sebor via Gcc
onnull - though perhaps there are cases where APIs check for NULL and reject them gracefully? No, I think they are separate. The access just says these access attributes are read only, write only, read-write or don't access what the pointer points to; it does not say they have to be read or writt

[PATCH v2] Document that the 'access' and 'nonnull' attributes are independent

2022-03-23 Thread David Malcolm via Gcc
, that parameter is probably > > > > going > > > > to > > > > be required to be nonnull - though perhaps there are cases > > > > where > > > > APIs > > > > check for NULL and reject them gracefully? > > > > > >

Re: [PATCH] Document that the 'access' and 'nonnull' attributes are independent

2022-03-14 Thread Martin Sebor via Gcc
think they are separate. The access just says these access attributes are read only, write only, read-write or don't access what the pointer points to; it does not say they have to be read or written to. I think it is a bad idea to connect the two ideas because you could have some cases

[PATCH] Document that the 'access' and 'nonnull' attributes are independent

2022-03-09 Thread David Malcolm via Gcc
t; > to > > be required to be nonnull - though perhaps there are cases where > > APIs > > check for NULL and reject them gracefully? > > No, I think they are separate. The access just says these access > attributes are read only, write only, read-write or don't a

Re: RFC: attributes for marking security boundaries (system calls/ioctls, user vs kernel pointers etc)

2021-04-30 Thread Andi Kleen via Gcc
David Malcolm via Gcc writes: > I think I want a way for the user to be able to mark security > boundaries in their code: for example: > * in the Linux kernel the boundary between untrusted user-space data > and kernel data, or, > * for a user-space daemon, the boundary between data coming from t

Re: RFC: attributes for marking security boundaries (system calls/ioctls, user vs kernel pointers etc)

2021-04-29 Thread Martin Sebor via Gcc
On 4/29/21 11:18 AM, David Malcolm wrote: I've been going through old Linux kernel CVEs, trying to prototype some possible new warnings for -fanalyzer in GCC 12 (and, alas, finding places where the analyzer internals need work...) I think I want a way for the user to be able to mark security bou

RFC: attributes for marking security boundaries (system calls/ioctls, user vs kernel pointers etc)

2021-04-29 Thread David Malcolm via Gcc
I've been going through old Linux kernel CVEs, trying to prototype some possible new warnings for -fanalyzer in GCC 12 (and, alas, finding places where the analyzer internals need work...) I think I want a way for the user to be able to mark security boundaries in their code: for example: * in the

DECL_RESULT not initialized for FUNCTION_DECL when processing attributes in a plugin - bug or feature?

2020-05-03 Thread Bartosz Szreder via Gcc
GCC manual (https://gcc.gnu.org/onlinedocs/gccint/Function-Basics.html) states that a result tree for a FUNCTION_DECL can be obtained by using a DECL_RESULT macro. This does not seem to be the case when processing user-defined attributes via a plugin - when GCC calls my callback for handling the

Re: GCC Common-Function-Attributes/const

2018-11-28 Thread Richard Biener
ion of the lookup table/api; or is it guaranteed, that the > > function is only called in places, where it would be called without the > > attribute. I also propose some additional attributes to let the programmer > > clarify his/her intentions. > > The purpose of the const at

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-

Re: GCC Common-Function-Attributes/const

2018-11-26 Thread Martin Sebor
also propose some additional attributes to let the programmer clarify his/her intentions. The purpose of the const attribute is to let GCC assume that invocations of a function it's on with the same argument values yield the same result no matter when they are made. Any function that sati

GCC Common-Function-Attributes/const

2018-11-26 Thread cmdLP #CODE
variables like a lookup table or the initialization of an api? Does GCC may invoke the function before the initialization of the lookup table/api; or is it guaranteed, that the function is only called in places, where it would be called without the attribute. I also propose some additional attributes

Re: [Bug target/80986] auto keyword variable lost its attributes

2017-06-18 Thread 林作健
is attribute. > > > Does affects_type_identity cause other user visible changes ? For e.g. based > on > a cursory look it appears to affect mangling in C++. The comment in > tree-core.h > simply says this affects the type's identity presumably implying that this >

Re: Proposal: readable and writable attributes on variables

2016-09-07 Thread Jeff Law
On 09/01/2016 09:04 AM, Martin Sebor wrote: Understood. I think a write-only attribute or type qualifier would make sense. Until/unless it's implemented I would recommend to work around its absence by hiding access to the registers behind a read- only and write-only functional API. As you note

Re: Proposal: readable and writable attributes on variables

2016-09-02 Thread Jens Bauer
Hi Martin (and all other list members). On Thu, 1 Sep 2016 09:04:10 -0600, Martin Sebor wrote: > On 08/31/2016 04:56 AM, Jens Bauer wrote: >>>__attribute__ ((not_readable)) int write_only; >>>int *preadwrite = &write_only; >> >> Would it not be possible to bring a warning in such cases ?

Re: Proposal: readable and writable attributes on variables

2016-09-01 Thread Martin Sebor
, attribute not_readable would need to be elevated to the status of a type qualifier analogous to const. Otherwise it would (likely, if applied as most other attributes) be lost during conversions such as in __attribute__ ((not_readable)) int write_only; int *preadwrite = &write_only; Woul

Re: Proposal: readable and writable attributes on variables

2016-09-01 Thread Jens Bauer
Hi Florian. On Thu, 1 Sep 2016 15:21:27 +0200, Florian Weimer wrote: >> So I'd like to propose the following two attributes, which is 'off' >> by default (eg. read access + write access): >> __attribute__((not_readable)) >> __attribute__((not_writable)) >

Re: Proposal: readable and writable attributes on variables

2016-09-01 Thread Florian Weimer
ucture member 'read-only', 'write-only' or 'read+write'. In addition to that, it would definitely be handy to declare variables 'no access' So I'd like to propose the following two attributes, which is 'off' by default (eg. read access +

Re: Proposal: readable and writable attributes on variables

2016-08-31 Thread Jens Bauer
to be elevated > to the status of a type qualifier analogous to const. Otherwise it > would (likely, if applied as most other attributes) be lost during > conversions such as in > > __attribute__ ((not_readable)) int write_only; > int *preadwrite = &write_only; Would it not be

Re: Proposal: readable and writable attributes on variables

2016-08-30 Thread Martin Sebor
ucture member 'read-only', 'write-only' or 'read+write'. In addition to that, it would definitely be handy to declare variables 'no access' So I'd like to propose the following two attributes, which is 'off' by default (eg. read access +

Proposal: readable and writable attributes on variables

2016-08-30 Thread Jens Bauer
write-only' or 'read+write'. In addition to that, it would definitely be handy to declare variables 'no access' So I'd like to propose the following two attributes, which is 'off' by default (eg. read access + write access): __attribute__((not_readable)) _

[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: target attributes/pragmas changing vector instruction availability and custom types

2015-06-02 Thread Michael Meissner
On Tue, May 19, 2015 at 03:17:26PM +0100, Kyrill Tkachov wrote: > Hi all, Sorry, it took me awhile to comment. > I'm working on enabling target attributes and pragmas on aarch64 and I'm > stuck on a particular issue. > I want to be able to use a target pragma to enable

Re: target attributes/pragmas changing vector instruction availability and custom types

2015-05-19 Thread Kyrill Tkachov
On 19/05/15 16:21, Kyrill Tkachov wrote: On 19/05/15 15:55, Christian Bruel wrote: Hi Kiril, This is funny, I've updated bz65837 today in the same direction. On 05/19/2015 04:17 PM, Kyrill Tkachov wrote: Hi all, I'm working on enabling target attributes and pragmas on aarch64 and

Re: target attributes/pragmas changing vector instruction availability and custom types

2015-05-19 Thread Kyrill Tkachov
On 19/05/15 15:55, Christian Bruel wrote: Hi Kiril, This is funny, I've updated bz65837 today in the same direction. On 05/19/2015 04:17 PM, Kyrill Tkachov wrote: Hi all, I'm working on enabling target attributes and pragmas on aarch64 and I'm stuck on a particular issue. I

target attributes/pragmas changing vector instruction availability and custom types

2015-05-19 Thread Kyrill Tkachov
Hi all, I'm working on enabling target attributes and pragmas on aarch64 and I'm stuck on a particular issue. I want to be able to use a target pragma to enable SIMD support in a SIMD intrinsics header file. So it will look like this: $ cat simd_header.h #pragma GCC push_options #

Re: target attributes, pragmas and preprocessor macros

2015-05-18 Thread Kyrill Tkachov
On 18/05/15 09:25, Kyrill Tkachov wrote: Hi Christian, On 18/05/15 07:26, Christian Bruel wrote: Hi Kyrill, On 05/13/2015 05:43 PM, Kyrill Tkachov wrote: Hi all, Are target attributes supposed to redefine the preprocessor macros available? For example, on aarch64 if the file is compiled

Re: target attributes, pragmas and preprocessor macros

2015-05-18 Thread Kyrill Tkachov
Hi Christian, On 18/05/15 07:26, Christian Bruel wrote: Hi Kyrill, On 05/13/2015 05:43 PM, Kyrill Tkachov wrote: Hi all, Are target attributes supposed to redefine the preprocessor macros available? For example, on aarch64 if the file is compiled with floating point support the

target attributes, pragmas and preprocessor macros

2015-05-13 Thread Kyrill Tkachov
Hi all, Are target attributes supposed to redefine the preprocessor macros available? For example, on aarch64 if the file is compiled with floating point support the __ARM_FEATURE_FMA predefine is available. If the user adds to a function a target attribute disabling floating point, then is

Attributes for var_decl and fun_decl.

2014-06-12 Thread Umesh Kalappa
Dear All, We ported gcc 4.8.1 for custom hardware and we have target specific attributes like io for variables and interrupt for functuions and many more. We are able to fetch the attributes for variables like look_up(DECL_ATTRIBUTES(node),attr_name) for typedef variables we are fetching

Re: function attributes

2013-10-16 Thread Nagaraju Mekala
, >>>>> >>>>> 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: >

Re: function attributes

2013-10-16 Thread Umesh Kalappa
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

Re: function attributes

2013-10-16 Thread Nagaraju Mekala
(INTVAL (operands[3]) & CALL_LONG) >>>>> operands[1] = rs6000_longcall_ref (operands[1]); >>>>> In my port I dont have suchthing to compare. Can we somehow parse the >>>>> tree chain and check the attributes of the functions.. >>>> >>

Re: function attributes

2013-10-16 Thread Umesh Kalappa
direct */ >>>> In the md file they are checking the operand with CALL_LONG >>>> if (INTVAL (operands[3]) & CALL_LONG) >>>> operands[1] = rs6000_longcall_ref (operands[1]); >>>> In my port I dont have suchthing to compare. Can we somehow parse the >>

Re: function attributes

2013-10-15 Thread Ian Lance Taylor
] = rs6000_longcall_ref (operands[1]); >>> In my port I dont have suchthing to compare. Can we somehow parse the >>> tree chain and check the attributes of the functions.. >> >> Look at init_cumulative_args in rs6000.c to see how CALL_LONG is set >> based on the function

Re: function attributes

2013-10-15 Thread Nagaraju Mekala
LONG 0x0008 /* always call indirect */ >> In the md file they are checking the operand with CALL_LONG >> if (INTVAL (operands[3]) & CALL_LONG) >> operands[1] = rs6000_longcall_ref (operands[1]); >> In my port I dont have suchthing to compare. Can we somehow parse t

Re: function attributes

2013-10-11 Thread Ian Lance Taylor
INTVAL (operands[3]) & CALL_LONG) > operands[1] = rs6000_longcall_ref (operands[1]); > In my port I dont have suchthing to compare. Can we somehow parse the > tree chain and check the attributes of the functions.. Look at init_cumulative_args in rs6000.c to see how CALL_LONG is set based on the function attribute. Ian

Re: function attributes

2013-10-11 Thread Nagaraju Mekala
question is how to find the attributes of a function which we are >> going to call >> >> Problem: >> >>Generally while calling a function we use branch instruction >> >>ex: br r5, >> >> But when we have a function with "super&quo

Re: function attributes

2013-10-11 Thread Ian Lance Taylor
On Fri, Oct 11, 2013 at 2:48 AM, Nagaraju Mekala wrote: > > My question is how to find the attributes of a function which we are > going to call > > Problem: > >Generally while calling a function we use branch instruction > >ex: br r5, > > But wh

function attributes

2013-10-11 Thread Nagaraju Mekala
Hi, I am working on GCC-4.6.4 version ported to a embedded target which is similar to frv. My question is how to find the attributes of a function which we are going to call Problem: Generally while calling a function we use branch instruction ex: br r5, But when we have a

Re: Intentional or accidental backward-incompatibility w.r.t. process attributes?

2013-04-05 Thread Dave Korn
ult is effectively to place an arbitrary limit of 1 (the hidden this pointer) on the number of parameters that can be passed in registers. If I change __stdcall to __thiscall in the example, I get a clear error message: > bar.h:3:57: error: regparam and thiscall attributes are not c

Re: Intentional or accidental backward-incompatibility w.r.t. process attributes?

2013-04-04 Thread Thorsten Glaser
NightStrike gmail.com> writes: > > ... used to work, with the attribute from the declaration being applied also > > to the definition. I stumbled upon this as well recently. > Someone else just asked not too long ago: > > http://gcc.gnu.org/ml/gcc-help/2013-03/msg00012.html Yes, but there’s n

Re: Intentional or accidental backward-incompatibility w.r.t. process attributes?

2013-04-03 Thread NightStrike
On Wed, Apr 3, 2013 at 10:44 PM, Dave Korn wrote: > > Hi list, > > Previously (tested with gcc-4.5.3), constructs like this:- > > -- foo.h > > struct sigpacket > { > int __stdcall process () __attribute__ ((regparm (1))); > }; > > -- foo.cpp > > #include "foo.h" > > int __stdcall > sigpack

Intentional or accidental backward-incompatibility w.r.t. process attributes?

2013-04-03 Thread Dave Korn
Hi list, Previously (tested with gcc-4.5.3), constructs like this:- -- foo.h struct sigpacket { int __stdcall process () __attribute__ ((regparm (1))); }; -- foo.cpp #include "foo.h" int __stdcall sigpacket::process () { return 2; } -- ... used to work, wi

Re: GCC Support of Function/Variable Attributes

2013-03-01 Thread Jeffrey Walton
On Thu, Feb 28, 2013 at 8:05 PM, Andrew Pinski wrote: > On Thu, Feb 28, 2013 at 3:54 PM, Jeffrey Walton wrote: >> Hi All, >> >> I'm having trouble compiling sources adorned with the aligned >> attribute under Clang 3.1. Clang claims its GCC 4.2.1 compatible: > > This is not a good list to ask thi

Re: GCC Support of Function/Variable Attributes

2013-03-01 Thread Marc Glisse
efine __GNUC_STDC_INLINE__ 1 #define __GNUC__ 4 When did GCC add support for function and variable attributes? Specifically, __attribute__(aligned) for x86/x64? Did the aligned attribute come into being after GCC 4.2? That wouldn't be the only place where clang is not perfectly compatible with gcc.

Re: GCC Support of Function/Variable Attributes

2013-02-28 Thread Andrew Pinski
inski > > $ clang -dM -E -x c /dev/null | grep -i gnuc > #define __GNUC_MINOR__ 2 > #define __GNUC_PATCHLEVEL__ 1 > #define __GNUC_STDC_INLINE__ 1 > #define __GNUC__ 4 > > When did GCC add support for function and variable attributes? > Specifically, __attribute__(align

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: RFC: Collecting together binary file attributes into a single file.

2011-09-29 Thread Joseph S. Myers
On Thu, 29 Sep 2011, Nick Clifton wrote: > Hi Richard, > > > I don't think it's a good idea to have the attributes of > > every CPU we support in a single file. That's going to > > get unmaintainable very quickly. > > Really - why ? > > These

Re: RFC: Collecting together binary file attributes into a single file.

2011-09-29 Thread Nick Clifton
Hi Richard, I don't think it's a good idea to have the attributes of every CPU we support in a single file. That's going to get unmaintainable very quickly. Really - why ? These attributes are mostly static. Some new ones might be added from time to time, but baring the

Re: RFC: Collecting together binary file attributes into a single file.

2011-09-29 Thread Richard Earnshaw (home)
e would contain enums describing the > attributes that be can found in SHT_GNU_ATTRIBUTES sections. The > purpose of the file is to provide a single place where these values > are defined, and to share the information between GCC, BINUTILS and > GDB. > > The patch

RFC: Collecting together binary file attributes into a single file.

2011-09-29 Thread Nick Clifton
Hi Guys, All I wanted to do was to make GCC's ARM assembler output slightly easier to read... I would like to propose a patch to create a new header file in the include/ directory. This file would contain enums describing the attributes that be can found in SHT_GNU_ATTRIBUTES sec

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: g++, trunk, recent weird mismatch for arguments with forwarded declaration when attributes are involved

2010-09-14 Thread tbp
On Tue, Sep 14, 2010 at 4:51 PM, Ian Lance Taylor wrote: > Please do file a PR if there isn't one already.  Thanks. I have no idea if that could happen outside C++ and couldn't find anything relevant, thus http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45668 That's the best i can do. And thanks for y

Re: g++, trunk, recent weird mismatch for arguments with forwarded declaration when attributes are involved

2010-09-14 Thread Ian Lance Taylor
tbp writes: > Would it be possible to have some clarifications? Shall i file a PR > for a warning? Sacrifice a goat? Please do file a PR if there isn't one already. Thanks. Ian

Re: g++, trunk, recent weird mismatch for arguments with forwarded declaration when attributes are involved

2010-09-14 Thread tbp
Hello, i know it's no good form to reply to self, or be that insistent, but i've been hit again. In the bug report discussion, i've been told by A. Pinski that, as of now, forward declarations shall have matching attributes. That's fine, i suppose. What's not is that: .

Re: g++, trunk, recent weird mismatch for arguments with forwarded declaration when attributes are involved

2010-09-10 Thread tbp
On Fri, Sep 10, 2010 at 5:20 PM, Ian Lance Taylor wrote: > Since you do have a test case, you could try using a tool like delta to reduce > it to something that you can share. My delta-fu is too weak to get anywhere with an error so easily produced (mismatched prototype, plus g++ senseless diagnos

Re: g++, trunk, recent weird mismatch for arguments with forwarded declaration when attributes are involved

2010-09-10 Thread Manuel López-Ibáñez
On 10 September 2010 17:20, Ian Lance Taylor wrote: > > I understand what you are trying to do, but it's very unlikely that > anybody will be able to solve this problem without a test case.  Since > you do have a test case, you could try using a tool like delta to reduce > it to something that you

Re: g++, trunk, recent weird mismatch for arguments with forwarded declaration when attributes are involved

2010-09-10 Thread Ian Lance Taylor
t's no testcase because it works: to kludge around, i have > to forward declare with matching attributes (or get an error). > I fail to reduce it, and the source code is large & fugly; i'd prefer > not to have to disclose, hence no formal bug report. > My hope being that

g++, trunk, recent weird mismatch for arguments with forwarded declaration when attributes are involved

2010-09-10 Thread tbp
foo { void bar(fwd &); }; } class __attribute((aligned(16))) fwd {}; } // error prototype for... candidate is... would be here. void n1::n2::foo::bar(n1::fwd &) {} Except that's no testcase because it works: to kludge around, i have to forward declare with matchin

Re: Attributes

2010-07-22 Thread Joseph S. Myers
I refer you to the various issues I have raised with attributes proposals in WG14 in the past, some at least of which have also been forwarded to WG21. The committees have generally chosen not to listen to compatibility concerns, except insofar as WG14 ended up not adopting general attribute

  1   2   >