Re: Re: typeof and operands in named address spaces

2020-11-17 Thread Will Deacon via Gcc
On Tue, Nov 17, 2020 at 09:10:53PM +, Will Deacon wrote: > On Tue, Nov 17, 2020 at 11:31:57AM -0800, Linus Torvalds wrote: > > On Tue, Nov 17, 2020 at 11:25 AM Jakub Jelinek wrote: > > > > > > It would need to be typeof( (typeof(type)) (type) ) to not be that > > > constrained on what kind of

Re: Re: typeof and operands in named address spaces

2020-11-17 Thread Uecker, Martin
Am Dienstag, den 17.11.2020, 11:31 -0800 schrieb Linus Torvalds: > On Tue, Nov 17, 2020 at 11:25 AM Jakub Jelinek wrote: > > > > It would need to be typeof( (typeof(type)) (type) ) to not be that > > constrained on what kind of expressions it accepts as arguments. > > Yup. > > > Anyway, it won'

Re: Re: typeof and operands in named address spaces

2020-11-17 Thread Will Deacon via Gcc
On Tue, Nov 17, 2020 at 11:31:57AM -0800, Linus Torvalds wrote: > On Tue, Nov 17, 2020 at 11:25 AM Jakub Jelinek wrote: > > > > It would need to be typeof( (typeof(type)) (type) ) to not be that > > constrained on what kind of expressions it accepts as arguments. > > Yup. > > > Anyway, it won't

Re: Re: typeof and operands in named address spaces

2020-11-17 Thread Linus Torvalds
On Tue, Nov 17, 2020 at 11:13 AM Linus Torvalds wrote: > > > +#define __unqual_typeof(type) typeof( (typeof(type))type ) > > that's certainly a much nicer version than the existing pre-processor > expansion from hell. Oh, and sparse doesn't handle this, and doesn't remove any qualifiers for the

Re: Re: typeof and operands in named address spaces

2020-11-17 Thread Linus Torvalds
On Tue, Nov 17, 2020 at 11:25 AM Jakub Jelinek wrote: > > It would need to be typeof( (typeof(type)) (type) ) to not be that > constrained on what kind of expressions it accepts as arguments. Yup. > Anyway, it won't work with array types at least, > int a[10]; > typeof ((typeof (a)) (a)) b;

Re: Re: typeof and operands in named address spaces

2020-11-17 Thread Jakub Jelinek via Gcc
On Tue, Nov 17, 2020 at 11:13:52AM -0800, Linus Torvalds wrote: > > +#define __unqual_typeof(type) typeof( (typeof(type))type ) > that's certainly a much nicer version than the existing pre-processor > expansion from hell. It would need to be typeof( (typeof(type)) (type) ) to not be that constr

Re: Re: typeof and operands in named address spaces

2020-11-17 Thread Linus Torvalds
On Mon, Nov 16, 2020 at 3:11 AM Peter Zijlstra wrote: > > XXX: I've only verified the below actually compiles, I've not verified > the generated code is actually 'correct'. Well, it was mainly the arm64 code generation for load-acquire and store-release that wanted this - so it's really the

Re: Re: typeof and operands in named address spaces

2020-11-16 Thread Peter Zijlstra
On Mon, Nov 16, 2020 at 12:23:17PM +, Uecker, Martin wrote: > > > > Another way to drop qualifiers is using a cast. So you > > > > can use typeof twice: > > > > > > > > typeof((typeof(_var))_var) tmp__; > > > > > > > > This also works for non-scalars but this is a GCC extension. > > (That c

Re: Re: typeof and operands in named address spaces

2020-11-16 Thread Uecker, Martin
Am Montag, den 16.11.2020, 12:10 +0100 schrieb Peter Zijlstra: > ( restoring at least linux-toolcha...@vger.kernel.org, since that > seems > to have gone missing ) > > On Mon, Nov 16, 2020 at 10:11:50AM +0100, Richard Biener wrote: > > On Sun, Nov 15, 2020 at 11:53 AM Uecker, Martin > > wrote

Re: Re: typeof and operands in named address spaces

2020-11-16 Thread Peter Zijlstra
On Mon, Nov 16, 2020 at 12:10:56PM +0100, Peter Zijlstra wrote: > > > Another way to drop qualifiers is using a cast. So you > > > can use typeof twice: > > > > > > typeof((typeof(_var))_var) tmp__; > > > > > > This also works for non-scalars but this is a GCC extension. FWIW, clang seems to supp

Re: Re: typeof and operands in named address spaces

2020-11-16 Thread Peter Zijlstra
( restoring at least linux-toolcha...@vger.kernel.org, since that seems to have gone missing ) On Mon, Nov 16, 2020 at 10:11:50AM +0100, Richard Biener wrote: > On Sun, Nov 15, 2020 at 11:53 AM Uecker, Martin > wrote: > > > On Wed, Nov 04, 2020 at 07:31:42PM +0100, Uros Bizjak wrote: > > > >

Re: Re: typeof and operands in named address spaces

2020-11-16 Thread Richard Biener via Gcc
On Sun, Nov 15, 2020 at 11:53 AM Uecker, Martin wrote: > > > > On Wed, Nov 04, 2020 at 07:31:42PM +0100, Uros Bizjak wrote: > > > Hello! > > > > > > I was looking at the recent linux patch series [1] where segment > > > qualifiers (named address spaces) were introduced to handle percpu > > > varia

Re: Re: typeof and operands in named address spaces

2020-11-15 Thread Uecker, Martin
> On Wed, Nov 04, 2020 at 07:31:42PM +0100, Uros Bizjak wrote: > > Hello! > >  > > I was looking at the recent linux patch series [1] where segment > > qualifiers (named address spaces) were introduced to handle percpu > > variables. In the patch [2], the author mentions that: > >  > > --q-- > > U