[Git][ghc/ghc][wip/marge_bot_batch_merge_job] 2 commits: configure: remove dead code in configure scripts
Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC Commits: 35b604cc by Cheng Shao at 2025-12-24T00:11:28-05:00 configure: remove dead code in configure scripts This patch removes dead code in our configure scripts, including: - Variables and auto-detected programs that are not used - autoconf functions that are not used, or export a variable that's not used - `AC_CHECK_HEADERS` invocations that don't have actual corresponding `HAVE_XXX_H` usage - Other dead code (e.g. stray `AC_DEFUN()`) Co-authored-by: Codex <codex@openai.com> - - - - - 2f304f37 by Wolfgang Jeltsch at 2025-12-24T00:11:29-05:00 Remove unused known keys and names for list operations This removes the known-key and corresponding name variables for `concat`, `filter`, `zip`, and `(++)`, as they are apparently nowhere used in GHC’s source code. - - - - - 9 changed files: - compiler/GHC/Builtin/Names.hs - configure.ac - libraries/ghc-internal/configure.ac - − m4/find_ghc_bootstrap_prog.m4 - − m4/fp_copy_shellvar.m4 - − m4/fp_prog_ld_flag.m4 - − m4/fp_prog_sort.m4 - m4/prep_target_file.m4 - rts/configure.ac Changes: ===================================== compiler/GHC/Builtin/Names.hs ===================================== @@ -339,8 +339,7 @@ basicKnownKeyNames getFieldName, setFieldName, -- List operations - concatName, filterName, mapName, - zipName, foldrName, buildName, augmentName, appendName, + mapName, foldrName, buildName, augmentName, -- FFI primitive types that are not wired-in. stablePtrTyConName, ptrTyConName, funPtrTyConName, constPtrConName, @@ -694,9 +693,8 @@ ltTag_RDR = nameRdrName ordLTDataConName eqTag_RDR = nameRdrName ordEQDataConName gtTag_RDR = nameRdrName ordGTDataConName -map_RDR, append_RDR :: RdrName +map_RDR :: RdrName map_RDR = nameRdrName mapName -append_RDR = nameRdrName appendName foldr_RDR, build_RDR, returnM_RDR, bindM_RDR, failM_RDR :: RdrName @@ -1068,7 +1066,7 @@ considerAccessibleName = varQual gHC_INTERNAL_EXTS (fsLit "considerAccessible") -- Random GHC.Internal.Base functions fromStringName, otherwiseIdName, foldrName, buildName, augmentName, - mapName, appendName, assertName, + mapName, assertName, dollarName :: Name dollarName = varQual gHC_INTERNAL_BASE (fsLit "$") dollarIdKey otherwiseIdName = varQual gHC_INTERNAL_BASE (fsLit "otherwise") otherwiseIdKey @@ -1076,7 +1074,6 @@ foldrName = varQual gHC_INTERNAL_BASE (fsLit "foldr") foldrIdKey buildName = varQual gHC_INTERNAL_BASE (fsLit "build") buildIdKey augmentName = varQual gHC_INTERNAL_BASE (fsLit "augment") augmentIdKey mapName = varQual gHC_INTERNAL_BASE (fsLit "map") mapIdKey -appendName = varQual gHC_INTERNAL_BASE (fsLit "++") appendIdKey assertName = varQual gHC_INTERNAL_BASE (fsLit "assert") assertIdKey fromStringName = varQual gHC_INTERNAL_DATA_STRING (fsLit "fromString") fromStringClassOpKey @@ -1409,12 +1406,6 @@ enumFromThenName = varQual gHC_INTERNAL_ENUM (fsLit "enumFromThen") enumFrom enumFromThenToName = varQual gHC_INTERNAL_ENUM (fsLit "enumFromThenTo") enumFromThenToClassOpKey boundedClassName = clsQual gHC_INTERNAL_ENUM (fsLit "Bounded") boundedClassKey --- List functions -concatName, filterName, zipName :: Name -concatName = varQual gHC_INTERNAL_LIST (fsLit "concat") concatIdKey -filterName = varQual gHC_INTERNAL_LIST (fsLit "filter") filterIdKey -zipName = varQual gHC_INTERNAL_LIST (fsLit "zip") zipIdKey - -- Overloaded lists isListClassName, fromListName, fromListNName, toListName :: Name isListClassName = clsQual gHC_INTERNAL_IS_LIST (fsLit "IsList") isListClassKey @@ -2201,7 +2192,7 @@ naturalNBDataConKey = mkPreludeDataConUnique 124 ************************************************************************ -} -wildCardKey, absentErrorIdKey, absentConstraintErrorIdKey, augmentIdKey, appendIdKey, +wildCardKey, absentErrorIdKey, absentConstraintErrorIdKey, augmentIdKey, buildIdKey, foldrIdKey, recSelErrorIdKey, seqIdKey, eqStringIdKey, noMethodBindingErrorIdKey, nonExhaustiveGuardsErrorIdKey, @@ -2218,7 +2209,6 @@ wildCardKey = mkPreludeMiscIdUnique 0 -- See Note [WildCard absentErrorIdKey = mkPreludeMiscIdUnique 1 absentConstraintErrorIdKey = mkPreludeMiscIdUnique 2 augmentIdKey = mkPreludeMiscIdUnique 3 -appendIdKey = mkPreludeMiscIdUnique 4 buildIdKey = mkPreludeMiscIdUnique 5 foldrIdKey = mkPreludeMiscIdUnique 6 recSelErrorIdKey = mkPreludeMiscIdUnique 7 @@ -2247,13 +2237,9 @@ divIntIdKey = mkPreludeMiscIdUnique 26 modIntIdKey = mkPreludeMiscIdUnique 27 cstringLengthIdKey = mkPreludeMiscIdUnique 28 -concatIdKey, filterIdKey, zipIdKey, - bindIOIdKey, returnIOIdKey, newStablePtrIdKey, +bindIOIdKey, returnIOIdKey, newStablePtrIdKey, printIdKey, nullAddrIdKey, voidArgIdKey, otherwiseIdKey, assertIdKey :: Unique -concatIdKey = mkPreludeMiscIdUnique 31 -filterIdKey = mkPreludeMiscIdUnique 32 -zipIdKey = mkPreludeMiscIdUnique 33 bindIOIdKey = mkPreludeMiscIdUnique 34 returnIOIdKey = mkPreludeMiscIdUnique 35 newStablePtrIdKey = mkPreludeMiscIdUnique 36 ===================================== configure.ac ===================================== @@ -57,14 +57,10 @@ dnl ** which are needed by FP_SETUP_PROJECT_VERSION dnl ** Find find command (for Win32's benefit) FP_PROG_FIND -FP_PROG_SORT dnl ---------------------------------------------------------- FP_SETUP_PROJECT_VERSION -# Hmmm, we fix the RPM release number to 1 here... Is this convenient? -AC_SUBST([release], [1]) - dnl * We require autoconf version 2.69 due to dnl https://bugs.ruby-lang.org/issues/8179. Also see #14910. dnl * We need 2.50 due to the use of AC_SYS_LARGEFILE and AC_MSG_NOTICE. @@ -249,9 +245,6 @@ then fi AC_SUBST([WithGhc]) -dnl ** Without optimization some INLINE trickery fails for GHCi -SRC_CC_OPTS="-O" - dnl-------------------------------------------------------------------- dnl * Choose host(/target/build) platform dnl-------------------------------------------------------------------- @@ -753,10 +746,6 @@ AC_PROG_LN_S dnl ** Find the path to sed AC_PATH_PROGS(SedCmd,gsed sed,sed) - -dnl ** check for time command -AC_PATH_PROG(TimeCmd,time) - dnl ** check for tar dnl if GNU tar is named gtar, look for it first. AC_PATH_PROGS(TarCmd,gnutar gtar tar,tar) ===================================== libraries/ghc-internal/configure.ac ===================================== @@ -23,7 +23,7 @@ AC_MSG_RESULT($WINDOWS) AC_CHECK_TYPES([long long]) # check for specific header (.h) files that we are interested in -AC_CHECK_HEADERS([ctype.h errno.h fcntl.h inttypes.h limits.h signal.h sys/file.h sys/resource.h sys/select.h sys/stat.h sys/syscall.h sys/time.h sys/timeb.h sys/timers.h sys/times.h sys/types.h sys/utsname.h sys/wait.h termios.h time.h unistd.h utime.h windows.h winsock.h langinfo.h poll.h sys/epoll.h sys/event.h sys/eventfd.h sys/socket.h]) +AC_CHECK_HEADERS([ctype.h errno.h fcntl.h inttypes.h limits.h signal.h sys/resource.h sys/select.h sys/stat.h sys/syscall.h sys/time.h sys/timeb.h sys/timers.h sys/times.h sys/types.h sys/utsname.h sys/wait.h termios.h unistd.h utime.h windows.h winsock.h langinfo.h poll.h sys/epoll.h sys/event.h sys/eventfd.h sys/socket.h]) # Enable large file support. Do this before testing the types ino_t, off_t, and # rlim_t, because it will affect the result of that test. ===================================== m4/find_ghc_bootstrap_prog.m4 deleted ===================================== @@ -1,17 +0,0 @@ -# FIND_GHC_BOOTSTRAP_PROG() -# -------------------------------- -# Parse the bootstrap GHC's compiler settings file for the location of things -# like the `llc` and `opt` commands. -# -# $1 = the variable to set -# $2 = The bootstrap compiler. -# $3 = The string to grep for to find the correct line. -# -AC_DEFUN([FIND_GHC_BOOTSTRAP_PROG],[ - BootstrapTmpCmd=`grep $3 $($2 --print-libdir)/settings 2>/dev/null | sed 's/.*", "//;s/".*//'` - if test -n "$BootstrapTmpCmd" && test `basename $BootstrapTmpCmd` = $BootstrapTmpCmd ; then - AC_PATH_PROG([$1], [$BootstrapTmpCmd], "") - else - $1=$BootstrapTmpCmd - fi -]) ===================================== m4/fp_copy_shellvar.m4 deleted ===================================== @@ -1,3 +0,0 @@ -# Helper for cloning a shell variable's state -AC_DEFUN([FP_COPY_SHELLVAR], -[if test -n "${$1+set}"; then $2="$$1"; else unset $2; fi ]) ===================================== m4/fp_prog_ld_flag.m4 deleted ===================================== @@ -1,17 +0,0 @@ -# FP_PROG_LD_FLAG -# --------------- -# Sets the output variable $2 to $1 if ld supports the $1 flag. -# Otherwise the variable's value is empty. -AC_DEFUN([FP_PROG_LD_FLAG], -[ -AC_CACHE_CHECK([whether ld understands $1], [fp_cv_$2], -[echo 'int foo() { return 0; }' > conftest.c -${CC-cc} -c conftest.c -if $LD -r $1 -o conftest2.o conftest.o > /dev/null 2>&1; then - fp_cv_$2=$1 -else - fp_cv_$2= -fi -rm -rf conftest*]) -$2=$fp_cv_$2 -])# FP_PROG_LD_FLAG ===================================== m4/fp_prog_sort.m4 deleted ===================================== @@ -1,18 +0,0 @@ -# FP_PROG_SORT -# ------------ -# Find a Unix-like sort -AC_DEFUN([FP_PROG_SORT], -[AC_PATH_PROG([fp_prog_sort], [sort]) -echo conwip > conftest.txt -$fp_prog_sort -f conftest.txt > conftest.out 2>&1 -if grep 'conwip' conftest.out > /dev/null 2>&1 ; then - # The goods - SortCmd="$fp_prog_sort" -else - # Summink else..pick next one. - AC_MSG_WARN([$fp_prog_sort looks like a non-*nix sort, ignoring it]) - FP_CHECK_PROG([SortCmd], [sort], [], [], [$fp_prog_sort]) -fi -rm -f conftest.txt conftest.out -AC_SUBST([SortCmd])[]dnl -])# FP_PROG_SORT ===================================== m4/prep_target_file.m4 ===================================== @@ -229,5 +229,3 @@ AC_DEFUN([PREP_TARGET_FILE],[ esac AC_SUBST([TargetEndianness]) ]) - -AC_DEFUN() ===================================== rts/configure.ac ===================================== @@ -96,7 +96,7 @@ dnl off_t, because it will affect the result of that test. AC_SYS_LARGEFILE dnl ** check for specific header (.h) files that we are interested in -AC_CHECK_HEADERS([ctype.h dirent.h dlfcn.h errno.h fcntl.h grp.h limits.h locale.h nlist.h pthread.h pwd.h signal.h sys/param.h sys/mman.h sys/resource.h sys/select.h sys/time.h sys/timeb.h sys/timerfd.h sys/timers.h sys/times.h sys/utsname.h sys/wait.h termios.h utime.h windows.h winsock.h sched.h]) +AC_CHECK_HEADERS([ctype.h dlfcn.h errno.h fcntl.h limits.h locale.h nlist.h pthread.h signal.h sys/param.h sys/mman.h sys/resource.h sys/select.h sys/time.h sys/timeb.h sys/timerfd.h sys/timers.h sys/times.h sys/utsname.h sys/wait.h termios.h utime.h windows.h winsock.h sched.h]) dnl sys/cpuset.h needs sys/param.h to be included first on FreeBSD 9.1; #7708 AC_CHECK_HEADERS([sys/cpuset.h], [], [], @@ -148,7 +148,7 @@ FP_CHECK_FUNC([GetModuleFileName], dnl ** check for more functions dnl ** The following have been verified to be used in ghc/, but might be used somewhere else, too. -AC_CHECK_FUNCS([getclock getrusage gettimeofday setitimer siginterrupt sysconf times ctime_r sched_setaffinity sched_getaffinity setlocale uselocale]) +AC_CHECK_FUNCS([getclock getrusage gettimeofday sysconf times ctime_r sched_setaffinity sched_getaffinity uselocale]) dnl ** On OS X 10.4 (at least), time.h doesn't declare ctime_r if dnl ** _POSIX_C_SOURCE is defined @@ -488,5 +488,3 @@ cat ghcautoconf.h.autoconf | sed \ >> include/ghcautoconf.h echo "#endif /* __GHCAUTOCONF_H__ */" >> include/ghcautoconf.h ] - - View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/77748ad5bd02a944940bd8d437b2dbd... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/77748ad5bd02a944940bd8d437b2dbd... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Marge Bot (@marge-bot)