#ifndef _NESTED_H_7fb8c651_ #define _NESTED_H_7fb8c651_ /* This file is in the public domain. */ /* * Include file defining NESTED, for use with nested functions. This * needs attention because with some versions of gcc, the only way to * make a nested function work without a warning in the presence of * -Wstrict-prototypes is to declare it static. But gcc 4.0 doesn't * like this; it wants them defined without any such modifier, or with * auto for forward (or attribute-tagged) declarations. * * So we use NESTED in the code, and define it here, with overrides * available for use in the Makefile if necessary. With no overrides, * we define NESTED as static or auto, depending on whether __GNUC__ * is 4 or higher (auto) or not (static). When overridden, you can * get NESTED to expand to whatever you want, including nothing. We * also define a NESTEDFWD, for forward, or attribute-tagged, nested * declarations, and a NESTEDDEF for the corresponding definition; * they always expand to auto by default, but are here against * possible future need (and permit overriding too). * * I'm not sure whether gcc 4 and higher object to auto declarations * with -Wstrict-prototypes; my informant did not say. Please let me * know if you have trouble with this. * * To override one of the above, just arrange to have it defined when * compiling; eg, -DNESTED=auto will force NESTED to expand to auto, * or -DNESTEDDEF= will make NESTEDDEF expand to nothing. */ #ifndef NESTED #if __GNUC__ >= 4 #define NESTED auto #else #define NESTED static #endif #endif #ifndef NESTEDFWD #define NESTEDFWD auto #endif #ifndef NESTEDDEF #define NESTEDDEF auto #endif #endif