• Ben Avison's avatar
    Tweak TCPIP headers for more GCC friendliness · df902575
    Ben Avison authored
    This is still a long way from being possible to compile with GCC. The main
    aim here is to facilitate preprocessing of TCPIPLibs clients so that we can
    run `cppcheck` on them.
    
    The problem being addressed is that the GCC preprocessor always looks
    preferentially for include files in the same directory as the one that
    features the `#include` statement. This means that when
    
    * `machine/limits.h` does `#include <limits.h>`
    * `machine/stdarg.h` does `#include <stdarg.h>`
    * `sys/signal.h` does `#include <signal.h>`
    * `sys/time.h` does `#include <time.h>`
    
    then, rather than including the top-level version of the header, as intended,
    GCC ends up in an infinite loop of inclusion.
    
    To deal with this with the minimum of side-effects, the recursive includes
    are now conditional on `__GNUC__` bein undefined - except `machine/stdarg.h`
    which adds nothing to `stdarg.h` (so it's recommended that where GCC
    compatibility is required, it is simply changed to `#include <stdarg.h>`).
    
    Where possible, instances of `#include <machine/limits.h>` within the
    TCPIPLibs headers have been prefixed with `#include <limits.h>`, and
    similarly for the others. The extra inclusion of the top-level header
    should be harmless for Norcroft compilation, but ensures that clients of
    those second-tier headers are less likely to need an additional `#include`
    of a top-level header in order to enable `cppcheck`.
    df902575
types 2.55 KB