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
Skip Montanaro wrote:
So that got me to thinking (dangerous, I know)... What about:
I did the same thing when converting to autoconf 2.5x, and zapped all which I was certain had no use (at that time).
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?
__EXTENSIONS__, *_SOURCE, _REENTRANT, _FILE_OFFSET_BITS are all used in system headers - so they need to be defined on the systems where they need to be defined... HAVE_UCS_TCL should probably be used. A number of the macros are not used because they are associated with replacement implementations, such as dup2 (all AC_REPLACE_FUNCS I think). We (probably) cannot remove the test whether a replacement function must be defined; that defines the macro as a side effect. _MINIX can be removed as part of the PEP 11 activities; if you remove that, please implement all scheduled removals. The other ones would need a more detailed investigation. Regards, Martin
Skip Montanaro wrote:
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?
I think HAVE_STRPTIME can be ditched. Sorry for the late response. This is what happens when I don't really get to read some emails in detail until I do the next Summary. -Brett
participants (4)
-
Brett -
Jeff Epler -
Martin v. Loewis -
Skip Montanaro