[m-rev.] for review: drop support for lcc

Julien Fischer jfischer at opturion.com
Mon Sep 29 15:52:00 AEST 2014


For review by anyone.

---------------------

Drop support for lcc.

Drop support for lcc as a C compiler.  lcc itself does not seem to have been
updated since around 2010 and Mercury's support for it has not been updated for
quite a while before that.

Derivatives of lcc, for example lcc-win32, would almost certainly need to be
treated separately anyway, so this change doesn't affect them (i.e. they are
already not supported).

configure.ac:
 	Do not recognise lcc as a C compiler.

 	Unrelated change: remove residual support for a.out executables on Linux.

scripts/mgnuc_file_opts.sh-subr:
 	Do not define the macros __EXTENSIONS__ and _GNU_SOURCE if the mgnuc script
 	is invoked with --no-ansi.  This was originally done to support lcc on Linux.
 	Doing so on *all* systems as this code actually does is not a good idea.
 	(If it becomes necessary to reinstate this behaviour on some system, it
 	should be controlled from the configure script not here.)

scripts/mgnuc.in:
scripts/ml.in:
compiler/compile_target_code.m:
compiler/handle_options.m:
compiler/globals.m:
 	Delete support for lcc.

README.lcc:
 	Delete this file.

Julien.

diff --git a/README.lcc b/README.lcc
deleted file mode 100644
index 6ff8bb8..0000000
--- a/README.lcc
+++ /dev/null
@@ -1,167 +0,0 @@
-This file documents how to use lcc 4.1 as the C compiler when
-installing Mercury on Linux.
-
-Some of the same issues may arise when using lcc on other systems,
-or when using other versions of lcc.
-
-1.  You can get lcc from <http://www.cs.princeton.edu/software/lcc/>.
-    In particular Linux RPM's are available from
-    <ftp://ftp.cs.princeton.edu/pub/packages/lcc/contrib>.
-
-2.  Apply the following patches:
-
-(i)  On at least some versions of Linux, the following patch must be
-applied to /usr/include/stdint.h.  This is because the Boehm (et al)
-collector uses elf.h, and the version of elf.h that gets installed on
-Linux uses by default is not compatible with lcc -- it uses
-typedefs defined as `long long' in stdint.h.
-
-If you prefer you can copy stdint.h to /usr/local/lib/lcc-4.1/include
-and then apply the patch there.
-
-This should be fixed in newer versions of glibc.
-
---- /usr/include/stdint.h	Sun Nov  7 03:23:27 1999
-+++ ./stdint.h	Tue Nov 21 05:25:39 2000
-@@ -28,6 +28,22 @@
- #include <stddef.h>
- #include <bits/wordsize.h>
- 
-+#ifdef __GNUC__
-+__extension__
-+typedef long long __long_long;
-+__extension__
-+typedef unsigned long long __u_long_long;
-+#else
-+typedef struct {
-+	long __ll_first;
-+	long __ll_second;
-+} __long_long;
-+typedef struct {
-+	unsigned long __ull_first;
-+	unsigned long __ull_second;
-+} __u_long_long;
-+#endif
-+
- /* Exact integral types.  */
- 
- /* Signed.  */
-@@ -42,8 +58,10 @@
- typedef long int		int64_t;
- # else
- __extension__
--typedef long long int		int64_t;
-+typedef __long_long		int64_t;
- # endif
-+#else
-+typedef __long_long		int64_t;
- #endif
- 
- /* Unsigned.  */
-@@ -54,7 +72,7 @@
- typedef unsigned long int	uint64_t;
- #else
- __extension__
--typedef unsigned long long int	uint64_t;
-+typedef __u_long_long		uint64_t;
- #endif
- 
- 
-@@ -68,7 +86,7 @@
- typedef long int		int_least64_t;
- #else
- __extension__
--typedef long long int		int_least64_t;
-+typedef __long_long		int_least64_t;
- #endif
- 
- /* Unsigned.  */
-@@ -79,7 +97,7 @@
- typedef unsigned long int	uint_least64_t;
- #else
- __extension__
--typedef unsigned long long int	uint_least64_t;
-+typedef __u_long_long		uint_least64_t;
- #endif
- 
- 
-@@ -95,7 +113,7 @@
- typedef int			int_fast16_t;
- typedef int			int_fast32_t;
- __extension__
--typedef long long int		int_fast64_t;
-+typedef __long_long		int_fast64_t;
- #endif
- 
- /* Unsigned.  */
-@@ -108,7 +126,7 @@
- typedef unsigned int		uint_fast16_t;
- typedef unsigned int		uint_fast32_t;
- __extension__
--typedef unsigned long long int	uint_fast64_t;
-+typedef __u_long_long		uint_fast64_t;
- #endif
- 
- 
-@@ -134,9 +152,9 @@
- typedef unsigned long int	uintmax_t;
- #else
- __extension__
--typedef long long int		intmax_t;
-+typedef __long_long		intmax_t;
- __extension__
--typedef unsigned long long int	uintmax_t;
-+typedef __u_long_long		uintmax_t;
- #endif
- 
-(ii) On some versions of Linux, the following patch must be
-applied to /usr/local/lib/lcc-4.1/include/stdio.h.
-This is due to an incompatibility between glibc's <sys/types.h>
-and lcc's <stdio.h>.
-
---- stdio.h.orig	Thu Jul  6 10:12:07 2000
-+++ stdio.h	Sun Feb  4 18:33:46 2001
-@@ -444,18 +444,20 @@
-    are originally defined in the Large File Support API.  */
- 
- /* Types needed in these functions.  */
--#ifndef off_t
-+#if !defined off_t && !defined __off_t_defined
- # ifndef __USE_FILE_OFFSET64
- typedef __off_t off_t;
- # else
- typedef __off64_t off_t;
- # endif
- # define off_t off_t
-+# define __off_t_defined
- #endif
- 
--#if defined __USE_LARGEFILE64 && !defined off64_t
-+#if defined __USE_LARGEFILE64 && !defined off64_t && !defined __off64_t_defined
- typedef __off64_t off64_t;
- # define off64_t off64_t
-+# define __off64_t_defined
- #endif
- 
-(iii) lcc 4.1 on at least some versions of Linux has a bug where
-`lcc -static' is broken.  To work around that, rename the
-original `lcc' program as `lcc.orig' and replace it with the
-following script:
-
-	#!/bin/sh
-	lcc.orig "$@" -lc -lgcc
-
-This results in some spurious warnings when invoking `lcc -c ...',
-but ensures that `lcc -static ...' works.
-
-3.  When invoking `configure', use the `--with-cc=lcc' option.
-
-4.  If you run into a fixed limit with lcc, it might be necessary
-    to pass the `--max-jump-table-size' to mmc, e.g. by putting
-    `EXTRA_MCFLAGS=--max-jump-table-size 100' in Mmake.params.
-    This requires recompiling the Mercury sources to C,
-    so you need to have a working Mercury compiler already installed
-    (e.g. one built using gcc instead of lcc).
-
-5.  Otherwise, follow the normal installation instructions in the INSTALL file.
-
diff --git a/compiler/compile_target_code.m b/compiler/compile_target_code.m
index 88107f6..6b4b0b3 100644
--- a/compiler/compile_target_code.m
+++ b/compiler/compile_target_code.m
@@ -514,7 +514,6 @@ gather_c_compiler_flags(Globals, PIC, AllCFlags) :-
          ;
              % XXX Check whether we need to do anything for these C compilers?
              ( C_CompilerType = cc_clang(_)
-            ; C_CompilerType = cc_lcc
              ; C_CompilerType = cc_cl(_)
              ),
              C_FnAlignOpt = ""
