On 02/24/2016 07:28 AM, Matthias Pfaller wrote: > On 02/23/2016 09:11 PM, Jeff Epler wrote: >> Since you are already using cc extensions like ({ ... }), you may prefer >> to use __COUNTER__ rather than __LINE__. >> >> >> Consider preprocessor input like >> #define X __LINE__ >> #define Y X,X,X,X >> >> Y; >> >> #undef X >> #define X __COUNTER__ >> >> Y; >> >> The first definition of X gives >> 4,4,4,4; // depending on the line that first Y; is on >> and the second one gives >> 0,1,2,3; >> >> >> This can be particularly important if mrs() is used multiple times in another >> macro, since when the macro is expanded it is all expanded with the same >> value for __LINE__. > > Thank's for the hint. That is indeed alot better than __LINE__. I had > totally forgoten about __COUNTER__. It looks like all this is not enough. While this solves my problem, I thinke there are cases where gcc will still will apply CSE. Consider: static int mrsbasepri(void) { return(mrs(basepri)); } When gcc decides to inline mrsbasepri it will again be free to CSE the mrs instructions :-(. Is it really just me having run into this problem? How do other people solve the problem that __asm__ without input is handled like a __attribute((const)) function? regards, Matthias -- Matthias Pfaller Software Entwicklung marco Systemanalyse und Entwicklung GmbH Tel +49 8131 5161 41 Hans-Böckler-Str. 2, D 85221 Dachau Fax +49 8131 5161 66 http://www.marco.de/ Email leo@xxxxxxxx Geschäftsführer Martin Reuter HRB 171775 Amtsgericht München