Reuben Thomas wrote:
> On Wed, 18 Mar 2009, Eric Blake wrote:
>
>> Ahh.  The bug is in zile, not gnulib.
>
> Ah, thanks very much, and apologies for the noise.

Always including <config.h> first is easy to forget.
You might want to use rules like these from gnulib's maint.mk:

# Nearly all .c files must include <config.h>.
sc_require_config_h:
        @if $(VC_LIST_EXCEPT) | grep '\.c$$' > /dev/null; then          \
          grep -L '^# *include <config\.h>'                             \
                $$($(VC_LIST_EXCEPT) | grep '\.c$$')                    \
              | grep . &&                                               \
          { echo '$(ME): the above files do not include <config.h>'     \
                1>&2; exit 1; } || :;                                   \
        else :;                                                         \
        fi

# You must include <config.h> before including any other header file.
sc_require_config_h_first:
        @if $(VC_LIST_EXCEPT) | grep '\.c$$' > /dev/null; then          \
          fail=0;                                                       \
          for i in $$($(VC_LIST_EXCEPT) | grep '\.c$$'); do             \
            grep '^# *include\>' $$i | sed 1q                           \
                | grep '^# *include <config\.h>' > /dev/null            \
              || { echo $$i; fail=1; };                                 \
          done;                                                         \
          test $$fail = 1 &&                                            \
            { echo '$(ME): the above files include some other header'   \
                'before <config.h>' 1>&2; exit 1; } || :;               \
        else :;                                                         \
        fi


Reply via email to