From dcd4d82b67c250987b17f61043d764d446ed00e3 Mon Sep 17 00:00:00 2001 From: Patrik Nyblom Date: Fri, 28 May 2010 18:10:25 +0200 Subject: Add -compile({no_auto_import,[F/A]}) doc to compiler.xml --- lib/compiler/doc/src/compile.xml | 74 ++++++++++++++++++++++++++++++---------- 1 file changed, 56 insertions(+), 18 deletions(-) (limited to 'lib/compiler') diff --git a/lib/compiler/doc/src/compile.xml b/lib/compiler/doc/src/compile.xml index bbd3f1043d..3a70f6277b 100644 --- a/lib/compiler/doc/src/compile.xml +++ b/lib/compiler/doc/src/compile.xml @@ -310,6 +310,23 @@ (there will not even be a warning if there is a mismatch).

+ {no_auto_import,[F/A, ...]} + +

Makes the function F/A no longer beeing + auto-imported from the module erlang, which resolves + BIF name clashes. This option has to be used to resolve name + clashes with BIFs auto-imported before R14A, if one wants to + call the local function with the same name as an + auto-imported BIF without module prefix.

+ +

From R14A and forward, the compiler resolves calls + without module prefix to local or imported functions before + trying auto-imported BIFs. If the BIF is to be + called, use the erlang module prefix in the call, not + { no_auto_import,[F/A, ...]}

+
+
+

If warnings are turned on (the report_warnings option @@ -338,21 +355,37 @@ nowarn_bif_clash -

By default, there will be a compilation error if a - module contains an exported function with the same name - as an auto-imported BIF (such as size/1) AND - there is a call to it without a qualifying module name. - The reason is that the BIF will be called, not - the function in the same module. The recommended way to - eliminate that warning is to use a call with a module - name - either erlang to call the BIF or - ?MODULE to call the function in the same module. - The warning can also be turned off using this option, - but that is not recommended.

- -

The use of this option is strongly discouraged, - as code that uses it will probably break in a future - major release (R14 or R15).

+

By default, the compiler will issue an error or warning + when replacing an auto-imported BIF. For local functions + having names clashing with an auto-imported BIF, the error + or warning is issued whenever it is called without using a + module prefix. For explicitly imported functions, the + error or warning will be issued as soon as it's imported + (regardless of calls). If the auto-imported BIF was present + before OTP R14A it will be a fatal error to override it, + otherwise only a warning will be issued.

+ + +

Beginning with R14A, the compiler no longer calls the + auto-imported BIF if the name clashes with a local or + explicitly imported function and a call without explicit + module name is issued. Instead the local or imported + function is called. Use of nowarn_bif_clash makes a + module calling functions clashing with autoimported BIFs + compile with both the old and new compilers, but with + completely different semantics, why a warning is always + issued if any code uses this option.

+ +

The use of this option has always been strongly discouraged. + From OTP R14A and forward it's also deprecated.

+

The only module who actually could have some legitimate use for + this option is the module erlang, which in + itself contains auto-imported functions, other modules + should never use it.

+

To resolve BIF clashes, use explicit module names or the + {no_auto_import,[F/A]} directive.

+

nowarn_bif_clash will be removed in a future release.

+
{nowarn_bif_clash, FAs} @@ -360,9 +393,14 @@

Turns off warnings as nowarn_bif_clash but only for the mentioned local functions. FAs is a tuple {Name,Arity} or a list of such tuples.

-

The use of this option is strongly discouraged, - as code that uses it will probably break in a future - major release (R14 or R15).

+ +

The use of this option has always been strongly discouraged. + From OTP R14A and forward it's also deprecated and a warning will be issued + whenever it is used.

+

To resolve BIF clashes, use explicit module names or the + {no_auto_import,[F/A]} directive instead.

+

nowarn_bif_clash will be removed in a future release.

+
warn_export_all -- cgit v1.2.3