diff --git a/Changes b/Changes index 05f48b554..58533169a 100644 --- a/Changes +++ b/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) diff --git a/Makefile.config.in b/Makefile.config.in index 64fcc4573..63868b6aa 100644 --- a/Makefile.config.in +++ b/Makefile.config.in @@ -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@ diff --git a/configure b/configure index d61baaeff..f1f36b087 100755 --- a/configure +++ b/configure @@ -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 diff --git a/configure.ac b/configure.ac index 32bbf1d5f..b2eddf3d4 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/ocamltest/Makefile b/ocamltest/Makefile index ea8c234a0..c3b514801 100644 --- a/ocamltest/Makefile +++ b/ocamltest/Makefile @@ -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)|' \ diff --git a/ocamltest/ocaml_actions.ml b/ocamltest/ocaml_actions.ml index 71c71be98..1d535962d 100644 --- a/ocamltest/ocaml_actions.ml +++ b/ocamltest/ocaml_actions.ml @@ -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 diff --git a/ocamltest/ocaml_variables.ml b/ocamltest/ocaml_variables.ml index 75f5d329a..c5f26299b 100644 --- a/ocamltest/ocaml_variables.ml +++ b/ocamltest/ocaml_variables.ml @@ -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; diff --git a/ocamltest/ocaml_variables.mli b/ocamltest/ocaml_variables.mli index 5bf3d8687..c0b75154f 100644 --- a/ocamltest/ocaml_variables.mli +++ b/ocamltest/ocaml_variables.mli @@ -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 diff --git a/testsuite/tests/basic/constprop.ml b/testsuite/tests/basic/constprop.ml.c similarity index 96% rename from testsuite/tests/basic/constprop.ml rename to testsuite/tests/basic/constprop.ml.c index c89b18249..ee23d4899 100644 --- a/testsuite/tests/basic/constprop.ml +++ b/testsuite/tests/basic/constprop.ml.c @@ -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 diff --git a/testsuite/tests/basic/constprop.reference b/testsuite/tests/basic/constprop.ml.reference similarity index 100% rename from testsuite/tests/basic/constprop.reference rename to testsuite/tests/basic/constprop.ml.reference diff --git a/testsuite/tests/basic/ocamltests b/testsuite/tests/basic/ocamltests index 9b5734e65..8142a2b34 100644 --- a/testsuite/tests/basic/ocamltests +++ b/testsuite/tests/basic/ocamltests @@ -1,7 +1,7 @@ arrays.ml bigints.ml boxedints.ml -constprop.ml +constprop.ml.c divint.ml equality.ml eval_order_1.ml