>>>>> "Andreas" == Andreas Färber <afaer...@suse.de> writes:
Andreas> Am 23.11.2011 01:51, schrieb Peter Chubb: >>>>>>> "Peter" == Peter Chubb <peter.ch...@nicta.com.au> writes: >> >> Peter> All comments received so far have been addressed --- I've added Peter> a macro, `scream' that gives at most 10 lines of output for OS Peter> error reporting. >> >> Except I noticed a thinko in the macro. The decrement should be >> inside the guard, thus: >> >> #define scream(fmt, args...) \ do { \ static int printable = 10;\ >> if (printable) { \ printable--;\ fprintf(stderr, fmt, ##args); \ } >> \ } while (0) Andreas> Another issue: Andreas> scream("black"); scream("black"); scream("black"); Andreas> scream("black"); scream("black"); scream("black"); Andreas> scream("black"); scream("black"); scream("black"); Andreas> scream("black"); scream("red"); Andreas> To show us "red", in addition to the integer count a Andreas> duplicate of the string contents would need to be stored and Andreas> compared to the newly formatted string. No, because it's a macro. Each time it appears the static count is instantiated--- so there's a count for each call site. Andreas> If we want to do this, it should go into a central file so Andreas> that it can be reused and centrally maintained. Agree -- but do we want to do this? For this patch series, Peter M says to just use hw_error() (even though he really doesn't like it). Peter C