From 5ba25e22bc28005a5b8893d546eba5606898667c Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Sun, 4 Sep 2022 19:15:10 +0200 Subject: Support the `-std=` option (#456) It has two effects: - With a GNU toolchain, it's passed down to the preprocessor. This influences the contents of standard includes. - It determines the default effect of the "C11 feature" warning: -std=c99: warn on the use of C11 features -std=c11 or -std=c18: don't warn For backward compatiblity, the default, if no `-std` option is given, is to not warn, but to pass `-std=c99` to the preprocessor. Co-authored-by: Bernhard Schommer --- driver/Frontend.ml | 3 +++ 1 file changed, 3 insertions(+) (limited to 'driver/Frontend.ml') diff --git a/driver/Frontend.ml b/driver/Frontend.ml index 4ee5c712..5d45306d 100644 --- a/driver/Frontend.ml +++ b/driver/Frontend.ml @@ -57,6 +57,9 @@ let preprocess ifile ofile = if ofile = "-" then None else Some ofile in let cmd = List.concat [ Configuration.prepro; + (if Configuration.gnu_toolchain + then ["-std=" ^ !option_std] + else []); predefined_macros; (if !Clflags.use_standard_headers then ["-I" ^ Filename.concat !Clflags.stdlib_path "include" ] -- cgit