[m-rev.] diff: use new-style C compiler type for MSVC

Julien Fischer jfischer at opturion.com
Mon Sep 29 17:45:54 AEST 2014


Use new-style C compiler type for MSVC.

It was intended that the C compiler type string for MSVC would
eventually have the form "msvc_<n>" (where <n> is the version number).
The configure script is still generating the older form of string,
"cl_<n>"; we want to avoid this because it's too easy to confuse with
clang.  Make configure generate the new kind of C compiler type string.

configure.ac:
 	Generate the new sort of compiler type strings for MSVC.

scripts/mgnuc.in:
compiler/globals.m:
 	Do not recognise the old sort any longer.

Julien.

diff --git a/compiler/globals.m b/compiler/globals.m
index 0b58d77..9361a8f 100644
--- a/compiler/globals.m
+++ b/compiler/globals.m
@@ -426,16 +426,11 @@ convert_c_compiler_type(CC_Str, C_CompilerType) :-
          convert_c_compiler_type_with_version(CC_Str, C_CompilerType)
      ).

-% NOTE: we currently accept strings of the form cl_<version> or
-% msvc_<version> for Visual C; support for the former is deprecated and
-% will be dropped once the configure script begins generated the latter.
-
  :- pred convert_c_compiler_type_simple(string::in, c_compiler_type::out)
      is semidet.

  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("cl",       cc_cl(no)).
  convert_c_compiler_type_simple("msvc",     cc_cl(no)).
  convert_c_compiler_type_simple("unknown",  cc_unknown).

@@ -449,8 +444,6 @@ convert_c_compiler_type_with_version(CC_Str, C_CompilerType) :-
          convert_gcc_version(Major, Minor, Patch, C_CompilerType)
      ; Tokens = ["clang", Major, Minor, Patch] ->
          convert_clang_version(Major, Minor, Patch, C_CompilerType)
-    ; Tokens = ["cl", Version] ->
-        convert_msvc_version(Version, C_CompilerType)
      ; Tokens = ["msvc", Version] ->
          convert_msvc_version(Version, C_CompilerType)
      ;
diff --git a/configure.ac b/configure.ac
index 973557b..a478283 100644
--- a/configure.ac
+++ b/configure.ac
@@ -174,8 +174,7 @@ case "$mercury_cv_cc_type" in
      msvc)
          MERCURY_HAVE_MSVC=yes
          MERCURY_MSVC_VERSION
-        # XXX For historical reasons msvc is identified as "cl".
-        C_COMPILER_TYPE="cl_${mercury_cv_msvc_version}"
+        C_COMPILER_TYPE="msvc_${mercury_cv_msvc_version}"
      ;;

      *)
diff --git a/scripts/mgnuc.in b/scripts/mgnuc.in
index b9d0310..aafebcf 100644
--- a/scripts/mgnuc.in
+++ b/scripts/mgnuc.in
@@ -80,7 +80,7 @@ case "$C_COMPILER_TYPE" in
          DISABLE_OPTS_OPT="-O0"
          COMPILER=clang
          ;;
-    msvc*|cl*)
+    msvc*)
          ANSI_OPTS=""
          CHECK_OPTS="-nologo"    # Suppress the MSVC banner message.
          OPT_OPTS=""



More information about the reviews mailing list