Update of "gcc" compiler doesn't take- Bug?

Help
2004-12-28
2013-04-24
  • Austin Hastings

    Austin Hastings - 2004-12-28

    I added a <compiler name="gcc"> ... </> block at the global level of my antfile.

    This block contained compilerargs like -Werror.

    When I run a cc task with
    <cc name="gcc"> ... </>

    the compilerargs don't appear.

    The cc block has no compiler entry in it whatsoever -- I rely on the external update and the name link.

    When I change the blocks to:

    <compiler id="Linux_gcc"> ...</>
    <cc>
      <compiler refid="Linux_gcc" />
    </>

    then the compilerargs take.

    I think that one of these two behaviors is buggy. Either my update to the 'name="gcc"' entry should become the global standard for gcc'ing (what I want), or I should get an error message telling me that my changes will be ignored.

    Comment?

    =Austin

     
    • Curt Arnold

      Curt Arnold - 2004-12-29

      The behavior is per design (more accurately, per evolution). 

      The name attribute on the <cc> and <compiler> specifies the compiler adapter to be used.  It is independent of the id's used to represent compiler configurations (the compiler adapter, all the compilerargs and other settings) and there has been no attempt to map one set of names to the other.

      Maybe we could warn if you specify a top-level <compiler> without an id attribute, since it would be unusable.  However, it may not be easy to detect that it is defined at the top-level.

       
      • Austin Hastings

        Austin Hastings - 2004-12-29

        I think that it would probably be better to DWIM, rather than warning.

        In particular, since the list of "name=" values is fixed I think any project-level <compiler> entry without an id= attribute should modify the defaults for that named compiler.

        Thus:

        <compiler>
          <!-- defaults get updated -->
        </compiler>

        <target>
          <cc />
        </task>

        <target>
          <cc />
        </target>

        =Austin

         

Log in to post a comment.