On Mon, Nov 09, 2020 at 01:47:13PM +0100, Peter Zijlstra wrote: > > + lots of people and linux-toolchains > > 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-- > > Unfortunately, gcc does not provide a way to remove segment > > qualifiers, which is needed to use typeof() to create local instances > > of the per-cpu variable. For this reason, do not use the segment > > qualifier for per-cpu variables, and do casting using the segment > > qualifier instead. > > --/q-- > > C in general does not provide means to strip qualifiers.
Most ways you can try to use the result are undefined behaviour, even. > We recently had > a _lot_ of 'fun' trying to strip volatile from a type, see here: > > https://lore.kernel.org/lkml/875zimp0ay....@mpe.ellerman.id.au > > which resulted in the current __unqual_scalar_typeof() hack. > > If we're going to do compiler extentions here, can we pretty please have > a sane means of modifying qualifiers in general? What do you want to do with it? It may be more feasible to do a compiler extension for *that*. Segher