@@ -80,15 +80,11 @@ package body Instrument.C is
8080 type Macro_Set_Cst_Access is access constant Macro_Set;
8181
8282 function Builtin_Macros
83- (Lang, Compiler, Std, Output_Dir : String) return Macro_Set_Cst_Access;
84- -- Return the list of built-in macros for the given compiler, standard and
85- -- language. Output_Dir is used to store a temporary file.
86- --
87- -- Note that we could generate a fully-fledged preprocessor configuration
88- -- (the standard macros + the command-line defined macros with an
89- -- additional argument there), but it is more convenient to cache the
90- -- "light" preprocessor configuration that is determined by the compiler,
91- -- language and standard only.
83+ (Lang, Compiler, Output_Dir : String;
84+ Compiler_Switches : String_Vectors.Vector) return Macro_Set_Cst_Access;
85+ -- Return the list of built-in macros for the given compiler, language and
86+ -- according to the compiler switches. Output_Dir is used to store a
87+ -- temporary file.
9288
9389 procedure Preprocess_Source
9490 (Filename : String;
@@ -2524,16 +2520,15 @@ package body Instrument.C is
25242520 -- ------------------
25252521
25262522 function Builtin_Macros
2527- (Lang, Compiler, Std, Output_Dir : String) return Macro_Set_Cst_Access
2523+ (Lang, Compiler, Output_Dir : String;
2524+ Compiler_Switches : String_Vectors.Vector) return Macro_Set_Cst_Access
25282525 is
25292526 use Ada.Characters.Handling;
25302527
25312528 PID : constant Unsigned_64 :=
25322529 Unsigned_64 (Pid_To_Integer (Current_Process_Id));
25332530
25342531 L : constant String := To_Lower (Lang);
2535- Key : constant Unbounded_String :=
2536- +Compiler & " -x " & L & " " & Std;
25372532 Result : constant Macro_Set_Access := new Macro_Set;
25382533
25392534 Args : String_Vectors.Vector;
@@ -2549,18 +2544,15 @@ package body Instrument.C is
25492544
25502545 Args.Append (+" -x" );
25512546 Args.Append (+L);
2552- if Std'Length /= 0 then
2553- Args.Append (+Std);
2554- end if ;
2547+ Args.Append (Compiler_Switches);
25552548 Args.Append (+" -E" );
25562549 Args.Append (+" -dM" );
25572550 Args.Append (+" -" );
25582551
25592552 Run_Command
25602553 (Command => Compiler,
25612554 Arguments => Args,
2562- Origin_Command_Name =>
2563- " getting built-in macros for " & (+Key),
2555+ Origin_Command_Name => " gnatcov instrument" ,
25642556 Output_File => Filename,
25652557 In_To_Null => True);
25662558
@@ -4532,8 +4524,8 @@ package body Instrument.C is
45324524 Builtin_Macros
45334525 (Image (C_Family_Language (Instrumenter.Language)),
45344526 +Prj.Compiler_Driver (Instrumenter.Language),
4535- +Self.Std ,
4536- +Prj.Output_Dir ).all ;
4527+ +Prj.Output_Dir ,
4528+ Self.Compiler_Switches ).all ;
45374529 end Import_Options ;
45384530
45394531 -- -------------------------
0 commit comments