@@ -1009,9 +1008,7 @@ gather_compiler_specific_flags(Globals, Flags) :-
          C_CompilerType = cc_cl(_),
          globals.lookup_accumulating_option(Globals, msvc_flags, FlagsList)
      ;
-        ( C_CompilerType = cc_lcc
-        ; C_CompilerType = cc_unknown
-        ),
+        C_CompilerType = cc_unknown,
          FlagsList = []
      ),
      join_string_list(FlagsList, "", "", " ", Flags).
@@ -2504,7 +2501,6 @@ get_restricted_command_line_link_opts(Globals, LinkTargetType,
              ;
                  ( C_CompilerType = cc_gcc(_, _, _)
                  ; C_CompilerType = cc_clang(_)
-                ; C_CompilerType = cc_lcc
                  ; C_CompilerType = cc_unknown
                  ),
                  ResCmdLinkOpts = ""
@@ -2671,7 +2667,6 @@ get_linker_output_option(Globals, LinkTargetType, OutputOpt) :-
      ;
          ( C_CompilerType = cc_gcc(_, _, _)
          ; C_CompilerType = cc_clang(_)
-        ; C_CompilerType = cc_lcc
          ; C_CompilerType = cc_unknown
          ),
          OutputOpt = " -o "
@@ -2688,7 +2683,6 @@ reserve_stack_size_flags(Globals) = Flags :-
          (
              ( C_CompilerType = cc_gcc(_, _, _)
              ; C_CompilerType = cc_clang(_)
-            ; C_CompilerType = cc_lcc
              ; C_CompilerType = cc_unknown
              ),
              string.format("-Wl,--stack=%d", [i(ReserveStackSize)], Flags)
@@ -2796,7 +2790,6 @@ create_archive(Globals, ErrorStream, LibFileName, Quote, ObjectList,
      ;
          ( C_CompilerType = cc_gcc(_, _, _)
          ; C_CompilerType = cc_clang(_)
-        ; C_CompilerType = cc_lcc
          ; C_CompilerType = cc_unknown
          ),
          ArOutputSpace = " "
diff --git a/compiler/globals.m b/compiler/globals.m
index 9a0c8b0..0b58d77 100644
--- a/compiler/globals.m
+++ b/compiler/globals.m
@@ -129,7 +129,6 @@
                  % This is only available since gcc 3.0.
              )
      ;       cc_clang(maybe(clang_version))
-    ;       cc_lcc
      ;       cc_cl(maybe(int))
      ;       cc_unknown.

@@ -436,7 +435,6 @@ convert_c_compiler_type(CC_Str, C_CompilerType) :-

  convert_c_compiler_type_simple("gcc",      cc_gcc(no, no, no)).
  convert_c_compiler_type_simple("clang",    cc_clang(no)).
-convert_c_compiler_type_simple("lcc",      cc_lcc).
  convert_c_compiler_type_simple("cl",       cc_cl(no)).
  convert_c_compiler_type_simple("msvc",     cc_cl(no)).
  convert_c_compiler_type_simple("unknown",  cc_unknown).
diff --git a/compiler/handle_options.m b/compiler/handle_options.m
index d945901..74d776a 100644
--- a/compiler/handle_options.m
+++ b/compiler/handle_options.m
@@ -484,7 +484,7 @@ check_option_values(!OptionTable, Target, GC_Method, TagsMethod,
      ;
          C_CompilerType = cc_unknown,   % dummy
          add_error("Invalid argument to option `--c-compiler-type'\n" ++
-            "\t(must be `gcc', `lcc', `clang', 'msvc', or `unknown').",
+            "\t(must be `gcc', `clang', 'msvc', or `unknown').",
              !Errors)
      ),

diff --git a/configure.ac b/configure.ac
index 459a4a9..973557b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -157,7 +157,6 @@ MERCURY_CC_TYPE
  MERCURY_HAVE_CLANG=no
  MERCURY_HAVE_GCC=no
  MERCURY_HAVE_MSVC=no
-MERCURY_HAVE_LCC=no

  case "$mercury_cv_cc_type" in
      clang)
@@ -180,18 +179,7 @@ case "$mercury_cv_cc_type" in
      ;;

      *)
