Skip to content

Commit

Permalink
Remove remaining MSVC things
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-schwarz committed Nov 28, 2021
1 parent bf79f1b commit b01b404
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 108 deletions.
10 changes: 0 additions & 10 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ $(CILLY): $(CILLY_EXE_BIN) $(CILLYDIR)/Makefile
$(MAKE) -C $(CILLYDIR)

# Create the machine dependency module
# If the cl command cannot be run then the MSVC part will be identical to GCC
.PHONY : machdep
machdep: $(OBJDIR)/machdep.ml
$(OBJDIR)/machdep.ml : src/machdep-ml.c configure.ac Makefile.in
Expand Down Expand Up @@ -204,15 +203,6 @@ $(OBJDIR)/machdep.ml : src/machdep-ml.c configure.ac Makefile.in
@echo "let gcc = {" >>$@
@$(OBJDIR)/machdep-ml.exe >>$@
@echo "}" >>$@
@if cl -D_MSVC $< -Fe$(OBJDIR)/machdep-ml.exe -Fo$(OBJDIR)/machdep-ml.obj ;then \
echo "let hasMSVC = true" >>$@ ;\
echo "let msvc = {" >>$@ ;\
$(OBJDIR)/machdep-ml.exe >>$@ ;\
echo "}" >>$@ \
;else \
echo "let hasMSVC = false" >>$@ ;\
echo "let msvc = gcc" >> $@ \
;fi
@echo "let theMachine : mach ref = ref gcc" >>$@

$(CILLYDIR)/App/$(CILLYMOD).pm: $(CILLYDIR)/App/$(CILLYMOD).pm.in src/machdep-ml.c configure.ac Makefile.in
Expand Down
1 change: 0 additions & 1 deletion config.mk.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
# A bunch of variables -*- Mode: makefile -*-
export HAS_MSVC=@HAS_MSVC@
export @DEFAULT_COMPILER@=1
4 changes: 0 additions & 4 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,6 @@ CIL_VERSION_MINOR
CIL_VERSION_MAJOR
DEFAULT_CIL_MODE
DEFAULT_COMPILER
HAS_MSVC
EMUL
LIBOBJS
CYGPATH
Expand Down Expand Up @@ -3470,7 +3469,6 @@ test -n "$target_alias" &&
DEFAULT_COMPILER=_GNUCC
DEFAULT_CIL_MODE=GNUCC

HAS_MSVC=no

# ------------------- OCaml ----------------

Expand Down Expand Up @@ -5243,7 +5241,6 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
printf "%s\n" "$THREAD_IS_KEYWORD" >&6; }

# Does gcc add underscores to identifiers to make assembly labels?
# (I think MSVC always does)
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if gcc adds underscores to assembly labels." >&5
printf %s "checking if gcc adds underscores to assembly labels.... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
Expand Down Expand Up @@ -6023,7 +6020,6 @@ printf "%s\n" "$real_type" >&6; }




# finish the configure script and generate various files; ./configure
# will apply variable substitutions to <filename>.in to generate <filename>;

Expand Down
3 changes: 0 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ AC_EXEEXT
DEFAULT_COMPILER=_GNUCC
DEFAULT_CIL_MODE=GNUCC

HAS_MSVC=no

# ------------------- OCaml ----------------

Expand Down Expand Up @@ -136,7 +135,6 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([int main(int __thread) { return 0; }])],
AC_MSG_RESULT($THREAD_IS_KEYWORD)

