[m-rev.] for post-commit review: get tools/make_optimization_options to update compiler/options.m

Julien Fischer jfischer at opturion.com
Fri Aug 18 21:21:43 AEST 2023


On Fri, 18 Aug 2023, Zoltan Somogyi wrote:

> Make tools/make_optimization_options update options.m.
> 
> tools/make_optimization_options:
>     Instead of generating a file to be manually copied into the middle
>     of compiler/options.m, do that update automatically.
> 
> compiler/options.m:
>     Mark both ends of the region whose contents are controlled by
>     tools/make_optimization_options.

...

> diff --git a/tools/make_optimization_options b/tools/make_optimization_options
> index 3eb753240..f97140187 100755
> --- a/tools/make_optimization_options
> +++ b/tools/make_optimization_options
> @@ -12,9 +12,10 @@
>  # respectively, while the middle is generated by
>  # make_optimization_options_middle from make_optimization_options_db.
>  #
> -# make_optimization_options_middle also generates handler_file,
> -# which is a code fragment that is intended to comprise part of
> -# the code of the special_handler predicate in compiler/options.m.
> +# make_optimization_options_middle also reconstructs the contents of
> +# compiler/options.m. Specifically, it rewrites the part between two markers,
> +# INCLUDE_HANDLER_FILE_START and INCLUDE_HANDLER_FILE_END, which contains
> +# the code handling the bool_special, int_special etc optimization options.
>  #
>
>  if test -f ../compiler/optimization_options.m
> @@ -22,6 +23,8 @@ then
>      chmod u+w ../compiler/optimization_options.m
>  fi
> 
> +/bin/rm .options_init .options_final handler_file > /dev/null 2>&1

Any reason not to just use rm -f there?

> +
>  (
>  cat make_optimization_options_start;
>  awk -f make_optimization_options_middle make_optimization_options_db;
> @@ -29,3 +32,13 @@ cat make_optimization_options_end
>  ) > ../compiler/optimization_options.m
>
>  chmod a-w ../compiler/optimization_options.m
> +
> +sed -e '1,/INCLUDE_HANDLER_FILE_START/w .options_init' \
> +    < ../compiler/options.m > /dev/null 2>&1
> +sed -e '/INCLUDE_HANDLER_FILE_END/,$w .options_final' \
> +    < ../compiler/options.m > /dev/null 2>&1
> +# The invocation of make_optimization_options_middle above
> +# creates handler_file
> +cat .options_init handler_file .options_final > .new_options.m
> +mv -f .new_options.m ../compiler/options.m
> +/bin/rm .options_init .options_final handler_file > /dev/null 2>&1

Ditto.

That looks fine otherwise.

Julien.


More information about the reviews mailing list