-        # XXX is there a better way to test for lcc other than
-        # to pattern match on its name?
-        case "$CC" in
-            *lcc*)
-                MERCURY_HAVE_LCC=yes
-                C_COMPILER_TYPE="lcc"
-            ;;
-
-            *)
-                C_COMPILER_TYPE="unknown"
-            ;;
-        esac
+        C_COMPILER_TYPE="unknown"
      ;;
  esac

@@ -1113,21 +1101,11 @@ else
      # which is used for interactive queries in the
      # Mercury debugger.  For gcc, this linker option can be enabled by
      # passing either `-rdynamic' or `-Wl,-export-dynamic' to gcc;
-    # we use the former.  For lcc 4.2, we need to use `-Wl-export-dynamic'.
+    # we use the former.
      #
      case $FULLARCH in
-        *-linux*aout)
-            # no special options needed
-            ;;
          *-linux*)
-            case "$CC" in
-                lcc*)
-                    LDFLAGS_FOR_TRACE="-Wl-export-dynamic"
-                    ;;
-                *)
-                    LDFLAGS_FOR_TRACE="-rdynamic"
-                    ;;
-            esac
+            LDFLAGS_FOR_TRACE="-rdynamic"
              ;;
      esac

@@ -4352,19 +4330,8 @@ case "$host" in
                  rm -f conftest*
                  ;;
              *)
