-
Notifications
You must be signed in to change notification settings - Fork 464
Description
The present situation
In order to make things clearer I tried to retrace the processing of the C compilation flags, here is what I got:
(you can click to enlarge the image)
Please tell me if I forgot something or misunderstood part of it.
What is wrong
ocamlc_cflagscan end duplicated in the compiler command-line (if:standardwas passed all the way down)- Dune silently adds
ocamlc_cflags + ocamlc_cppflagsto the command line making the:standardset of flagsSC.default_c_cxx_flagsirrelevant. This was unavoidable before because dune was callingocamlcto compile C code. - The CC variable will always miss the
ocamlc_cppflagsand sometimes theocamlc_cflagsif the standard value was discarded, while these are in fact part of the compiler command line.
Proposition
Stop adding silently the flags from the config. These should be present in the :standard field and the users should be reminded that they need to use :standard when they want to add flags to the default set. This was not possible when dune was calling ocamlc to build C code but it is now that the C compiler is directly summoned.
This would solve the previous problem:
- No more duplication of flags
- The CC variable would really contain the base set of flags used for compiling
- Users will be in total control of the flags set
Of course this change will break some projects in which the :standard set of flags was overridden by the user. So we should add an option to the dune-project file for users that want to use the new system before 3.0.