# Does gcc add underscores to identifiers to make assembly labels?
# (I think MSVC always does)
AC_MSG_CHECKING([if gcc adds underscores to assembly labels.])
AC_LINK_IFELSE([AC_LANG_SOURCE([int main() { __asm__("jmp _main"); }])],
UNDERSCORE_NAME=true,
Expand Down Expand Up @@ -167,7 +165,6 @@ CIL_CHECK_INTEGER_TYPE(wchar_t, TYPE_WCHAR_T)
# names of the variables that get substituted in files; for example,
# write @CIL_VERSION@ somewhere in a written file to get it substituted
AC_SUBST(EMUL)
AC_SUBST(HAS_MSVC)
AC_SUBST(DEFAULT_COMPILER)
AC_SUBST(DEFAULT_CIL_MODE)
AC_SUBST(CIL_VERSION_MAJOR)
Expand Down
61 changes: 16 additions & 45 deletions lib/perl5/patcher
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ options:
--verbose Prints a lot of information about what is being done
--mode=xxx What tool to emulate:
GNUCC - GNU CC
MSVC - MS VC cl compiler
EDG - EDG front end
--dest=xxx The destination directory. Will make one if it does not exist
Expand All @@ -77,9 +76,6 @@ options:
--clean Remove all files in the destination directory
--skipmissing Skip patches for files whose original cannot be found
--stdoutpp For MSVC only, use the "preprocess to stdout" mode. This
is for some versions of MSVC that do not support
well the /P file
--dumpversion Print the version name used for the current compiler
All of the other arguments are passed to the preprocessor.
Expand All @@ -97,7 +93,7 @@ my %option;
(\%option,
"--help", # Display help information
"--verbose|v", # Display information about programs invoked
"--mode=s", # The mode (GNUCC, MSVC)
"--mode=s", # The mode (GNUCC)
"--dest=s", # The destination directory
"--patch=s@", # Patch files
"--ufile=s@", # User include files
Expand Down Expand Up @@ -204,44 +200,30 @@ exit $hadError;
sub findCompilerVersion {
$cname = "";
$cversion = 0;
if($option{mode} eq "GNUCC") {
$cname = "GNU CC";
open(VER, "$::cc -dumpversion $ppargs|")
|| die "Cannot start $cname";
while(<VER>) {
# sm: had to modify this to match "egcs-2.91.66", which is
# how egcs responds to the -dumpversion request
if($_ =~ m|^(\d+\S+)| ||
$_ =~ m|^(egcs-\d+\S+)|) {
$cversion = "gcc_$1";
close(VER) || die "Cannot start $cname\n";
return;
}
}
die "Cannot find the version for GCC\n";
}
if($option{mode} eq "MSVC") {
$cname = "Microsoft cl";
$ppargs =~ s|/nologo||g;
open(VER, "cl $ppargs 2>&1|") || die "Cannot start $cname: cl $ppargs\n";
while(<VER>) {
if($_ =~ m|Compiler Version (\S+) |) {
$cversion = "cl_$1";
close(VER);
return;
}
$cname = "GNU CC";
open(VER, "$::cc -dumpversion $ppargs|")
|| die "Cannot start $cname";
while(<VER>) {
# sm: had to modify this to match "egcs-2.91.66", which is
# how egcs responds to the -dumpversion request
if($_ =~ m|^(\d+\S+)| ||
$_ =~ m|^(egcs-\d+\S+)|) {
$cversion = "gcc_$1";
close(VER) || die "Cannot start $cname\n";
return;
}
die "Cannot find the version for Microsoft CL\n";
}
die "You must specify a --mode (either GNUCC or MSVC)";
die "Cannot find the version for GCC\n";

die "You must specify a --mode (GNUCC)";
}

sub lineDirective {
my ($fileName, $lineno) = @_;
if($::iswin32) {
$fileName =~ s|\\|/|g;
}
if($option{mode} eq "GNUCC" || $option{mode} eq "MSVC") {
if($option{mode} eq "GNUCC") {
return "#line $lineno \"$fileName\"\n";
}
if($option{mode} eq "EDG") {
Expand Down Expand Up @@ -269,18 +251,7 @@ sub patchOneFile {
# ignore stderr (e.g. #error directives)
$preproccmd .= " 2>/dev/null";
}
} elsif($option{mode} eq "MSVC") {
if($option{stdoutpp}) {
$preproccmd = "cl /nologo /E $ppargs >$preprocfile.i";
} else {
$preproccmd = "cl /nologo /P $ppargs $preprocfile.c";
}
} else { die "Invalid --mode"; }

if(system($preproccmd) && $option{mode} eq "MSVC" ) {
# For some reason the gcc returns spurious error codes
die "Error running preprocessor: $preproccmd"
}

# Now scan the resulting file and get the real name of the file
my $absname = "";
Expand Down
3 changes: 1 addition & 2 deletions src/cil.ml
Original file line number Diff line number Diff line change
Expand Up @@ -672,8 +672,7 @@ and init =
* initializers; the rest are 0-initialized.
* For unions there must be exactly one initializer. If
* the initializer is not for the first field then a field
* designator is printed, so you better be on GCC since MSVC does
* not understand this. You can scan an initializer list with
* designator is printed. You can scan an initializer list with
* {!Cil.foldLeftCompound}. *)

(** We want to be able to update an initializer in a global variable, so we
Expand Down
2 changes: 1 addition & 1 deletion src/cil.mli
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,7 @@ and init =
* bitfields), in the proper order. This is necessary since the offsets
* are not printed. For unions there must be exactly one initializer. If
* the initializer is not for the first field then a field designator is
* printed, so you better be on GCC since MSVC does not understand this.
* printed.
* For arrays, however, we allow you to give only a prefix of the
* initializers. You can scan an initializer list with
* {!Cil.foldLeftCompound}. *)
Expand Down
42 changes: 0 additions & 42 deletions test/Makefile.msvc

This file was deleted.

0 comments on commit b01b404

Please sign in to comment.