[Python-Dev] pyconfig.h macro usage

Skip Montanaro skip at pobox.com
Wed Jan 7 18:27:53 EST 2004


After Zacks message about configure.in cruft, I zapped the SIZEOF_CHAR macro
and noticed it was never used in any .c files.  So that got me to thinking
(dangerous, I know)...  What about:

    for macro in `egrep '#undef [_A-Z]' pyconfig.h.in \
                  | awk '{print $2}' \
                  | sort`
    do
        echo -n "$macro:   "
        find . -name '*.[ch]' \
        | egrep -v pyconfig \
        | xargs egrep $macro \
        | wc -l
    done \
    | sort -n -k 2,2

Turns out there are quite a few macros defined in pyconfig.h that are
unused:

    HAVE_DUP2                       SIZEOF_FLOAT
    HAVE_GETPID                     SIZEOF_UINTPTR_T
    HAVE_LIBDL                      SIZEOF_WCHAR_T
    HAVE_LIBDLD                     SYS_SELECT_WITH_SYS_TIME
    HAVE_LIBIEEE                    TM_IN_SYS_TIME
    HAVE_LIBRESOLV                  WITH_DL_DLD
    HAVE_PTHREAD_INIT               WITH_DYLD
    HAVE_STDARG_H                   WITH_LIBINTL
    HAVE_STRDUP                     _FILE_OFFSET_BITS
    HAVE_STRPTIME                   _LARGEFILE_SOURCE
    HAVE_ST_BLOCKS                  _MINIX
    HAVE_SYS_SOCKET_H               _NETBSD_SOURCE
    HAVE_TERMIOS_H                  _OSF_SOURCE
    HAVE_TIMEGM                     _POSIX_1_SOURCE
    HAVE_TM_ZONE                    _POSIX_C_SOURCE
    HAVE_TRUNCATE                   _POSIX_SOURCE
    HAVE_UCS4_TCL                   _REENTRANT
    RETSIGTYPE                      __BSD_VISIBLE
    SIZEOF_DOUBLE                   __EXTENSIONS__

Any votes for getting rid of them?

Skip



More information about the Python-Dev mailing list