aboutsummaryrefslogtreecommitdiffstats
path: root/lib
AgeCommit message (Collapse)Author
2010-06-03Merge branch 'pan/otp_8579_autoimport_override' into devErlang/OTP
* origin/pan/otp_8579_autoimport_override: Update preloaded modules Update primary bootstrap Remove outcommented code from erl_lint Make port_command/3 auto-imported Remove (harmless) warnings about min/max in core applications Autoimport min/2 and max/2 Improve coverage of erl_int in testcases Change warning to error for nowarn_bif_clash compiler directive Add -compile({no_auto_import,[F/A]}) doc to compiler.xml Add some testcases to compiler to verify that overriding really happens Return nowarn_bif_clash functionality but with warning Teach erl_lint to better override BIFs with local functions and imports Teach compiler to override autoimport with import First prototype for local functions overriding autoimported OTP-8579 Local functions should override auto-imported Local and imported functions now override the autoimported BIFs when the names clash. The pre R14 behaviour was that autoimported BIFs would override local functions. To avoid that old programs change behaviour, the following will generate an error: Doing a call without explicit module name to a local function having a name clashing with the name of an autoimported BIF that was present (and autoimported) before OTP R14A Explicitly importing a function having a name clashing with the name of an autoimported BIF that was present (and autoimported) before OTP R14A Using any form of the old compiler directive nowarn_bif_clash If the BIF was added or autoimported in OTP R14A or later, overriding it with an import or a local function will only result in a warning, To resolve clashes, you can either use the explicit module name erlang to call the BIF, or you can remove the autoimport of that specific BIF by using the new compiler directive -compile({no_auto_import,[F/A]})., which makes all calls to the local or imported function without explicit module name pass without warnings or errors. The change makes it possible to add autoimported BIFs without breaking or silently changing old code in the future. However some current code ingeniously utilizing the old behaviour or the nowarn_bif_clash compiler directive, might need changing to be accepted by the compiler.
2010-06-03Merge branch 'pan/otp_8577_re_pattern_doc' into devErlang/OTP
* pan/otp_8577_re_pattern_doc: Add documentation of what part of a re mp() can be used for guard tests OTP-8577 Document re_pattern properties Some properties of a compiled re pattern are defined to allow for guard tests.
2010-06-03Merge branch 'pan/otp_8611_standard_io' into devErlang/OTP
* pan/otp_8611_standard_io: Teach file:write/read/read_line about named io_servers OTP-8611 file:write,read and read_line on named io_device() The file module's functions write,read and read_line now handles named io_servers like 'standard_io' and 'standard_error' correctly.
2010-06-03Merge branch 'pan/otp_3626_win_find_executable' into devErlang/OTP
* pan/otp_3626_win_find_executable: Teach os.erl to find executable names with extension (i.e. .exe) on windows OTP-3626 os:find_executable bug on Windows os:find_executable can now be fed with the complete name of the executable on Windows and still find it. I.e os:find_executable("werl.exe") will work as os:find_executable("werl").
2010-06-03Fixed a bug in the spec which caused dsa parameters to be lost in the ↵Dan Gudmundsson
certificates.
2010-06-02OTP-8529: Raise condition processing repliesMicael Karlberg
2010-06-02OTP-8634: Pending counter raise condition.Micael Karlberg
2010-06-02Remove outcommented code from erl_lintPatrik Nyblom
2010-06-02Make port_command/3 auto-importedPatrik Nyblom
2010-06-02Remove (harmless) warnings about min/max in core applicationsPatrik Nyblom
2010-06-02Autoimport min/2 and max/2Patrik Nyblom
2010-06-02Improve coverage of erl_int in testcasesPatrik Nyblom
2010-06-02Change warning to error for nowarn_bif_clash compiler directivePatrik Nyblom
2010-06-02Add -compile({no_auto_import,[F/A]}) doc to compiler.xmlPatrik Nyblom
2010-06-02Add some testcases to compiler to verify that overriding really happensPatrik Nyblom
2010-06-02Return nowarn_bif_clash functionality but with warningPatrik Nyblom
Wrote and changed some tests in stdlib:erl_lint_SUITE nowarn_bif_clash is obsoleted but will remove warnings and errors about bif clashes. The recommended way is to use no_auto_import directives instead. Hopefully erlang.erl is the only user in the world of nowarn_bif_clash.
2010-06-02Teach erl_lint to better override BIFs with local functions and importsPatrik Nyblom
Added only a few testcases in compiler:error_SUITE and guard_SUITE The new behaviour of warnings and errors when overriding autoimported BIF's: Bifs that were autoimported before R14 are dangerous because old code using them and overriding them in exports can start behaving differently. For newly added autoimports this can't happen to the new code that wants to (or dont want to) use them, why only warnings are added for the BIFs autoimported after the compilator change. Errors are issued only for code that could have worked in one way in R13 and now will behave in a different way. If overriding autoimport with local function: - if explicit -compile directive supresses autoimport -> no message else - if called from inside module - if pre R14 autoimported bif -> error else -> warning else -> no message If overriding autoimport with import directive - if explicit -compile directive supresses autoimport -> no message else (regardless of actual usage) - if pre R14 autoimported bif -> error else -> warning Calls of local functions or imports overriding autoimported functions (either post R14 or by using explicit -compile supressions of autoimport) always goes to the local function or the imported. The compileation errors are added to not let code like this silently and disastrously change its semantic (probably to an infinite loop) between R13 and R14: ---------- -module(m). -export([length/1]). length(X) -> ... Y = length(Z), .... ---------- The user has to select if he/she wants to call length in 'erlang' explicitly or if the overriding semantics is desired, in which case the -compile directive has to be used. -compile({no_auto_import,[F/A]}). Is added to allow to override the autoimports so that code gets unanbiguous. The directive will remove an autoimport even if there is no local function or import overriding, because any other behaviour would be inconsistent and confusing. record_info and module_info can never be overridden.
2010-06-02Teach compiler to override autoimport with importPatrik Nyblom
2010-06-02First prototype for local functions overriding autoimportedPatrik Nyblom
Import directives still not sorted out!
2010-06-02OTP-8664 Erlang parser augmented with operators for integer typesHans Bolinder
Expressions evaluating to integers can now be used in types and function specifications where hitherto only integers were allowed ("Erlang_Integer").
2010-06-02Teach os.erl to find executable names with extension (i.e. .exe) on windowsPatrik Nyblom
2010-06-02Merge branch 'jv/autoimport-binary_to_term_2' into devErlang/OTP
* jv/autoimport-binary_to_term_2: Change binary_to_term/2 to be auto-imported OTP-8671 jv/autoimport-binary_to_term_2 Now, binary_to_term/2 is auto-imported. This will cause a compile warning if and only if a module has got a local function with that name.
2010-06-02Fixing compiler warnings regarding max/2Niclas Eklund
2010-06-02Merge branch 'bg/compiler' into devErlang/OTP
* bg/compiler: beam_peep: Remove optimization already done by beam_dead beam_dead: Combine is_eq_exact instructions into select_val instructions Evaluate is_record/3 at compile-time using type information Evaluate element/2 at compile-time using type information erl_expand_records: Replace is_record() with matching OTP-8668 bg/compiler The compiler optimizes record operations better.
2010-06-02Merge branch 'am/net_kernel_catchall' into devErlang/OTP
* am/net_kernel_catchall: Add catch all handle_call to net_kernel
2010-06-02beam_peep: Remove optimization already done by beam_deadBjörn Gustavsson
2010-06-02beam_dead: Combine is_eq_exact instructions into select_val instructionsBjörn Gustavsson
Combine a sequence of chained is_eq_exact instructions into a select_val instruction.
2010-06-02Evaluate is_record/3 at compile-time using type informationBjörn Gustavsson
2010-06-02Evaluate element/2 at compile-time using type informationBjörn Gustavsson
The erl_expand_records compiler pass translates the following code: h(X) when X#r1.a =:= 1 -> ok. to (essentially): h({r1,V1,V2}=X) when element(2, X) =:= 1 -> ok. Since the guard can only be executed when the pattern matching has succeeded, we know that the second element in the tuple X must have been bound to V2. Thus we can eliminate the call to element/2 like this: h({r1,V1,V2}=X) when V1 =:= 1 -> ok.
2010-06-02erl_expand_records: Replace is_record() with matchingBjörn Gustavsson
The compiler currently generates better code for: f(#r1{}) -> r1; f(#r2{}) -> r2; f(#r3{}) -> r3. than for: g(X) when is_record(X, r1) -> r1; g(X) when is_record(X, r2) -> r2; g(X) when is_record(X, r3) -> r3. The compiler generates good code for pattern matching (as in f/1), but in g/1 there are no patterns to match, and the clause to be executed must be chosen by evaluating the guards sequentially until one succeeds. Make the compiler generate better code by replacing calls to is_record() with matching in the function head (basically, g/1 will automatically be rewritten to do pattern matching as in f/1). Note that this rewrite will also benefit code such as: h(X) when X#r1.a =:= 1 -> ok. because it would have been rewritten to: h(X) when (is_record(X, r1, 3) orelse fail) and (element(2, X) =:= 1) -> ok. which in turn will be rewritten to: h({r1,_,_}=X) when (true orelse fail) and (element(2, X) =:= 1) -> ok. (That will be further simplified in later compiler passes.)
2010-06-02Merge branch 'rn/resolver-leaking-ports' into devErlang/OTP
* rn/resolver-leaking-ports: Resolver: make inet_dns decode ugly truncated reply Resolver: stop inet_res leaking ports OTP-8652 inet_res leaking ports The kernel DNS resolver was leaking one or two ports if the DNS reply could not be parsed or if the resolver(s) caused noconnection type errors. Bug now fixed. A DNS specification borderline truncated reply triggering the port leakage bug has also been fixed.
2010-06-02Add documentation of what part of a re mp() can be used for guard testsPatrik Nyblom
2010-06-01Add catch all handle_call to net_kernelAntonio SJ Musumeci
Of the core networking apps only net_kernel fails to have a catchall for unknown gen_server:call messages causing it to exit and eventually bring down kernal_sup and beam if it had not been manually started. For stability and consistancy it has been altered to include a catchall which does not reply.
2010-06-01Teach file:write/read/read_line about named io_serversPatrik Nyblom
2010-06-01Merge branch 'dgud/emacs-catch-improvements' into devErlang/OTP
* dgud/emacs-catch-improvements: Improved indentation of old catch. Added more type highlighting and fixed record indentation with types.
2010-06-01Merge branch 'kj/emacs-erlang-flymake' into devErlang/OTP
* kj/emacs-erlang-flymake: erlang-flymake: Document in README erlang-flymake: Make the syntax check command configurable erlang-flymake: By default pass <app>/include and <app>/ebin to compiler erlang-flymake: Include in Makefile erlang-flymake: Syntax check erlang code on the fly (using flymake)
2010-06-01OTP-8643 Improvements of net_kernelHans Bolinder
Under certain circumstances the net kernel could hang. (Thanks to Scott Lystig Fritchie.)
2010-06-01Merge branch 'bg/dist_utils' into devErlang/OTP
* bg/dist_utils: dist_utils: Eliminate crash when list_to_existing_atom/1 fails
2010-06-01Improved indentation of old catch.Dan Gudmundsson
An example that didn't work previously. case Foo of {ok, X} -> ok; _ -> catch file:close(FD) end.
2010-06-01Added more type highlighting and fixed record indentation with types.Dan Gudmundsson
Type highlighting reported by Jay Nelson non_neg_integer() will highlight purple but pos_integer() does not. Closing record indentation problem reported by Maxim Treskin: -record(state, { sequence_number = 1 :: integer() }).
2010-06-01erlang-flymake: Document in READMEKlas Johansson
2010-06-01erlang-flymake: Make the syntax check command configurableKlas Johansson
2010-06-01erlang-flymake: By default pass <app>/include and <app>/ebin to compilerKlas Johansson
Hopefully this covers at least some of the common cases and makes the flymake support more usable as is. The purpose of including the ebin directory is to support things like behaviours and parse transforms.
2010-06-01erlang-flymake: Include in MakefileKlas Johansson
2010-06-01erlang-flymake: Syntax check erlang code on the fly (using flymake)Klas Johansson
2010-06-01Resolver: make inet_dns decode ugly truncated replyRaimo Niskanen
Bugfix: a DNS reply with the truncation bit set containing misleading section length (i.e header claimed length greater than what was actually in the reply section) in the header caused decode error in inet_dns.
2010-06-01Resolver: stop inet_res leaking portsRaimo Niskanen
Bugfix: when all nameservers return a reply causing decode errors or when errors enetunreach or econnrefused occured while contacting them, one or two UDP ports was leaked i.e left open and forgotten.
2010-06-01dist_utils: Eliminate crash when list_to_existing_atom/1 failsBjörn Gustavsson
In the following scenario list_to_existing_atom/1 may crash during handshake: Start a node in one window: erl -sname adam@localhost Start another node in another window: erl -sname bertil In this node, ping the first node (use the actual hostname in the command): net:ping(adam@hostname). There will be an error report similar to: =ERROR REPORT==== 27-May-2010::15:03:14 === Error in process <0.40.0> on node 'bertil@hostname' with exit value: {badarg,[{erlang,list_to_existing_atom, ["adam@localhost"]},{dist_util,recv_challenge,1},{dist_util,handshake_we_started,1}]} Eliminate the crash and the error report by catching the call to list_to_existing_atom/1 and do a clean shutdown if it fails.
2010-06-01Added workaround for tcp delivery problemIngela Anderton Andin
2010-06-01OTP-8649 dg/public_key-test-coverageRaimo Niskanen