yaml / AdaYaml

experimental YAML 1.3 implementation in Ada
https://ada.yaml.io/
MIT License
37 stars 6 forks source link

Question: Why is compiler package on yaml.gpr defined as it is? #17

Open pjljvandelaar opened 2 years ago

pjljvandelaar commented 2 years ago

In yaml.gpr I read

package Compiler is
      for Default_Switches ("ada") use
        ("-gnat12", "-gnatwa", "-gnatwl", "-gnata",  "-gnaty3abcefhiklmNprt", "-fstack-check");

      case Mode is
      when "debug" =>
         for Default_Switches ("ada") use Compiler'Default_Switches ("ada") &
         ("-gnata", "-gnateE", "-E",  "-g");
      when "release" =>
         for Default_Switches ("ada") use
           ("-O3" );
      end case;
   end Compiler;

Why does the release alternative on https://github.com/yaml/AdaYaml/blob/b972e88f66fc664dd77c91cf230bbb8f2d0e2ece/yaml.gpr#L40 not contain Compiler'Default_Switches ("ada") &?

If it is done on purpose, why isn't it written as

package Compiler is
      case Mode is
      when "debug" =>
         for Default_Switches ("ada") use 
        ("-gnat12", "-gnatwa", "-gnatwl", "-gnata",  "-gnaty3abcefhiklmNprt", "-fstack-check")  &
         ("-gnata", "-gnateE", "-E",  "-g");
      when "release" =>
         for Default_Switches ("ada") use
           ("-O3" );
      end case;
   end Compiler;

Thanks in advance for your explanation.

pjljvandelaar commented 2 years ago

In addition: why is the flag "-gnata" that is already present in

 for Default_Switches ("ada") use
        ("-gnat12", "-gnatwa", "-gnatwl", "-gnata",  "-gnaty3abcefhiklmNprt", "-fstack-check");

added again in the debug mode

when "debug" =>
         for Default_Switches ("ada") use Compiler'Default_Switches ("ada") &
         ("-gnata", "-gnateE", "-E",  "-g");
pjljvandelaar commented 2 years ago

In addition, why is -E offered to the compiler while it is an option of the Binder?

flyx commented 2 years ago

The answer to these questions is that I was sloppy when reviewing #12 and let this slip because it worked. You're welcome to make a PR improving this :).

persan commented 2 years ago

To continue with flyx view on life, it was sloppy review before the pull request since the project-files wasn't the prioritized.