I know we'd find something like that really handy for some of the embedded stuff we're doing.
There's the case where we'd like to have the files of a subsystem to be optimized but we want a handful of functions that directly access hardware be unoptimized. (We found that the optimization did some write reordering that the hardware didn't like. ;) ) -Kelly Murphy On Apr 1, 2005 8:05 AM, Andi Kleen <[EMAIL PROTECTED]> wrote: > Dale Johannesen <[EMAIL PROTECTED]> writes: > > > I've currently got the job of implementing pragma(s) to change > > optimization level in the middle of a file. This has come up a few > > times before, > > Would it be possible to make it a function attribute? I would > really like to have > > void __attribute__((optimization("Os"))) slow_init_function(void) > { > } > > to let slow_init_function be compiled as space efficient as possible. > > I think that would be very useful for the Linux kernel at least. > There is already a __init modifier for functions that ought to be > freed after initialization and it would be nice to just add a one > liner to make them smaller too. > > In addition letting the compiler do that automatically based > on profile feedback for "cold" functions would be very cool. > > -Andi >