[m-rev.] for review: add --c-compiler-type option
Julien Fischer
juliensf at csse.unimelb.edu.au
Mon Jan 21 23:10:35 AEDT 2008
Estimated hours taken: 0.5
Branches: main
Add a new internal option, `--c-compiler-type', that allows the type of the C
compiler to be specified, e.g. gcc, lcc etc. This information will be set by
the configuration script and can be used for enabling or disabling C compiler
specific optimisation flags with mmc --make. (We have such a facility with
mmake, via the mgnuc script, but not with mmc --make.)
This diff just makes the compiler recognise the new option; I will add the
rest after this change has bootstrapped on our machines.
compiler/options.m:
Add the new option.
Julien.
Index: options.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/options.m,v
retrieving revision 1.608
diff -u -r1.608 options.m
--- options.m 30 Dec 2007 08:23:52 -0000 1.608
+++ options.m 21 Jan 2008 11:51:55 -0000
@@ -711,6 +711,8 @@
; object_file_extension
; pic_object_file_extension
; link_with_pic_object_file_extension
+ ; c_compiler_type_special
+ ; c_compiler_type
% Java
; java_compiler
@@ -1502,7 +1504,11 @@
object_file_extension - string(".o"),
pic_object_file_extension - string(".o"),
link_with_pic_object_file_extension - string(".o"),
-
+ c_compiler_type_special - string_special,
+ c_compiler_type - string("gcc"),
+ % The `mmc' script will override the
+ % default with a value determined at
+ % configuration time.
% Java
java_compiler - string("javac"),
java_interpreter - string("java"),
@@ -2345,6 +2351,8 @@
long_option("pic-object-file-extension", pic_object_file_extension).
long_option("link-with-pic-object-file-extension",
link_with_pic_object_file_extension).
+long_option("c-compiler-type", c_compiler_type_special).
+
long_option("java-compiler", java_compiler).
long_option("javac", java_compiler).
@@ -2722,6 +2730,13 @@
Result = error("argument of `--mercury-linkage' should be either " ++
"""shared"" or ""static"".")
).
+special_handler(c_compiler_type_special, string(Flag), OptionTable0, Result) :-
+ ( ( Flag = "gcc" ; Flag = "lcc" ; Flag = "cl" ; Flag = "unknown" ) ->
+ Result = ok(OptionTable0 ^ elem(c_compiler_type) := string(Flag))
+ ;
+ Result = error("argument of `--c-compiler-type' should be one of " ++
+ """gcc"", ""lcc"", ""cl"" or ""unknown"".")
+ ).
%-----------------------------------------------------------------------------%
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to: mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions: mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the reviews
mailing list