[erlang-patches] [PATCH 2/3] hipe: Do not auto-import min/2 and max/2

Mikael Pettersson <>
Sun Sep 12 23:20:29 CEST 2010

Tuncer Ayaz writes:
 > On Sun, Sep 12, 2010 at 7:37 PM, Mikael Pettersson wrote:
 > > Tuncer Ayaz writes:
 > >  > Resolve name clash with auto-imported BIFs min/2 and max/2.
 > [...]
 > > What is the consequence of this name clash?  Is it a recent problem?
 > >
 > > I've not heard anything about this causing build failures.
 > This is a new warning generated since R14:
 > ./hipe_icode_type.erl:81: Warning: import directive overrides
 > auto-imported BIF max/2 - use "-compile({no_auto_import,[max/2]})." to
 > resolve name clash
 > ./hipe_icode_type.erl:81: Warning: import directive overrides
 > auto-imported BIF min/2 - use "-compile({no_auto_import,[min/2]})." to
 > resolve name clash
 > lib/hipe/cerl/erl_types.erl exports [min/2,max/2] and has the same
 > compiler directive already in place:
 > -compile({no_auto_import,[min/2,max/2]}).
 > > Personally I'd rather rename the local min/max functions or,
 > > if they're compatible with the standard ones, just delete them.
 > > no_auto_import seems like a kludge...
 > Yes, a rename is better than telling the compiler what to ignore.
 > What about a patch to replace the import with fully qualified calls?
 > Or do you prefer a rename patch?

I initially thought that these min/max functions were local
function similar to the erlang ones (they didn't use to be
standard so we used to have to duplicate them), but the issue
in hipe_icode_type is that it explicitly imports min/max from
erl_types, and that explicit import triggers a warning due to
the newish auto-import from erlang.

Given that I think your initial no_auto_import patch is Ok.

Sorry about the confusion.

More information about the erlang-patches mailing list