On Wed, Apr 01, 2026 at 10:30:53PM +0200, Peter Zijlstra wrote: > On Wed, Apr 01, 2026 at 01:21:17PM -0700, Kees Cook wrote: > > On Wed, Apr 01, 2026 at 11:08:15AM +0200, Peter Zijlstra wrote: > > > On Tue, Mar 31, 2026 at 12:52:10PM -0700, Kees Cook wrote: > > > > > > > I think for this series, __ob_trap/__ob_wrap is what should be used. > > > > > > > > And for other folks, the background here is that we originally wanted > > > > to use macros for "__trap" and "__wrap", but the powerpc C compiler > > > > (both Clang and GCC) have a builtin macro named "__trap" already. So > > > > I switched to just using the Clang-native type qualifier. We can use > > > > the attribute style too, but there was a lot of confusion during the > > > > Clang development phases where people kept forgetting this was a type > > > > qualifier, not an attribute (i.e. the attribute is an internal alias > > > > for the qualifier, and the qualifier is a new type). > > > > > > Since you mention qualifiers... > > > > > > What is the result of __typeof_unqual__(int __ob_trap) ? > > > > Hmm, it seems like "const" doesn't get peeled off. That can be fixed, if > > that's needed? > > > > 'typeof_unqual(int)' (aka 'int') > > 'typeof_unqual(__ob_trap int)' (aka '__ob_trap int') > > 'typeof_unqual(const int)' (aka 'int') > > 'typeof_unqual(__ob_trap const int)' (aka '__ob_trap const int') > > So how can something be called a qualifier if unqual doesn't strip it? > > (We might already have had this discussion, but I can't find the answer > in the LLVM documentation page and didn't search our previous > correspondence on this).
I'll let Justin answer this correctly, but I suspect I'm using the wrong name for things. I think I should have said "keyword"? The mechanism produces a distinct type, so it's not actually a "qualifier", but the intent is that they are distinct types (this came from a long long discussion with the LLVM devs, etc), but that they have implicit casts to the non-obt scalars, but Justin knows more on this. -- Kees Cook

