At 06:47 PM 3/5/2003, Stas Bekman wrote: >William A. Rowe, Jr. wrote: >>Stas, to avoid clobbering what the clib headers already do, would... >>#ifndef __attribute__ >>#define __attribute__(__x) >>#endif >>solve the problem as well? Does defined(_foo_) pick up _foo_(x) declarations? >>If not is there such a beast? > >I suppose that this will do. If I remember correcly it doesn't matter what the >argumets are, but the symbol itself. We aren't in C++ here ;) > >but it's possible that that other macro was defined differently. If that's the >case, shouldn't this be overriden? (that's why I've done an unconditional >#undef). But I'm not sure what's the correct way to handle this. > >FWIW, perl defines it as: > >/* HASATTRIBUTE: > * This symbol indicates the C compiler can check for function attributes, > * such as printf formats. This is normally only supported by GNU cc. > */ >/*#define HASATTRIBUTE / **/ >#ifndef HASATTRIBUTE >#define __attribute__(_arg_) >#endif > >on platforms where __attribute__ is supported, it uncomments: >/*#define HASATTRIBUTE / **/
Right. We shouldn't unconditionally define __attribute__. If it is supported (e.g. by gcc) then let that definition be. Bill
