Get rid of the direct call to the C preprocessor in the testsuite (#8528)
Call the C preprocessor through the C compiler rather than calling it directly. This required the definition of a new ocamltest variable, ocaml_filetype_flag, which makes it possible to override the filetype inferred by the compiler from the extnesion of the source file.master
parent
58ef7303bb
commit
b56c4ff3d0
3
Changes
3
Changes
|
@ -707,6 +707,9 @@ OCaml 4.08.0
|
|||
- GPR#2295: Restore support for bytecode target XLC/AIX/Power
|
||||
(Konstantin Romanov, review by Sébastien Hinderer and David Allsopp)
|
||||
|
||||
- GPR#8528: get rid of the direct call to the C preprocessor in the testsuite
|
||||
(Sébastien Hinderer, review by David Allsopp)
|
||||
|
||||
* GPR#8533: Remove some unused configure tests
|
||||
(Stephen Dolan, review by David Allsopp and Sébastien Hinderer)
|
||||
|
||||
|
|
|
@ -76,10 +76,6 @@ OC_LDFLAGS=@oc_ldflags@
|
|||
### How to invoke the C preprocessor through the C compiler
|
||||
CPP=@CPP@
|
||||
|
||||
### How to invoke the C preprocessor directly, just to expand macros
|
||||
### (at the moment this is used only in one test in the testsuite)
|
||||
DIRECT_CPP=@DIRECT_CPP@
|
||||
|
||||
### How to invoke ranlib
|
||||
RANLIB=@RANLIB@
|
||||
RANLIBCMD=@RANLIBCMD@
|
||||
|
|
|
@ -12209,101 +12209,9 @@ esac
|
|||
# manually to make sure the backward compatibility is preserved
|
||||
case $host in #(
|
||||
*-pc-windows) :
|
||||
DIRECT_CPP="$CC -nologo -EP";
|
||||
CPP="$DIRECT_CPP" ;; #(
|
||||
CPP="$CC -nologo -EP" ;; #(
|
||||
*) :
|
||||
if test -n "$ac_tool_prefix"; then
|
||||
# Extract the first word of "${ac_tool_prefix}cpp", so it can be a program name with args.
|
||||
set dummy ${ac_tool_prefix}cpp; ac_word=$2
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
|
||||
$as_echo_n "checking for $ac_word... " >&6; }
|
||||
if ${ac_cv_prog_DIRECT_CPP+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
if test -n "$DIRECT_CPP"; then
|
||||
ac_cv_prog_DIRECT_CPP="$DIRECT_CPP" # Let the user override the test.
|
||||
else
|
||||
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
|
||||
for as_dir in $PATH
|
||||
do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
||||
ac_cv_prog_DIRECT_CPP="${ac_tool_prefix}cpp"
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
IFS=$as_save_IFS
|
||||
|
||||
fi
|
||||
fi
|
||||
DIRECT_CPP=$ac_cv_prog_DIRECT_CPP
|
||||
if test -n "$DIRECT_CPP"; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $DIRECT_CPP" >&5
|
||||
$as_echo "$DIRECT_CPP" >&6; }
|
||||
else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
$as_echo "no" >&6; }
|
||||
fi
|
||||
|
||||
|
||||
fi
|
||||
if test -z "$ac_cv_prog_DIRECT_CPP"; then
|
||||
ac_ct_DIRECT_CPP=$DIRECT_CPP
|
||||
# Extract the first word of "cpp", so it can be a program name with args.
|
||||
set dummy cpp; ac_word=$2
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
|
||||
$as_echo_n "checking for $ac_word... " >&6; }
|
||||
if ${ac_cv_prog_ac_ct_DIRECT_CPP+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
if test -n "$ac_ct_DIRECT_CPP"; then
|
||||
ac_cv_prog_ac_ct_DIRECT_CPP="$ac_ct_DIRECT_CPP" # Let the user override the test.
|
||||
else
|
||||
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
|
||||
for as_dir in $PATH
|
||||
do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
||||
ac_cv_prog_ac_ct_DIRECT_CPP="cpp"
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
IFS=$as_save_IFS
|
||||
|
||||
fi
|
||||
fi
|
||||
ac_ct_DIRECT_CPP=$ac_cv_prog_ac_ct_DIRECT_CPP
|
||||
if test -n "$ac_ct_DIRECT_CPP"; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DIRECT_CPP" >&5
|
||||
$as_echo "$ac_ct_DIRECT_CPP" >&6; }
|
||||
else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
$as_echo "no" >&6; }
|
||||
fi
|
||||
|
||||
if test "x$ac_ct_DIRECT_CPP" = x; then
|
||||
DIRECT_CPP=""
|
||||
else
|
||||
case $cross_compiling:$ac_tool_warned in
|
||||
yes:)
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
|
||||
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
|
||||
ac_tool_warned=yes ;;
|
||||
esac
|
||||
DIRECT_CPP=$ac_ct_DIRECT_CPP
|
||||
fi
|
||||
else
|
||||
DIRECT_CPP="$ac_cv_prog_DIRECT_CPP"
|
||||
fi
|
||||
;;
|
||||
;;
|
||||
esac
|
||||
|
||||
# Libraries to build depending on the host
|
||||
|
|
|
@ -415,9 +415,7 @@ AS_CASE([$host],
|
|||
# manually to make sure the backward compatibility is preserved
|
||||
AS_CASE([$host],
|
||||
[*-pc-windows],
|
||||
[DIRECT_CPP="$CC -nologo -EP";
|
||||
CPP="$DIRECT_CPP"],
|
||||
[AC_CHECK_TOOL([DIRECT_CPP],[cpp])])
|
||||
[CPP="$CC -nologo -EP"])
|
||||
|
||||
# Libraries to build depending on the host
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ else
|
|||
endif
|
||||
|
||||
ifeq "$(TOOLCHAIN)" "msvc"
|
||||
DIRECT_CPP := $(DIRECT_CPP) 2> nul
|
||||
CPP := $(CPP) 2> nul
|
||||
CSC := csc
|
||||
ifeq "$(HOST)" "i686-pc-windows"
|
||||
CSCFLAGS := /platform:x86
|
||||
|
@ -232,7 +232,7 @@ ocamltest_config.ml: ocamltest_config.ml.in Makefile ../Makefile.config
|
|||
-e 's|@@SYSTHREADS@@|$(systhreads)|' \
|
||||
-e 's|@@STR@@|$(str)|' \
|
||||
-e 's|@@SYSTEM@@|$(SYSTEM)|' \
|
||||
-e 's|@@CPP@@|$(DIRECT_CPP)|' \
|
||||
-e 's|@@CPP@@|$(CPP)|' \
|
||||
-e 's|@@OCAMLCDEFAULTFLAGS@@|$(ocamlcdefaultflags)|' \
|
||||
-e 's|@@OCAMLOPTDEFAULTFLAGS@@|$(ocamloptdefaultflags)|' \
|
||||
-e 's|@@OCAMLSRCDIR@@|$(ocamlsrcdir)|' \
|
||||
|
|
|
@ -262,6 +262,7 @@ let compile_program ocamlsrcdir (compiler : Ocaml_compilers.compiler) log env =
|
|||
backend_flags env compiler#target;
|
||||
compile_flags;
|
||||
output;
|
||||
(Environments.safe_lookup Ocaml_variables.ocaml_filetype_flag env);
|
||||
module_names;
|
||||
last_flags env
|
||||
] in
|
||||
|
|
|
@ -149,6 +149,9 @@ let ocamlyacc_flags = make ("ocamlyacc_flags",
|
|||
let ocaml_exit_status = make ("ocaml_exit_status",
|
||||
"Expected exit status of ocaml")
|
||||
|
||||
let ocaml_filetype_flag = make ("ocaml_filetype_flag",
|
||||
"Filetype of the testfile (-impl, -intf, etc.)")
|
||||
|
||||
let ocamlc_byte_exit_status = make ("ocamlc_byte_exit_status",
|
||||
"Expected exit status of ocac.byte")
|
||||
|
||||
|
@ -255,6 +258,7 @@ let _ = List.iter register_variable
|
|||
ocamlopt_flags;
|
||||
ocamlopt_default_flags;
|
||||
ocaml_exit_status;
|
||||
ocaml_filetype_flag;
|
||||
ocamlc_byte_exit_status;
|
||||
ocamlopt_byte_exit_status;
|
||||
ocamlnat_exit_status;
|
||||
|
|
|
@ -89,6 +89,8 @@ val ocamlyacc_flags : Variables.t
|
|||
|
||||
val ocaml_exit_status : Variables.t
|
||||
|
||||
val ocaml_filetype_flag : Variables.t
|
||||
|
||||
val ocamlc_byte_exit_status : Variables.t
|
||||
|
||||
val ocamlopt_byte_exit_status : Variables.t
|
||||
|
|
|
@ -1,10 +1,16 @@
|
|||
(* TEST
|
||||
flags = "-pp '${c_preprocessor}'"
|
||||
ocaml_filetype_flag = "-impl"
|
||||
* bytecode
|
||||
compare_programs = "false"
|
||||
* native
|
||||
*)
|
||||
|
||||
(* This file has extension .ml.c because it needs to be preprocessed
|
||||
by the C preprocessor, which requires a .c extension when called
|
||||
through the C compiler
|
||||
*)
|
||||
|
||||
(* Test constant propagation through inlining *)
|
||||
|
||||
(* constprop.ml is generated from constprop.mlp using
|
|
@ -1,7 +1,7 @@
|
|||
arrays.ml
|
||||
bigints.ml
|
||||
boxedints.ml
|
||||
constprop.ml
|
||||
constprop.ml.c
|
||||
divint.ml
|
||||
equality.ml
|
||||
eval_order_1.ml
|
||||
|
|
Loading…
Reference in New Issue