-                case "$C_COMPILER_TYPE" in
-                    lcc)
-                        AC_MSG_RESULT(yes)
-                        EXT_FOR_SHARED_LIB=so
-                        EXE_RPATH_OPT="-Wl-rpath -Wl"
-                        EXE_RPATH_SEP=" -Wl-rpath -Wl"
-                        SHLIB_RPATH_OPT="-Wl-rpath -Wl"
-                        SHLIB_RPATH_SEP=" -Wl-rpath -Wl"
-                        ;;
-                    *)
-                        AC_MSG_RESULT(no)
-                        ;;
-                esac
+                AC_MSG_RESULT(no)
+                ;;
          esac

          EXT_FOR_LINK_WITH_PIC_OBJECTS=o
@@ -4608,18 +4575,6 @@ case "$mercury_cv_cc_type" in
          MCFLAGS_FOR_CC=
          ;;

-    lcc)
-        CFLAGS_FOR_ANSI=
-
-        # Turn off all warnings due to spurious warnings.
-        CFLAGS_FOR_WARNINGS="-w"
-
-        CFLAGS_FOR_OPT=
-        CFLAGS_FOR_DEBUG="-g"
-        CFLAGS_FOR_NO_STRICT_ALIASING=
-        MCFLAGS_FOR_CC=
-        ;;
-
      clang*)

          # We do not compile with -ansi when using clang because that (currently) puts
@@ -4692,7 +4647,7 @@ AC_SUBST([C_COMPILER_TYPE])

  LD_STATIC_FLAGS=
  case "$C_COMPILER_TYPE" in
-    gcc*|clang*|lcc)
+    gcc*|clang*)
          LD_STATIC_FLAGS=-static
          ;;
  esac
@@ -4709,25 +4664,6 @@ case "$FULLARCH" in
              clang*)
                  LD_STATIC_FLAGS="-static -Wl,-defsym -Wl,_DYNAMIC=0"
                  ;;
-            lcc)
-                # for lcc 4.1, we need to use "-Wl,".
-                # for lcc 4.2, we need to use "-Wl" without the comma,
-                # like we do for gcc.
-                AC_MSG_CHECKING([whether lcc requires comma after -Wl])
-                LD_STATIC_FLAGS="-static -Wl-defsym -Wl_DYNAMIC=0"
-                rm -f conftest*
-                echo "int main() { return 0; }" > conftest.c
-                if
-                    echo $CC $LD_STATIC_FLAGS conftest.c >&AC_FD_CC 2>&1 &&
-                    $CC $LD_STATIC_FLAGS conftest.c >&AC_FD_CC 2>&1
-                then
-                    AC_MSG_RESULT(no)
-                else
-                    AC_MSG_RESULT(yes)
-                    LD_STATIC_FLAGS="-static -Wl,-defsym -Wl,_DYNAMIC=0"
-                fi
-                rm -f conftest*
-                ;;
          esac
          ;;
      *-sun-solaris*)
diff --git a/scripts/mgnuc.in b/scripts/mgnuc.in
index 33eaf46..b9d0310 100644
--- a/scripts/mgnuc.in
+++ b/scripts/mgnuc.in
@@ -80,14 +80,6 @@ case "$C_COMPILER_TYPE" in
          DISABLE_OPTS_OPT="-O0"
          COMPILER=clang
          ;;
-    lcc*)
-        ANSI_OPTS=
-        CHECK_OPTS="-w"     # turn off all warnings due to spurious warnings.
-        OPT_OPTS=""
-        DEBUG_OPT="-g"
-        DISABLE_OPTS_OPT="-O0"
-        COMPILER=lcc
-        ;;
      msvc*|cl*)
          ANSI_OPTS=""
          CHECK_OPTS="-nologo"    # Suppress the MSVC banner message.
diff --git a/scripts/mgnuc_file_opts.sh-subr b/scripts/mgnuc_file_opts.sh-subr
index ce9113d..5e0a41d 100644
--- a/scripts/mgnuc_file_opts.sh-subr
+++ b/scripts/mgnuc_file_opts.sh-subr
@@ -31,7 +31,6 @@

          --no-ansi)
              ANSI_OPTS=
-            DEFINE_OPTS="$DEFINE_OPTS -D__EXTENSIONS__ -D_GNU_SOURCE"
              ;;

          --no-check)
diff --git a/scripts/ml.in b/scripts/ml.in
index e527351..52103be 100644
--- a/scripts/ml.in
+++ b/scripts/ml.in
@@ -74,9 +74,6 @@ case "$CC" in
  	*gcc*)
  		COMPILER=gcc
  		;;
-	*lcc*)
-		COMPILER=lcc
-		;;
  	*clang*)
  		COMPILER=clang
  		;;



More information about the reviews mailing list